summaryrefslogtreecommitdiff
path: root/sys/dev/pci/ppb.c
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2006-03-13 20:10:50 +0000
committerBrad Smith <brad@cvs.openbsd.org>2006-03-13 20:10:50 +0000
commit2bbf5c811672d5b0c39d5784c61dd91913e8e045 (patch)
treea1809fa7aebf56fa87ef985c841627841bad37d0 /sys/dev/pci/ppb.c
parent9afec5752905399d9d215d7e3ed13f7c74e690fb (diff)
* Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to a persistent copy of the bridge's pcitag_t. This can be very useful for machine-dependent PCI bus enumeration code. From NetBSD ok grange@ kettenis@
Diffstat (limited to 'sys/dev/pci/ppb.c')
-rw-r--r--sys/dev/pci/ppb.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/dev/pci/ppb.c b/sys/dev/pci/ppb.c
index 888f55a4fd6..b40c1a10604 100644
--- a/sys/dev/pci/ppb.c
+++ b/sys/dev/pci/ppb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ppb.c,v 1.13 2006/02/27 02:05:19 drahn Exp $ */
+/* $OpenBSD: ppb.c,v 1.14 2006/03/13 20:10:49 brad Exp $ */
/* $NetBSD: ppb.c,v 1.16 1997/06/06 23:48:05 thorpej Exp $ */
/*
@@ -50,11 +50,17 @@
#include <dev/pci/pcidevs.h>
#include <dev/pci/ppbreg.h>
+struct ppb_softc {
+ struct device sc_dev; /* generic device glue */
+ pci_chipset_tag_t sc_pc; /* our PCI chipset... */
+ pcitag_t sc_tag; /* ...and tag. */
+};
+
int ppbmatch(struct device *, void *, void *);
void ppbattach(struct device *, struct device *, void *);
struct cfattach ppb_ca = {
- sizeof(struct device), ppbmatch, ppbattach
+ sizeof(struct ppb_softc), ppbmatch, ppbattach
};
struct cfdriver ppb_cd = {
@@ -96,6 +102,7 @@ ppbattach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
+ struct ppb_softc *sc = (void *) self;
struct pci_attach_args *pa = aux;
pci_chipset_tag_t pc = pa->pa_pc;
struct pcibus_attach_args pba;
@@ -103,6 +110,9 @@ ppbattach(parent, self, aux)
printf("\n");
+ sc->sc_pc = pc;
+ sc->sc_tag = pa->pa_tag;
+
busdata = pci_conf_read(pc, pa->pa_tag, PPB_REG_BUSINFO);
if (PPB_BUSINFO_SECONDARY(busdata) == 0) {
@@ -132,6 +142,7 @@ ppbattach(parent, self, aux)
pba.pba_dmat = pa->pa_dmat;
pba.pba_pc = pc;
pba.pba_bus = PPB_BUSINFO_SECONDARY(busdata);
+ pba.pba_bridgetag = &sc->sc_tag;
pba.pba_intrswiz = pa->pa_intrswiz;
pba.pba_intrtag = pa->pa_intrtag;