From 84e6ee5f337fc6c92c3272f2547b56d33b4ee6f7 Mon Sep 17 00:00:00 2001 From: Dale Rahn Date: Tue, 11 Jun 2002 03:50:15 +0000 Subject: Add missing bus_space_read_raw_region_X bus_space_write_raw_region_X APIs. --- sys/arch/macppc/include/bus.h | 106 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 104 insertions(+), 2 deletions(-) (limited to 'sys') 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. @@ -243,6 +243,108 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, #define bus_space_write_region_8 !!! bus_space_write_region_8 unimplemented !!! #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, @@ -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, -- cgit v1.2.3