aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64/pci/pci_bus.c
diff options
context:
space:
mode:
authorStefan Eßer <se@FreeBSD.org>1995-09-13 17:03:47 +0000
committerStefan Eßer <se@FreeBSD.org>1995-09-13 17:03:47 +0000
commitcda6791190cf16526003d539acd5e7ea055a9d2a (patch)
treebc0c182408a595829a50c56fef342ee3b6f1ee30 /sys/amd64/pci/pci_bus.c
parent46bce4ac74b6d455b7e1c0b70d47a76bb8473d65 (diff)
downloadsrc-cda6791190cf16526003d539acd5e7ea055a9d2a.tar.gz
src-cda6791190cf16526003d539acd5e7ea055a9d2a.zip
Make the PCI host bridge probe code more robust when dealing with chip sets
that use configuration mode 1, but still violate the PCI 2.0 specs ... (Required for the Compaq Proliant, for example.)
Notes
Notes: svn path=/head/; revision=10710
Diffstat (limited to 'sys/amd64/pci/pci_bus.c')
-rw-r--r--sys/amd64/pci/pci_bus.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/sys/amd64/pci/pci_bus.c b/sys/amd64/pci/pci_bus.c
index d0621e99cac2..28264260a3f8 100644
--- a/sys/amd64/pci/pci_bus.c
+++ b/sys/amd64/pci/pci_bus.c
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** $Id: pcibus.c,v 1.9 1995/06/28 15:54:57 se Exp $
+** $Id: pcibus.c,v 1.10 1995/06/30 16:11:42 se Exp $
**
** pci bus subroutines for i386 architecture.
**
@@ -139,7 +139,9 @@ DATA_SET (pcibus_set, i386pci);
#define CONF1_ENABLE 0x80000000ul
-#define CONF1_ENABLE_CHK 0xF0000000ul
+#define CONF1_ENABLE_CHK1 0xF0000000ul
+#define CONF1_ENABLE_CHK2 0xfffffffful
+#define CONF1_ENABLE_RES2 0x80fffffcul
#define CONF1_ADDR_PORT 0x0cf8
#define CONF1_DATA_PORT 0x0cfc
@@ -159,7 +161,7 @@ pcibus_setup (void)
*/
oldval = inl (CONF1_ADDR_PORT);
- outl (CONF1_ADDR_PORT, CONF1_ENABLE_CHK);
+ outl (CONF1_ADDR_PORT, CONF1_ENABLE_CHK1);
outb (CONF1_ADDR_PORT +3, 0);
result = inl (CONF1_ADDR_PORT);
outl (CONF1_ADDR_PORT, oldval);
@@ -167,7 +169,8 @@ pcibus_setup (void)
if (result & CONF1_ENABLE) {
pci_mechanism = 1;
pci_maxdevice = 32;
- return;
+ if (pcibus_read (pcibus_tag (0,0,0), 0) != 0xfffffffful)
+ return;
};
/*---------------------------------------
@@ -180,13 +183,39 @@ pcibus_setup (void)
if (!inb (CONF2_ENABLE_PORT) && !inb (CONF2_FORWARD_PORT)) {
pci_mechanism = 2;
pci_maxdevice = 16;
- return;
+ if (pcibus_read (pcibus_tag (0,0,0), 0) != 0xfffffffful)
+ return;
};
+
+ /*-----------------------------------------------------
+ ** Well, is it Configuration mode 1, after all ?
+ **-----------------------------------------------------
+ */
+
+ oldval = inl (CONF1_ADDR_PORT);
+ outl (CONF1_ADDR_PORT, CONF1_ENABLE_CHK2);
+ result = inl (CONF1_ADDR_PORT);
+ outl (CONF1_ADDR_PORT, oldval);
+
+ if (result == CONF1_ENABLE_RES2) {
+ pci_mechanism = 1;
+ pci_maxdevice = 32;
+ if (pcibus_read (pcibus_tag (0,0,0), 0) != 0xfffffffful)
+ return;
+ }
+ if (result != 0xfffffffful)
+ printf ("pcibus_setup: "
+ "wrote 0x%08x, read back 0x%08x, expected 0x%08x\n",
+ CONF1_ENABLE_CHK2, result, CONF1_ENABLE_RES2);
+
/*---------------------------------------
- ** No PCI bus available.
+ ** No PCI bus host bridge found
**---------------------------------------
*/
+
+ pci_mechanism = 0;
+ pci_maxdevice = 0;
}
/*--------------------------------------------------------------------