From 2bbf5c811672d5b0c39d5784c61dd91913e8e045 Mon Sep 17 00:00:00 2001
From: Brad Smith <brad@cvs.openbsd.org>
Date: Mon, 13 Mar 2006 20:10:50 +0000
Subject: * 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@
---
 sys/arch/alpha/pci/apecs.c           | 3 ++-
 sys/arch/alpha/pci/cia.c             | 3 ++-
 sys/arch/alpha/pci/irongate.c        | 3 ++-
 sys/arch/alpha/pci/lca.c             | 3 ++-
 sys/arch/alpha/pci/tsc.c             | 3 ++-
 sys/arch/amd64/amd64/mainbus.c       | 3 ++-
 sys/arch/amd64/pci/pchb.c            | 3 ++-
 sys/arch/arm/footbridge/footbridge.c | 3 ++-
 sys/arch/hppa/dev/dino.c             | 3 ++-
 sys/arch/hppa64/dev/elroy.c          | 3 ++-
 sys/arch/i386/i386/mainbus.c         | 3 ++-
 sys/arch/i386/pci/pchb.c             | 3 ++-
 sys/arch/macppc/pci/ht.c             | 3 ++-
 sys/arch/macppc/pci/mpcpcibus.c      | 3 ++-
 sys/arch/sgi/pci/macepcibridge.c     | 3 ++-
 sys/arch/sparc64/dev/psycho.c        | 3 ++-
 sys/arch/sparc64/dev/schizo.c        | 3 ++-
 17 files changed, 34 insertions(+), 17 deletions(-)

(limited to 'sys/arch')

diff --git a/sys/arch/alpha/pci/apecs.c b/sys/arch/alpha/pci/apecs.c
index f3d2966a7af..dba64eae71e 100644
--- a/sys/arch/alpha/pci/apecs.c
+++ b/sys/arch/alpha/pci/apecs.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: apecs.c,v 1.17 2002/03/14 01:26:27 millert Exp $	*/
+/*	$OpenBSD: apecs.c,v 1.18 2006/03/13 20:10:49 brad Exp $	*/
 /*	$NetBSD: apecs.c,v 1.16 1996/12/05 01:39:34 cgd Exp $	*/
 
 /*-
@@ -245,6 +245,7 @@ apecsattach(parent, self, aux)
 	    alphabus_dma_get_tag(&acp->ac_dmat_direct, ALPHA_BUS_PCI);
 	pba.pba_pc = &acp->ac_pc;
 	pba.pba_bus = 0;
+	pba.pba_bridgetag = NULL;
 #ifdef notyet
 	pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
 	    PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY;
diff --git a/sys/arch/alpha/pci/cia.c b/sys/arch/alpha/pci/cia.c
index 6648a0b2d93..87623a2e941 100644
--- a/sys/arch/alpha/pci/cia.c
+++ b/sys/arch/alpha/pci/cia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cia.c,v 1.20 2003/10/18 20:14:42 jmc Exp $ */
+/* $OpenBSD: cia.c,v 1.21 2006/03/13 20:10:49 brad Exp $ */
 /* $NetBSD: cia.c,v 1.56 2000/06/29 08:58:45 mrg Exp $ */
 
 /*-
@@ -402,6 +402,7 @@ ciaattach(parent, self, aux)
 	    alphabus_dma_get_tag(&ccp->cc_dmat_direct, ALPHA_BUS_PCI);
 	pba.pba_pc = &ccp->cc_pc;
 	pba.pba_bus = 0;
+	pba.pba_bridgetag = NULL;
 
 #ifdef notyet
 	pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
diff --git a/sys/arch/alpha/pci/irongate.c b/sys/arch/alpha/pci/irongate.c
index ca970b8c1a7..bca9c006616 100644
--- a/sys/arch/alpha/pci/irongate.c
+++ b/sys/arch/alpha/pci/irongate.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: irongate.c,v 1.6 2004/07/18 02:18:26 deraadt Exp $	*/
+/*	$OpenBSD: irongate.c,v 1.7 2006/03/13 20:10:49 brad Exp $	*/
 /* $NetBSD: irongate.c,v 1.3 2000/11/29 06:29:10 thorpej Exp $ */
 
 /*-
@@ -185,6 +185,7 @@ irongate_attach(struct device *parent, struct device *self, void *aux)
 	    alphabus_dma_get_tag(&icp->ic_dmat_pci, ALPHA_BUS_PCI);
 	pba.pba_pc = &icp->ic_pc;
 	pba.pba_bus = 0;
+	pba.pba_bridgetag = NULL;
 #ifdef notyet
 	pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
 	    PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY;
diff --git a/sys/arch/alpha/pci/lca.c b/sys/arch/alpha/pci/lca.c
index 859e1f9e9d7..a90c5f92007 100644
--- a/sys/arch/alpha/pci/lca.c
+++ b/sys/arch/alpha/pci/lca.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: lca.c,v 1.16 2002/03/14 01:26:27 millert Exp $	*/
+/*	$OpenBSD: lca.c,v 1.17 2006/03/13 20:10:49 brad Exp $	*/
 /*	$NetBSD: lca.c,v 1.14 1996/12/05 01:39:35 cgd Exp $	*/
 
 /*-
@@ -256,6 +256,7 @@ lcaattach(parent, self, aux)
 	    alphabus_dma_get_tag(&lcp->lc_dmat_direct, ALPHA_BUS_PCI);
 	pba.pba_pc = &lcp->lc_pc;
 	pba.pba_bus = 0;
+	pba.pba_bridgetag = NULL;
 #ifdef notyet
 	pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
 	    PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY;
diff --git a/sys/arch/alpha/pci/tsc.c b/sys/arch/alpha/pci/tsc.c
index 52a03a5b41c..29807f4af7b 100644
--- a/sys/arch/alpha/pci/tsc.c
+++ b/sys/arch/alpha/pci/tsc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tsc.c,v 1.10 2005/12/13 01:16:11 martin Exp $ */
+/* $OpenBSD: tsc.c,v 1.11 2006/03/13 20:10:49 brad Exp $ */
 /* $NetBSD: tsc.c,v 1.3 2000/06/25 19:17:40 thorpej Exp $ */
 
 /*-
@@ -200,6 +200,7 @@ tspattach(parent, self, aux)
 	    alphabus_dma_get_tag(&pcp->pc_dmat_direct, ALPHA_BUS_PCI);
 	pba.pba_pc = &pcp->pc_pc;
 	pba.pba_bus = 0;
+	pba.pba_bridgetag = NULL;
 #ifdef	notyet
 	pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
 	    PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY;
diff --git a/sys/arch/amd64/amd64/mainbus.c b/sys/arch/amd64/amd64/mainbus.c
index d8ddd224ec2..a07542b4be9 100644
--- a/sys/arch/amd64/amd64/mainbus.c
+++ b/sys/arch/amd64/amd64/mainbus.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: mainbus.c,v 1.5 2006/03/13 15:57:18 marco Exp $	*/
+/*	$OpenBSD: mainbus.c,v 1.6 2006/03/13 20:10:49 brad Exp $	*/
 /*	$NetBSD: mainbus.c,v 1.1 2003/04/26 18:39:29 fvdl Exp $	*/
 
 /*
@@ -205,6 +205,7 @@ mainbus_attach(parent, self, aux)
 		mba.mba_pba.pba_memt = X86_BUS_SPACE_MEM;
 		mba.mba_pba.pba_dmat = &pci_bus_dma_tag;
 		mba.mba_pba.pba_bus = 0;
+		mba.mba_pba.pba_bridgetag = NULL;
 		mba.mba_pba.pba_pc = NULL;
 		config_found(self, &mba.mba_pba, mainbus_print);
 	}
diff --git a/sys/arch/amd64/pci/pchb.c b/sys/arch/amd64/pci/pchb.c
index 478121194bf..ac63b13aff5 100644
--- a/sys/arch/amd64/pci/pchb.c
+++ b/sys/arch/amd64/pci/pchb.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: pchb.c,v 1.3 2006/02/12 23:46:27 kettenis Exp $	*/
+/*	$OpenBSD: pchb.c,v 1.4 2006/03/13 20:10:49 brad Exp $	*/
 /*	$NetBSD: pchb.c,v 1.1 2003/04/26 18:39:50 fvdl Exp $	*/
 
 /*-
@@ -171,6 +171,7 @@ pchb_amd64ht_attach (struct device *self, struct pci_attach_args *pa, int i)
 		pba.pba_memt = pa->pa_memt;
 		pba.pba_dmat = pa->pa_dmat;
 		pba.pba_bus = AMD64HT_LDT_SEC_BUS_NUM(bus);
+		pba.pba_bridgetag = NULL;
 		pba.pba_pc = pa->pa_pc;
 		config_found(self, &pba, pchb_print);
 	}
diff --git a/sys/arch/arm/footbridge/footbridge.c b/sys/arch/arm/footbridge/footbridge.c
index 6fa0cfed203..cba0426c0c7 100644
--- a/sys/arch/arm/footbridge/footbridge.c
+++ b/sys/arch/arm/footbridge/footbridge.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: footbridge.c,v 1.4 2004/08/17 19:40:45 drahn Exp $	*/
+/*	$OpenBSD: footbridge.c,v 1.5 2006/03/13 20:10:49 brad Exp $	*/
 /*	$NetBSD: footbridge.c,v 1.7 2002/05/16 01:01:33 thorpej Exp $	*/
 
 /*
@@ -222,6 +222,7 @@ footbridge_attach(parent, self, aux)
 	fba.fba_pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
 	*/
 	fba.fba_pba.pba_bus = 0;
+	fba.fba_pba.pba_bridgetag = NULL;
 	config_found(self, &fba.fba_pba, footbridge_print);
 
 	/* Attach uart device */
diff --git a/sys/arch/hppa/dev/dino.c b/sys/arch/hppa/dev/dino.c
index ec279bdb32d..f25598e11fe 100644
--- a/sys/arch/hppa/dev/dino.c
+++ b/sys/arch/hppa/dev/dino.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: dino.c,v 1.16 2005/09/06 23:53:38 mickey Exp $	*/
+/*	$OpenBSD: dino.c,v 1.17 2006/03/13 20:10:49 brad Exp $	*/
 
 /*
  * Copyright (c) 2003-2005 Michael Shalayeff
@@ -1623,6 +1623,7 @@ dinoattach(parent, self, aux)
 	pba.pba_dmat = &sc->sc_dmatag;
 	pba.pba_pc = &sc->sc_pc;
 	pba.pba_bus = 0;
+	pba.pba_bridgetag = NULL;
 	config_found(self, &pba, dinoprint);
 
 	/* enable interrupts now that all the devices are there */
diff --git a/sys/arch/hppa64/dev/elroy.c b/sys/arch/hppa64/dev/elroy.c
index 36538cdfd00..e271b97fbcc 100644
--- a/sys/arch/hppa64/dev/elroy.c
+++ b/sys/arch/hppa64/dev/elroy.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: elroy.c,v 1.2 2005/05/22 01:38:09 mickey Exp $	*/
+/*	$OpenBSD: elroy.c,v 1.3 2006/03/13 20:10:49 brad Exp $	*/
 
 /*
  * Copyright (c) 2005 Michael Shalayeff
@@ -1179,6 +1179,7 @@ letoh64(r->eio_base), letoh64(r->eio_mask));
 	pba.pba_memt = &sc->sc_memt;
 	pba.pba_dmat = &sc->sc_dmatag;
 	pba.pba_pc = &sc->sc_pc;
+	pba.pba_bridgetag = NULL;
 	pba.pba_bus = 0; /* (letoh32(elroy_read32(&r->busnum)) & 0xff) >> 4; */
 	config_found(self, &pba, elroyprint);
 
diff --git a/sys/arch/i386/i386/mainbus.c b/sys/arch/i386/i386/mainbus.c
index 6397fb6d2f9..8bae218b5a5 100644
--- a/sys/arch/i386/i386/mainbus.c
+++ b/sys/arch/i386/i386/mainbus.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: mainbus.c,v 1.24 2006/03/13 15:40:37 marco Exp $	*/
+/*	$OpenBSD: mainbus.c,v 1.25 2006/03/13 20:10:49 brad Exp $	*/
 /*	$NetBSD: mainbus.c,v 1.21 1997/06/06 23:14:20 thorpej Exp $	*/
 
 /*
@@ -237,6 +237,7 @@ mainbus_attach(parent, self, aux)
 		mba.mba_pba.pba_memt = I386_BUS_SPACE_MEM;
 		mba.mba_pba.pba_dmat = &pci_bus_dma_tag;
 		mba.mba_pba.pba_bus = 0;
+		mba.mba_pba.pba_bridgetag = NULL;
 		config_found(self, &mba.mba_pba, mainbus_print);
 	}
 #endif
diff --git a/sys/arch/i386/pci/pchb.c b/sys/arch/i386/pci/pchb.c
index 8da305e6d7d..7a664b416c5 100644
--- a/sys/arch/i386/pci/pchb.c
+++ b/sys/arch/i386/pci/pchb.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: pchb.c,v 1.51 2006/02/14 13:42:54 kettenis Exp $	*/
+/*	$OpenBSD: pchb.c,v 1.52 2006/03/13 20:10:49 brad Exp $	*/
 /*	$NetBSD: pchb.c,v 1.6 1997/06/06 23:29:16 thorpej Exp $	*/
 
 /*
@@ -238,6 +238,7 @@ pchbattach(parent, self, aux)
 		pba.pba_memt = pa->pa_memt;
 		pba.pba_dmat = pa->pa_dmat;
 		pba.pba_bus = bdnum;
+		pba.pba_bridgetag = NULL;
 		pba.pba_pc = pa->pa_pc;
 		printf("\n");
 		config_found(self, &pba, pchb_print);
diff --git a/sys/arch/macppc/pci/ht.c b/sys/arch/macppc/pci/ht.c
index 657c41cac8b..ba439b2056e 100644
--- a/sys/arch/macppc/pci/ht.c
+++ b/sys/arch/macppc/pci/ht.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ht.c,v 1.8 2005/12/14 20:06:57 kettenis Exp $	*/
+/*	$OpenBSD: ht.c,v 1.9 2006/03/13 20:10:49 brad Exp $	*/
 
 /*
  * Copyright (c) 2005 Mark Kettenis
@@ -190,6 +190,7 @@ ht_attach(struct device *parent, struct device *self, void *aux)
 	pba.pba_dmat = &pci_bus_dma_tag;
 	pba.pba_pc = &sc->sc_pc;
 	pba.pba_bus = 0;
+	pba.pba_bridgetag = NULL;
 
 	printf(": %d devices\n", sc->sc_maxdevs);
 
diff --git a/sys/arch/macppc/pci/mpcpcibus.c b/sys/arch/macppc/pci/mpcpcibus.c
index 786ab8c5dbc..cd624c24a0b 100644
--- a/sys/arch/macppc/pci/mpcpcibus.c
+++ b/sys/arch/macppc/pci/mpcpcibus.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: mpcpcibus.c,v 1.30 2006/02/11 05:21:40 brad Exp $ */
+/*	$OpenBSD: mpcpcibus.c,v 1.31 2006/03/13 20:10:49 brad Exp $ */
 
 /*
  * Copyright (c) 1997 Per Fogelstrom
@@ -444,6 +444,7 @@ mpcpcibrattach(struct device *parent, struct device *self, void *aux)
 	pba.pba_memt = &sc->sc_membus_space;
 	pba.pba_pc = &lcp->lc_pc;
 	pba.pba_bus = 0;
+	pba.pba_bridgetag = NULL;
 
 	/* we want to check pci irq settings */
 	if (of_node != 0) {
diff --git a/sys/arch/sgi/pci/macepcibridge.c b/sys/arch/sgi/pci/macepcibridge.c
index 90b6646b683..fb6efacb836 100644
--- a/sys/arch/sgi/pci/macepcibridge.c
+++ b/sys/arch/sgi/pci/macepcibridge.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: macepcibridge.c,v 1.9 2006/01/04 20:23:09 miod Exp $ */
+/*	$OpenBSD: macepcibridge.c,v 1.10 2006/03/13 20:10:49 brad Exp $ */
 
 /*
  * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se)
@@ -243,6 +243,7 @@ mace_pcibrattach(struct device *parent, struct device *self, void *aux)
 	*pba.pba_dmat = pci_bus_dma_tag;
 	pba.pba_pc = &sc->sc_pc;
 	pba.pba_bus = sc->sc_dev.dv_unit;
+	pba.pba_bridgetag = NULL;
 	config_found(self, &pba, mace_pcibrprint);
 
 	/* Clear PCI errors and set up error interrupt */
diff --git a/sys/arch/sparc64/dev/psycho.c b/sys/arch/sparc64/dev/psycho.c
index 7ef8a64e5d9..b187a7e81c7 100644
--- a/sys/arch/sparc64/dev/psycho.c
+++ b/sys/arch/sparc64/dev/psycho.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: psycho.c,v 1.41 2005/06/06 20:31:12 jason Exp $	*/
+/*	$OpenBSD: psycho.c,v 1.42 2006/03/13 20:10:49 brad Exp $	*/
 /*	$NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp $	*/
 
 /*
@@ -358,6 +358,7 @@ psycho_attach(struct device *parent, struct device *self, void *aux)
 	psycho_get_bus_range(sc->sc_node, psycho_br);
 
 	pba.pba_bus = psycho_br[0];
+	pba.pba_bridgetag = NULL;
 
 	printf("bus range %u to %u", psycho_br[0], psycho_br[1]);
 	printf("; PCI bus %d", psycho_br[0]);
diff --git a/sys/arch/sparc64/dev/schizo.c b/sys/arch/sparc64/dev/schizo.c
index fdffac2237b..252275b7eba 100644
--- a/sys/arch/sparc64/dev/schizo.c
+++ b/sys/arch/sparc64/dev/schizo.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: schizo.c,v 1.16 2003/06/24 21:54:39 henric Exp $	*/
+/*	$OpenBSD: schizo.c,v 1.17 2006/03/13 20:10:49 brad Exp $	*/
 
 /*
  * Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -191,6 +191,7 @@ schizo_init(struct schizo_softc *sc, int busa)
 
 	pba.pba_busname = "pci";
 	pba.pba_bus = busranges[0];
+	pba.pba_bridgetag = NULL;
 	pba.pba_pc = pbm->sp_pc;
 #if 0
 	pba.pba_flags = pbm->sp_flags;
-- 
cgit v1.2.3