diff options
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/alpha/include/bus.h | 10 | ||||
-rw-r--r-- | sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c | 20 | ||||
-rw-r--r-- | sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c | 17 | ||||
-rw-r--r-- | sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c | 20 | ||||
-rw-r--r-- | sys/arch/alpha/pci/pci_swiz_bus_mem_chipdep.c | 22 | ||||
-rw-r--r-- | sys/arch/alpha/tc/tc_bus_mem.c | 23 |
6 files changed, 106 insertions, 6 deletions
diff --git a/sys/arch/alpha/include/bus.h b/sys/arch/alpha/include/bus.h index e20db6fb2ba..6157ac433f9 100644 --- a/sys/arch/alpha/include/bus.h +++ b/sys/arch/alpha/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.27 2009/07/30 21:39:15 miod Exp $ */ +/* $OpenBSD: bus.h,v 1.28 2009/12/25 20:52:32 miod Exp $ */ /* $NetBSD: bus.h,v 1.10 1996/12/02 22:19:32 cgd Exp $ */ /* @@ -62,6 +62,9 @@ struct alpha_bus_space { void (*abs_free)(void *, bus_space_handle_t, bus_size_t); + /* get kernel virtual address */ + void * (*abs_vaddr)(void *, bus_space_handle_t); + /* barrier */ void (*abs_barrier)(void *, bus_space_handle_t, bus_size_t, bus_size_t, int); @@ -231,6 +234,11 @@ struct alpha_bus_space { #define bus_space_free(t, h, s) \ (*(t)->abs_free)((t)->abs_cookie, (h), (s)) +/* + * Get kernel virtual address for ranges mapped BUS_SPACE_MAP_LINEAR. + */ +#define bus_space_vaddr(t, h) \ + (*(t)->abs_vaddr)((t)->abs_cookie, (h)) /* * Bus barrier operations. 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 ad52b0fbed8..5c6325a226d 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.8 2009/09/17 19:28:20 miod Exp $ */ +/* $OpenBSD: pci_bwx_bus_io_chipdep.c,v 1.9 2009/12/25 20:52:34 miod Exp $ */ /* $NetBSD: pcs_bus_io_common.c,v 1.14 1996/12/02 22:19:35 cgd Exp $ */ /* @@ -69,6 +69,9 @@ int __C(CHIP,_io_alloc)(void *, bus_addr_t, bus_addr_t, void __C(CHIP,_io_free)(void *, bus_space_handle_t, bus_size_t); +/* get kernel virtual address */ +void * __C(CHIP,_io_vaddr)(void *, bus_space_handle_t); + /* barrier */ inline void __C(CHIP,_io_barrier)(void *, bus_space_handle_t, bus_size_t, bus_size_t, int); @@ -205,6 +208,9 @@ __C(CHIP,_bus_io_init)(t, v) t->abs_alloc = __C(CHIP,_io_alloc); t->abs_free = __C(CHIP,_io_free); + /* get kernel virtual address */ + t->abs_vaddr = __C(CHIP,_io_vaddr); + /* barrier */ t->abs_barrier = __C(CHIP,_io_barrier); @@ -379,6 +385,18 @@ __C(CHIP,_io_free)(v, bsh, size) panic("%s not implemented", __S(__C(CHIP,_io_free))); } +void * +__C(CHIP,_io_vaddr)(v, bsh) + void *v; + bus_space_handle_t bsh; +{ + /* + * _io_map() catches BUS_SPACE_MAP_LINEAR, + * so we shouldn't get here + */ + panic("_io_vaddr"); +} + inline void __C(CHIP,_io_barrier)(v, h, o, l, f) void *v; 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 9e57698f998..c9a1e180e42 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.8 2009/07/30 21:39:15 miod Exp $ */ +/* $OpenBSD: pci_bwx_bus_mem_chipdep.c,v 1.9 2009/12/25 20:52:34 miod Exp $ */ /* $NetBSD: pcs_bus_mem_common.c,v 1.15 1996/12/02 22:19:36 cgd Exp $ */ /* @@ -77,6 +77,9 @@ int __C(CHIP,_mem_alloc)(void *, bus_addr_t, bus_addr_t, void __C(CHIP,_mem_free)(void *, bus_space_handle_t, bus_size_t); +/* get kernel virtual address */ +void * __C(CHIP,_mem_vaddr)(void *, bus_space_handle_t); + /* barrier */ inline void __C(CHIP,_mem_barrier)(void *, bus_space_handle_t, bus_size_t, bus_size_t, int); @@ -213,6 +216,9 @@ __C(CHIP,_bus_mem_init)(t, v) t->abs_alloc = __C(CHIP,_mem_alloc); t->abs_free = __C(CHIP,_mem_free); + /* get kernel virtual address */ + t->abs_vaddr = __C(CHIP,_mem_vaddr); + /* barrier */ t->abs_barrier = __C(CHIP,_mem_barrier); @@ -407,6 +413,15 @@ __C(CHIP,_mem_free)(v, bsh, size) __C(CHIP,_mem_unmap)(v, bsh, size); } +void * +__C(CHIP,_mem_vaddr)(v, bsh) + void *v; + bus_space_handle_t bsh; +{ + + return ((void *)bsh); +} + inline void __C(CHIP,_mem_barrier)(v, h, o, l, f) void *v; diff --git a/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c b/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c index b97def42166..fa0d517b0ba 100644 --- a/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c +++ b/sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_swiz_bus_io_chipdep.c,v 1.8 2009/09/17 19:28:20 miod Exp $ */ +/* $OpenBSD: pci_swiz_bus_io_chipdep.c,v 1.9 2009/12/25 20:52:34 miod Exp $ */ /* $NetBSD: pcs_bus_io_common.c,v 1.14 1996/12/02 22:19:35 cgd Exp $ */ /* @@ -67,6 +67,9 @@ int __C(CHIP,_io_alloc)(void *, bus_addr_t, bus_addr_t, void __C(CHIP,_io_free)(void *, bus_space_handle_t, bus_size_t); +/* get kernel virtual address */ +void * __C(CHIP,_io_vaddr)(void *, bus_space_handle_t); + /* barrier */ inline void __C(CHIP,_io_barrier)(void *, bus_space_handle_t, bus_size_t, bus_size_t, int); @@ -203,6 +206,9 @@ __C(CHIP,_bus_io_init)(t, v) t->abs_alloc = __C(CHIP,_io_alloc); t->abs_free = __C(CHIP,_io_free); + /* get kernel virtual address */ + t->abs_vaddr = __C(CHIP,_io_vaddr); + /* barrier */ t->abs_barrier = __C(CHIP,_io_barrier); @@ -462,6 +468,18 @@ __C(CHIP,_io_free)(v, bsh, size) panic("%s not implemented", __S(__C(CHIP,_io_free))); } +void * +__C(CHIP,_io_vaddr)(v, bsh) + void *v; + bus_space_handle_t bsh; +{ + /* + * _io_map() catches BUS_SPACE_MAP_LINEAR, + * so we shouldn't get here + */ + panic("_io_vaddr"); +} + inline void __C(CHIP,_io_barrier)(v, h, o, l, f) void *v; diff --git a/sys/arch/alpha/pci/pci_swiz_bus_mem_chipdep.c b/sys/arch/alpha/pci/pci_swiz_bus_mem_chipdep.c index 4d37cb7d092..0b86552908a 100644 --- a/sys/arch/alpha/pci/pci_swiz_bus_mem_chipdep.c +++ b/sys/arch/alpha/pci/pci_swiz_bus_mem_chipdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_swiz_bus_mem_chipdep.c,v 1.7 2009/09/17 19:26:53 miod Exp $ */ +/* $OpenBSD: pci_swiz_bus_mem_chipdep.c,v 1.8 2009/12/25 20:52:34 miod Exp $ */ /* $NetBSD: pcs_bus_mem_common.c,v 1.15 1996/12/02 22:19:36 cgd Exp $ */ /* @@ -77,6 +77,9 @@ int __C(CHIP,_mem_alloc)(void *, bus_addr_t, bus_addr_t, void __C(CHIP,_mem_free)(void *, bus_space_handle_t, bus_size_t); +/* get kernel virtual address */ +void * __C(CHIP,_mem_vaddr)(void *, bus_space_handle_t); + /* barrier */ inline void __C(CHIP,_mem_barrier)(void *, bus_space_handle_t, bus_size_t, bus_size_t, int); @@ -213,6 +216,8 @@ __C(CHIP,_bus_mem_init)(t, v) t->abs_alloc = __C(CHIP,_mem_alloc); t->abs_free = __C(CHIP,_mem_free); + /* get kernel virtual address */ + t->abs_vaddr = __C(CHIP,_mem_vaddr); /* barrier */ t->abs_barrier = __C(CHIP,_mem_barrier); @@ -697,6 +702,21 @@ __C(CHIP,_mem_free)(v, bsh, size) panic("%s not implemented", __S(__C(CHIP,_mem_free))); } +void * +__C(CHIP,_mem_vaddr)(v, bsh) + void *v; + bus_space_handle_t bsh; +{ + /* + * XXX should check that the range was mapped + * with BUS_SPACE_MAP_LINEAR for sanity + */ + if ((bsh >> 63) != 0) + return ((void *)bsh); + + return (0); +} + inline void __C(CHIP,_mem_barrier)(v, h, o, l, f) void *v; diff --git a/sys/arch/alpha/tc/tc_bus_mem.c b/sys/arch/alpha/tc/tc_bus_mem.c index 1904cc0eb9c..1eda503b545 100644 --- a/sys/arch/alpha/tc/tc_bus_mem.c +++ b/sys/arch/alpha/tc/tc_bus_mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tc_bus_mem.c,v 1.15 2009/09/17 19:28:22 miod Exp $ */ +/* $OpenBSD: tc_bus_mem.c,v 1.16 2009/12/25 20:52:36 miod Exp $ */ /* $NetBSD: tc_bus_mem.c,v 1.25 2001/09/04 05:31:28 thorpej Exp $ */ /* @@ -58,6 +58,9 @@ int tc_mem_alloc(void *, bus_addr_t, bus_addr_t, bus_size_t, bus_space_handle_t *); void tc_mem_free(void *, bus_space_handle_t, bus_size_t); +/* get kernel virtual address */ +void * tc_mem_vaddr(void *, bus_space_handle_t); + /* barrier */ inline void tc_mem_barrier(void *, bus_space_handle_t, bus_size_t, bus_size_t, int); @@ -161,6 +164,9 @@ struct alpha_bus_space tc_mem_space = { tc_mem_alloc, tc_mem_free, + /* get kernel virtual address */ + tc_mem_vaddr, + /* barrier */ tc_mem_barrier, @@ -308,6 +314,21 @@ tc_mem_free(v, bsh, size) panic("tc_mem_free unimplemented"); } +void * +tc_mem_vaddr(void *v, bus_space_handle_t bsh) +{ +#ifdef DIAGNOSTIC + if ((bsh & TC_SPACE_SPARSE) != 0) { + /* + * tc_mem_map() catches linear && !cacheable, + * so we shouldn't come here + */ + panic("tc_mem_vaddr"); + } +#endif + return ((void *)bsh); +} + inline void tc_mem_barrier(v, h, o, l, f) void *v; |