diff options
author | se <se@FreeBSD.org> | 1995-09-14 20:27:31 +0000 |
---|---|---|
committer | se <se@FreeBSD.org> | 1995-09-14 20:27:31 +0000 |
commit | 8b4c06dbf8dc7d86690084b755662e5148ea905c (patch) | |
tree | e74e16dd5a09947e46189d2517f0a8399b5e1c4e /sys/i386/pci | |
parent | 7bb3401166bf0ab8f6325a835bbe6ed5f6202b9e (diff) | |
download | FreeBSD-src-8b4c06dbf8dc7d86690084b755662e5148ea905c.zip FreeBSD-src-8b4c06dbf8dc7d86690084b755662e5148ea905c.tar.gz |
Improved verification of configuration space accesses working:
Scan for devices instead of assuming that device 0 is present on bus 0
of every PCI motherboard.
Diffstat (limited to 'sys/i386/pci')
-rw-r--r-- | sys/i386/pci/pci_bus.c | 23 | ||||
-rw-r--r-- | sys/i386/pci/pci_cfgreg.c | 23 | ||||
-rw-r--r-- | sys/i386/pci/pci_pir.c | 23 |
3 files changed, 57 insertions, 12 deletions
diff --git a/sys/i386/pci/pci_bus.c b/sys/i386/pci/pci_bus.c index 2826426..0b6bd4c 100644 --- a/sys/i386/pci/pci_bus.c +++ b/sys/i386/pci/pci_bus.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pcibus.c,v 1.10 1995/06/30 16:11:42 se Exp $ +** $Id: pcibus.c,v 1.11 1995/09/13 17:03:47 se Exp $ ** ** pci bus subroutines for i386 architecture. ** @@ -83,6 +83,9 @@ **----------------------------------------------------------------- */ +static int +pcibus_check (void); + static void pcibus_setup (void); @@ -150,6 +153,18 @@ DATA_SET (pcibus_set, i386pci); #define CONF2_FORWARD_PORT 0x0cfa +static int +pcibus_check (void) +{ + u_char device; + + for (device = 0; device < pci_maxdevice; device++) { + if (pcibus_read (pcibus_tag (0,device,0), 0) != 0xfffffffful) + return 1; + } + return 0; +} + static void pcibus_setup (void) { @@ -169,7 +184,7 @@ pcibus_setup (void) if (result & CONF1_ENABLE) { pci_mechanism = 1; pci_maxdevice = 32; - if (pcibus_read (pcibus_tag (0,0,0), 0) != 0xfffffffful) + if (pcibus_check()) return; }; @@ -183,7 +198,7 @@ pcibus_setup (void) if (!inb (CONF2_ENABLE_PORT) && !inb (CONF2_FORWARD_PORT)) { pci_mechanism = 2; pci_maxdevice = 16; - if (pcibus_read (pcibus_tag (0,0,0), 0) != 0xfffffffful) + if (pcibus_check()) return; }; @@ -201,7 +216,7 @@ pcibus_setup (void) if (result == CONF1_ENABLE_RES2) { pci_mechanism = 1; pci_maxdevice = 32; - if (pcibus_read (pcibus_tag (0,0,0), 0) != 0xfffffffful) + if (pcibus_check()) return; } if (result != 0xfffffffful) diff --git a/sys/i386/pci/pci_cfgreg.c b/sys/i386/pci/pci_cfgreg.c index 2826426..0b6bd4c 100644 --- a/sys/i386/pci/pci_cfgreg.c +++ b/sys/i386/pci/pci_cfgreg.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pcibus.c,v 1.10 1995/06/30 16:11:42 se Exp $ +** $Id: pcibus.c,v 1.11 1995/09/13 17:03:47 se Exp $ ** ** pci bus subroutines for i386 architecture. ** @@ -83,6 +83,9 @@ **----------------------------------------------------------------- */ +static int +pcibus_check (void); + static void pcibus_setup (void); @@ -150,6 +153,18 @@ DATA_SET (pcibus_set, i386pci); #define CONF2_FORWARD_PORT 0x0cfa +static int +pcibus_check (void) +{ + u_char device; + + for (device = 0; device < pci_maxdevice; device++) { + if (pcibus_read (pcibus_tag (0,device,0), 0) != 0xfffffffful) + return 1; + } + return 0; +} + static void pcibus_setup (void) { @@ -169,7 +184,7 @@ pcibus_setup (void) if (result & CONF1_ENABLE) { pci_mechanism = 1; pci_maxdevice = 32; - if (pcibus_read (pcibus_tag (0,0,0), 0) != 0xfffffffful) + if (pcibus_check()) return; }; @@ -183,7 +198,7 @@ pcibus_setup (void) if (!inb (CONF2_ENABLE_PORT) && !inb (CONF2_FORWARD_PORT)) { pci_mechanism = 2; pci_maxdevice = 16; - if (pcibus_read (pcibus_tag (0,0,0), 0) != 0xfffffffful) + if (pcibus_check()) return; }; @@ -201,7 +216,7 @@ pcibus_setup (void) if (result == CONF1_ENABLE_RES2) { pci_mechanism = 1; pci_maxdevice = 32; - if (pcibus_read (pcibus_tag (0,0,0), 0) != 0xfffffffful) + if (pcibus_check()) return; } if (result != 0xfffffffful) diff --git a/sys/i386/pci/pci_pir.c b/sys/i386/pci/pci_pir.c index 2826426..0b6bd4c 100644 --- a/sys/i386/pci/pci_pir.c +++ b/sys/i386/pci/pci_pir.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pcibus.c,v 1.10 1995/06/30 16:11:42 se Exp $ +** $Id: pcibus.c,v 1.11 1995/09/13 17:03:47 se Exp $ ** ** pci bus subroutines for i386 architecture. ** @@ -83,6 +83,9 @@ **----------------------------------------------------------------- */ +static int +pcibus_check (void); + static void pcibus_setup (void); @@ -150,6 +153,18 @@ DATA_SET (pcibus_set, i386pci); #define CONF2_FORWARD_PORT 0x0cfa +static int +pcibus_check (void) +{ + u_char device; + + for (device = 0; device < pci_maxdevice; device++) { + if (pcibus_read (pcibus_tag (0,device,0), 0) != 0xfffffffful) + return 1; + } + return 0; +} + static void pcibus_setup (void) { @@ -169,7 +184,7 @@ pcibus_setup (void) if (result & CONF1_ENABLE) { pci_mechanism = 1; pci_maxdevice = 32; - if (pcibus_read (pcibus_tag (0,0,0), 0) != 0xfffffffful) + if (pcibus_check()) return; }; @@ -183,7 +198,7 @@ pcibus_setup (void) if (!inb (CONF2_ENABLE_PORT) && !inb (CONF2_FORWARD_PORT)) { pci_mechanism = 2; pci_maxdevice = 16; - if (pcibus_read (pcibus_tag (0,0,0), 0) != 0xfffffffful) + if (pcibus_check()) return; }; @@ -201,7 +216,7 @@ pcibus_setup (void) if (result == CONF1_ENABLE_RES2) { pci_mechanism = 1; pci_maxdevice = 32; - if (pcibus_read (pcibus_tag (0,0,0), 0) != 0xfffffffful) + if (pcibus_check()) return; } if (result != 0xfffffffful) |