summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordyoung <dyoung@NetBSD.org>2011-10-21 21:35:28 +0000
committerdyoung <dyoung@NetBSD.org>2011-10-21 21:35:28 +0000
commitb5976ec47fee75fa6c783b8d6ebe3f2b463d87f0 (patch)
tree37ee66e101e7473cf9625be8614d2540eff1592a
parentd4120bb3207381ee7848a245252a427c60445ada (diff)
Tell a pci(4) instance its subordinate PCI buses using a new member
in the pcibus_attach_args, pba_sub. pciN attaches to pba_bus itself. If pba_bus < pba_sub, then [pba_bus + 1, pba_sub] are subordinate to pba_bus. On i386, make mainbus0 attach pci0 with pba_sub = 255 because all buses 1 and up must be subordinate to pci0. XXX Deal with other architectures.
-rw-r--r--sys/arch/i386/i386/mainbus.c5
-rw-r--r--sys/dev/pci/pcivar.h10
-rw-r--r--sys/dev/pci/ppb.c5
3 files changed, 15 insertions, 5 deletions
diff --git a/sys/arch/i386/i386/mainbus.c b/sys/arch/i386/i386/mainbus.c
index d34d725dd9a..33bb5d1bede 100644
--- a/sys/arch/i386/i386/mainbus.c
+++ b/sys/arch/i386/i386/mainbus.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.91 2011/05/17 17:34:50 dyoung Exp $ */
+/* $NetBSD: mainbus.c,v 1.92 2011/10/21 21:35:28 dyoung 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.91 2011/05/17 17:34:50 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.92 2011/10/21 21:35:28 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -406,6 +406,7 @@ mainbus_rescan(device_t self, const char *ifattr, const int *locators)
mba.mba_pba.pba_pc = NULL;
mba.mba_pba.pba_flags = pci_bus_flags();
mba.mba_pba.pba_bus = 0;
+ mba.mba_pba.pba_sub = 255;
mba.mba_pba.pba_bridgetag = NULL;
#if NACPICA > 0 && defined(ACPI_SCANPCI)
if (npcibus == 0 && sc->sc_mpacpi_active)
diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h
index 2de51d0bbc1..e9140155ace 100644
--- a/sys/dev/pci/pcivar.h
+++ b/sys/dev/pci/pcivar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: pcivar.h,v 1.95 2011/08/24 20:27:36 dyoung Exp $ */
+/* $NetBSD: pcivar.h,v 1.96 2011/10/21 21:35:28 dyoung Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -104,6 +104,14 @@ struct pcibus_attach_args {
int pba_flags; /* flags; see below */
int pba_bus; /* PCI bus number */
+ int pba_sub; /* pba_bus >= pba_sub: no
+ * buses are subordinate to
+ * pba_bus.
+ *
+ * pba_bus < pba_sub: buses
+ * [pba_bus + 1, pba_sub] are
+ * subordinate to pba_bus.
+ */
/*
* Pointer to the pcitag of our parent bridge. If there is no
diff --git a/sys/dev/pci/ppb.c b/sys/dev/pci/ppb.c
index 5fcc0df3219..12603d00cb9 100644
--- a/sys/dev/pci/ppb.c
+++ b/sys/dev/pci/ppb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ppb.c,v 1.46 2011/08/17 00:59:47 dyoung Exp $ */
+/* $NetBSD: ppb.c,v 1.47 2011/10/21 21:35:28 dyoung Exp $ */
/*
* Copyright (c) 1996, 1998 Christopher G. Demetriou. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.46 2011/08/17 00:59:47 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.47 2011/10/21 21:35:28 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -206,6 +206,7 @@ ppbattach(device_t parent, device_t self, void *aux)
pba.pba_pc = pc;
pba.pba_flags = pa->pa_flags & ~PCI_FLAGS_MRM_OKAY;
pba.pba_bus = PPB_BUSINFO_SECONDARY(busdata);
+ pba.pba_sub = PPB_BUSINFO_SUBORDINATE(busdata);
pba.pba_bridgetag = &sc->sc_tag;
pba.pba_intrswiz = pa->pa_intrswiz;
pba.pba_intrtag = pa->pa_intrtag;