Date: Sun, 18 Mar 2001 13:19:11 -0800 From: Mike Smith <msmith@freebsd.org> To: Alexey Dokuchaev <danfe@inet.ssc.nsu.ru> Cc: freebsd-hackers@freebsd.org Subject: Re: Some PCI-related programming things Message-ID: <200103182119.f2ILJBL01279@mass.dis.org> In-Reply-To: Your message of "Mon, 19 Mar 2001 02:16:23 %2B0600." <Pine.LNX.4.10.10103190158060.7285-100000@inet.ssc.nsu.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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) > <code ostype="linux"> > . . . > 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; > . . . > </code> > > I am not quite sure how to code the same thing under FreeBSD, particulary: > > pi.pi_width = 4; > pi.pi_reg = <WHAT DO I PUT HERE?> > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103182119.f2ILJBL01279>