[OpenBIOS] PCI enumeration?

Jeff Garzik jgarzik at mandrakesoft.com
Sat Feb 26 17:37:41 CET 2000


Brian Hurt wrote:
> Is anyone else out there working on adding PCI enumeration to OpenBIOS?
> Any one have any pointers to code I can theft, er, reuse?  I'm looking at
> the function pci_scan_bus() in the linux source code (drivers/pci/pci.c),
> but that looks like it just reads the results of an already-enummerated
> PCI bus.

Scanning the PCI bus is easy.  Look at linux/arch/i386/kernel/pci-*.c. 
Most modern PC motherboards support two well-known 32-bit I/O ports,
which read and write to PCI configuration space.  In the Linux kernel
this is called the direct access method.

(this is all defined in the PCI spec)  To scan the PCI bus, you
basically iterate through each slot, reading the device and vendor ids. 
If the slot is empty you get a nonexistent value (either 0 or 0xffff I
think).  There can also be bridges on the PCI bus, so you must
recursively descending into those, and scan their devices, as well.

-- 
Jeff Garzik              | "Are you the police?"
Building 1024            | 
MandrakeSoft, Inc.       | "No ma'am.  We're musicians."
-
To unsubscribe: send mail to majordomo at freiburg.linux.de
with 'unsubscribe openbios' in the body of the message



More information about the openbios mailing list