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 /sys/arch/macppc | |
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.
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r-- | sys/arch/macppc/include/bus.h | 10 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/machdep.c | 20 |
2 files changed, 17 insertions, 13 deletions
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) { |