diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2003-10-08 21:52:47 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2003-10-08 21:52:47 +0000 |
commit | 7d31cb4e4d4ff9076df3ed644843eabc6cb5c29b (patch) | |
tree | 663a79e860c7e690ada98800a64ea46e1e5fdf15 /sys/arch | |
parent | 0cf3f5cae2f2b28d02e3d956de1c64135d378411 (diff) |
Fix endian bug in macppc bus_space_set_region_N(). ok miod@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/macppc/include/bus.h | 8 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/machdep.c | 71 |
2 files changed, 56 insertions, 23 deletions
diff --git a/sys/arch/macppc/include/bus.h b/sys/arch/macppc/include/bus.h index 1430de74971..c4dd81d2cb8 100644 --- a/sys/arch/macppc/include/bus.h +++ b/sys/arch/macppc/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.10 2003/06/23 21:48:24 mickey Exp $ */ +/* $OpenBSD: bus.h,v 1.11 2003/10/08 21:52:46 drahn Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom. All rights reserved. @@ -405,13 +405,13 @@ bus_space_write_raw_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh, !!! bus_space_write_raw_multi_8 not implemented !!! void -bus_space_set_region_1(void *v, bus_space_handle_t h, bus_size_t o, +bus_space_set_region_1(bus_space_tag_t bst, bus_space_handle_t h, bus_size_t o, u_int8_t val, bus_size_t c); void -bus_space_set_region_2(void *v, bus_space_handle_t h, bus_size_t o, +bus_space_set_region_2(bus_space_tag_t bst, bus_space_handle_t h, bus_size_t o, u_int16_t val, bus_size_t c); void -bus_space_set_region_4(void *v, bus_space_handle_t h, bus_size_t o, +bus_space_set_region_4(bus_space_tag_t bst, bus_space_handle_t h, bus_size_t o, u_int32_t val, bus_size_t c); #define bus_space_set_region_8 \ !!! bus_space_set_region_8 not implemented !!! diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c index 12749553eb9..00de6b0cace 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.55 2003/09/22 21:39:38 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.56 2003/10/08 21:52:46 drahn Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -1329,26 +1329,59 @@ BUS_SPACE_COPY_N(1,u_int8_t) BUS_SPACE_COPY_N(2,u_int16_t) BUS_SPACE_COPY_N(4,u_int32_t) -#define BUS_SPACE_SET_REGION_N(BYTES,TYPE) \ -void \ -__C(bus_space_set_region_,BYTES)(v, h, o, val, c) \ - void *v; \ - bus_space_handle_t h; \ - TYPE val; \ - bus_size_t o, c; \ -{ \ - TYPE *dst; \ - int i; \ - \ - dst = (TYPE *) (h+o); \ - for (i = 0; i < c; i++) { \ - dst[i] = val; \ - } \ +void +bus_space_set_region_1(t, h, o, val, c) + bus_space_tag_t t; + bus_space_handle_t h; + u_int8_t val; + bus_size_t o, c; +{ + u_int8_t *dst; + int i; + + dst = (u_int8_t *) (h+o); + + for (i = 0; i < c; i++) { + dst[i] = val; + } } -BUS_SPACE_SET_REGION_N(1,u_int8_t) -BUS_SPACE_SET_REGION_N(2,u_int16_t) -BUS_SPACE_SET_REGION_N(4,u_int32_t) +void +bus_space_set_region_2(t, h, o, val, c) + bus_space_tag_t t; + bus_space_handle_t h; + u_int16_t val; + bus_size_t o, c; +{ + u_int16_t *dst; + int i; + + dst = (u_int16_t *) (h+o); + if (t->bus_reverse) + val = swap16(val); + + for (i = 0; i < c; i++) { + dst[i] = val; + } +} +void +bus_space_set_region_4(t, h, o, val, c) + bus_space_tag_t t; + bus_space_handle_t h; + u_int32_t val; + bus_size_t o, c; +{ + u_int32_t *dst; + int i; + + dst = (u_int32_t *) (h+o); + if (t->bus_reverse) + val = swap32(val); + + for (i = 0; i < c; i++) { + dst[i] = val; + } +} #define BUS_SPACE_READ_RAW_MULTI_N(BYTES,SHIFT,TYPE) \ void \ |