summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64/dev
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2010-12-04 17:06:33 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2010-12-04 17:06:33 +0000
commit4b7076ea351a93ed49ec893da421f6291344206e (patch)
tree8e5937b390074e65576adaef9e87dde05d917958 /sys/arch/sparc64/dev
parenta0570286cbc603d45d495c2ab02e4654ae5c8a90 (diff)
Introduce a new pci routine, pci_conf_size(), which returns the size of a
given pcitag_t configuration address space. Currently, all pci controllers will return the usual 0x100 bytes of PCI configuration space, but this will eventually change on PCIe-capable controlers. ok kettenis@
Diffstat (limited to 'sys/arch/sparc64/dev')
-rw-r--r--sys/arch/sparc64/dev/pci_machdep.c13
-rw-r--r--sys/arch/sparc64/dev/psycho.c9
-rw-r--r--sys/arch/sparc64/dev/pyro.c10
-rw-r--r--sys/arch/sparc64/dev/schizo.c10
-rw-r--r--sys/arch/sparc64/dev/vpci.c10
5 files changed, 47 insertions, 5 deletions
diff --git a/sys/arch/sparc64/dev/pci_machdep.c b/sys/arch/sparc64/dev/pci_machdep.c
index 1b3200bafc4..964063c2ef5 100644
--- a/sys/arch/sparc64/dev/pci_machdep.c
+++ b/sys/arch/sparc64/dev/pci_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci_machdep.c,v 1.39 2009/08/22 02:54:51 mk Exp $ */
+/* $OpenBSD: pci_machdep.c,v 1.40 2010/12/04 17:06:32 miod Exp $ */
/* $NetBSD: pci_machdep.c,v 1.22 2001/07/20 00:07:13 eeh Exp $ */
/*
@@ -316,6 +316,17 @@ sparc64_pci_enumerate_bus(struct pci_softc *sc,
return (0);
}
+int
+pci_conf_size(pci_chipset_tag_t pc, pcitag_t tag)
+{
+ int val = 0;
+
+ if (PCITAG_NODE(tag) != -1)
+ val = pc->conf_size(pc, tag);
+
+ return (val);
+}
+
pcireg_t
pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
{
diff --git a/sys/arch/sparc64/dev/psycho.c b/sys/arch/sparc64/dev/psycho.c
index 82ac64a57c5..6f2d3232cf1 100644
--- a/sys/arch/sparc64/dev/psycho.c
+++ b/sys/arch/sparc64/dev/psycho.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: psycho.c,v 1.66 2009/03/29 22:52:11 kettenis Exp $ */
+/* $OpenBSD: psycho.c,v 1.67 2010/12/04 17:06:32 miod Exp $ */
/* $NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp $ */
/*
@@ -118,6 +118,7 @@ int psycho_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
void psycho_identify_pbm(struct psycho_softc *sc, struct psycho_pbm *pp,
struct pcibus_attach_args *pa);
+int psycho_conf_size(pci_chipset_tag_t, pcitag_t);
pcireg_t psycho_conf_read(pci_chipset_tag_t, pcitag_t, int);
void psycho_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
@@ -590,6 +591,7 @@ psycho_attach(struct device *parent, struct device *self, void *aux)
pba.pba_memt = sc->sc_psycho_this->pp_memt;
pba.pba_pc->bustag = sc->sc_configtag;
pba.pba_pc->bushandle = sc->sc_configaddr;
+ pba.pba_pc->conf_size = psycho_conf_size;
pba.pba_pc->conf_read = psycho_conf_read;
pba.pba_pc->conf_write = psycho_conf_write;
pba.pba_pc->intr_map = psycho_intr_map;
@@ -1105,6 +1107,11 @@ psycho_bus_addr(bus_space_tag_t t, bus_space_tag_t t0, bus_space_handle_t h)
return (-1);
}
+int
+psycho_conf_size(pci_chipset_tag_t pc, pcitag_t tag)
+{
+ return PCI_CONFIG_SPACE_SIZE;
+}
pcireg_t
psycho_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
diff --git a/sys/arch/sparc64/dev/pyro.c b/sys/arch/sparc64/dev/pyro.c
index 0e9fd571899..2e58939deba 100644
--- a/sys/arch/sparc64/dev/pyro.c
+++ b/sys/arch/sparc64/dev/pyro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pyro.c,v 1.18 2009/03/29 22:52:11 kettenis Exp $ */
+/* $OpenBSD: pyro.c,v 1.19 2010/12/04 17:06:32 miod Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -92,6 +92,7 @@ bus_space_tag_t _pyro_alloc_bus_tag(struct pyro_pbm *, const char *,
int, int, int);
bus_dma_tag_t pyro_alloc_dma_tag(struct pyro_pbm *);
+int pyro_conf_size(pci_chipset_tag_t, pcitag_t);
pcireg_t pyro_conf_read(pci_chipset_tag_t, pcitag_t, int);
void pyro_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
@@ -220,6 +221,7 @@ pyro_init(struct pyro_softc *sc, int busa)
pba.pba_dmat = pbm->pp_dmat;
pba.pba_memt = pbm->pp_memt;
pba.pba_iot = pbm->pp_iot;
+ pba.pba_pc->conf_size = pyro_conf_size;
pba.pba_pc->conf_read = pyro_conf_read;
pba.pba_pc->conf_write = pyro_conf_write;
pba.pba_pc->intr_map = pyro_intr_map;
@@ -271,6 +273,12 @@ pyro_print(void *aux, const char *p)
return (QUIET);
}
+int
+pyro_conf_size(pci_chipset_tag_t pc, pcitag_t tag)
+{
+ return PCI_CONFIG_SPACE_SIZE;
+}
+
pcireg_t
pyro_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
{
diff --git a/sys/arch/sparc64/dev/schizo.c b/sys/arch/sparc64/dev/schizo.c
index 89867b2bd2a..5d6e6ef89c3 100644
--- a/sys/arch/sparc64/dev/schizo.c
+++ b/sys/arch/sparc64/dev/schizo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: schizo.c,v 1.60 2009/03/29 22:52:11 kettenis Exp $ */
+/* $OpenBSD: schizo.c,v 1.61 2010/12/04 17:06:32 miod Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -89,6 +89,7 @@ bus_space_tag_t schizo_alloc_bus_tag(struct schizo_pbm *, const char *,
int, int, int);
bus_dma_tag_t schizo_alloc_dma_tag(struct schizo_pbm *);
+int schizo_conf_size(pci_chipset_tag_t, pcitag_t);
pcireg_t schizo_conf_read(pci_chipset_tag_t, pcitag_t, int);
void schizo_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
@@ -238,6 +239,7 @@ schizo_init(struct schizo_softc *sc, int busa)
pba.pba_dmat = pbm->sp_dmat;
pba.pba_memt = pbm->sp_memt;
pba.pba_iot = pbm->sp_iot;
+ pba.pba_pc->conf_size = schizo_conf_size;
pba.pba_pc->conf_read = schizo_conf_read;
pba.pba_pc->conf_write = schizo_conf_write;
pba.pba_pc->intr_map = schizo_intr_map;
@@ -460,6 +462,12 @@ schizo_print(void *aux, const char *p)
return (QUIET);
}
+int
+schizo_conf_size(pci_chipset_tag_t pc, pcitag_t tag)
+{
+ return PCI_CONFIG_SPACE_SIZE;
+}
+
pcireg_t
schizo_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
{
diff --git a/sys/arch/sparc64/dev/vpci.c b/sys/arch/sparc64/dev/vpci.c
index 327f586c850..ebe37225694 100644
--- a/sys/arch/sparc64/dev/vpci.c
+++ b/sys/arch/sparc64/dev/vpci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vpci.c,v 1.4 2009/03/29 22:52:11 kettenis Exp $ */
+/* $OpenBSD: vpci.c,v 1.5 2010/12/04 17:06:32 miod Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis <kettenis@openbsd.org>
*
@@ -79,6 +79,7 @@ bus_space_tag_t vpci_alloc_bus_tag(struct vpci_pbm *, const char *,
int, int, int);
bus_dma_tag_t vpci_alloc_dma_tag(struct vpci_pbm *);
+int vpci_conf_size(pci_chipset_tag_t, pcitag_t);
pcireg_t vpci_conf_read(pci_chipset_tag_t, pcitag_t, int);
void vpci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
@@ -167,6 +168,7 @@ vpci_attach(struct device *parent, struct device *self, void *aux)
pba.pba_dmat = pbm->vp_dmat;
pba.pba_memt = pbm->vp_memt;
pba.pba_iot = pbm->vp_iot;
+ pba.pba_pc->conf_size = vpci_conf_size;
pba.pba_pc->conf_read = vpci_conf_read;
pba.pba_pc->conf_write = vpci_conf_write;
pba.pba_pc->intr_map = vpci_intr_map;
@@ -201,6 +203,12 @@ vpci_print(void *aux, const char *p)
return (QUIET);
}
+int
+vpci_conf_size(pci_chipset_tag_t pc, pcitag_t tag)
+{
+ return PCI_CONFIG_SPACE_SIZE;
+}
+
pcireg_t
vpci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
{