diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-12-04 17:06:33 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-12-04 17:06:33 +0000 |
commit | 4b7076ea351a93ed49ec893da421f6291344206e (patch) | |
tree | 8e5937b390074e65576adaef9e87dde05d917958 /sys/arch/alpha/pci | |
parent | a0570286cbc603d45d495c2ab02e4654ae5c8a90 (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/alpha/pci')
-rw-r--r-- | sys/arch/alpha/pci/apecs_pci.c | 10 | ||||
-rw-r--r-- | sys/arch/alpha/pci/cia_pci.c | 10 | ||||
-rw-r--r-- | sys/arch/alpha/pci/irongate_pci.c | 10 | ||||
-rw-r--r-- | sys/arch/alpha/pci/lca_pci.c | 10 | ||||
-rw-r--r-- | sys/arch/alpha/pci/mcpcia_pci.c | 41 | ||||
-rw-r--r-- | sys/arch/alpha/pci/pci_machdep.h | 5 | ||||
-rw-r--r-- | sys/arch/alpha/pci/tsp_pci.c | 11 |
7 files changed, 72 insertions, 25 deletions
diff --git a/sys/arch/alpha/pci/apecs_pci.c b/sys/arch/alpha/pci/apecs_pci.c index 9ef26cbf121..a0b5bd1d139 100644 --- a/sys/arch/alpha/pci/apecs_pci.c +++ b/sys/arch/alpha/pci/apecs_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apecs_pci.c,v 1.10 2006/03/26 20:23:08 brad Exp $ */ +/* $OpenBSD: apecs_pci.c,v 1.11 2010/12/04 17:06:31 miod Exp $ */ /* $NetBSD: apecs_pci.c,v 1.10 1996/11/13 21:13:25 cgd Exp $ */ /* @@ -48,6 +48,7 @@ int apecs_bus_maxdevs(void *, int); pcitag_t apecs_make_tag(void *, int, int, int); void apecs_decompose_tag(void *, pcitag_t, int *, int *, int *); +int apecs_conf_size(void *, pcitag_t); pcireg_t apecs_conf_read(void *, pcitag_t, int); void apecs_conf_write(void *, pcitag_t, int, pcireg_t); @@ -62,6 +63,7 @@ apecs_pci_init(pc, v) pc->pc_bus_maxdevs = apecs_bus_maxdevs; pc->pc_make_tag = apecs_make_tag; pc->pc_decompose_tag = apecs_decompose_tag; + pc->pc_conf_size = apecs_conf_size; pc->pc_conf_read = apecs_conf_read; pc->pc_conf_write = apecs_conf_write; } @@ -106,6 +108,12 @@ apecs_decompose_tag(cpv, tag, bp, dp, fp) *fp = (tag >> 8) & 0x7; } +int +apecs_conf_size(void *cpv, pcitag_t tag) +{ + return PCI_CONFIG_SPACE_SIZE; +} + pcireg_t apecs_conf_read(cpv, tag, offset) void *cpv; diff --git a/sys/arch/alpha/pci/cia_pci.c b/sys/arch/alpha/pci/cia_pci.c index 540d45ff0b0..597d9b9bae3 100644 --- a/sys/arch/alpha/pci/cia_pci.c +++ b/sys/arch/alpha/pci/cia_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cia_pci.c,v 1.11 2006/03/26 20:23:08 brad Exp $ */ +/* $OpenBSD: cia_pci.c,v 1.12 2010/12/04 17:06:31 miod Exp $ */ /* $NetBSD: cia_pci.c,v 1.25 2000/06/29 08:58:46 mrg Exp $ */ /* @@ -46,6 +46,7 @@ int cia_bus_maxdevs(void *, int); pcitag_t cia_make_tag(void *, int, int, int); void cia_decompose_tag(void *, pcitag_t, int *, int *, int *); +int cia_conf_size(void *, pcitag_t); pcireg_t cia_conf_read(void *, pcitag_t, int); void cia_conf_write(void *, pcitag_t, int, pcireg_t); @@ -60,6 +61,7 @@ cia_pci_init(pc, v) pc->pc_bus_maxdevs = cia_bus_maxdevs; pc->pc_make_tag = cia_make_tag; pc->pc_decompose_tag = cia_decompose_tag; + pc->pc_conf_size = cia_conf_size; pc->pc_conf_read = cia_conf_read; pc->pc_conf_write = cia_conf_write; } @@ -104,6 +106,12 @@ cia_decompose_tag(cpv, tag, bp, dp, fp) *fp = (tag >> 8) & 0x7; } +int +cia_conf_size(void *cpv, pcitag_t tag) +{ + return PCI_CONFIG_SPACE_SIZE; +} + pcireg_t cia_conf_read(cpv, tag, offset) void *cpv; diff --git a/sys/arch/alpha/pci/irongate_pci.c b/sys/arch/alpha/pci/irongate_pci.c index 4fbde0a0474..fb7cf035167 100644 --- a/sys/arch/alpha/pci/irongate_pci.c +++ b/sys/arch/alpha/pci/irongate_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: irongate_pci.c,v 1.5 2008/06/26 05:42:08 ray Exp $ */ +/* $OpenBSD: irongate_pci.c,v 1.6 2010/12/04 17:06:31 miod Exp $ */ /* $NetBSD: irongate_pci.c,v 1.2 2000/06/29 08:58:47 mrg Exp $ */ /*- @@ -53,6 +53,7 @@ int irongate_bus_maxdevs(void *, int); pcitag_t irongate_make_tag(void *, int, int, int); void irongate_decompose_tag(void *, pcitag_t, int *, int *, int *); +int irongate_conf_size(void *, pcitag_t); pcireg_t irongate_conf_read(void *, pcitag_t, int); void irongate_conf_write(void *, pcitag_t, int, pcireg_t); @@ -74,6 +75,7 @@ irongate_pci_init(pci_chipset_tag_t pc, void *v) pc->pc_bus_maxdevs = irongate_bus_maxdevs; pc->pc_make_tag = irongate_make_tag; pc->pc_decompose_tag = irongate_decompose_tag; + pc->pc_conf_size = irongate_conf_size; pc->pc_conf_read = irongate_conf_read; pc->pc_conf_write = irongate_conf_write; } @@ -110,6 +112,12 @@ irongate_decompose_tag(void *ipv, pcitag_t tag, int *bp, int *dp, int *fp) *fp = (tag >> 8) & 0x7; } +int +irongate_conf_size(void *ipv, pcitag_t tag) +{ + return PCI_CONFIG_SPACE_SIZE; +} + pcireg_t irongate_conf_read(void *ipv, pcitag_t tag, int offset) { diff --git a/sys/arch/alpha/pci/lca_pci.c b/sys/arch/alpha/pci/lca_pci.c index 0aef2d52572..20725619bf8 100644 --- a/sys/arch/alpha/pci/lca_pci.c +++ b/sys/arch/alpha/pci/lca_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lca_pci.c,v 1.9 2006/03/26 20:23:08 brad Exp $ */ +/* $OpenBSD: lca_pci.c,v 1.10 2010/12/04 17:06:31 miod Exp $ */ /* $NetBSD: lca_pci.c,v 1.13 1997/09/02 13:19:35 thorpej Exp $ */ /* @@ -48,6 +48,7 @@ int lca_bus_maxdevs(void *, int); pcitag_t lca_make_tag(void *, int, int, int); void lca_decompose_tag(void *, pcitag_t, int *, int *, int *); +int lca_conf_size(void *, pcitag_t); pcireg_t lca_conf_read(void *, pcitag_t, int); void lca_conf_write(void *, pcitag_t, int, pcireg_t); @@ -62,6 +63,7 @@ lca_pci_init(pc, v) pc->pc_bus_maxdevs = lca_bus_maxdevs; pc->pc_make_tag = lca_make_tag; pc->pc_decompose_tag = lca_decompose_tag; + pc->pc_conf_size = lca_conf_size; pc->pc_conf_read = lca_conf_read; pc->pc_conf_write = lca_conf_write; } @@ -109,6 +111,12 @@ lca_decompose_tag(cpv, tag, bp, dp, fp) *fp = (tag >> 8) & 0x7; } +int +lca_conf_size(void *cpv, pcitag_t tag) +{ + return PCI_CONFIG_SPACE_SIZE; +} + pcireg_t lca_conf_read(cpv, tag, offset) void *cpv; diff --git a/sys/arch/alpha/pci/mcpcia_pci.c b/sys/arch/alpha/pci/mcpcia_pci.c index ccc0b7b978a..ddc9e00b76c 100644 --- a/sys/arch/alpha/pci/mcpcia_pci.c +++ b/sys/arch/alpha/pci/mcpcia_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mcpcia_pci.c,v 1.1 2007/03/16 21:22:27 robert Exp $ */ +/* $OpenBSD: mcpcia_pci.c,v 1.2 2010/12/04 17:06:31 miod Exp $ */ /* $NetBSD: mcpcia_pci.c,v 1.5 2007/03/04 05:59:11 christos Exp $ */ /* @@ -46,18 +46,14 @@ #define KV(_addr) ((void *)ALPHA_PHYS_TO_K0SEG((_addr))) -static void mcpcia_attach_hook (struct device *, struct device *, - struct pcibus_attach_args *); -static int -mcpcia_bus_maxdevs (void *, int); -static pcitag_t -mcpcia_make_tag (void *, int, int, int); -static void -mcpcia_decompose_tag (void *, pcitag_t, int *, int *, int *); -static pcireg_t -mcpcia_conf_read (void *, pcitag_t, int); -static void -mcpcia_conf_write (void *, pcitag_t, int, pcireg_t); +void mcpcia_attach_hook(struct device *, struct device *, + struct pcibus_attach_args *); +int mcpcia_bus_maxdevs(void *, int); +pcitag_t mcpcia_make_tag(void *, int, int, int); +void mcpcia_decompose_tag(void *, pcitag_t, int *, int *, int *); +int mcpcia_conf_size(void *, pcitag_t); +pcireg_t mcpcia_conf_read(void *, pcitag_t, int); +void mcpcia_conf_write(void *, pcitag_t, int, pcireg_t); void mcpcia_pci_init(pc, v) @@ -69,18 +65,19 @@ mcpcia_pci_init(pc, v) pc->pc_bus_maxdevs = mcpcia_bus_maxdevs; pc->pc_make_tag = mcpcia_make_tag; pc->pc_decompose_tag = mcpcia_decompose_tag; + pc->pc_conf_size = mcpcia_conf_size; pc->pc_conf_read = mcpcia_conf_read; pc->pc_conf_write = mcpcia_conf_write; } -static void +void mcpcia_attach_hook(parent, self, pba) struct device *parent, *self; struct pcibus_attach_args *pba; { } -static int +int mcpcia_bus_maxdevs(cpv, busno) void *cpv; int busno; @@ -88,7 +85,7 @@ mcpcia_bus_maxdevs(cpv, busno) return (MCPCIA_MAXDEV); } -static pcitag_t +pcitag_t mcpcia_make_tag(cpv, b, d, f) void *cpv; int b, d, f; @@ -98,7 +95,7 @@ mcpcia_make_tag(cpv, b, d, f) return (tag); } -static void +void mcpcia_decompose_tag(cpv, tag, bp, dp, fp) void *cpv; pcitag_t tag; @@ -112,7 +109,13 @@ mcpcia_decompose_tag(cpv, tag, bp, dp, fp) *fp = (tag >> 13) & 0x7; } -static pcireg_t +int +mcpcia_conf_size(void *cpv, pcitag_t tag) +{ + return PCI_CONFIG_SPACE_SIZE; +} + +pcireg_t mcpcia_conf_read(cpv, tag, offset) void *cpv; pcitag_t tag; @@ -143,7 +146,7 @@ mcpcia_conf_read(cpv, tag, offset) return (data); } -static void +void mcpcia_conf_write(cpv, tag, offset, data) void *cpv; pcitag_t tag; diff --git a/sys/arch/alpha/pci/pci_machdep.h b/sys/arch/alpha/pci/pci_machdep.h index 6e20951e387..cbcd10a8fb7 100644 --- a/sys/arch/alpha/pci/pci_machdep.h +++ b/sys/arch/alpha/pci/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.23 2010/06/29 22:08:28 jordan Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.24 2010/12/04 17:06:31 miod Exp $ */ /* $NetBSD: pci_machdep.h,v 1.6 1996/11/19 04:49:21 cgd Exp $ */ /* @@ -56,6 +56,7 @@ struct alpha_pci_chipset { pcitag_t (*pc_make_tag)(void *, int, int, int); void (*pc_decompose_tag)(void *, pcitag_t, int *, int *, int *); + int (*pc_conf_size)(void *, pcitag_t); pcireg_t (*pc_conf_read)(void *, pcitag_t, int); void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t); @@ -96,6 +97,8 @@ int alpha_sysctl_chipset(int *, u_int, char *, size_t *); (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f)) #define pci_decompose_tag(c, t, bp, dp, fp) \ (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp)) +#define pci_conf_size(c, t) \ + (*(c)->pc_conf_size)((c)->pc_conf_v, (t)) #define pci_conf_read(c, t, r) \ (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r)) #define pci_conf_write(c, t, r, v) \ diff --git a/sys/arch/alpha/pci/tsp_pci.c b/sys/arch/alpha/pci/tsp_pci.c index 6abcbc7936f..cf06cc49d47 100644 --- a/sys/arch/alpha/pci/tsp_pci.c +++ b/sys/arch/alpha/pci/tsp_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tsp_pci.c,v 1.3 2002/03/14 01:26:27 millert Exp $ */ +/* $OpenBSD: tsp_pci.c,v 1.4 2010/12/04 17:06:31 miod Exp $ */ /* $NetBSD: tsp_pci.c,v 1.1 1999/06/29 06:46:47 ross Exp $ */ /*- @@ -56,6 +56,7 @@ int tsp_bus_maxdevs(void *, int); pcitag_t tsp_make_tag(void *, int, int, int); void tsp_decompose_tag(void *, pcitag_t, int *, int *, int *); +int tsp_conf_size(void *, pcitag_t); pcireg_t tsp_conf_read(void *, pcitag_t, int); void tsp_conf_write(void *, pcitag_t, int, pcireg_t); @@ -69,6 +70,7 @@ tsp_pci_init(pc, v) pc->pc_bus_maxdevs = tsp_bus_maxdevs; pc->pc_make_tag = tsp_make_tag; pc->pc_decompose_tag = tsp_decompose_tag; + pc->pc_conf_size = tsp_conf_size; pc->pc_conf_read = tsp_conf_read; pc->pc_conf_write = tsp_conf_write; } @@ -109,6 +111,13 @@ tsp_decompose_tag(cpv, tag, bp, dp, fp) if (fp != NULL) *fp = (tag >> 8) & 0x7; } + +int +tsp_conf_size(void *cpv, pcitag_t tag) +{ + return PCI_CONFIG_SPACE_SIZE; +} + /* * Tsunami makes this a lot easier than it used to be, automatically * generating type 0 or type 1 cycles, and quietly returning -1 with |