diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2002-06-11 03:50:15 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2002-06-11 03:50:15 +0000 |
commit | 84e6ee5f337fc6c92c3272f2547b56d33b4ee6f7 (patch) | |
tree | f0f4ac4e5ba08ee8bf54c48d2e04c2ea9c6b16b1 /sys | |
parent | 0531d3d7cccbf8af2181a5a454aebda4ed28668a (diff) |
Add missing bus_space_read_raw_region_X bus_space_write_raw_region_X APIs.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/macppc/include/bus.h | 106 |
1 files changed, 104 insertions, 2 deletions
diff --git a/sys/arch/macppc/include/bus.h b/sys/arch/macppc/include/bus.h index 757d8bb0a90..b0c97daf0ca 100644 --- a/sys/arch/macppc/include/bus.h +++ b/sys/arch/macppc/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.5 2002/03/14 01:26:36 millert Exp $ */ +/* $OpenBSD: bus.h,v 1.6 2002/06/11 03:50:14 drahn Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom. All rights reserved. @@ -244,6 +244,108 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, #endif /* + * void bus_space_read_raw_region_N(bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, + * u_intN_t *addr, size_t count); + * + * Read `count' 1, 2, 4, or 8 byte quantities from bus space + * described by tag/handle and starting at `offset' and copy into + * buffer provided. + */ + +static __inline void +bus_space_read_raw_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int8_t *addr, size_t count) +{ + volatile u_int8_t *s = __BA(tag, bsh, offset); + u_int8_t *laddr = (void *)addr; + + while (count--) + *laddr++ = *s++; + __asm __volatile("eieio; sync"); +} + +static __inline void +bus_space_read_raw_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int8_t *addr, size_t count) +{ + volatile u_int16_t *s = __BA(tag, bsh, offset); + u_int16_t *laddr = (void *)addr; + + while (count--) + *laddr++ = *s++; + __asm __volatile("eieio; sync"); +} + +static __inline void +bus_space_read_raw_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, u_int8_t *addr, size_t count) +{ + volatile u_int32_t *s = __BA(tag, bsh, offset); + u_int32_t *laddr = (void *)addr; + + while (count--) + *laddr++ = *s++; + __asm __volatile("eieio; sync"); +} + +#if 0 /* Cause a link error for bus_space_read_raw_region_8 */ +#define bus_space_read_raw_region_8 \ + !!! bus_space_read_raw_region_8 unimplemented !!! +#endif + + +/* + * void bus_space_write_raw_region_N(bus_space_tag_t tag, + * bus_space_handle_t bsh, bus_size_t offset, + * const u_intN_t *addr, size_t count); + * + * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided + * to bus space described by tag/handle starting at `offset'. + */ + +static __inline void +bus_space_write_raw_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, const u_int8_t *addr, size_t count) +{ + volatile u_int8_t *d = __BA(tag, bsh, offset); + const u_int8_t *laddr = (void *)addr; + + while (count--) + *d++ = *laddr++; + __asm __volatile("eieio; sync"); +} + +static __inline void +bus_space_write_raw_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, const u_int8_t *addr, size_t count) +{ + volatile u_int16_t *d = __BA(tag, bsh, offset); + const u_int16_t *laddr = (void *)addr; + + while (count--) + *d++ = *laddr++; + __asm __volatile("eieio; sync"); +} + +static __inline void +bus_space_write_raw_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, + bus_size_t offset, const u_int8_t *addr, size_t count) +{ + volatile u_int32_t *d = __BA(tag, bsh, offset); + const u_int32_t *laddr = (void *)addr; + + while (count--) + *d++ = *laddr++; + __asm __volatile("eieio; sync"); +} + +#if 0 +#define bus_space_write_raw_region_8 \ + !!! bus_space_write_raw_region_8 unimplemented !!! +#endif + +/* * void bus_space_set_multi_N(bus_space_tag_t tag, * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val, * size_t count); @@ -342,7 +444,7 @@ void bus_space_set_region_4(void *v, 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_write_raw_multi_8 not implemented !!! + !!! bus_space_set_region_8 not implemented !!! void bus_space_copy_1(void *v, bus_space_handle_t h1, bus_space_handle_t h2, |