From owner-freebsd-hackers Sun Mar 18 13:18:51 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mass.dis.org (mass.dis.org [216.240.45.41]) by hub.freebsd.org (Postfix) with ESMTP id 8280137B71F for ; Sun, 18 Mar 2001 13:18:40 -0800 (PST) (envelope-from msmith@mass.dis.org) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.2/8.11.2) with ESMTP id f2ILJBL01279; Sun, 18 Mar 2001 13:19:12 -0800 (PST) (envelope-from msmith@mass.dis.org) Message-Id: <200103182119.f2ILJBL01279@mass.dis.org> X-Mailer: exmh version 2.1.1 10/15/1999 To: Alexey Dokuchaev Cc: freebsd-hackers@freebsd.org Subject: Re: Some PCI-related programming things In-reply-to: Your message of "Mon, 19 Mar 2001 02:16:23 +0600." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 18 Mar 2001 13:19:11 -0800 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Hello there, > > Under linux, PCI stuff is generally done thru set of pci* functions, while > under FreeBSD there are ioctls provided by pci driver. I've been doing > some code migration from linux to FreeBSD, and got thru most of it, except > for things like this one: You are probably doing something very wrong here, but rather than try to convince you to do it, right, I'll just answer your question. 8) > > . . . > pcibios_read_config_dword(bus_id, func_id, PCI_BASE_ADDRESS_0, &addr_0); > addr_0 &= PCI_BASE_ADDRESS_IO_MASK; > pcibios_read_config_dword(bus_id, func_id, PCI_BASE_ADDRESS_1, &addr_1); > addr_1 &= PCI_BASE_ADDRESS_MEM_MASK; > . . . > > > I am not quite sure how to code the same thing under FreeBSD, particulary: > > pi.pi_width = 4; > pi.pi_reg = > ioctl(fd, PCIOCREAD, &pi); You put PCI_BASE_ADDRESS_0, or PCIR_MAPS if you're using our headers. PCI_BASE_ADDRESS_1 is typically PCIR_MAPS + 4 > Could anyone give me an example for both addr_0 and addr_1 (that is, > translation of the linux code I cited above?) Er, you don't. You'll get the value you've read in pi.pi_data. -- ... every activity meets with opposition, everyone who acts has his rivals and unfortunately opponents also. But not because people want to be opponents, rather because the tasks and relationships force people to take different points of view. [Dr. Fritz Todt] V I C T O R Y N O T V E N G E A N C E To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message