summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2000-10-25 19:13:13 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2000-10-25 19:13:13 +0000
commit163460ad330f4983c5a1bcd24d1d5a8b56d6ff5d (patch)
tree48ded14ad179d7c5881371de12dee68d84223083 /sys
parent3b3fd0fa38a1bd7aead982122a289dde19f98ad2 (diff)
put back using bios_pciinfo, we will rework it later on
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/i386/bios.c11
-rw-r--r--sys/arch/i386/pci/pci_machdep.c34
2 files changed, 42 insertions, 3 deletions
diff --git a/sys/arch/i386/i386/bios.c b/sys/arch/i386/i386/bios.c
index 63240bf3987..a75f17f00b4 100644
--- a/sys/arch/i386/i386/bios.c
+++ b/sys/arch/i386/i386/bios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bios.c,v 1.37 2000/10/21 17:43:50 mickey Exp $ */
+/* $OpenBSD: bios.c,v 1.38 2000/10/25 19:13:11 mickey Exp $ */
/*
* Copyright (c) 1997-2000 Michael Shalayeff
@@ -86,6 +86,9 @@ extern dev_t bootdev;
#if NAPM > 0 || defined(DEBUG)
bios_apminfo_t *apm;
#endif
+#if NPCI > 0
+bios_pciinfo_t *bios_pciinfo;
+#endif
bios_diskinfo_t *bios_diskinfo;
bios_memmap_t *bios_memmap;
u_int32_t bios_cksumlen;
@@ -261,6 +264,12 @@ bios_getopt()
printf(" cksumlen %d", bios_cksumlen);
#endif
break;
+#if NPCI > 0
+ case BOOTARG_PCIINFO:
+ bios_pciinfo = (bios_pciinfo_t *)q->ba_arg;
+ printf(" pciinfo %p", bios_pciinfo);
+ break;
+#endif
case BOOTARG_CONSDEV:
if (q->ba_size >= sizeof(bios_consdev_t))
{
diff --git a/sys/arch/i386/pci/pci_machdep.c b/sys/arch/i386/pci/pci_machdep.c
index 63ad76260e0..58231fa1032 100644
--- a/sys/arch/i386/pci/pci_machdep.c
+++ b/sys/arch/i386/pci/pci_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.c,v 1.16 2000/08/17 22:08:10 mickey Exp $ */
+/* $OpenBSD: pci_machdep.c,v 1.17 2000/10/25 19:13:12 mickey Exp $ */
/* $NetBSD: pci_machdep.c,v 1.28 1997/06/06 23:29:17 thorpej Exp $ */
/*-
@@ -94,6 +94,12 @@
#include <machine/bus.h>
#include <machine/pio.h>
+#include "bios.h"
+#if NBIOS > 0
+#include <machine/biosvar.h>
+extern bios_pciinfo_t *bios_pciinfo;
+#endif
+
#include <i386/isa/icu.h>
#include <dev/isa/isavar.h>
#include <dev/pci/pcivar.h>
@@ -135,8 +141,14 @@ pci_attach_hook(parent, self, pba)
struct pcibus_attach_args *pba;
{
+#if NBIOS > 0
+ if (pba->pba_bus == 0)
+ printf(": configuration mode %d (%s)",
+ pci_mode, (bios_pciinfo?"bios":"no bios"));
+#else
if (pba->pba_bus == 0)
printf(": configuration mode %d", pci_mode);
+#endif
}
int
@@ -340,13 +352,31 @@ pci_mode_detect()
if (pci_mode != -1)
return pci_mode;
+#if NBIOS > 0
+ /*
+ * If we have PCI info passed from the BIOS, use the mode given there
+ * for all of this code. If not, pass on through to the previous tests
+ * to try and devine the correct mode.
+ */
+ if (bios_pciinfo != NULL) {
+ if (bios_pciinfo->pci_chars & 0x2)
+ return (pci_mode = 2);
+
+ if (bios_pciinfo->pci_chars & 0x1)
+ return (pci_mode = 1);
+
+ /* We should never get here, but if we do, fall through... */
+ }
+#endif
+
/*
* We try to divine which configuration mode the host bridge wants. We
* try mode 2 first, because our probe for mode 1 is likely to succeed
* for mode 2 also.
*
* This should really be done using the PCI BIOS. If we get here, the
- * PCI BIOS does not exist, or it was disabled in kernel config.
+ * PCI BIOS does not exist, or the boot blocks did not provide the
+ * information.
*/
outb(PCI_MODE2_ENABLE_REG, 0);
outb(PCI_MODE2_FORWARD_REG, 0);