Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Ensure reorder protection for amigappc in all bus s...



details:   https://anonhg.NetBSD.org/src/rev/9365c6c2c40c
branches:  trunk
changeset: 751397:9365c6c2c40c
user:      phx <phx%NetBSD.org@localhost>
date:      Wed Feb 03 13:56:53 2010 +0000

description:
Ensure reorder protection for amigappc in all bus space functions.
The ne(4) driver (XSurf2), which is the only bus_space device I got,
works now.

diffstat:

 sys/arch/amiga/amiga/amiga_bus_simple_4.c |   6 ++-
 sys/arch/amiga/amiga/busfuncs.c           |  44 ++++++++++++++++++++++++++----
 sys/arch/amiga/amiga/simple_busfuncs.c    |  30 +++++++++++++++++---
 sys/arch/amiga/include/bus.h              |   5 ++-
 sys/arch/amigappc/include/bus.h           |   5 ++-
 5 files changed, 74 insertions(+), 16 deletions(-)

diffs (truncated from 467 to 300 lines):

diff -r 19deb48fbb3c -r 9365c6c2c40c sys/arch/amiga/amiga/amiga_bus_simple_4.c
--- a/sys/arch/amiga/amiga/amiga_bus_simple_4.c Wed Feb 03 13:51:00 2010 +0000
+++ b/sys/arch/amiga/amiga/amiga_bus_simple_4.c Wed Feb 03 13:56:53 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: amiga_bus_simple_4.c,v 1.5 2008/04/28 20:23:12 martin Exp $ */
+/* $NetBSD: amiga_bus_simple_4.c,v 1.6 2010/02/03 13:56:53 phx Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: amiga_bus_simple_4.c,v 1.5 2008/04/28 20:23:12 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: amiga_bus_simple_4.c,v 1.6 2010/02/03 13:56:53 phx Exp $");
 
 #define AMIGA_SIMPLE_BUS_STRIDE 4              /* 1 byte per long */
 #define AMIGA_SIMPLE_BUS_WORD_METHODS
@@ -57,6 +57,7 @@
 
        while (count > 0) {
                *pointer++ = bswap16(*p);
+               amiga_bus_reorder_protect();
                --count;
        }
 }
@@ -71,6 +72,7 @@
 
        while (count > 0) {
                *p = bswap16(*pointer);
+               amiga_bus_reorder_protect();
                ++pointer;
                --count;
        }
diff -r 19deb48fbb3c -r 9365c6c2c40c sys/arch/amiga/amiga/busfuncs.c
--- a/sys/arch/amiga/amiga/busfuncs.c   Wed Feb 03 13:51:00 2010 +0000
+++ b/sys/arch/amiga/amiga/busfuncs.c   Wed Feb 03 13:56:53 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: busfuncs.c,v 1.10 2009/03/14 21:04:03 dsl Exp $        */
+/*     $NetBSD: busfuncs.c,v 1.11 2010/02/03 13:56:53 phx Exp $        */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: busfuncs.c,v 1.10 2009/03/14 21:04:03 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: busfuncs.c,v 1.11 2010/02/03 13:56:53 phx Exp $");
 
 /*
  * Amiga bus access methods for data widths > 1
@@ -118,7 +118,11 @@
 amiga_contiguous_read_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
 {
        /* ARGSUSED */
-       return (* (u_int16_t *) (h + o)); /* only used if t->stride == 0 */
+       u_int16_t x;
+
+       x  = * (u_int16_t *) (h + o); /* only used if t->stride == 0 */
+       amiga_bus_reorder_protect();
+       return x;
 }
 
 void
@@ -126,6 +130,7 @@
 {
        /* ARGSUSED */
        * (u_int16_t *) (h + o) = v;
+       amiga_bus_reorder_protect();
 }
 
 void
@@ -136,6 +141,7 @@
 
        while (s-- > 0) {
                *p++ =  *q;
+               amiga_bus_reorder_protect();
        }
 }
 
@@ -147,6 +153,7 @@
 
        while (s-- > 0) {
                *q = *p++;
+               amiga_bus_reorder_protect();
        }
 }
 
@@ -158,6 +165,7 @@
 
        while (s-- > 0) {
                *p++ =  *q++;
+               amiga_bus_reorder_protect();
        }
 }
 
@@ -169,6 +177,7 @@
 
        while (s-- > 0) {
                *q++ = *p++;
+               amiga_bus_reorder_protect();
        }
 }
 
@@ -180,6 +189,7 @@
 
        while (s-- > 0) {
                *q++ = v;
+               amiga_bus_reorder_protect();
        }
 }
 
@@ -192,6 +202,7 @@
 
        while (s-- > 0) {
                *q++ = *p++;
+               amiga_bus_reorder_protect();
        }
 }
 
@@ -205,12 +216,14 @@
 amiga_interleaved_read_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
 {
        volatile u_int8_t *q;
+       u_int16_t x;
        int step;
 
        step = 1 << t->stride;
        q = (volatile u_int8_t *)(h + (o << t->stride));
-
-       return ((*q) << 8) | *(q + step);
+       x = ((*q) << 8) | *(q + step);
+       amiga_bus_reorder_protect();
+       return x;
 }
 
 void
@@ -224,6 +237,7 @@
 
        *q = v >> 8;
        *(q+step) = v;
+       amiga_bus_reorder_protect();
 }
 
 void
@@ -237,6 +251,7 @@
 
        while (s-- > 0) {
                *p++ =  ((*q)<<8) | *(q+step);
+               amiga_bus_reorder_protect();
        }
 }
 
@@ -254,6 +269,7 @@
                v = *p++;
                *q              = v>>8;
                *(q + step)     = v;
+               amiga_bus_reorder_protect();
        }
 }
 
@@ -271,6 +287,7 @@
                v = (*q) << 8;
                q += step;
                v |= *q;
+               amiga_bus_reorder_protect();
                q += step;
                *p++ =  v;
        }
@@ -291,6 +308,7 @@
                *q = v >> 8;
                q += step;
                *q = v;
+               amiga_bus_reorder_protect();
                q += step;
        }
 }
@@ -305,6 +323,7 @@
 
        while (s-- > 0) {
                *q = v;
+               amiga_bus_reorder_protect();
                q += step;
        }
 }
@@ -320,6 +339,7 @@
 
        while (s-- > 0) {
                *q = *p;
+               amiga_bus_reorder_protect();
                p += step;
                q += step;
        }
@@ -334,7 +354,11 @@
 amiga_interleaved_wordaccess_read_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
 {
        /* ARGSUSED */
-       return (* (u_int16_t *) (h + (o << t->stride)));
+       u_int16_t x;
+
+       x = * (u_int16_t *) (h + (o << t->stride));
+       amiga_bus_reorder_protect();
+       return x;
 }
 
 void
@@ -342,6 +366,7 @@
 {
        /* ARGSUSED */
        * (u_int16_t *) (h + (o << t->stride)) = v;
+       amiga_bus_reorder_protect();
 }
 
 void
@@ -354,6 +379,7 @@
 
        while (s-- > 0) {
                *p++ =  *q;
+               amiga_bus_reorder_protect();
        }
 }
 
@@ -367,6 +393,7 @@
 
        while (s-- > 0) {
                *q = *p++;
+               amiga_bus_reorder_protect();
        }
 }
 
@@ -382,6 +409,7 @@
 
        while (s-- > 0) {
                *p++ =  *q;
+               amiga_bus_reorder_protect();
                q += step;
        }
 }
@@ -398,6 +426,7 @@
 
        while (s-- > 0) {
                *q = *p++;
+               amiga_bus_reorder_protect();
                q += step;
        }
 }
@@ -414,6 +443,7 @@
 
        while (s-- > 0) {
                *q = v;
+               amiga_bus_reorder_protect();
                q += step;
        }
 }
@@ -432,8 +462,8 @@
 
        while (s-- > 0) {
                *q = *p;
+               amiga_bus_reorder_protect();
                q += step;
                p += step;
        }
 }
-
diff -r 19deb48fbb3c -r 9365c6c2c40c sys/arch/amiga/amiga/simple_busfuncs.c
--- a/sys/arch/amiga/amiga/simple_busfuncs.c    Wed Feb 03 13:51:00 2010 +0000
+++ b/sys/arch/amiga/amiga/simple_busfuncs.c    Wed Feb 03 13:56:53 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: simple_busfuncs.c,v 1.5 2008/04/28 20:23:12 martin Exp $ */
+/* $NetBSD: simple_busfuncs.c,v 1.6 2010/02/03 13:56:53 phx Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: simple_busfuncs.c,v 1.5 2008/04/28 20:23:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: simple_busfuncs.c,v 1.6 2010/02/03 13:56:53 phx Exp $");
 
 /*
  * Do NOT use this standalone.
@@ -110,9 +110,12 @@
        bus_size_t offset;
 {
        u_int8_t *p;
+       u_int8_t x;
 
        p = (u_int8_t *)(handle + offset * AMIGA_SIMPLE_BUS_STRIDE);
-       return (*p);
+       x = *p;
+       amiga_bus_reorder_protect();
+       return x;
 }
 
 void
@@ -125,6 +128,7 @@
 
        p = (u_int8_t *)(handle + offset * AMIGA_SIMPLE_BUS_STRIDE);



Home | Main Index | Thread Index | Old Index