diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2003-09-02 17:25:22 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2003-09-02 17:25:22 +0000 |
commit | 7592107d280aebe0829159bdff0c28d07a15ad5c (patch) | |
tree | be3858eb98d5551c88fa98da2beb45255bad0331 /sys/arch/alpha/pci | |
parent | 502ab6598a0aceb78d7a33559ce85c2c4ef131c0 (diff) |
Our extent implementation relies on the fact that extents all have distinct
names.
However, the tsp code uses one global extent, which both device instances
want to reinitialize and use for themselves (whether this is a genuine bug
or not is left to the reader).
Solve the problem by putting the extents into the tsp softc, and change the
pci_bwx_bus code to handle variable extent names.
This makes DS20 systems with tsp0 and tsp1 work again.
ok deraadt@
Diffstat (limited to 'sys/arch/alpha/pci')
-rw-r--r-- | sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c | 21 | ||||
-rw-r--r-- | sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c | 21 | ||||
-rw-r--r-- | sys/arch/alpha/pci/tsc.c | 7 | ||||
-rw-r--r-- | sys/arch/alpha/pci/tsp_bus_io.c | 5 | ||||
-rw-r--r-- | sys/arch/alpha/pci/tsp_bus_mem.c | 5 | ||||
-rw-r--r-- | sys/arch/alpha/pci/tsvar.h | 5 |
6 files changed, 46 insertions, 18 deletions
diff --git a/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c b/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c index fb73a422d16..2dd720fb08b 100644 --- a/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c +++ b/sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_bwx_bus_io_chipdep.c,v 1.4 2002/03/14 01:26:27 millert Exp $ */ +/* $OpenBSD: pci_bwx_bus_io_chipdep.c,v 1.5 2003/09/02 17:25:21 miod Exp $ */ /* $NetBSD: pcs_bus_io_common.c,v 1.14 1996/12/02 22:19:35 cgd Exp $ */ /* @@ -44,6 +44,16 @@ #define __C(A,B) __CONCAT(A,B) #define __S(S) __STRING(S) +#ifndef CHIP_EXTENT_NAME +#define CHIP_EXTENT_NAME(v) __S(__C(CHIP,_bus_io)) +#endif + +#ifndef CHIP_EXTENT_STORAGE +#define CHIP_EXTENT_STORAGE(v) __C(CHIP,_io_ex_storage) +static long + __C(CHIP,_io_ex_storage)[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)]; +#endif + /* mapping/unmapping */ int __C(CHIP,_io_map)(void *, bus_addr_t, bus_size_t, int, bus_space_handle_t *); @@ -172,9 +182,6 @@ void __C(CHIP,_io_write_raw_multi_8)(void *, bus_space_handle_t, bus_size_t, const u_int8_t *, bus_size_t); -static long - __C(CHIP,_io_ex_storage)[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)]; - void __C(CHIP,_bus_io_init)(t, v) bus_space_tag_t t; @@ -265,9 +272,9 @@ __C(CHIP,_bus_io_init)(t, v) t->abs_wrm_4 = __C(CHIP,_io_write_raw_multi_4); t->abs_wrm_8 = __C(CHIP,_io_write_raw_multi_8); - ex = extent_create(__S(__C(CHIP,_bus_io)), 0x0UL, 0xffffffffUL, - M_DEVBUF, (caddr_t)__C(CHIP,_io_ex_storage), - sizeof(__C(CHIP,_io_ex_storage)), EX_NOWAIT|EX_NOCOALESCE); + ex = extent_create(CHIP_EXTENT_NAME(v), 0x0UL, 0xffffffffUL, + M_DEVBUF, (caddr_t)CHIP_EXTENT_STORAGE(v), + sizeof(CHIP_EXTENT_STORAGE(v)), EX_NOWAIT|EX_NOCOALESCE); CHIP_IO_EXTENT(v) = ex; } diff --git a/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c b/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c index 472c4be0a35..879757b36ca 100644 --- a/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c +++ b/sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_bwx_bus_mem_chipdep.c,v 1.5 2002/03/14 01:26:27 millert Exp $ */ +/* $OpenBSD: pci_bwx_bus_mem_chipdep.c,v 1.6 2003/09/02 17:25:21 miod Exp $ */ /* $NetBSD: pcs_bus_mem_common.c,v 1.15 1996/12/02 22:19:36 cgd Exp $ */ /* @@ -52,6 +52,16 @@ #define __C(A,B) __CONCAT(A,B) #define __S(S) __STRING(S) +#ifndef CHIP_EXTENT_NAME +#define CHIP_EXTENT_NAME(v) __S(__C(CHIP,_bus_dmem)) +#endif + +#ifndef CHIP_EXTENT_STORAGE +#define CHIP_EXTENT_STORAGE(v) __C(CHIP,_mem_ex_storage) +static long + __C(CHIP,_mem_ex_storage)[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)]; +#endif + /* mapping/unmapping */ int __C(CHIP,_mem_map)(void *, bus_addr_t, bus_size_t, int, bus_space_handle_t *); @@ -180,9 +190,6 @@ void __C(CHIP,_mem_write_raw_multi_8)(void *, bus_space_handle_t, bus_size_t, const u_int8_t *, bus_size_t); -static long - __C(CHIP,_mem_ex_storage)[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)]; - void __C(CHIP,_bus_mem_init)(t, v) bus_space_tag_t t; @@ -273,10 +280,10 @@ __C(CHIP,_bus_mem_init)(t, v) t->abs_wrm_4 = __C(CHIP,_mem_write_raw_multi_4); t->abs_wrm_8 = __C(CHIP,_mem_write_raw_multi_8); - ex = extent_create(__S(__C(CHIP,_bus_dmem)), 0x0UL, + ex = extent_create(CHIP_EXTENT_NAME(v), 0x0UL, 0xffffffffffffffffUL, M_DEVBUF, - (caddr_t)__C(CHIP,_mem_ex_storage), - sizeof(__C(CHIP,_mem_ex_storage)), EX_NOWAIT|EX_NOCOALESCE); + (caddr_t)CHIP_EXTENT_STORAGE(v), + sizeof(CHIP_EXTENT_STORAGE(v)), EX_NOWAIT|EX_NOCOALESCE); CHIP_MEM_EXTENT(v) = ex; } diff --git a/sys/arch/alpha/pci/tsc.c b/sys/arch/alpha/pci/tsc.c index 1c7d2cfe6f4..03fd784a16b 100644 --- a/sys/arch/alpha/pci/tsc.c +++ b/sys/arch/alpha/pci/tsc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tsc.c,v 1.7 2002/03/14 01:26:27 millert Exp $ */ +/* $OpenBSD: tsc.c,v 1.8 2003/09/02 17:25:21 miod Exp $ */ /* $NetBSD: tsc.c,v 1.3 2000/06/25 19:17:40 thorpej Exp $ */ /*- @@ -219,6 +219,11 @@ tsp_init(mallocsafe, n) pcp->pc_pslot = n; pcp->pc_iobase = TS_Pn(n, 0); pcp->pc_csr = S_PAGE(TS_Pn(n, P_CSRBASE)); + snprintf(pcp->pc_io_ex_name, sizeof pcp->pc_io_ex_name, + "tsp%d_bus_io", n); + snprintf(pcp->pc_mem_ex_name, sizeof pcp->pc_mem_ex_name, + "tsp%d_bus_mem", n); + if (!pcp->pc_initted) { tsp_bus_io_init(&pcp->pc_iot, pcp); tsp_bus_mem_init(&pcp->pc_memt, pcp); diff --git a/sys/arch/alpha/pci/tsp_bus_io.c b/sys/arch/alpha/pci/tsp_bus_io.c index fbbb5681cfd..ba39d9b0b56 100644 --- a/sys/arch/alpha/pci/tsp_bus_io.c +++ b/sys/arch/alpha/pci/tsp_bus_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tsp_bus_io.c,v 1.2 2001/11/06 19:53:13 miod Exp $ */ +/* $OpenBSD: tsp_bus_io.c,v 1.3 2003/09/02 17:25:21 miod Exp $ */ /* $NetBSD: tsp_bus_io.c,v 1.4 2000/06/26 19:46:24 thorpej Exp $ */ /*- @@ -60,4 +60,7 @@ typedef struct tsp_config *TSPCON; */ __asm(".arch ev6"); +#define CHIP_EXTENT_NAME(v) ((struct tsp_config *)(v))->pc_io_ex_name +#define CHIP_EXTENT_STORAGE(v) ((struct tsp_config *)(v))->pc_io_ex_storage + #include <alpha/pci/pci_bwx_bus_io_chipdep.c> diff --git a/sys/arch/alpha/pci/tsp_bus_mem.c b/sys/arch/alpha/pci/tsp_bus_mem.c index 3ced801484b..97017b5b0fb 100644 --- a/sys/arch/alpha/pci/tsp_bus_mem.c +++ b/sys/arch/alpha/pci/tsp_bus_mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tsp_bus_mem.c,v 1.3 2001/11/06 19:53:13 miod Exp $ */ +/* $OpenBSD: tsp_bus_mem.c,v 1.4 2003/09/02 17:25:21 miod Exp $ */ /* $NetBSD: tsp_bus_mem.c,v 1.4 2000/06/26 19:46:25 thorpej Exp $ */ /*- @@ -62,6 +62,9 @@ */ __asm(".arch ev6"); +#define CHIP_EXTENT_NAME(v) ((struct tsp_config *)(v))->pc_mem_ex_name +#define CHIP_EXTENT_STORAGE(v) ((struct tsp_config *)(v))->pc_mem_ex_storage + #include <alpha/pci/pci_bwx_bus_mem_chipdep.c> void diff --git a/sys/arch/alpha/pci/tsvar.h b/sys/arch/alpha/pci/tsvar.h index de3d3ee8603..057163157ef 100644 --- a/sys/arch/alpha/pci/tsvar.h +++ b/sys/arch/alpha/pci/tsvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tsvar.h,v 1.4 2002/03/14 01:26:27 millert Exp $ */ +/* $OpenBSD: tsvar.h,v 1.5 2003/09/02 17:25:21 miod Exp $ */ /* $NetBSD: tsvar.h,v 1.1 1999/06/29 06:46:47 ross Exp $ */ /*- @@ -60,6 +60,9 @@ struct tsp_config { u_int32_t pc_hae_io; struct extent *pc_io_ex, *pc_mem_ex; + char pc_io_ex_name[16], pc_mem_ex_name[16]; + long pc_io_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)]; + long pc_mem_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)]; int pc_mallocsafe; }; |