diff options
-rw-r--r-- | sys/arch/i386/i386/bios.c | 12 | ||||
-rw-r--r-- | sys/arch/i386/include/biosvar.h | 13 | ||||
-rw-r--r-- | sys/arch/i386/pci/pci_machdep.c | 38 |
3 files changed, 55 insertions, 8 deletions
diff --git a/sys/arch/i386/i386/bios.c b/sys/arch/i386/i386/bios.c index 1f5ab2ced8f..2b6b34e803f 100644 --- a/sys/arch/i386/i386/bios.c +++ b/sys/arch/i386/i386/bios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bios.c,v 1.21 1998/01/09 12:14:42 niklas Exp $ */ +/* $OpenBSD: bios.c,v 1.22 1998/02/24 22:02:09 weingart Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -62,6 +62,7 @@ #include <i386/isa/isa_machdep.h> #include "apm.h" +#include "pci.h" struct bios_softc { struct device sc_dev; @@ -81,6 +82,9 @@ struct cfdriver bios_cd = { extern dev_t bootdev; +#if NPCI > 0 +bios_pciinfo_t *bios_pciinfo = NULL; +#endif bios_diskinfo_t *bios_diskinfo = NULL; u_int32_t bios_cksumlen; @@ -160,6 +164,12 @@ biosattach(parent, self, aux) bios_cksumlen = *(u_int32_t *)q->ba_arg; printf(" cksumlen %d", bios_cksumlen); break; +#if NPCI > 0 + case BOOTARG_PCIINFO: + bios_pciinfo = (bios_pciinfo_t *)q->ba_arg; + printf(" pciinfo %p", bios_pciinfo); + break; +#endif default: printf(" unsupported arg (%d) %p", q->ba_type, q->ba_arg); diff --git a/sys/arch/i386/include/biosvar.h b/sys/arch/i386/include/biosvar.h index c737c55d4fd..906792f708b 100644 --- a/sys/arch/i386/include/biosvar.h +++ b/sys/arch/i386/include/biosvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: biosvar.h,v 1.26 1998/01/09 12:14:40 niklas Exp $ */ +/* $OpenBSD: biosvar.h,v 1.27 1998/02/24 22:02:07 weingart Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -130,7 +130,16 @@ typedef struct _bios_apminfo { u_int apm_entry; } bios_apminfo_t; -#define BOOTARG_CKSUMLEN 3 /* u_int32_t */ +#define BOOTARG_CKSUMLEN 3 /* u_int32_t */ + +#define BOOTARG_PCIINFO 4 +typedef struct _bios_pciinfo { + /* PCI BIOS v2.0+ - Installation check values */ + u_int32_t pci_chars; /* Characteristics (%eax) */ + u_int32_t pci_rev; /* BCD Revision (%ebx) */ + u_int32_t pci_entry32; /* PM entry point for PCI BIOS */ + u_int32_t pci_lastbus; /* Number of last PCI bus */ +} bios_pciinfo_t; #if defined(_KERNEL) || defined (_STANDALONE) diff --git a/sys/arch/i386/pci/pci_machdep.c b/sys/arch/i386/pci/pci_machdep.c index 9146ad91640..5b16806b839 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.11 1998/01/20 18:40:23 niklas Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.12 1998/02/24 22:02:11 weingart Exp $ */ /* $NetBSD: pci_machdep.c,v 1.28 1997/06/06 23:29:17 thorpej Exp $ */ /*- @@ -92,9 +92,14 @@ #define _I386_BUS_DMA_PRIVATE #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> @@ -136,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,15 +351,32 @@ 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. * - * XXX - * This should really be done using the PCI BIOS. + * This should really be done using the PCI BIOS. If we get here, the + * 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); if (inb(PCI_MODE2_ENABLE_REG) != 0 || |