summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/hppa/dev/mongoose.c48
-rw-r--r--sys/arch/hppa/hppa/mainbus.c94
2 files changed, 80 insertions, 62 deletions
diff --git a/sys/arch/hppa/dev/mongoose.c b/sys/arch/hppa/dev/mongoose.c
index 05a67ec2a9c..be66db5a73d 100644
--- a/sys/arch/hppa/dev/mongoose.c
+++ b/sys/arch/hppa/dev/mongoose.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mongoose.c,v 1.19 2010/01/01 20:28:42 kettenis Exp $ */
+/* $OpenBSD: mongoose.c,v 1.20 2010/04/27 18:29:39 kettenis Exp $ */
/*
* Copyright (c) 1998-2003 Michael Shalayeff
@@ -304,63 +304,69 @@ mg_isa_sm_4(void *v, bus_space_handle_t h, bus_size_t o, u_int32_t vv, bus_size_
void
mg_isa_rr_2(void *v, bus_space_handle_t h, bus_size_t o, u_int16_t *a, bus_size_t c)
{
- register u_int16_t r;
- h += o;
+ volatile u_int16_t *p = (u_int16_t *)(h + o);
+ u_int32_t r;
+
while (c--) {
- r = *((volatile u_int16_t *)h)++;
- *(a++) = letoh16(r);
+ r = *p++;
+ *a++ = letoh16(r);
}
}
void
mg_isa_rr_4(void *v, bus_space_handle_t h, bus_size_t o, u_int32_t *a, bus_size_t c)
{
- register u_int32_t r;
- h += o;
+ volatile u_int32_t *p = (u_int32_t *)(h + o);
+ u_int32_t r;
+
while (c--) {
- r = *((volatile u_int32_t *)h)++;
- *(a++) = letoh32(r);
+ r = *p++;
+ *a++ = letoh32(r);
}
}
void
mg_isa_wr_2(void *v, bus_space_handle_t h, bus_size_t o, const u_int16_t *a, bus_size_t c)
{
- register u_int16_t r;
- h += o;
+ volatile u_int16_t *p = (u_int16_t *)(h + o);
+ u_int32_t r;
+
while (c--) {
- r = *(a++);
- *((volatile u_int16_t *)h)++ = htole16(r);
+ r = *a++;
+ *p++ = htole16(r);
}
}
void
mg_isa_wr_4(void *v, bus_space_handle_t h, bus_size_t o, const u_int32_t *a, bus_size_t c)
{
- register u_int32_t r;
- h += o;
+ volatile u_int32_t *p = (u_int32_t *)(h + o);
+ u_int32_t r;
+
while (c--) {
- r = *(a++);
- *((volatile u_int32_t *)h)++ = htole32(r);
+ r = *a++;
+ *p++ = htole32(r);
}
}
void
mg_isa_sr_2(void *v, bus_space_handle_t h, bus_size_t o, u_int16_t vv, bus_size_t c)
{
+ volatile u_int16_t *p = (u_int16_t *)(h + o);
+
vv = htole16(vv);
- h += o;
while (c--)
- *((volatile u_int16_t *)h)++ = vv;
+ *p++ = vv;
}
void
mg_isa_sr_4(void *v, bus_space_handle_t h, bus_size_t o, u_int32_t vv, bus_size_t c)
{
+ volatile u_int32_t *p = (u_int32_t *)(h + o);
+
vv = htole32(vv);
- h += o;
while (c--)
- *((volatile u_int32_t *)h)++ = vv;
+ *p++ = vv;
}
int
diff --git a/sys/arch/hppa/hppa/mainbus.c b/sys/arch/hppa/hppa/mainbus.c
index ca7244b667c..fd8d9759eb2 100644
--- a/sys/arch/hppa/hppa/mainbus.c
+++ b/sys/arch/hppa/hppa/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.76 2010/04/20 23:27:00 deraadt Exp $ */
+/* $OpenBSD: mainbus.c,v 1.77 2010/04/27 18:29:39 kettenis Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -446,65 +446,73 @@ void mbus_wrm_8(void *v, bus_space_handle_t h,
void
mbus_rr_1(void *v, bus_space_handle_t h, bus_size_t o, u_int8_t *a, bus_size_t c)
{
- h += o;
+ volatile u_int8_t *p = (u_int8_t *)(h + o);
+
while (c--)
- *(a++) = *((volatile u_int8_t *)h)++;
+ *a++ = *p++;
}
void
mbus_rr_2(void *v, bus_space_handle_t h, bus_size_t o, u_int16_t *a, bus_size_t c)
{
- h += o;
+ volatile u_int16_t *p = (u_int16_t *)(h + o);
+
while (c--)
- *(a++) = *((volatile u_int16_t *)h)++;
+ *a++ = *p++;
}
void
mbus_rr_4(void *v, bus_space_handle_t h, bus_size_t o, u_int32_t *a, bus_size_t c)
{
- h += o;
+ volatile u_int32_t *p = (u_int32_t *)(h + o);
+
while (c--)
- *(a++) = *((volatile u_int32_t *)h)++;
+ *a++ = *p++;
}
void
mbus_rr_8(void *v, bus_space_handle_t h, bus_size_t o, u_int64_t *a, bus_size_t c)
{
- h += o;
+ volatile u_int64_t *p = (u_int64_t *)(h + o);
+
while (c--)
- *(a++) = *((volatile u_int64_t *)h)++;
+ *a++ = *p++;
}
void
mbus_wr_1(void *v, bus_space_handle_t h, bus_size_t o, const u_int8_t *a, bus_size_t c)
{
- h += o;
+ volatile u_int8_t *p = (u_int8_t *)(h + o);
+
while (c--)
- *((volatile u_int8_t *)h)++ = *(a++);
+ *p++ = *a++;
}
void
mbus_wr_2(void *v, bus_space_handle_t h, bus_size_t o, const u_int16_t *a, bus_size_t c)
{
- h += o;
+ volatile u_int16_t *p = (u_int16_t *)(h + o);
+
while (c--)
- *((volatile u_int16_t *)h)++ = *(a++);
+ *p++ = *a++;
}
void
mbus_wr_4(void *v, bus_space_handle_t h, bus_size_t o, const u_int32_t *a, bus_size_t c)
{
- h += o;
+ volatile u_int32_t *p = (u_int32_t *)(h + o);
+
while (c--)
- *((volatile u_int32_t *)h)++ = *(a++);
+ *p++ = *a++;
}
void
mbus_wr_8(void *v, bus_space_handle_t h, bus_size_t o, const u_int64_t *a, bus_size_t c)
{
- h += o;
+ volatile u_int64_t *p = (u_int64_t *)(h + o);
+
while (c--)
- *((volatile u_int64_t *)h)++ = *(a++);
+ *p++ = *a++;
}
void mbus_rrr_2(void *v, bus_space_handle_t h,
@@ -524,77 +532,81 @@ void mbus_wrr_8(void *v, bus_space_handle_t h,
void
mbus_sr_1(void *v, bus_space_handle_t h, bus_size_t o, u_int8_t vv, bus_size_t c)
{
- h += o;
+ volatile u_int8_t *p = (u_int8_t *)(h + o);
+
while (c--)
- *((volatile u_int8_t *)h)++ = vv;
+ *p++ = vv;
}
void
mbus_sr_2(void *v, bus_space_handle_t h, bus_size_t o, u_int16_t vv, bus_size_t c)
{
- h += o;
+ volatile u_int16_t *p = (u_int16_t *)(h + o);
+
while (c--)
- *((volatile u_int16_t *)h)++ = vv;
+ *p++ = vv;
}
void
mbus_sr_4(void *v, bus_space_handle_t h, bus_size_t o, u_int32_t vv, bus_size_t c)
{
- h += o;
+ volatile u_int32_t *p = (u_int32_t *)(h + o);
+
while (c--)
- *((volatile u_int32_t *)h)++ = vv;
+ *p++ = vv;
}
void
mbus_sr_8(void *v, bus_space_handle_t h, bus_size_t o, u_int64_t vv, bus_size_t c)
{
- h += o;
+ volatile u_int64_t *p = (u_int64_t *)(h + o);
+
while (c--)
- *((volatile u_int64_t *)h)++ = vv;
+ *p++ = vv;
}
void
mbus_cp_1(void *v, bus_space_handle_t h1, bus_size_t o1,
bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
{
- h1 += o1;
- h2 += o2;
+ volatile u_int8_t *p1 = (u_int8_t *)(h1 + o1);
+ volatile u_int8_t *p2 = (u_int8_t *)(h2 + o2);
+
while (c--)
- *((volatile u_int8_t *)h1)++ =
- *((volatile u_int8_t *)h2)++;
+ *p1++ = *p2++;
}
void
mbus_cp_2(void *v, bus_space_handle_t h1, bus_size_t o1,
bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
{
- h1 += o1;
- h2 += o2;
+ volatile u_int16_t *p1 = (u_int16_t *)(h1 + o1);
+ volatile u_int16_t *p2 = (u_int16_t *)(h2 + o2);
+
while (c--)
- *((volatile u_int16_t *)h1)++ =
- *((volatile u_int16_t *)h2)++;
+ *p1++ = *p2++;
}
void
mbus_cp_4(void *v, bus_space_handle_t h1, bus_size_t o1,
bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
{
- h1 += o1;
- h2 += o2;
+ volatile u_int32_t *p1 = (u_int32_t *)(h1 + o1);
+ volatile u_int32_t *p2 = (u_int32_t *)(h2 + o2);
+
while (c--)
- *((volatile u_int32_t *)h1)++ =
- *((volatile u_int32_t *)h2)++;
+ *p1++ = *p2++;
}
void
mbus_cp_8(void *v, bus_space_handle_t h1, bus_size_t o1,
bus_space_handle_t h2, bus_size_t o2, bus_size_t c)
{
- h1 += o1;
- h2 += o2;
+ volatile u_int64_t *p1 = (u_int64_t *)(h1 + o1);
+ volatile u_int64_t *p2 = (u_int64_t *)(h2 + o2);
+
while (c--)
- *((volatile u_int64_t *)h1)++ =
- *((volatile u_int64_t *)h2)++;
+ *p1++ = *p2++;
}