Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Mar 2001 02:16:23 +0600 (NOVT)
From:      Alexey Dokuchaev <danfe@inet.ssc.nsu.ru>
To:        freebsd-hackers@freebsd.org
Subject:   Some PCI-related programming things
Message-ID:  <Pine.LNX.4.10.10103190158060.7285-100000@inet.ssc.nsu.ru>

next 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:

<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);

Could anyone give me an example for both addr_0 and addr_1 (that is,
translation of the linux code I cited above?)

I will really appreciate any help with regard to this.  Thanks in advance.


					--
					Alexey.


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?Pine.LNX.4.10.10103190158060.7285-100000>