From c6dd609e7fb04b5046b347ee589537ef3be0f383 Mon Sep 17 00:00:00 2001 From: cgd Date: Mon, 3 Jun 1996 20:18:48 +0000 Subject: [PATCH] gross hack to get around the fact that there are currently devices with common back-ends that live on multiple very-different busses (e.g. PCI and TC), which need bus-specific DMA mapping support. As a nice side effect, this will allow the especially nasty (vtophys(va) | 0x40000000) expressions to go away in favor of less nasty bus-specific function calls. --- sys/arch/alpha/include/bus.h | 8 +++++++- sys/arch/alpha/pci/pci_swiz_bus_mem_chipdep.c | 16 +++++++++++++++- sys/arch/alpha/pci/pcs_bus_mem_common.c | 16 +++++++++++++++- sys/arch/alpha/tc/tc_bus_mem.c | 17 ++++++++++++++++- 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/sys/arch/alpha/include/bus.h b/sys/arch/alpha/include/bus.h index 78eb29f688c7..aee88cf447f5 100644 --- a/sys/arch/alpha/include/bus.h +++ b/sys/arch/alpha/include/bus.h @@ -1,4 +1,4 @@ -/* $NetBSD: bus.h,v 1.2 1996/04/18 05:47:29 cgd Exp $ */ +/* $NetBSD: bus.h,v 1.3 1996/06/03 20:18:48 cgd Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -136,6 +136,9 @@ struct alpha_bus_chipset { bus_mem_size_t off, u_int32_t val)); void (*bc_mw8) __P((void *v, bus_mem_handle_t memh, bus_mem_size_t off, u_int64_t val)); + + /* XXX THIS DOES NOT YET BELONG HERE */ + vm_offset_t (*bc_XXX_dmamap) __P((void *addr)); }; #define __bc_CONCAT(A,B) __CONCAT(A,B) @@ -199,4 +202,7 @@ struct alpha_bus_chipset { #define bus_mem_write_4(t, h, o, v) __bc_wr((t),(h),(o),(v),4,m) #define bus_mem_write_8(t, h, o, v) __bc_wr((t),(h),(o),(v),8,m) +/* XXX THIS DOES NOT BELONG HERE YET. */ +#define __alpha_bus_XXX_dmamap(t, va) (*(t)->bc_XXX_dmamap)((va)) + #endif /* _ALPHA_BUS_H_ */ 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 a86381f8402c..39a48c054226 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 @@ -/* $NetBSD: pci_swiz_bus_mem_chipdep.c,v 1.1 1996/04/12 04:35:01 cgd Exp $ */ +/* $NetBSD: pci_swiz_bus_mem_chipdep.c,v 1.2 1996/06/03 20:18:53 cgd Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -60,6 +60,9 @@ void __C(CHIP,_mem_write_4) __P((void *, bus_mem_handle_t, void __C(CHIP,_mem_write_8) __P((void *, bus_mem_handle_t, bus_mem_size_t, u_int64_t)); +/* XXX DOES NOT BELONG */ +vm_offset_t __C(CHIP,_XXX_dmamap) __P((void *)); + void __C(CHIP,_bus_mem_init)(bc, memv) bus_chipset_tag_t bc; @@ -80,6 +83,9 @@ __C(CHIP,_bus_mem_init)(bc, memv) bc->bc_mw2 = __C(CHIP,_mem_write_2); bc->bc_mw4 = __C(CHIP,_mem_write_4); bc->bc_mw8 = __C(CHIP,_mem_write_8); + + /* XXX DOES NOT BELONG */ + bc->bc_XXX_dmamap = __C(CHIP,_XXX_dmamap); } int @@ -290,3 +296,11 @@ __C(CHIP,_mem_write_8)(v, memh, off, val) } wbflush(); } + +vm_offset_t +__C(CHIP,_XXX_dmamap)(addr) + void *addr; +{ + + return (vtophys(addr) | 0x40000000); +} diff --git a/sys/arch/alpha/pci/pcs_bus_mem_common.c b/sys/arch/alpha/pci/pcs_bus_mem_common.c index 21df1acdb3f0..2df4786b76ff 100644 --- a/sys/arch/alpha/pci/pcs_bus_mem_common.c +++ b/sys/arch/alpha/pci/pcs_bus_mem_common.c @@ -1,4 +1,4 @@ -/* $NetBSD: pcs_bus_mem_common.c,v 1.1 1996/04/12 04:35:01 cgd Exp $ */ +/* $NetBSD: pcs_bus_mem_common.c,v 1.2 1996/06/03 20:18:53 cgd Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -60,6 +60,9 @@ void __C(CHIP,_mem_write_4) __P((void *, bus_mem_handle_t, void __C(CHIP,_mem_write_8) __P((void *, bus_mem_handle_t, bus_mem_size_t, u_int64_t)); +/* XXX DOES NOT BELONG */ +vm_offset_t __C(CHIP,_XXX_dmamap) __P((void *)); + void __C(CHIP,_bus_mem_init)(bc, memv) bus_chipset_tag_t bc; @@ -80,6 +83,9 @@ __C(CHIP,_bus_mem_init)(bc, memv) bc->bc_mw2 = __C(CHIP,_mem_write_2); bc->bc_mw4 = __C(CHIP,_mem_write_4); bc->bc_mw8 = __C(CHIP,_mem_write_8); + + /* XXX DOES NOT BELONG */ + bc->bc_XXX_dmamap = __C(CHIP,_XXX_dmamap); } int @@ -290,3 +296,11 @@ __C(CHIP,_mem_write_8)(v, memh, off, val) } wbflush(); } + +vm_offset_t +__C(CHIP,_XXX_dmamap)(addr) + void *addr; +{ + + return (vtophys(addr) | 0x40000000); +} diff --git a/sys/arch/alpha/tc/tc_bus_mem.c b/sys/arch/alpha/tc/tc_bus_mem.c index e38b94426b30..ce604d3360fd 100644 --- a/sys/arch/alpha/tc/tc_bus_mem.c +++ b/sys/arch/alpha/tc/tc_bus_mem.c @@ -1,4 +1,4 @@ -/* $NetBSD: tc_bus_mem.c,v 1.2 1996/05/20 03:14:07 cgd Exp $ */ +/* $NetBSD: tc_bus_mem.c,v 1.3 1996/06/03 20:18:57 cgd Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -61,6 +61,9 @@ void tc_mem_write_4 __P((void *, bus_mem_handle_t, void tc_mem_write_8 __P((void *, bus_mem_handle_t, bus_mem_size_t, u_int64_t)); +/* XXX DOES NOT BELONG */ +vm_offset_t tc_XXX_dmamap __P((void *)); + void tc_bus_mem_init(bc, memv) bus_chipset_tag_t bc; @@ -81,6 +84,9 @@ tc_bus_mem_init(bc, memv) bc->bc_mw2 = tc_mem_write_2; bc->bc_mw4 = tc_mem_write_4; bc->bc_mw8 = tc_mem_write_8; + + /* XXX DOES NOT BELONG */ + bc->bc_XXX_dmamap = tc_XXX_dmamap; } int @@ -274,3 +280,12 @@ tc_mem_write_8(v, memh, off, val) *p = val; wbflush(); } + +/* XXX DOES NOT BELONG */ +vm_offset_t +tc_XXX_dmamap(addr) + void *addr; +{ + + return (vtophys(addr)); +}