diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2006-12-14 17:36:13 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2006-12-14 17:36:13 +0000 |
commit | c4c3193cc824f923b4f1e5b8c5ec27c32bbbcd8f (patch) | |
tree | b468fde9421bc79f715486e8c79db8efe9bb2abd | |
parent | 95476d7a5b0c0ad0d5c49ec2f74336bdafa725a3 (diff) |
Make pci subsystem aware of domains. Each host bridge gets assigned a unique
domain number such that we can distinguish between busses with the same bus
number that are behind different host bridges. Domains can be accessed by
using different device nodes.
ok deraadt@
-rw-r--r-- | sys/arch/alpha/pci/apecs.c | 3 | ||||
-rw-r--r-- | sys/arch/alpha/pci/cia.c | 3 | ||||
-rw-r--r-- | sys/arch/alpha/pci/irongate.c | 3 | ||||
-rw-r--r-- | sys/arch/alpha/pci/lca.c | 3 | ||||
-rw-r--r-- | sys/arch/alpha/pci/tsc.c | 3 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/mainbus.c | 3 | ||||
-rw-r--r-- | sys/arch/arm/footbridge/footbridge.c | 3 | ||||
-rw-r--r-- | sys/arch/arm/xscale/i80321.c | 3 | ||||
-rw-r--r-- | sys/arch/hppa/dev/dino.c | 3 | ||||
-rw-r--r-- | sys/arch/hppa64/dev/elroy.c | 3 | ||||
-rw-r--r-- | sys/arch/i386/i386/mainbus.c | 3 | ||||
-rw-r--r-- | sys/arch/i386/pci/pchb.c | 6 | ||||
-rw-r--r-- | sys/arch/macppc/pci/ht.c | 3 | ||||
-rw-r--r-- | sys/arch/macppc/pci/mpcpcibus.c | 3 | ||||
-rw-r--r-- | sys/arch/mvmeppc/pci/mpcpcibr.c | 3 | ||||
-rw-r--r-- | sys/arch/sgi/pci/macepcibridge.c | 3 | ||||
-rw-r--r-- | sys/arch/sh/dev/shpcic.c | 3 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/psycho.c | 3 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/schizo.c | 3 | ||||
-rw-r--r-- | sys/dev/pci/pci.c | 13 | ||||
-rw-r--r-- | sys/dev/pci/pcivar.h | 10 | ||||
-rw-r--r-- | sys/dev/pci/ppb.c | 3 |
22 files changed, 61 insertions, 25 deletions
diff --git a/sys/arch/alpha/pci/apecs.c b/sys/arch/alpha/pci/apecs.c index 5f117a980a0..89c311cb9e6 100644 --- a/sys/arch/alpha/pci/apecs.c +++ b/sys/arch/alpha/pci/apecs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apecs.c,v 1.19 2006/03/16 22:32:44 miod Exp $ */ +/* $OpenBSD: apecs.c,v 1.20 2006/12/14 17:36:12 kettenis Exp $ */ /* $NetBSD: apecs.c,v 1.16 1996/12/05 01:39:34 cgd Exp $ */ /*- @@ -243,6 +243,7 @@ apecsattach(parent, self, aux) pba.pba_dmat = alphabus_dma_get_tag(&acp->ac_dmat_direct, ALPHA_BUS_PCI); pba.pba_pc = &acp->ac_pc; + pba.pba_domain = pci_ndomains++; pba.pba_bus = 0; pba.pba_bridgetag = NULL; #ifdef notyet diff --git a/sys/arch/alpha/pci/cia.c b/sys/arch/alpha/pci/cia.c index 8ebaddc86ae..b0812211881 100644 --- a/sys/arch/alpha/pci/cia.c +++ b/sys/arch/alpha/pci/cia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cia.c,v 1.22 2006/03/16 22:32:44 miod Exp $ */ +/* $OpenBSD: cia.c,v 1.23 2006/12/14 17:36:12 kettenis Exp $ */ /* $NetBSD: cia.c,v 1.56 2000/06/29 08:58:45 mrg Exp $ */ /*- @@ -400,6 +400,7 @@ ciaattach(parent, self, aux) pba.pba_dmat = alphabus_dma_get_tag(&ccp->cc_dmat_direct, ALPHA_BUS_PCI); pba.pba_pc = &ccp->cc_pc; + pba.pba_domain = pci_ndomains++; pba.pba_bus = 0; pba.pba_bridgetag = NULL; diff --git a/sys/arch/alpha/pci/irongate.c b/sys/arch/alpha/pci/irongate.c index 233dcb3b374..16edd337408 100644 --- a/sys/arch/alpha/pci/irongate.c +++ b/sys/arch/alpha/pci/irongate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: irongate.c,v 1.8 2006/03/16 22:32:44 miod Exp $ */ +/* $OpenBSD: irongate.c,v 1.9 2006/12/14 17:36:12 kettenis Exp $ */ /* $NetBSD: irongate.c,v 1.3 2000/11/29 06:29:10 thorpej Exp $ */ /*- @@ -183,6 +183,7 @@ irongate_attach(struct device *parent, struct device *self, void *aux) pba.pba_dmat = alphabus_dma_get_tag(&icp->ic_dmat_pci, ALPHA_BUS_PCI); pba.pba_pc = &icp->ic_pc; + pba.pba_domain = pci_ndomains++; pba.pba_bus = 0; pba.pba_bridgetag = NULL; #ifdef notyet diff --git a/sys/arch/alpha/pci/lca.c b/sys/arch/alpha/pci/lca.c index 3ec9a253179..5fc19ab9c7d 100644 --- a/sys/arch/alpha/pci/lca.c +++ b/sys/arch/alpha/pci/lca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lca.c,v 1.18 2006/03/16 22:32:44 miod Exp $ */ +/* $OpenBSD: lca.c,v 1.19 2006/12/14 17:36:12 kettenis Exp $ */ /* $NetBSD: lca.c,v 1.14 1996/12/05 01:39:35 cgd Exp $ */ /*- @@ -254,6 +254,7 @@ lcaattach(parent, self, aux) pba.pba_dmat = alphabus_dma_get_tag(&lcp->lc_dmat_direct, ALPHA_BUS_PCI); pba.pba_pc = &lcp->lc_pc; + pba.pba_domain = pci_ndomains++; pba.pba_bus = 0; pba.pba_bridgetag = NULL; #ifdef notyet diff --git a/sys/arch/alpha/pci/tsc.c b/sys/arch/alpha/pci/tsc.c index 2acb1c49210..2ba899960d0 100644 --- a/sys/arch/alpha/pci/tsc.c +++ b/sys/arch/alpha/pci/tsc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tsc.c,v 1.12 2006/03/16 22:32:44 miod Exp $ */ +/* $OpenBSD: tsc.c,v 1.13 2006/12/14 17:36:12 kettenis Exp $ */ /* $NetBSD: tsc.c,v 1.3 2000/06/25 19:17:40 thorpej Exp $ */ /*- @@ -199,6 +199,7 @@ tspattach(parent, self, aux) pba.pba_dmat = alphabus_dma_get_tag(&pcp->pc_dmat_direct, ALPHA_BUS_PCI); pba.pba_pc = &pcp->pc_pc; + pba.pba_domain = pci_ndomains++; pba.pba_bus = 0; pba.pba_bridgetag = NULL; #ifdef notyet diff --git a/sys/arch/amd64/amd64/mainbus.c b/sys/arch/amd64/amd64/mainbus.c index 2f661daa01b..d665280cd60 100644 --- a/sys/arch/amd64/amd64/mainbus.c +++ b/sys/arch/amd64/amd64/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.10 2006/11/25 16:59:31 niklas Exp $ */ +/* $OpenBSD: mainbus.c,v 1.11 2006/12/14 17:36:12 kettenis Exp $ */ /* $NetBSD: mainbus.c,v 1.1 2003/04/26 18:39:29 fvdl Exp $ */ /* @@ -219,6 +219,7 @@ mainbus_attach(struct device *parent, struct device *self, void *aux) mba.mba_pba.pba_iot = X86_BUS_SPACE_IO; mba.mba_pba.pba_memt = X86_BUS_SPACE_MEM; mba.mba_pba.pba_dmat = &pci_bus_dma_tag; + mba.mba_pba.pba_domain = pci_ndomains++; mba.mba_pba.pba_bus = 0; mba.mba_pba.pba_bridgetag = NULL; mba.mba_pba.pba_pc = NULL; diff --git a/sys/arch/arm/footbridge/footbridge.c b/sys/arch/arm/footbridge/footbridge.c index cba0426c0c7..0bf0fd385fa 100644 --- a/sys/arch/arm/footbridge/footbridge.c +++ b/sys/arch/arm/footbridge/footbridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: footbridge.c,v 1.5 2006/03/13 20:10:49 brad Exp $ */ +/* $OpenBSD: footbridge.c,v 1.6 2006/12/14 17:36:12 kettenis Exp $ */ /* $NetBSD: footbridge.c,v 1.7 2002/05/16 01:01:33 thorpej Exp $ */ /* @@ -221,6 +221,7 @@ footbridge_attach(parent, self, aux) /* fba.fba_pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED; */ + fba.fba_pba.pba_domain = pci_ndomains++; fba.fba_pba.pba_bus = 0; fba.fba_pba.pba_bridgetag = NULL; config_found(self, &fba.fba_pba, footbridge_print); diff --git a/sys/arch/arm/xscale/i80321.c b/sys/arch/arm/xscale/i80321.c index de4ff5a34e3..da242d45af2 100644 --- a/sys/arch/arm/xscale/i80321.c +++ b/sys/arch/arm/xscale/i80321.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i80321.c,v 1.4 2006/06/02 01:33:55 drahn Exp $ */ +/* $OpenBSD: i80321.c,v 1.5 2006/12/14 17:36:12 kettenis Exp $ */ /* $NetBSD: i80321.c,v 1.18 2006/02/25 02:28:56 wiz Exp $ */ /* @@ -221,6 +221,7 @@ i80321_attach(struct i80321_softc *sc) pba.pba_memt = &sc->sc_pci_memt; pba.pba_dmat = &sc->sc_pci_dmat; pba.pba_pc = &sc->sc_pci_chipset; + pba.pba_domain = pci_ndomains++; pba.pba_bus = preg; pba.pba_bridgetag = NULL; pba.pba_intrswiz = 0; /* XXX what if busno != 0? */ diff --git a/sys/arch/hppa/dev/dino.c b/sys/arch/hppa/dev/dino.c index f25598e11fe..75c64ae6598 100644 --- a/sys/arch/hppa/dev/dino.c +++ b/sys/arch/hppa/dev/dino.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dino.c,v 1.17 2006/03/13 20:10:49 brad Exp $ */ +/* $OpenBSD: dino.c,v 1.18 2006/12/14 17:36:12 kettenis Exp $ */ /* * Copyright (c) 2003-2005 Michael Shalayeff @@ -1622,6 +1622,7 @@ dinoattach(parent, self, aux) pba.pba_memt = &sc->sc_memt; pba.pba_dmat = &sc->sc_dmatag; pba.pba_pc = &sc->sc_pc; + pba.pba_domain = pci_ndomains++; pba.pba_bus = 0; pba.pba_bridgetag = NULL; config_found(self, &pba, dinoprint); diff --git a/sys/arch/hppa64/dev/elroy.c b/sys/arch/hppa64/dev/elroy.c index e271b97fbcc..04c7f10b4e5 100644 --- a/sys/arch/hppa64/dev/elroy.c +++ b/sys/arch/hppa64/dev/elroy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: elroy.c,v 1.3 2006/03/13 20:10:49 brad Exp $ */ +/* $OpenBSD: elroy.c,v 1.4 2006/12/14 17:36:12 kettenis Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -1180,6 +1180,7 @@ letoh64(r->eio_base), letoh64(r->eio_mask)); pba.pba_dmat = &sc->sc_dmatag; pba.pba_pc = &sc->sc_pc; pba.pba_bridgetag = NULL; + pba.pba_domain = pci_ndomains++; 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 f9bda59957d..b476f7e2c1b 100644 --- a/sys/arch/i386/i386/mainbus.c +++ b/sys/arch/i386/i386/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.30 2006/11/29 20:03:19 dim Exp $ */ +/* $OpenBSD: mainbus.c,v 1.31 2006/12/14 17:36:12 kettenis Exp $ */ /* $NetBSD: mainbus.c,v 1.21 1997/06/06 23:14:20 thorpej Exp $ */ /* @@ -256,6 +256,7 @@ mainbus_attach(struct device *parent, struct device *self, void *aux) mba.mba_pba.pba_iot = I386_BUS_SPACE_IO; mba.mba_pba.pba_memt = I386_BUS_SPACE_MEM; mba.mba_pba.pba_dmat = &pci_bus_dma_tag; + mba.mba_pba.pba_domain = pci_ndomains++; mba.mba_pba.pba_bus = 0; mba.mba_pba.pba_bridgetag = NULL; config_found(self, &mba.mba_pba, mainbus_print); diff --git a/sys/arch/i386/pci/pchb.c b/sys/arch/i386/pci/pchb.c index 466d9cf0a78..76593587238 100644 --- a/sys/arch/i386/pci/pchb.c +++ b/sys/arch/i386/pci/pchb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pchb.c,v 1.53 2006/09/19 11:06:34 jsg Exp $ */ +/* $OpenBSD: pchb.c,v 1.54 2006/12/14 17:36:12 kettenis Exp $ */ /* $NetBSD: pchb.c,v 1.6 1997/06/06 23:29:16 thorpej Exp $ */ /* @@ -233,6 +233,7 @@ pchbattach(struct device *parent, struct device *self, void *aux) pba.pba_iot = pa->pa_iot; pba.pba_memt = pa->pa_memt; pba.pba_dmat = pa->pa_dmat; + pba.pba_domain = pa->pa_domain; pba.pba_bus = bdnum; pba.pba_bridgetag = NULL; pba.pba_pc = pa->pa_pc; @@ -284,6 +285,7 @@ pchbattach(struct device *parent, struct device *self, void *aux) pba.pba_iot = pa->pa_iot; pba.pba_memt = pa->pa_memt; pba.pba_dmat = pa->pa_dmat; + pba.pba_domain = pa->pa_domain; pba.pba_bus = pbnum; pba.pba_pc = pa->pa_pc; printf("\n"); @@ -320,6 +322,7 @@ pchbattach(struct device *parent, struct device *self, void *aux) pba.pba_iot = pa->pa_iot; pba.pba_memt = pa->pa_memt; pba.pba_dmat = pa->pa_dmat; + pba.pba_domain = pa->pa_domain; pba.pba_bus = pbnum; pba.pba_pc = pa->pa_pc; printf("\n"); @@ -464,6 +467,7 @@ pchb_amd64ht_attach (struct device *self, struct pci_attach_args *pa, int i) pba.pba_iot = pa->pa_iot; pba.pba_memt = pa->pa_memt; pba.pba_dmat = pa->pa_dmat; + pba.pba_domain = pa->pa_domain; pba.pba_bus = AMD64HT_LDT_SEC_BUS_NUM(bus); pba.pba_pc = pa->pa_pc; config_found(self, &pba, pchb_print); diff --git a/sys/arch/macppc/pci/ht.c b/sys/arch/macppc/pci/ht.c index ba439b2056e..05d49099568 100644 --- a/sys/arch/macppc/pci/ht.c +++ b/sys/arch/macppc/pci/ht.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ht.c,v 1.9 2006/03/13 20:10:49 brad Exp $ */ +/* $OpenBSD: ht.c,v 1.10 2006/12/14 17:36:12 kettenis Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -189,6 +189,7 @@ ht_attach(struct device *parent, struct device *self, void *aux) pba.pba_memt = sc->sc_memt; pba.pba_dmat = &pci_bus_dma_tag; pba.pba_pc = &sc->sc_pc; + pba.pba_domain = pci_ndomains++; pba.pba_bus = 0; pba.pba_bridgetag = NULL; diff --git a/sys/arch/macppc/pci/mpcpcibus.c b/sys/arch/macppc/pci/mpcpcibus.c index 5408692ecb4..1bdf2215474 100644 --- a/sys/arch/macppc/pci/mpcpcibus.c +++ b/sys/arch/macppc/pci/mpcpcibus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpcpcibus.c,v 1.35 2006/12/05 20:48:23 gwk Exp $ */ +/* $OpenBSD: mpcpcibus.c,v 1.36 2006/12/14 17:36:12 kettenis Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -444,6 +444,7 @@ mpcpcibrattach(struct device *parent, struct device *self, void *aux) pba.pba_iot = &sc->sc_iobus_space; pba.pba_memt = &sc->sc_membus_space; pba.pba_pc = &lcp->lc_pc; + pba.pba_domain = pci_ndomains++; pba.pba_bus = 0; pba.pba_bridgetag = NULL; diff --git a/sys/arch/mvmeppc/pci/mpcpcibr.c b/sys/arch/mvmeppc/pci/mpcpcibr.c index d52e042816c..4ab76a14489 100644 --- a/sys/arch/mvmeppc/pci/mpcpcibr.c +++ b/sys/arch/mvmeppc/pci/mpcpcibr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpcpcibr.c,v 1.17 2005/11/07 02:19:46 brad Exp $ */ +/* $OpenBSD: mpcpcibr.c,v 1.18 2006/12/14 17:36:12 kettenis Exp $ */ /* * Copyright (c) 2001 Steve Murphree, Jr. @@ -238,6 +238,7 @@ mpcpcibrattach(parent, self, aux) pba.pba_iot = &sc->sc_iobus_space; pba.pba_memt = &sc->sc_membus_space; pba.pba_pc = &lcp->lc_pc; + pba.pba_domain = pci_ndomains++; pba.pba_bus = 0; /* diff --git a/sys/arch/sgi/pci/macepcibridge.c b/sys/arch/sgi/pci/macepcibridge.c index fb6efacb836..ae9801c6e40 100644 --- a/sys/arch/sgi/pci/macepcibridge.c +++ b/sys/arch/sgi/pci/macepcibridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macepcibridge.c,v 1.10 2006/03/13 20:10:49 brad Exp $ */ +/* $OpenBSD: macepcibridge.c,v 1.11 2006/12/14 17:36:12 kettenis Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se) @@ -242,6 +242,7 @@ mace_pcibrattach(struct device *parent, struct device *self, void *aux) pci_bus_dma_tag.dma_offs = 0x00000000; *pba.pba_dmat = pci_bus_dma_tag; pba.pba_pc = &sc->sc_pc; + pba.pba_domain = pci_ndomains++; pba.pba_bus = sc->sc_dev.dv_unit; pba.pba_bridgetag = NULL; config_found(self, &pba, mace_pcibrprint); diff --git a/sys/arch/sh/dev/shpcic.c b/sys/arch/sh/dev/shpcic.c index 8085d85ea4d..13883468e97 100644 --- a/sys/arch/sh/dev/shpcic.c +++ b/sys/arch/sh/dev/shpcic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: shpcic.c,v 1.5 2006/10/23 20:15:50 miod Exp $ */ +/* $OpenBSD: shpcic.c,v 1.6 2006/12/14 17:36:12 kettenis Exp $ */ /* $NetBSD: shpcic.c,v 1.10 2005/12/24 20:07:32 perry Exp $ */ /* @@ -261,6 +261,7 @@ shpcic_attach(struct device *parent, struct device *self, void *aux) pba.pba_memt = shpcic_get_bus_mem_tag(); pba.pba_dmat = shpcic_get_bus_dma_tag(); pba.pba_pc = NULL; + pba.pba_domain = pci_ndomains++; pba.pba_bus = 0; pba.pba_bridgetag = NULL; config_found(self, &pba, NULL); diff --git a/sys/arch/sparc64/dev/psycho.c b/sys/arch/sparc64/dev/psycho.c index f1a03025b8c..7ef0c4dd07f 100644 --- a/sys/arch/sparc64/dev/psycho.c +++ b/sys/arch/sparc64/dev/psycho.c @@ -1,4 +1,4 @@ -/* $OpenBSD: psycho.c,v 1.47 2006/07/01 16:41:26 deraadt Exp $ */ +/* $OpenBSD: psycho.c,v 1.48 2006/12/14 17:36:12 kettenis Exp $ */ /* $NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp $ */ /* @@ -355,6 +355,7 @@ psycho_attach(struct device *parent, struct device *self, void *aux) /* get the bus-range for the psycho */ psycho_get_bus_range(sc->sc_node, psycho_br); + pba.pba_domain = pci_ndomains++; pba.pba_bus = psycho_br[0]; pba.pba_bridgetag = NULL; diff --git a/sys/arch/sparc64/dev/schizo.c b/sys/arch/sparc64/dev/schizo.c index 3f38552102f..c5947838872 100644 --- a/sys/arch/sparc64/dev/schizo.c +++ b/sys/arch/sparc64/dev/schizo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: schizo.c,v 1.36 2006/12/12 19:18:52 kettenis Exp $ */ +/* $OpenBSD: schizo.c,v 1.37 2006/12/14 17:36:12 kettenis Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -213,6 +213,7 @@ schizo_init(struct schizo_softc *sc, int busa) pbm->sp_pc->bushandle = pbm->sp_cfgh; pba.pba_busname = "pci"; + pba.pba_domain = pci_ndomains++; pba.pba_bus = busranges[0]; pba.pba_bridgetag = NULL; pba.pba_pc = pbm->sp_pc; diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 143952ea170..f9f62a68882 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci.c,v 1.48 2006/12/11 19:47:37 kettenis Exp $ */ +/* $OpenBSD: pci.c,v 1.49 2006/12/14 17:36:12 kettenis Exp $ */ /* $NetBSD: pci.c,v 1.31 1997/06/06 23:48:04 thorpej Exp $ */ /* @@ -72,6 +72,8 @@ struct cfdriver pci_cd = { NULL, "pci", DV_DULL }; +int pci_ndomains; + int pciprint(void *, const char *); int pcisubmatch(struct device *, void *, void *); @@ -150,6 +152,7 @@ pciattach(struct device *parent, struct device *self, void *aux) sc->sc_memt = pba->pba_memt; sc->sc_dmat = pba->pba_dmat; sc->sc_pc = pba->pba_pc; + sc->sc_domain = pba->pba_domain; sc->sc_bus = pba->pba_bus; sc->sc_bridgetag = pba->pba_bridgetag; sc->sc_maxndevs = pci_bus_maxdevs(pba->pba_pc, pba->pba_bus); @@ -265,6 +268,7 @@ pci_probe_device(struct pci_softc *sc, pcitag_t tag, pa.pa_memt = sc->sc_memt; pa.pa_dmat = sc->sc_dmat; pa.pa_pc = pc; + pa.pa_domain = sc->sc_domain; pa.pa_bus = bus; pa.pa_device = device; pa.pa_function = function; @@ -496,6 +500,10 @@ pciopen(dev_t dev, int oflags, int devtype, struct proc *p) { PCIDEBUG(("pciopen ndevs: %d\n" , pci_cd.cd_ndevs)); + if (minor(dev) >= pci_ndomains) { + return ENXIO; + } + #ifndef APERTURE if ((oflags & FWRITE) && securelevel > 0) { return EPERM; @@ -533,7 +541,8 @@ pciioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) for (i = 0; i < pci_cd.cd_ndevs; i++) { pci = pci_cd.cd_devs[i]; - if (pci != NULL && pci->sc_bus == io->pi_sel.pc_bus) + if (pci != NULL && pci->sc_domain == minor(dev) && + pci->sc_bus == io->pi_sel.pc_bus) break; } if (pci != NULL && pci->sc_bus == io->pi_sel.pc_bus) { diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h index 27396b2c348..99cafa18b2d 100644 --- a/sys/dev/pci/pcivar.h +++ b/sys/dev/pci/pcivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcivar.h,v 1.49 2006/12/11 19:47:37 kettenis Exp $ */ +/* $OpenBSD: pcivar.h,v 1.50 2006/12/14 17:36:12 kettenis Exp $ */ /* $NetBSD: pcivar.h,v 1.23 1997/06/06 23:48:05 thorpej Exp $ */ /* @@ -80,6 +80,7 @@ struct pcibus_attach_args { bus_dma_tag_t pba_dmat; /* DMA tag */ pci_chipset_tag_t pba_pc; + int pba_domain; /* PCI domain */ int pba_bus; /* PCI bus number */ /* @@ -106,8 +107,9 @@ struct pci_attach_args { pci_chipset_tag_t pa_pc; int pa_flags; /* flags; see below */ - u_int pa_device; + u_int pa_domain; u_int pa_bus; + u_int pa_device; u_int pa_function; pcitag_t pa_tag; pcireg_t pa_id, pa_class; @@ -159,12 +161,14 @@ struct pci_softc { pci_chipset_tag_t sc_pc; void *sc_powerhook; LIST_HEAD(, pci_dev) sc_devs; - int sc_bus, sc_maxndevs; + int sc_domain, sc_bus, sc_maxndevs; pcitag_t *sc_bridgetag; u_int sc_intrswiz; pcitag_t sc_intrtag; }; +extern int pci_ndomains; + /* * Locators devices that attach to 'pcibus', as specified to config. */ diff --git a/sys/dev/pci/ppb.c b/sys/dev/pci/ppb.c index bd21727ff23..84470f0fab6 100644 --- a/sys/dev/pci/ppb.c +++ b/sys/dev/pci/ppb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ppb.c,v 1.16 2006/07/04 18:26:30 kettenis Exp $ */ +/* $OpenBSD: ppb.c,v 1.17 2006/12/14 17:36:12 kettenis Exp $ */ /* $NetBSD: ppb.c,v 1.16 1997/06/06 23:48:05 thorpej Exp $ */ /* @@ -131,6 +131,7 @@ ppbattach(struct device *parent, struct device *self, void *aux) #if 0 pba.pba_flags = pa->pa_flags & ~PCI_FLAGS_MRM_OKAY; #endif + pba.pba_domain = pa->pa_domain; pba.pba_bus = PPB_BUSINFO_SECONDARY(busdata); pba.pba_bridgetag = &sc->sc_tag; pba.pba_intrswiz = pa->pa_intrswiz; |