diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-07-26 18:48:56 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-07-26 18:48:56 +0000 |
commit | 7458aafff0569577b463f9c368e66cb25262aa6c (patch) | |
tree | 70cdb126d1cfdb8654412193beda18a7118700fc | |
parent | 7499c0ea68ce760474e8b4e98e74f2e0f120cc77 (diff) |
Make sure all platforms understand the flags argument of bus_space_map() and
bus_space_alloc() as a bitmask of flags, and not a boolean controlling
cacheability; and make sure the three MI BUS_SPACE_MAP_xxx values documented
in the manual page are defined on all platforms as well.
29 files changed, 129 insertions, 115 deletions
diff --git a/share/man/man9/bus_space.9 b/share/man/man9/bus_space.9 index d5beb0590c2..bbc2d871e56 100644 --- a/share/man/man9/bus_space.9 +++ b/share/man/man9/bus_space.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bus_space.9,v 1.19 2008/06/26 05:42:08 ray Exp $ +.\" $OpenBSD: bus_space.9,v 1.20 2009/07/26 18:48:53 miod Exp $ .\" $NetBSD: bus_space.9,v 1.15 2000/08/09 03:11:00 tv Exp $ .\" .\" Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: June 26 2008 $ +.Dd $Mdocdate: July 26 2009 $ .Dt BUS_SPACE 9 .Os .Sh NAME @@ -105,7 +105,7 @@ .Fd #include <machine/bus.h> .Ft int .Fn bus_space_map "bus_space_tag_t space" "bus_addr_t address" \ -"bus_size_t size" "int cacheable" "bus_space_handle_t *handlep" +"bus_size_t size" "int flags" "bus_space_handle_t *handlep" .Ft void .Fn bus_space_unmap "bus_space_tag_t space" "bus_space_handle_t handle" \ "bus_size_t size" @@ -116,7 +116,7 @@ .Fo bus_space_alloc .Fa "bus_space_tag_t space" "bus_addr_t reg_start" "bus_addr_t reg_end" .Fa "bus_size_t size" "bus_size_t alignment" "bus_size_t boundary" -.Fa "int cacheable" "bus_addr_t *addrp" "bus_space_handle_t *handlep" +.Fa "int flags" "bus_addr_t *addrp" "bus_space_handle_t *handlep" .Fc .Ft void .Fn bus_space_free "bus_space_tag_t space" "bus_space_handle_t handle" \ @@ -517,7 +517,7 @@ The function allows such subregions to be created. .Pp .Bl -ohang -compact -.It Fn bus_space_map "space" "address" "size" "cacheable" "handlep" +.It Fn bus_space_map "space" "address" "size" "flags" "handlep" .Pp The .Fn bus_space_map @@ -537,7 +537,7 @@ pointed to by in an undefined state. .Pp The -.Fa cacheable +.Fa flags argument controls how the space is to be mapped. Supported flags include: .Bl -tag -width BUS_SPACE_MAP_CACHEABLE -offset indent @@ -700,7 +700,7 @@ functions provide these capabilities. .It Xo .Fo bus_space_alloc .Fa "space" "reg_start" "reg_end" "size" -.Fa "alignment" "boundary" "cacheable" "addrp" "handlep" +.Fa "alignment" "boundary" "flags" "addrp" "handlep" .Fc .Xc .Pp @@ -759,7 +759,7 @@ greater than .Pc . .Pp The -.Fa cacheable +.Fa flags parameter is the same as the like-named parameter to .Fa bus_space_map , the same flag values should be used, and they have the same meanings. 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 2dd720fb08b..89f84f9f152 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.5 2003/09/02 17:25:21 miod Exp $ */ +/* $OpenBSD: pci_bwx_bus_io_chipdep.c,v 1.6 2009/07/26 18:48:54 miod Exp $ */ /* $NetBSD: pcs_bus_io_common.c,v 1.14 1996/12/02 22:19:35 cgd Exp $ */ /* @@ -280,11 +280,11 @@ __C(CHIP,_bus_io_init)(t, v) } int -__C(CHIP,_io_map)(v, ioaddr, iosize, cacheable, iohp) +__C(CHIP,_io_map)(v, ioaddr, iosize, flags, iohp) void *v; bus_addr_t ioaddr; bus_size_t iosize; - int cacheable; + int flags; bus_space_handle_t *iohp; { int error; @@ -349,12 +349,12 @@ __C(CHIP,_io_subregion)(v, ioh, offset, size, nioh) } int -__C(CHIP,_io_alloc)(v, rstart, rend, size, align, boundary, cacheable, +__C(CHIP,_io_alloc)(v, rstart, rend, size, align, boundary, flags, addrp, bshp) void *v; bus_addr_t rstart, rend, *addrp; bus_size_t size, align, boundary; - int cacheable; + int flags; bus_space_handle_t *bshp; { 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 879757b36ca..b5c5c3e3dbb 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.6 2003/09/02 17:25:21 miod Exp $ */ +/* $OpenBSD: pci_bwx_bus_mem_chipdep.c,v 1.7 2009/07/26 18:48:54 miod Exp $ */ /* $NetBSD: pcs_bus_mem_common.c,v 1.15 1996/12/02 22:19:36 cgd Exp $ */ /* @@ -289,11 +289,11 @@ __C(CHIP,_bus_mem_init)(t, v) } int -__C(CHIP,_mem_map)(v, memaddr, memsize, cacheable, memhp) +__C(CHIP,_mem_map)(v, memaddr, memsize, flags, memhp) void *v; bus_addr_t memaddr; bus_size_t memsize; - int cacheable; + int flags; bus_space_handle_t *memhp; { int error; @@ -358,12 +358,12 @@ __C(CHIP,_mem_subregion)(v, memh, offset, size, nmemh) } int -__C(CHIP,_mem_alloc)(v, rstart, rend, size, align, boundary, cacheable, +__C(CHIP,_mem_alloc)(v, rstart, rend, size, align, boundary, flags, addrp, bshp) void *v; bus_addr_t rstart, rend, *addrp; bus_size_t size, align, boundary; - int cacheable; + int flags; bus_space_handle_t *bshp; { bus_addr_t memaddr; 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 da0d832a9dc..3a41b3e98f6 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.5 2008/07/19 17:10:03 miod Exp $ */ +/* $OpenBSD: pci_swiz_bus_io_chipdep.c,v 1.6 2009/07/26 18:48:54 miod Exp $ */ /* $NetBSD: pcs_bus_io_common.c,v 1.14 1996/12/02 22:19:35 cgd Exp $ */ /* @@ -301,11 +301,11 @@ __C(CHIP,_bus_io_init)(t, v) } int -__C(CHIP,_io_map)(v, ioaddr, iosize, cacheable, iohp) +__C(CHIP,_io_map)(v, ioaddr, iosize, flags, iohp) void *v; bus_addr_t ioaddr; bus_size_t iosize; - int cacheable; + int flags; bus_space_handle_t *iohp; { bus_addr_t ioend = ioaddr + (iosize - 1); @@ -432,12 +432,12 @@ __C(CHIP,_io_subregion)(v, ioh, offset, size, nioh) } int -__C(CHIP,_io_alloc)(v, rstart, rend, size, align, boundary, cacheable, +__C(CHIP,_io_alloc)(v, rstart, rend, size, align, boundary, flags, addrp, bshp) void *v; bus_addr_t rstart, rend, *addrp; bus_size_t size, align, boundary; - int cacheable; + int flags; bus_space_handle_t *bshp; { 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 4251ecf8115..dfeee2283cc 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.4 2007/03/16 21:22:27 robert Exp $ */ +/* $OpenBSD: pci_swiz_bus_mem_chipdep.c,v 1.5 2009/07/26 18:48:54 miod Exp $ */ /* $NetBSD: pcs_bus_mem_common.c,v 1.15 1996/12/02 22:19:36 cgd Exp $ */ /* @@ -478,18 +478,18 @@ __C(CHIP,_xlate_sparse_handle_to_addr)(v, memh, memaddrp) } int -__C(CHIP,_mem_map)(v, memaddr, memsize, cacheable, memhp) +__C(CHIP,_mem_map)(v, memaddr, memsize, flags, memhp) void *v; bus_addr_t memaddr; bus_size_t memsize; - int cacheable; + int flags; bus_space_handle_t *memhp; { bus_space_handle_t dh = 0, sh = 0; /* XXX -Wuninitialized */ int didd, dids, errord, errors, mustd, musts; mustd = 1; - musts = (cacheable == 0); + musts = (flags & BUS_SPACE_MAP_CACHEABLE) == 0; #ifdef EXTENT_DEBUG printf("mem: allocating 0x%lx to 0x%lx\n", memaddr, @@ -542,7 +542,7 @@ __C(CHIP,_mem_map)(v, memaddr, memsize, cacheable, memhp) __S(__C(CHIP,_mem_map)), memaddr); } - if (cacheable) + if (flags & BUS_SPACE_MAP_CACHEABLE) *memhp = dh; else *memhp = sh; @@ -665,12 +665,12 @@ __C(CHIP,_mem_subregion)(v, memh, offset, size, nmemh) } int -__C(CHIP,_mem_alloc)(v, rstart, rend, size, align, boundary, cacheable, +__C(CHIP,_mem_alloc)(v, rstart, rend, size, align, boundary, flags, addrp, bshp) void *v; bus_addr_t rstart, rend, *addrp; bus_size_t size, align, boundary; - int cacheable; + int flags; bus_space_handle_t *bshp; { diff --git a/sys/arch/alpha/tc/tc_bus_mem.c b/sys/arch/alpha/tc/tc_bus_mem.c index 759c9e4a295..af6bfc8b9f6 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.13 2002/05/02 22:56:06 miod Exp $ */ +/* $OpenBSD: tc_bus_mem.c,v 1.14 2009/07/26 18:48:54 miod Exp $ */ /* $NetBSD: tc_bus_mem.c,v 1.25 2001/09/04 05:31:28 thorpej Exp $ */ /* @@ -231,17 +231,17 @@ tc_bus_mem_init(memv) /* ARGSUSED */ int -tc_mem_map(v, memaddr, memsize, cacheable, memhp) +tc_mem_map(v, memaddr, memsize, flags, memhp) void *v; bus_addr_t memaddr; bus_size_t memsize; - int cacheable; + int flags; bus_space_handle_t *memhp; { if (memaddr & 0x7) panic("tc_mem_map needs 8 byte alignment"); - if (cacheable) + if (flags & BUS_SPACE_MAP_CACHEABLE) *memhp = ALPHA_PHYS_TO_K0SEG(memaddr); else *memhp = ALPHA_PHYS_TO_K0SEG(TC_DENSE_TO_SPARSE(memaddr)); diff --git a/sys/arch/amd64/include/bus.h b/sys/arch/amd64/include/bus.h index 382e722378a..54fbdab0da1 100644 --- a/sys/arch/amd64/include/bus.h +++ b/sys/arch/amd64/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.19 2009/06/07 02:30:34 oga Exp $ */ +/* $OpenBSD: bus.h,v 1.20 2009/07/26 18:48:55 miod Exp $ */ /* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */ /*- @@ -115,7 +115,7 @@ void _bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, /* like bus_space_map(), but without extent map checking/allocation */ int _bus_space_map(bus_space_tag_t t, bus_addr_t addr, - bus_size_t size, int cacheable, bus_space_handle_t *bshp); + bus_size_t size, int flags, bus_space_handle_t *bshp); /* * int bus_space_subregion(bus_space_tag_t t, diff --git a/sys/arch/arm/include/bus.h b/sys/arch/arm/include/bus.h index 04408dbc798..e070c49fabb 100644 --- a/sys/arch/arm/include/bus.h +++ b/sys/arch/arm/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.11 2009/04/20 00:42:06 oga Exp $ */ +/* $OpenBSD: bus.h,v 1.12 2009/07/26 18:48:55 miod Exp $ */ /* $NetBSD: bus.h,v 1.12 2003/10/23 15:03:24 scw Exp $ */ /*- @@ -386,7 +386,7 @@ bus_space_copy_4(bus_space_tag_t bst, bus_space_handle_t h1, #define bs_map_proto(f) \ int __bs_c(f,_bs_map) (void *t, bus_addr_t addr, \ - bus_size_t size, int cacheable, bus_space_handle_t *bshp); + bus_size_t size, int flags, bus_space_handle_t *bshp); #define bs_unmap_proto(f) \ void __bs_c(f,_bs_unmap) (void *t, bus_space_handle_t bsh, \ @@ -400,7 +400,7 @@ int __bs_c(f,_bs_subregion) (void *t, bus_space_handle_t bsh, \ #define bs_alloc_proto(f) \ int __bs_c(f,_bs_alloc) (void *t, bus_addr_t rstart, \ bus_addr_t rend, bus_size_t size, bus_size_t align, \ - bus_size_t boundary, int cacheable, bus_addr_t *addrp, \ + bus_size_t boundary, int flags, bus_addr_t *addrp, \ bus_space_handle_t *bshp); #define bs_free_proto(f) \ diff --git a/sys/arch/arm/mainbus/mainbus_io.c b/sys/arch/arm/mainbus/mainbus_io.c index b29fb574f95..494246376c2 100644 --- a/sys/arch/arm/mainbus/mainbus_io.c +++ b/sys/arch/arm/mainbus/mainbus_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus_io.c,v 1.3 2007/05/25 16:45:59 krw Exp $ */ +/* $OpenBSD: mainbus_io.c,v 1.4 2009/07/26 18:48:55 miod Exp $ */ /* $NetBSD: mainbus_io.c,v 1.14 2003/12/06 22:05:33 bjh21 Exp $ */ /* @@ -174,12 +174,12 @@ mainbus_bs_map(t, bpa, size, flags, bshp) } int -mainbus_bs_alloc(t, rstart, rend, size, alignment, boundary, cacheable, +mainbus_bs_alloc(t, rstart, rend, size, alignment, boundary, flags, bpap, bshp) void *t; bus_addr_t rstart, rend; bus_size_t size, alignment, boundary; - int cacheable; + int flags; bus_addr_t *bpap; bus_space_handle_t *bshp; { diff --git a/sys/arch/beagle/beagle/beagle_machdep.c b/sys/arch/beagle/beagle/beagle_machdep.c index 37053d50673..969a0db0fdc 100644 --- a/sys/arch/beagle/beagle/beagle_machdep.c +++ b/sys/arch/beagle/beagle/beagle_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: beagle_machdep.c,v 1.2 2009/05/24 21:05:30 drahn Exp $ */ +/* $OpenBSD: beagle_machdep.c,v 1.3 2009/07/26 18:48:55 miod Exp $ */ /* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */ /* @@ -379,10 +379,10 @@ read_ttb(void) static vaddr_t section_free = 0xfd000000; /* XXX - huh */ int bootstrap_bs_map(void *t, bus_addr_t bpa, bus_size_t size, - int cacheable, bus_space_handle_t *bshp); + int flags, bus_space_handle_t *bshp); int bootstrap_bs_map(void *t, bus_addr_t bpa, bus_size_t size, - int cacheable, bus_space_handle_t *bshp) + int flags, bus_space_handle_t *bshp) { u_long startpa; vaddr_t va; diff --git a/sys/arch/gumstix/gumstix/gumstix_machdep.c b/sys/arch/gumstix/gumstix/gumstix_machdep.c index 590f93bae9d..a3e278b83df 100644 --- a/sys/arch/gumstix/gumstix/gumstix_machdep.c +++ b/sys/arch/gumstix/gumstix/gumstix_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gumstix_machdep.c,v 1.1 2008/11/26 14:18:11 drahn Exp $ */ +/* $OpenBSD: gumstix_machdep.c,v 1.2 2009/07/26 18:48:55 miod Exp $ */ /* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */ /* @@ -438,7 +438,7 @@ static vaddr_t section_free = GUMSTIX_VBASE_FREE; static int bootstrap_bs_map(void *t, bus_addr_t bpa, bus_size_t size, - int cacheable, bus_space_handle_t *bshp) + int flags, bus_space_handle_t *bshp) { u_long startpa; vaddr_t va; diff --git a/sys/arch/hppa/dev/mongoose.c b/sys/arch/hppa/dev/mongoose.c index c7ed85463b3..e20b7d13b84 100644 --- a/sys/arch/hppa/dev/mongoose.c +++ b/sys/arch/hppa/dev/mongoose.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mongoose.c,v 1.17 2004/11/08 20:54:04 miod Exp $ */ +/* $OpenBSD: mongoose.c,v 1.18 2009/07/26 18:48:55 miod Exp $ */ /* * Copyright (c) 1998-2003 Michael Shalayeff @@ -183,7 +183,7 @@ mg_intr(void *v) } int -mg_eisa_iomap(void *v, bus_addr_t addr, bus_size_t size, int cacheable, +mg_eisa_iomap(void *v, bus_addr_t addr, bus_size_t size, int flags, bus_space_handle_t *bshp) { struct mongoose_softc *sc = v; @@ -196,11 +196,11 @@ mg_eisa_iomap(void *v, bus_addr_t addr, bus_size_t size, int cacheable, } return (sc->sc_bt->hbt_map)(NULL, sc->sc_iomap + addr, size, - cacheable, bshp); + flags, bshp); } int -mg_eisa_memmap(void *v, bus_addr_t addr, bus_size_t size, int cacheable, +mg_eisa_memmap(void *v, bus_addr_t addr, bus_size_t size, int flags, bus_space_handle_t *bshp) { /* TODO: eisa memory map */ diff --git a/sys/arch/i386/include/bus.h b/sys/arch/i386/include/bus.h index ae42970834b..76fc3300db2 100644 --- a/sys/arch/i386/include/bus.h +++ b/sys/arch/i386/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.49 2009/06/06 05:43:13 oga Exp $ */ +/* $OpenBSD: bus.h,v 1.50 2009/07/26 18:48:55 miod Exp $ */ /* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */ /*- @@ -89,10 +89,10 @@ typedef int bus_space_tag_t; typedef u_long bus_space_handle_t; int bus_space_map(bus_space_tag_t t, bus_addr_t addr, - bus_size_t size, int cacheable, bus_space_handle_t *bshp); + bus_size_t size, int flags, bus_space_handle_t *bshp); /* like bus_space_map(), but without extent map checking/allocation */ int _bus_space_map(bus_space_tag_t t, bus_addr_t addr, - bus_size_t size, int cacheable, bus_space_handle_t *bshp); + bus_size_t size, int flags, bus_space_handle_t *bshp); void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size); /* like bus_space_unmap(), but without extent map deallocation */ @@ -103,7 +103,7 @@ int bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh, int bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart, bus_addr_t rend, bus_size_t size, bus_size_t align, - bus_size_t boundary, int cacheable, bus_addr_t *addrp, + bus_size_t boundary, int flags, bus_addr_t *addrp, bus_space_handle_t *bshp); void bus_space_free(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size); diff --git a/sys/arch/luna88k/include/bus.h b/sys/arch/luna88k/include/bus.h index f1a6c508e6b..634808f7e08 100644 --- a/sys/arch/luna88k/include/bus.h +++ b/sys/arch/luna88k/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.4 2008/06/26 05:42:11 ray Exp $ */ +/* $OpenBSD: bus.h,v 1.5 2009/07/26 18:48:55 miod Exp $ */ /* $NetBSD: bus.h,v 1.9 1998/01/13 18:32:15 scottr Exp $ */ /*- @@ -124,7 +124,7 @@ int bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh, int bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart, bus_addr_t rend, bus_size_t size, bus_size_t align, - bus_size_t boundary, int cacheable, bus_addr_t *addrp, + bus_size_t boundary, int flags, bus_addr_t *addrp, bus_space_handle_t *bshp); /* diff --git a/sys/arch/mac68k/include/bus.h b/sys/arch/mac68k/include/bus.h index 01a8f43bf18..75c22b1f333 100644 --- a/sys/arch/mac68k/include/bus.h +++ b/sys/arch/mac68k/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.13 2008/06/26 05:42:12 ray Exp $ */ +/* $OpenBSD: bus.h,v 1.14 2009/07/26 18:48:55 miod Exp $ */ /* $NetBSD: bus.h,v 1.9 1998/01/13 18:32:15 scottr Exp $ */ /*- @@ -161,6 +161,7 @@ void mac68k_bus_space_handle_swapped(bus_space_tag_t, #define BUS_SPACE_MAP_CACHEABLE 0x01 #define BUS_SPACE_MAP_LINEAR 0x02 +#define BUS_SPACE_MAP_PREFETCHABLE 0x04 int bus_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int, bus_space_handle_t *); @@ -196,7 +197,7 @@ int bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh, int bus_space_alloc(bus_space_tag_t t, bus_addr_t rstart, bus_addr_t rend, bus_size_t size, bus_size_t align, - bus_size_t boundary, int cacheable, bus_addr_t *addrp, + bus_size_t boundary, int flags, bus_addr_t *addrp, bus_space_handle_t *bshp); /* diff --git a/sys/arch/macppc/include/bus.h b/sys/arch/macppc/include/bus.h index 9588be509ef..d6ff8a5a332 100644 --- a/sys/arch/macppc/include/bus.h +++ b/sys/arch/macppc/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.15 2009/05/31 17:42:13 miod Exp $ */ +/* $OpenBSD: bus.h,v 1.16 2009/07/26 18:48:55 miod Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom. All rights reserved. @@ -65,18 +65,22 @@ extern struct ppc_bus_space ppc_isa_io, ppc_isa_mem; * Access methods for bus resources */ int bus_space_map(bus_space_tag_t t, bus_addr_t addr, - bus_size_t size, int cacheable, bus_space_handle_t *bshp); + bus_size_t size, int flags, bus_space_handle_t *bshp); void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size); int bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp); int bus_space_alloc(bus_space_tag_t tag, bus_addr_t rstart, bus_addr_t rend, bus_size_t size, bus_size_t alignment, - bus_size_t boundary, int cacheable, bus_addr_t *addrp, + bus_size_t boundary, int flags, bus_addr_t *addrp, bus_space_handle_t *handlep); void bus_space_free(bus_space_tag_t tag, bus_space_handle_t handle, bus_size_t size); +#define BUS_SPACE_MAP_CACHEABLE 0x01 +#define BUS_SPACE_MAP_LINEAR 0x02 +#define BUS_SPACE_MAP_PREFETCHABLE 0x04 + #define bus_space_read(n,m) \ static __inline CAT3(u_int,m,_t) \ CAT(bus_space_read_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c index ab9e2862361..f4c9ba24af1 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.108 2009/06/15 17:01:26 beck Exp $ */ +/* $OpenBSD: machdep.c,v 1.109 2009/07/26 18:48:55 miod Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -154,7 +154,7 @@ void ppc_intr_setup(intr_establish_t *establish, intr_disestablish_t *disestablish); void *ppc_intr_establish(void *lcv, pci_intr_handle_t ih, int type, int level, int (*func)(void *), void *arg, char *name); -int bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int cacheable, +int bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int flags, bus_space_handle_t *bshp); bus_addr_t bus_space_unmap_p(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size); @@ -1129,20 +1129,20 @@ ppc_send_ipi(struct cpu_info *ci, int id) /* BUS functions */ int bus_space_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, - int cacheable, bus_space_handle_t *bshp) + int flags, bus_space_handle_t *bshp) { int error; if (POWERPC_BUS_TAG_BASE(t) == 0) { /* if bus has base of 0 fail. */ - return 1; + return EINVAL; } bpa |= POWERPC_BUS_TAG_BASE(t); if ((error = extent_alloc_region(devio_ex, bpa, size, EX_NOWAIT | (ppc_malloc_ok ? EX_MALLOCOK : 0)))) return error; - if ((error = bus_mem_add_mapping(bpa, size, cacheable, bshp))) { + if ((error = bus_mem_add_mapping(bpa, size, flags, bshp))) { if (extent_free(devio_ex, bpa, size, EX_NOWAIT | (ppc_malloc_ok ? EX_MALLOCOK : 0))) { @@ -1196,7 +1196,7 @@ bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size) vaddr_t ppc_kvm_stolen = VM_KERN_ADDRESS_SIZE; int -bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int cacheable, +bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int flags, bus_space_handle_t *bshp) { bus_addr_t vaddr; @@ -1237,9 +1237,9 @@ bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int cacheable, bpa, size, *bshp, spa); #endif for (; len > 0; len -= PAGE_SIZE) { - pmap_kenter_cache(vaddr, spa, - VM_PROT_READ | VM_PROT_WRITE, - cacheable ? PMAP_CACHE_WT : PMAP_CACHE_CI); + pmap_kenter_cache(vaddr, spa, VM_PROT_READ | VM_PROT_WRITE, + (flags & BUS_SPACE_MAP_CACHEABLE) ? + PMAP_CACHE_WT : PMAP_CACHE_CI); spa += PAGE_SIZE; vaddr += PAGE_SIZE; } @@ -1248,7 +1248,7 @@ bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int cacheable, int bus_space_alloc(bus_space_tag_t tag, bus_addr_t rstart, bus_addr_t rend, - bus_size_t size, bus_size_t alignment, bus_size_t boundary, int cacheable, + bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags, bus_addr_t *addrp, bus_space_handle_t *handlep) { diff --git a/sys/arch/moko/moko/moko_machdep.c b/sys/arch/moko/moko/moko_machdep.c index b1c13a457e1..d4bc8509407 100644 --- a/sys/arch/moko/moko/moko_machdep.c +++ b/sys/arch/moko/moko/moko_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: moko_machdep.c,v 1.3 2009/01/02 06:38:25 drahn Exp $ */ +/* $OpenBSD: moko_machdep.c,v 1.4 2009/07/26 18:48:55 miod Exp $ */ /* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */ /* @@ -428,7 +428,7 @@ static vaddr_t section_free = MOKO_VBASE_FREE; static int bootstrap_bs_map(void *t, bus_addr_t bpa, bus_size_t size, - int cacheable, bus_space_handle_t *bshp) + int flags, bus_space_handle_t *bshp) { u_long startpa; vaddr_t va; diff --git a/sys/arch/mvme68k/include/bus.h b/sys/arch/mvme68k/include/bus.h index 54d1857cbdc..ffe84c7fa8e 100644 --- a/sys/arch/mvme68k/include/bus.h +++ b/sys/arch/mvme68k/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.4 2009/05/31 17:42:13 miod Exp $ */ +/* $OpenBSD: bus.h,v 1.5 2009/07/26 18:48:55 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. * @@ -57,8 +57,9 @@ typedef const struct mvme68k_bus_space_tag *bus_space_tag_t; #define BUS_SPACE_BARRIER_READ 0 #define BUS_SPACE_BARRIER_WRITE 1 -#define BUS_SPACE_MAP_CACHEABLE 0x01 -#define BUS_SPACE_MAP_LINEAR 0x02 +#define BUS_SPACE_MAP_CACHEABLE 0x01 +#define BUS_SPACE_MAP_LINEAR 0x02 +#define BUS_SPACE_MAP_PREFETCHABLE 0x04 /* * General bus_space function set diff --git a/sys/arch/mvme88k/include/bus.h b/sys/arch/mvme88k/include/bus.h index 311f71c4762..a2d32e70ce7 100644 --- a/sys/arch/mvme88k/include/bus.h +++ b/sys/arch/mvme88k/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.7 2009/05/31 17:42:13 miod Exp $ */ +/* $OpenBSD: bus.h,v 1.8 2009/07/26 18:48:55 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. * @@ -57,8 +57,9 @@ typedef const struct mvme88k_bus_space_tag *bus_space_tag_t; #define BUS_SPACE_BARRIER_READ 0 #define BUS_SPACE_BARRIER_WRITE 1 -#define BUS_SPACE_MAP_CACHEABLE 0x01 -#define BUS_SPACE_MAP_LINEAR 0x02 +#define BUS_SPACE_MAP_CACHEABLE 0x01 +#define BUS_SPACE_MAP_LINEAR 0x02 +#define BUS_SPACE_MAP_PREFETCHABLE 0x04 /* * General bus_space function set diff --git a/sys/arch/sgi/include/bus.h b/sys/arch/sgi/include/bus.h index 9b859b9caec..c6c2dda82ea 100644 --- a/sys/arch/sgi/include/bus.h +++ b/sys/arch/sgi/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.19 2009/07/23 19:24:56 miod Exp $ */ +/* $OpenBSD: bus.h,v 1.20 2009/07/26 18:48:55 miod Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB Sweden. All rights reserved. @@ -114,6 +114,10 @@ struct mips_bus_space { #define bus_space_subregion(t, h, o, s, p) \ (*(t)->_space_subregion)((t), (h), (o), (s), (p)) +#define BUS_SPACE_MAP_CACHEABLE 0x01 +#define BUS_SPACE_MAP_LINEAR 0x02 +#define BUS_SPACE_MAP_PREFETCHABLE 0x04 + #define bus_space_vaddr(t, h) (*(t)->_space_vaddr)((t), (h)) /*----------------------------------------------------------------------------*/ @@ -298,9 +302,6 @@ bus_space_copy_8(void *v, bus_space_handle_t h1, bus_size_t o1, #define BUS_BARRIER_READ BUS_SPACE_BARRIER_READ #define BUS_BARRIER_WRITE BUS_SPACE_BARRIER_WRITE -#define BUS_SPACE_MAP_CACHEABLE 0x01 -#define BUS_SPACE_MAP_LINEAR 0x02 - #define BUS_DMA_WAITOK 0x000 #define BUS_DMA_NOWAIT 0x001 #define BUS_DMA_ALLOCNOW 0x002 diff --git a/sys/arch/sgi/xbow/xbow.c b/sys/arch/sgi/xbow/xbow.c index b77bc88675b..3c180271b8d 100644 --- a/sys/arch/sgi/xbow/xbow.c +++ b/sys/arch/sgi/xbow/xbow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xbow.c,v 1.15 2009/07/22 21:28:44 miod Exp $ */ +/* $OpenBSD: xbow.c,v 1.16 2009/07/26 18:48:55 miod Exp $ */ /* * Copyright (c) 2008, 2009 Miodrag Vallat. @@ -597,7 +597,7 @@ xbow_write_raw_8(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o, int xbow_space_map(bus_space_tag_t t, bus_addr_t offs, bus_size_t size, - int cacheable, bus_space_handle_t *bshp) + int flags, bus_space_handle_t *bshp) { bus_addr_t bpa; diff --git a/sys/arch/sgi/xbow/xbridge.c b/sys/arch/sgi/xbow/xbridge.c index 11ab79d30bc..c2e3636d83c 100644 --- a/sys/arch/sgi/xbow/xbridge.c +++ b/sys/arch/sgi/xbow/xbridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xbridge.c,v 1.41 2009/07/23 19:24:03 miod Exp $ */ +/* $OpenBSD: xbridge.c,v 1.42 2009/07/26 18:48:55 miod Exp $ */ /* * Copyright (c) 2008, 2009 Miodrag Vallat. @@ -997,7 +997,7 @@ xbridge_write_raw_8(bus_space_tag_t t, bus_space_handle_t h, bus_addr_t o, int xbridge_space_map_devio(bus_space_tag_t t, bus_addr_t offs, bus_size_t size, - int cacheable, bus_space_handle_t *bshp) + int flags, bus_space_handle_t *bshp) { struct xbridge_softc *sc = (struct xbridge_softc *)t->bus_private; bus_addr_t bpa; @@ -1040,7 +1040,7 @@ xbridge_space_map_devio(bus_space_tag_t t, bus_addr_t offs, bus_size_t size, int xbridge_space_map_io(bus_space_tag_t t, bus_addr_t offs, bus_size_t size, - int cacheable, bus_space_handle_t *bshp) + int flags, bus_space_handle_t *bshp) { struct xbridge_softc *sc = (struct xbridge_softc *)t->bus_private; @@ -1050,7 +1050,7 @@ xbridge_space_map_io(bus_space_tag_t t, bus_addr_t offs, bus_size_t size, */ if ((offs >> 24) == sc->sc_devio_skew) - return xbridge_space_map_devio(t, offs, size, cacheable, bshp); + return xbridge_space_map_devio(t, offs, size, flags, bshp); *bshp = (t->bus_base + offs); return 0; @@ -1058,7 +1058,7 @@ xbridge_space_map_io(bus_space_tag_t t, bus_addr_t offs, bus_size_t size, int xbridge_space_map_mem(bus_space_tag_t t, bus_addr_t offs, bus_size_t size, - int cacheable, bus_space_handle_t *bshp) + int flags, bus_space_handle_t *bshp) { struct xbridge_softc *sc = (struct xbridge_softc *)t->bus_private; @@ -1070,7 +1070,7 @@ xbridge_space_map_mem(bus_space_tag_t t, bus_addr_t offs, bus_size_t size, if (sys_config.system_type != SGI_OCTANE && (offs >> 24) == sc->sc_devio_skew) - return xbridge_space_map_devio(t, offs, size, cacheable, bshp); + return xbridge_space_map_devio(t, offs, size, flags, bshp); *bshp = (t->bus_base + offs); return 0; diff --git a/sys/arch/socppc/include/bus.h b/sys/arch/socppc/include/bus.h index 978d3afa558..b0f3d61e449 100644 --- a/sys/arch/socppc/include/bus.h +++ b/sys/arch/socppc/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.3 2009/05/31 17:42:13 miod Exp $ */ +/* $OpenBSD: bus.h,v 1.4 2009/07/26 18:48:55 miod Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom. All rights reserved. @@ -65,18 +65,22 @@ extern struct ppc_bus_space ppc_isa_io, ppc_isa_mem; * Access methods for bus resources */ int bus_space_map(bus_space_tag_t t, bus_addr_t addr, - bus_size_t size, int cacheable, bus_space_handle_t *bshp); + bus_size_t size, int flags, bus_space_handle_t *bshp); void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size); int bus_space_subregion(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp); int bus_space_alloc(bus_space_tag_t tag, bus_addr_t rstart, bus_addr_t rend, bus_size_t size, bus_size_t alignment, - bus_size_t boundary, int cacheable, bus_addr_t *addrp, + bus_size_t boundary, int flags, bus_addr_t *addrp, bus_space_handle_t *handlep); void bus_space_free(bus_space_tag_t tag, bus_space_handle_t handle, bus_size_t size); +#define BUS_SPACE_MAP_CACHEABLE 0x01 +#define BUS_SPACE_MAP_LINEAR 0x02 +#define BUS_SPACE_MAP_PREFETCHABLE 0x04 + #define bus_space_read(n,m) \ static __inline CAT3(u_int,m,_t) \ CAT(bus_space_read_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ diff --git a/sys/arch/socppc/socppc/machdep.c b/sys/arch/socppc/socppc/machdep.c index fc2a738d51b..509a5e6a9bb 100644 --- a/sys/arch/socppc/socppc/machdep.c +++ b/sys/arch/socppc/socppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.13 2009/06/15 17:01:26 beck Exp $ */ +/* $OpenBSD: machdep.c,v 1.14 2009/07/26 18:48:55 miod Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -429,20 +429,20 @@ lcsplx(int ipl) /* BUS functions */ int bus_space_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, - int cacheable, bus_space_handle_t *bshp) + int flags, bus_space_handle_t *bshp) { int error; if (POWERPC_BUS_TAG_BASE(t) == 0) { /* if bus has base of 0 fail. */ - return 1; + return EINVAL; } bpa |= POWERPC_BUS_TAG_BASE(t); if ((error = extent_alloc_region(devio_ex, bpa, size, EX_NOWAIT | (ppc_malloc_ok ? EX_MALLOCOK : 0)))) return error; - if ((error = bus_mem_add_mapping(bpa, size, cacheable, bshp))) { + if ((error = bus_mem_add_mapping(bpa, size, flags, bshp))) { if (extent_free(devio_ex, bpa, size, EX_NOWAIT | (ppc_malloc_ok ? EX_MALLOCOK : 0))) { @@ -498,7 +498,7 @@ bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size) vaddr_t ppc_kvm_stolen = VM_KERN_ADDRESS_SIZE; int -bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int cacheable, +bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int flags, bus_space_handle_t *bshp) { bus_addr_t vaddr; @@ -539,9 +539,9 @@ bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int cacheable, bpa, size, *bshp, spa); #endif for (; len > 0; len -= PAGE_SIZE) { - pmap_kenter_cache(vaddr, spa, - VM_PROT_READ | VM_PROT_WRITE, - cacheable ? PMAP_CACHE_WT : PMAP_CACHE_CI); + pmap_kenter_cache(vaddr, spa, VM_PROT_READ | VM_PROT_WRITE, + (flags & BUS_SPACE_MAP_CACHEABLE) ? + PMAP_CACHE_WT : PMAP_CACHE_CI); spa += PAGE_SIZE; vaddr += PAGE_SIZE; } @@ -550,7 +550,7 @@ bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int cacheable, int bus_space_alloc(bus_space_tag_t tag, bus_addr_t rstart, bus_addr_t rend, - bus_size_t size, bus_size_t alignment, bus_size_t boundary, int cacheable, + bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags, bus_addr_t *addrp, bus_space_handle_t *handlep) { diff --git a/sys/arch/sparc/include/bus.h b/sys/arch/sparc/include/bus.h index d938939cc89..5632d700755 100644 --- a/sys/arch/sparc/include/bus.h +++ b/sys/arch/sparc/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.7 2009/07/13 19:50:00 kettenis Exp $ */ +/* $OpenBSD: bus.h,v 1.8 2009/07/26 18:48:55 miod Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. * @@ -72,6 +72,10 @@ static int bus_space_map(bus_space_tag_t, bus_addr_t, bus_size_t, int, static int bus_space_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t); +#define BUS_SPACE_MAP_CACHEABLE 0x01 +#define BUS_SPACE_MAP_LINEAR 0x02 +#define BUS_SPACE_MAP_PREFETCHABLE 0x04 + #define BUS_SPACE_BARRIER_READ 0 #define BUS_SPACE_BARRIER_WRITE 1 diff --git a/sys/arch/vax/vax/bus_mem.c b/sys/arch/vax/vax/bus_mem.c index 1f63fa5e9f3..064ed8b080d 100644 --- a/sys/arch/vax/vax/bus_mem.c +++ b/sys/arch/vax/vax/bus_mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_mem.c,v 1.4 2001/11/06 19:53:17 miod Exp $ */ +/* $OpenBSD: bus_mem.c,v 1.5 2009/07/26 18:48:55 miod Exp $ */ /* $NetBSD: bus_mem.c,v 1.8 2000/06/29 07:14:23 mrg Exp $ */ /* * Copyright (c) 1998 Matt Thomas @@ -51,7 +51,7 @@ vax_mem_bus_space_map( void *t, bus_addr_t pa, bus_size_t size, - int cacheable, + int flags, bus_space_handle_t *bshp, int f2) { diff --git a/sys/arch/zaurus/zaurus/zaurus_machdep.c b/sys/arch/zaurus/zaurus/zaurus_machdep.c index a8bcb4a23a9..0914793ab94 100644 --- a/sys/arch/zaurus/zaurus/zaurus_machdep.c +++ b/sys/arch/zaurus/zaurus/zaurus_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zaurus_machdep.c,v 1.31 2008/11/26 01:29:00 kevlo Exp $ */ +/* $OpenBSD: zaurus_machdep.c,v 1.32 2009/07/26 18:48:55 miod Exp $ */ /* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */ /* @@ -434,7 +434,7 @@ static vaddr_t section_free = ZAURUS_VBASE_FREE; static int bootstrap_bs_map(void *t, bus_addr_t bpa, bus_size_t size, - int cacheable, bus_space_handle_t *bshp) + int flags, bus_space_handle_t *bshp) { u_long startpa; vaddr_t va; diff --git a/sys/dev/pci/tga.c b/sys/dev/pci/tga.c index f4c70ab097b..881e013eed7 100644 --- a/sys/dev/pci/tga.c +++ b/sys/dev/pci/tga.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tga.c,v 1.31 2009/03/29 21:53:52 sthen Exp $ */ +/* $OpenBSD: tga.c,v 1.32 2009/07/26 18:48:55 miod Exp $ */ /* $NetBSD: tga.c,v 1.40 2002/03/13 15:05:18 ad Exp $ */ /* @@ -219,14 +219,12 @@ tga_getdevconfig(memt, pc, tag, dc) return; DPRINTF("tga_getdevconfig: preparing to map\n"); -#ifdef __OpenBSD__ - if (bus_space_map(memt, dc->dc_pcipaddr, pcisize, 1, &dc->dc_memh)) - return; - dc->dc_vaddr = dc->dc_memh; -#else if (bus_space_map(memt, dc->dc_pcipaddr, pcisize, BUS_SPACE_MAP_PREFETCHABLE | BUS_SPACE_MAP_LINEAR, &dc->dc_memh)) return; +#ifdef __OpenBSD__ + dc->dc_vaddr = dc->dc_memh; +#else dc->dc_vaddr = (vaddr_t) bus_space_vaddr(memt, dc->dc_memh); #endif DPRINTF("tga_getdevconfig: mapped\n"); |