summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreeh <eeh@NetBSD.org>1999-01-30 17:02:32 +0000
committereeh <eeh@NetBSD.org>1999-01-30 17:02:32 +0000
commit8ee118c70dd18dc948b48d7987fa6b24be05ab50 (patch)
tree9757bf9c303ba82ee06d440e79f8df31c182b195
parentc24c65fdd0226ffe2d1c0982c69cbb7b1be006b0 (diff)
Fix problems with bus_space*() macros (thanks M.Drochner).
-rw-r--r--sys/arch/sparc64/include/bus.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/sys/arch/sparc64/include/bus.h b/sys/arch/sparc64/include/bus.h
index d70fb48d3c7..aaf9dbc5ecb 100644
--- a/sys/arch/sparc64/include/bus.h
+++ b/sys/arch/sparc64/include/bus.h
@@ -1,4 +1,4 @@
-/* $NetBSD: bus.h,v 1.7 1998/09/06 21:53:42 eeh Exp $ */
+/* $NetBSD: bus.h,v 1.8 1999/01/30 17:02:32 eeh Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -38,6 +38,7 @@
*/
/*
+ * Copyright (c) 1997, 1998 Eduardo E. Horvath. All rights reserved.
* Copyright (c) 1996 Charles M. Hannum. All rights reserved.
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
*
@@ -386,28 +387,28 @@ int bus_space_probe __P((
#define bus_space_read_multi_1(t, h, o, a, c) do { \
int i = c; \
- u_char *p = (u_char *)a; \
+ u_int8_t *p = (u_int8_t *)a; \
while (i-- > 0) \
*p++ = bus_space_read_1(t, h, o); \
} while (0)
#define bus_space_read_multi_2(t, h, o, a, c) do { \
int i = c; \
- u_char *p = (u_char *)a; \
+ u_int8_t *p = (u_int8_t *)a; \
while (i-- > 0) \
*p++ = bus_space_read_2(t, h, o); \
} while (0)
#define bus_space_read_multi_4(t, h, o, a, c) do { \
int i = c; \
- u_char *p = (u_char *)a; \
+ u_int8_t *p = (u_int8_t *)a; \
while (i-- > 0) \
*p++ = bus_space_read_4(t, h, o); \
} while (0)
#define bus_space_read_multi_8(t, h, o, a, c) do { \
int i = c; \
- u_char *p = (u_char *)a; \
+ u_int8_t *p = (u_int8_t *)a; \
while (i-- > 0) \
*p++ = bus_space_read_8(t, h, o); \
} while (0)
@@ -461,28 +462,28 @@ int bus_space_probe __P((
#define bus_space_write_multi_1(t, h, o, a, c) do { \
int i = c; \
- u_char *p = (u_char *)a; \
+ u_int8_t *p = (u_int8_t *)a; \
while (i-- > 0) \
bus_space_write_1(t, h, o, *p++); \
} while (0)
#define bus_space_write_multi_2(t, h, o, a, c) do { \
int i = c; \
- u_char *p = (u_char *)a; \
+ u_int8_t *p = (u_int8_t *)a; \
while (i-- > 0) \
bus_space_write_2(t, h, o, *p++); \
} while (0)
#define bus_space_write_multi_4(t, h, o, a, c) do { \
int i = c; \
- u_char *p = (u_char *)a; \
+ u_int8_t *p = (u_int8_t *)a; \
while (i-- > 0) \
bus_space_write_4(t, h, o, *p++); \
} while (0)
#define bus_space_write_multi_8(t, h, o, a, c) do { \
int i = c; \
- u_char *p = (u_char *)a; \
+ u_int8_t *p = (u_int8_t *)a; \
while (i-- > 0) \
bus_space_write_8(t, h, o, *p++); \
} while (0)
@@ -533,25 +534,25 @@ int bus_space_probe __P((
#define bus_space_copy_region_1(t, h1, o1, h2, o2, c) \
{ int i = c; \
- while (i-- > 0) \
+ for (; i; i--, o1++, o2++) \
bus_space_write_1(t, h1, o1, bus_space_read_1(t, h2, o2)); \
} while (0)
#define bus_space_copy_region_2(t, h1, o1, h2, o2, c) \
{ int i = c; \
- while (i-- > 0) \
+ for (; i; i--, o1 += 2, o2 += 2) \
bus_space_write_2(t, h1, o1, bus_space_read_2(t, h2, o2)); \
} while (0)
#define bus_space_copy_region_4(t, h1, o1, h2, o2, c) \
{ int i = c; \
- while (i-- > 0) \
+ for (; i; i--, o1 += 4, o2 += 4) \
bus_space_write_4(t, h1, o1, bus_space_read_4(t, h2, o2)); \
} while (0)
#define bus_space_copy_region_8(t, h1, o1, h2, o2, c) \
{ int i = c; \
- while (i-- > 0) \
+ for (; i; i--, o1 += 8, o2 += 8) \
bus_space_write_8(t, h1, o1, bus_space_read_4(t, h2, o2)); \
} while (0)