summaryrefslogtreecommitdiffstats
path: root/src/drivers
diff options
context:
space:
mode:
authorMichael Brown2006-05-17 03:12:11 +0200
committerMichael Brown2006-05-17 03:12:11 +0200
commit6b6096d28ba0ac47af9070df7ebaf1fdda099a4f (patch)
treea2cb39a02b85a9df08f3beb9db52a9045b57804f /src/drivers
parentRestructured PCI subsystem to fit the new device model. (diff)
downloadipxe-6b6096d28ba0ac47af9070df7ebaf1fdda099a4f.tar.gz
ipxe-6b6096d28ba0ac47af9070df7ebaf1fdda099a4f.tar.xz
ipxe-6b6096d28ba0ac47af9070df7ebaf1fdda099a4f.zip
Strip down i386 PCI configuration space I/O to the bare minimum. A
typical build will now include 880 bytes of PCI support code, compared to 2327 bytes in Etherboot 5.4. (There is a slight cost of around 5 extra bytes per access to a non-constant config space address; this should be an overall win. Driver-specific accesses will usually be to constant addresses, for which there is no additional cost.)
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/bus/pci.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/drivers/bus/pci.c b/src/drivers/bus/pci.c
index 853dda64e..222f3eeab 100644
--- a/src/drivers/bus/pci.c
+++ b/src/drivers/bus/pci.c
@@ -39,15 +39,6 @@ static struct pci_driver pci_drivers_end[0] __table_end ( pci_drivers );
static void pcibus_remove ( struct root_device *rootdev );
/**
- * Maximum PCI bus number
- *
- * Architecture-specific code may know how many buses we have, in
- * which case it can overwrite this value.
- *
- */
-unsigned int pci_max_bus = 0xff;
-
-/**
* Read PCI BAR
*
* @v pci PCI device
@@ -242,13 +233,15 @@ static void unregister_pcidev ( struct pci_device *pci ) {
*/
static int pcibus_probe ( struct root_device *rootdev ) {
struct pci_device *pci = NULL;
+ unsigned int max_bus;
unsigned int bus;
unsigned int devfn;
- uint8_t hdrtype;
+ uint8_t hdrtype = 0;
uint32_t tmp;
int rc;
- for ( bus = 0 ; bus <= pci_max_bus ; bus++ ) {
+ max_bus = pci_max_bus();
+ for ( bus = 0 ; bus <= max_bus ; bus++ ) {
for ( devfn = 0 ; devfn <= 0xff ; devfn++ ) {
/* Allocate struct pci_device */