Add the options MPBIOS_SCANPCI and MPACPI_SCANPCI to configure PCI roots
with the MPBIOS/ACPI bus information, by walking through the buses, and descending down every bus that hasn't been marked configured yet.
This commit is contained in:
parent
4ee0df68f2
commit
afff857edc
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mainbus.c,v 1.4 2003/05/15 02:20:51 fvdl Exp $ */
|
||||
/* $NetBSD: mainbus.c,v 1.5 2003/05/29 20:22:33 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -222,7 +222,18 @@ mainbus_attach(parent, self, aux)
|
|||
mba.mba_pba.pba_flags = pci_bus_flags();
|
||||
mba.mba_pba.pba_bus = 0;
|
||||
mba.mba_pba.pba_bridgetag = NULL;
|
||||
#if defined(MPACPI) && defined(MPACPI_SCANPCI)
|
||||
if (mpacpi_active)
|
||||
mpacpi_scan_pci(self, &mba.mba_pba, mainbus_print);
|
||||
else
|
||||
#endif
|
||||
#if defined(MPBIOS) && defined(MPBIOS_SCANPCI)
|
||||
if (mpbios_scanned != 0)
|
||||
mpbios_scan_pci(self, &mba.mba_pba, mainbus_print);
|
||||
else
|
||||
#endif
|
||||
config_found(self, &mba.mba_pba, mainbus_print);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: GENERIC,v 1.4 2003/05/21 17:23:35 christos Exp $
|
||||
# $NetBSD: GENERIC,v 1.5 2003/05/29 20:22:33 fvdl Exp $
|
||||
#
|
||||
# GENERIC machine description file
|
||||
#
|
||||
|
@ -22,7 +22,7 @@ include "arch/amd64/conf/std.amd64"
|
|||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.4 $"
|
||||
#ident "GENERIC-$Revision: 1.5 $"
|
||||
|
||||
maxusers 32 # estimated number of users
|
||||
|
||||
|
@ -203,7 +203,8 @@ mainbus0 at root
|
|||
#acpi0 at mainbus0
|
||||
|
||||
#acpi0 at mainbus0
|
||||
#options MPACPI
|
||||
#options MPACPI
|
||||
#options MPACPI_SCANPCI # MPBIOS configures PCI roots
|
||||
#options ACPI_PCI_FIXUP # PCI interrupt routing via ACPI
|
||||
#options ACPI_ACTIVATE_DEV=0 # If set, activate inactive devices
|
||||
|
||||
|
@ -223,6 +224,7 @@ mainbus0 at root
|
|||
#wss* at acpi? # NeoMagic 256AV in wss mode
|
||||
|
||||
options MPBIOS
|
||||
#options MPBIOS_SCANPCI # MPBIOS configures PCI roots
|
||||
cpu* at mainbus?
|
||||
ioapic* at mainbus? apid ?
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: GENERIC,v 1.560 2003/05/15 13:13:23 wiz Exp $
|
||||
# $NetBSD: GENERIC,v 1.561 2003/05/29 20:22:28 fvdl Exp $
|
||||
#
|
||||
# GENERIC machine description file
|
||||
#
|
||||
|
@ -22,7 +22,7 @@ include "arch/i386/conf/std.i386"
|
|||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.560 $"
|
||||
#ident "GENERIC-$Revision: 1.561 $"
|
||||
|
||||
maxusers 32 # estimated number of users
|
||||
|
||||
|
@ -264,8 +264,10 @@ cpu* at mainbus?
|
|||
# that I/O APICs can be used if ACPI is enabled below.
|
||||
# To use the I/O APIC(s), enable the ioapic line above.
|
||||
#options MPBIOS # configure CPUs and APICs using MPBIOS
|
||||
#options MPBIOS_SCANPCI # find PCI roots using MPBIOS
|
||||
#options MPACPI # configure CPUs and APICs using ACPI
|
||||
# (acpi at mainbus must also be enabled)
|
||||
#options MPACPI_SCANPCI # find PCI roots using MPACPI
|
||||
|
||||
#acpi0 at mainbus0
|
||||
#options ACPI_PCI_FIXUP # PCI interrupt routing via ACPI
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mainbus.c,v 1.50 2003/03/04 01:06:38 fvdl Exp $ */
|
||||
/* $NetBSD: mainbus.c,v 1.51 2003/05/29 20:22:31 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.50 2003/03/04 01:06:38 fvdl Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.51 2003/05/29 20:22:31 fvdl Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -295,6 +295,16 @@ mainbus_attach(parent, self, aux)
|
|||
mba.mba_pba.pba_flags = pci_bus_flags();
|
||||
mba.mba_pba.pba_bus = 0;
|
||||
mba.mba_pba.pba_bridgetag = NULL;
|
||||
#if defined(MPACPI) && defined(MPACPI_SCANPCI)
|
||||
if (mpacpi_active)
|
||||
mpacpi_scan_pci(self, &mba.mba_pba, mainbus_print);
|
||||
else
|
||||
#endif
|
||||
#if defined(MPBIOS) && defined(MPBIOS_SCANPCI)
|
||||
if (mpbios_scanned != 0)
|
||||
mpbios_scan_pci(self, &mba.mba_pba, mainbus_print);
|
||||
else
|
||||
#endif
|
||||
config_found(self, &mba.mba_pba, mainbus_print);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# $NetBSD: files.x86,v 1.7 2003/05/11 18:24:12 fvdl Exp $
|
||||
# $NetBSD: files.x86,v 1.8 2003/05/29 20:22:31 fvdl Exp $
|
||||
|
||||
# options for MP configuration through the MP spec
|
||||
defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG
|
||||
defflag opt_mpacpi.h MPACPI
|
||||
defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI
|
||||
defflag opt_mpacpi.h MPACPI MPACPI_SCANPCI
|
||||
|
||||
# MTRR support
|
||||
defflag MTRR
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
/* $NetBSD: mpacpi.h,v 1.1 2003/05/11 18:48:13 fvdl Exp $ */
|
||||
/* $NetBSD: mpacpi.h,v 1.2 2003/05/29 20:22:32 fvdl Exp $ */
|
||||
|
||||
#ifndef _I386_MPACPI_H
|
||||
#define _I386_MPACPI_H
|
||||
|
||||
struct pcibus_attach_args;
|
||||
|
||||
int mpacpi_scan_apics(struct device *);
|
||||
int mpacpi_find_interrupts(void *);
|
||||
int mpacpi_pci_attach_hook(struct device *, struct device *,
|
||||
struct pcibus_attach_args *);
|
||||
int mpacpi_scan_pci(struct device *, struct pcibus_attach_args *, cfprint_t);
|
||||
|
||||
#endif /* _I386_MPACPI_H */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mpbiosvar.h,v 1.2 2003/04/02 07:53:57 thorpej Exp $ */
|
||||
/* $NetBSD: mpbiosvar.h,v 1.3 2003/05/29 20:22:32 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -49,9 +49,15 @@
|
|||
#include <machine/mpbiosreg.h>
|
||||
#include <machine/mpconfig.h>
|
||||
|
||||
struct pcibus_attach_args;
|
||||
|
||||
#if defined(_KERNEL)
|
||||
void mpbios_scan __P((struct device *));
|
||||
int mpbios_probe __P((struct device *));
|
||||
void mpbios_scan(struct device *);
|
||||
int mpbios_probe(struct device *);
|
||||
int mpbios_pci_attach_hook(struct device *, struct device *,
|
||||
struct pcibus_attach_args *);
|
||||
int mpbios_scan_pci(struct device *, struct pcibus_attach_args *, cfprint_t);
|
||||
|
||||
|
||||
extern int mpbios_scanned;
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mpconfig.h,v 1.2 2003/05/11 00:05:52 fvdl Exp $ */
|
||||
/* $NetBSD: mpconfig.h,v 1.3 2003/05/29 20:22:32 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Definitions originally from the mpbios code, but now used for ACPI
|
||||
|
@ -36,6 +36,7 @@ struct mp_bus
|
|||
void (*mb_intr_cfg) __P((const struct mpbios_int *, u_int32_t *));
|
||||
struct mp_intr_map *mb_intrs;
|
||||
u_int32_t mb_data; /* random bus-specific datum. */
|
||||
int mb_configured; /* has been autoconfigured */
|
||||
};
|
||||
|
||||
struct mp_intr_map
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_machdep.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */
|
||||
/* $NetBSD: pci_machdep.c,v 1.4 2003/05/29 20:22:32 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -80,7 +80,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.4 2003/05/29 20:22:32 fvdl Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -106,12 +106,22 @@ __KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $")
|
|||
|
||||
#include "ioapic.h"
|
||||
#include "eisa.h"
|
||||
#include "opt_mpbios.h"
|
||||
#include "opt_mpacpi.h"
|
||||
|
||||
#if NIOAPIC > 0
|
||||
#include <machine/i82093var.h>
|
||||
#include <machine/mpbiosvar.h>
|
||||
#endif
|
||||
|
||||
#ifdef MPBIOS
|
||||
#include <machine/mpbiosvar.h>
|
||||
#endif
|
||||
|
||||
#ifdef MPACPI
|
||||
#include <machine/mpacpi.h>
|
||||
#endif
|
||||
|
||||
#include "opt_pci_conf_mode.h"
|
||||
|
||||
int pci_mode = -1;
|
||||
|
@ -201,6 +211,12 @@ pci_attach_hook(parent, self, pba)
|
|||
|
||||
if (pba->pba_bus == 0)
|
||||
printf(": configuration mode %d", pci_mode);
|
||||
#ifdef MPBIOS
|
||||
mpbios_pci_attach_hook(parent, self, pba);
|
||||
#endif
|
||||
#ifdef MPACPI
|
||||
mpacpi_pci_attach_hook(parent, self, pba);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mpacpi.c,v 1.4 2003/05/15 21:31:59 fvdl Exp $ */
|
||||
/* $NetBSD: mpacpi.c,v 1.5 2003/05/29 20:22:33 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Wasabi Systems, Inc.
|
||||
|
@ -793,7 +793,7 @@ mpacpi_find_interrupts(void *self)
|
|||
return 0;
|
||||
|
||||
/*
|
||||
* Switch us into APIC mode by evaluating the _PIC(1).
|
||||
* Switch us into APIC mode by evaluating _PIC(1).
|
||||
* Needs to be done now, since it has an effect on
|
||||
* the interrupt information we're about to retrieve.
|
||||
*/
|
||||
|
@ -819,3 +819,53 @@ mpacpi_find_interrupts(void *self)
|
|||
mpacpi_print_intr(&mp_intrs[i]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if NPCI > 0
|
||||
|
||||
/*
|
||||
* These are the same as their MPBIOS equivalents, but might not be someday.
|
||||
*/
|
||||
int
|
||||
mpacpi_pci_attach_hook(struct device *parent, struct device *self,
|
||||
struct pcibus_attach_args *pba)
|
||||
{
|
||||
struct mp_bus *mpb;
|
||||
|
||||
#ifdef MPBIOS
|
||||
if (mpbios_scanned != 0 || mpacpi_nioapic == 0)
|
||||
return ENOENT;
|
||||
#endif
|
||||
|
||||
if (pba->pba_bus >= mp_nbus)
|
||||
return EINVAL;
|
||||
|
||||
mpb = &mp_busses[pba->pba_bus];
|
||||
if (strcmp(mpb->mb_name, "pci"))
|
||||
return EINVAL;
|
||||
|
||||
mpb->mb_configured = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
mpacpi_scan_pci(struct device *self, struct pcibus_attach_args *pba,
|
||||
cfprint_t print)
|
||||
{
|
||||
int i;
|
||||
struct mp_bus *mpb;
|
||||
struct pci_attach_args;
|
||||
|
||||
for (i = 0; i < mp_nbus; i++) {
|
||||
mpb = &mp_busses[i];
|
||||
if (mpb->mb_name == NULL)
|
||||
continue;
|
||||
if (!strcmp(mpb->mb_name, "pci") && mpb->mb_configured == 0) {
|
||||
printf("configuring bus %d\n", i);
|
||||
pba->pba_bus = i;
|
||||
config_found(self, pba, print);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mpbios.c,v 1.7 2003/05/15 16:32:50 fvdl Exp $ */
|
||||
/* $NetBSD: mpbios.c,v 1.8 2003/05/29 20:22:33 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -128,6 +128,12 @@
|
|||
#include <dev/eisa/eisavar.h> /* for ELCR* def'ns */
|
||||
#endif
|
||||
|
||||
#include "pci.h"
|
||||
|
||||
#if NPCI > 0
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/pcireg.h>
|
||||
#endif
|
||||
|
||||
static struct mpbios_ioapic default_ioapic = {
|
||||
2,0,1,IOAPICENTRY_FLAG_EN,(u_int32_t)IOAPIC_BASE_DEFAULT
|
||||
|
@ -1109,3 +1115,46 @@ mpbios_int(ent, enttype, mpi)
|
|||
bitmask_snprintf(flags, flagtype_fmt, buf, sizeof(buf)));
|
||||
}
|
||||
}
|
||||
|
||||
#if NPCI > 0
|
||||
int
|
||||
mpbios_pci_attach_hook(struct device *parent, struct device *self,
|
||||
struct pcibus_attach_args *pba)
|
||||
{
|
||||
struct mp_bus *mpb;
|
||||
|
||||
if (mpbios_scanned == 0)
|
||||
return ENOENT;
|
||||
|
||||
if (pba->pba_bus >= mp_nbus)
|
||||
return EINVAL;
|
||||
|
||||
mpb = &mp_busses[pba->pba_bus];
|
||||
if (strcmp(mpb->mb_name, "pci"))
|
||||
return EINVAL;
|
||||
|
||||
mpb->mb_configured = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
mpbios_scan_pci(struct device *self, struct pcibus_attach_args *pba,
|
||||
cfprint_t print)
|
||||
{
|
||||
int i;
|
||||
struct mp_bus *mpb;
|
||||
struct pci_attach_args;
|
||||
|
||||
for (i = 0; i < mp_nbus; i++) {
|
||||
mpb = &mp_busses[i];
|
||||
if (mpb->mb_name == NULL)
|
||||
continue;
|
||||
if (!strcmp(mpb->mb_name, "pci") && mpb->mb_configured == 0) {
|
||||
pba->pba_bus = i;
|
||||
config_found(self, pba, print);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue