Port-atari archive

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

Re: Current kernel with http://gnats.netbsd.org/39965 and pmap patches



> I added ATAC_CAP_NOIRQ for sc->sc_wdcdev.sc_atac.atac_cap in 
> atari/dev/wdc_mb.c
> (workaround for ATA polling issues), because mounting of ATA device complained
> about lost interrupts.
> 
> Here's screenshot of the problem:
> http://koti.welho.com/tmakinen/atari/mount.jpg

The drives are probed properly (with interrupts)
but interrupts are lost on read ops?

I wonder if atari bus_space(9) functions should have
volatile keywords for aggressive gcc4 optimizations.

---
Index: atari/be_bus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/atari/be_bus.c,v
retrieving revision 1.9
diff -u -r1.9 be_bus.c
--- atari/be_bus.c      28 Apr 2008 20:23:14 -0000      1.9
+++ atari/be_bus.c      19 Dec 2008 12:35:50 -0000
@@ -161,15 +161,15 @@
 /*
  * Don't force a function call overhead on these primitives...
  */
-#define __read_1(h, o)         *((u_int8_t  *)((h) + (o)))
-#define __read_2(h, o)         *((u_int16_t *)((h) + (o)))
-#define __read_4(h, o)         *((u_int32_t *)((h) + (o)))
-#define __read_8(h, o)         *((u_int64_t *)((h) + (o)))
-
-#define __write_1(h, o, v)     *((u_int8_t  *)((h) + (o))) = (v)
-#define __write_2(h, o, v)     *((u_int16_t *)((h) + (o))) = (v)
-#define __write_4(h, o, v)     *((u_int32_t *)((h) + (o))) = (v)
-#define __write_8(h, o, v)     *((u_int64_t *)((h) + (o))) = (v)
+#define __read_1(h, o)         *((volatile u_int8_t  *)((h) + (o)))
+#define __read_2(h, o)         *((volatile u_int16_t *)((h) + (o)))
+#define __read_4(h, o)         *((volatile u_int32_t *)((h) + (o)))
+#define __read_8(h, o)         *((volatile u_int64_t *)((h) + (o)))
+
+#define __write_1(h, o, v)     *((volatile u_int8_t  *)((h) + (o))) = (v)
+#define __write_2(h, o, v)     *((volatile u_int16_t *)((h) + (o))) = (v)
+#define __write_4(h, o, v)     *((volatile u_int32_t *)((h) + (o))) = (v)
+#define __write_8(h, o, v)     *((volatile u_int64_t *)((h) + (o))) = (v)
 
 bus_space_tag_t
 beb_alloc_bus_space_tag(storage)
Index: atari/le_bus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/atari/le_bus.c,v
retrieving revision 1.13
diff -u -r1.13 le_bus.c
--- atari/le_bus.c      28 Apr 2008 20:23:14 -0000      1.13
+++ atari/le_bus.c      19 Dec 2008 12:35:50 -0000
@@ -243,15 +243,15 @@
 /*
  * Don't force a function call overhead on these primitives...
  */
-#define __read_1(h, o)         *((u_int8_t *)((h) + (o)))
-#define __read_2(h, o)         swap16(*((u_int16_t *)((h) + (o))))
-#define __read_4(h, o)         swap32(*((u_int32_t *)((h) + (o))))
-#define __read_8(h, o)         bswap64(*((u_int64_t *)((h) + (o))))
-
-#define __write_1(h, o, v)     *((u_int8_t *)((h) + (o))) = (v)
-#define __write_2(h, o, v)     *((u_int16_t *)((h) + (o))) = swap16(v)
-#define __write_4(h, o, v)     *((u_int32_t *)((h) + (o))) = swap32(v)
-#define __write_8(h, o, v)     *((u_int64_t *)((h) + (o))) = bswap64(v)
+#define __read_1(h, o)         *((volatile u_int8_t *)((h) + (o)))
+#define __read_2(h, o)         swap16(*((volatile u_int16_t *)((h) + (o))))
+#define __read_4(h, o)         swap32(*((volatile u_int32_t *)((h) + (o))))
+#define __read_8(h, o)         bswap64(*((volatile u_int64_t *)((h) + (o))))
+
+#define __write_1(h, o, v)     *((volatile u_int8_t *)((h) + (o))) = (v)
+#define __write_2(h, o, v)     *((volatile u_int16_t *)((h) + (o))) = swap16(v)
+#define __write_4(h, o, v)     *((volatile u_int32_t *)((h) + (o))) = swap32(v)
+#define __write_8(h, o, v)     *((volatile u_int64_t *)((h) + (o))) = 
bswap64(v)
 
 bus_space_tag_t
 leb_alloc_bus_space_tag(storage)
@@ -486,7 +486,7 @@
        bus_space_handle_t      h;
        bus_size_t              o;
 {
-       return(*((u_int16_t *)(h + o)));
+       return(*((volatile u_int16_t *)(h + o)));
 }
 
 static u_int32_t
@@ -495,7 +495,7 @@
        bus_space_handle_t      h;
        bus_size_t              o;
 {
-       return(*((u_int32_t *)(h + o)));
+       return(*((volatile u_int32_t *)(h + o)));
 }
 
 static u_int64_t
@@ -504,7 +504,7 @@
        bus_space_handle_t      h;
        bus_size_t              o;
 {
-       return(*((u_int64_t *)(h + o)));
+       return(*((volatile u_int64_t *)(h + o)));
 }
 
 /*
@@ -521,7 +521,7 @@
        bus_size_t              o;
        u_int16_t               v;
 {
-       *((u_int16_t *)(h + o)) = v;
+       *((volatile u_int16_t *)(h + o)) = v;
 }
 
 static void
@@ -531,7 +531,7 @@
        bus_size_t              o;
        u_int32_t               v;
 {
-       *((u_int32_t *)(h + o)) = v;
+       *((volatile u_int32_t *)(h + o)) = v;
 }
 
 static void
@@ -541,7 +541,7 @@
        bus_size_t              o;
        u_int64_t               v;
 {
-       *((u_int64_t *)(h + o)) = v;
+       *((volatile u_int64_t *)(h + o)) = v;
 }
 
 /*
@@ -668,7 +668,7 @@
        u_int16_t               *a;
 {
        for (; c; a++, c--)
-               *a = *((u_int16_t *)(h + o));
+               *a = *((volatile u_int16_t *)(h + o));
 }
 
 static void
@@ -679,7 +679,7 @@
        u_int32_t               *a;
 {
        for (; c; a++, c--)
-               *a = *((u_int32_t *)(h + o));
+               *a = *((volatile u_int32_t *)(h + o));
 }
 
 static void
@@ -690,7 +690,7 @@
        u_int64_t               *a;
 {
        for (; c; a++, c--)
-               *a = *((u_int64_t *)(h + o));
+               *a = *((volatile u_int64_t *)(h + o));
 }
 
 /*
@@ -710,7 +710,7 @@
        const u_int16_t         *a;
 {
        for (; c; a++, c--)
-               *((u_int16_t *)(h + o)) = *a;
+               *((volatile u_int16_t *)(h + o)) = *a;
 }
 
 static void
@@ -721,7 +721,7 @@
        const u_int32_t         *a;
 {
        for (; c; a++, c--)
-               *((u_int32_t *)(h + o)) = *a;
+               *((volatile u_int32_t *)(h + o)) = *a;
 }
 
 static void
@@ -732,7 +732,7 @@
        const u_int64_t         *a;
 {
        for (; c; a++, c--)
-               *((u_int64_t *)(h + o)) = *a;
+               *((volatile u_int64_t *)(h + o)) = *a;
 }
 
 /*
@@ -858,7 +858,7 @@
        u_int16_t               *a;
 {
        for (; c; a++, o += 2, c--)
-               *a = *(u_int16_t *)(h + o);
+               *a = *(volatile u_int16_t *)(h + o);
 }
 
 static void
@@ -869,7 +869,7 @@
        u_int32_t               *a;
 {
        for (; c; a++, o += 4, c--)
-               *a = *(u_int32_t *)(h + o);
+               *a = *(volatile u_int32_t *)(h + o);
 }
 
 static void
@@ -880,7 +880,7 @@
        u_int64_t               *a;
 {
        for (; c; a++, o += 8, c--)
-               *a = *(u_int64_t *)(h + o);
+               *a = *(volatile u_int64_t *)(h + o);
 }
 
 /*
@@ -900,7 +900,7 @@
        const u_int16_t         *a;
 {
        for (; c; a++, o += 2, c--)
-               *((u_int16_t *)(h + o)) = *a;
+               *((volatile u_int16_t *)(h + o)) = *a;
 }
 
 static void
@@ -911,7 +911,7 @@
        const u_int32_t         *a;
 {
        for (; c; a++, o += 4, c--)
-               *((u_int32_t *)(h + o)) = *a;
+               *((volatile u_int32_t *)(h + o)) = *a;
 }
 
 static void
@@ -922,7 +922,7 @@
        const u_int64_t         *a;
 {
        for (; c; a++, o += 8, c--)
-               *((u_int64_t *)(h + o)) = *a;
+               *((volatile u_int64_t *)(h + o)) = *a;
 }
 
 /*
@@ -954,7 +954,7 @@
 {
        v = swap16(v);
        for (; c; c--)
-               *((u_int16_t *)(h + o)) = v;
+               *((volatile u_int16_t *)(h + o)) = v;
 }
 
 static void
@@ -966,7 +966,7 @@
 {
        v = swap32(v);
        for (; c; c--)
-               *((u_int32_t *)(h + o)) = v;
+               *((volatile u_int32_t *)(h + o)) = v;
 }
 
 static void
@@ -978,7 +978,7 @@
 {
        v = bswap64(v);
        for (; c; c--)
-               *((u_int64_t *)(h + o)) = v;
+               *((volatile u_int64_t *)(h + o)) = v;
 }
 
 /*
@@ -1009,7 +1009,7 @@
 {
        v = swap16(v);
        for (; c; o += 2, c--)
-               *((u_int16_t *)(h + o)) = v;
+               *((volatile u_int16_t *)(h + o)) = v;
 }
 
 static void
@@ -1021,7 +1021,7 @@
 {
        v = swap32(v);
        for (; c; o += 4, c--)
-               *((u_int32_t *)(h + o)) = v;
+               *((volatile u_int32_t *)(h + o)) = v;
 }
 
 static void
@@ -1033,5 +1033,5 @@
 {
        v = bswap64(v);
        for (; c; o += 8, c--)
-               *((u_int64_t *)(h + o)) = v;
+               *((volatile u_int64_t *)(h + o)) = v;
 }
Index: atari/mainbus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/atari/mainbus.c,v
retrieving revision 1.6
diff -u -r1.6 mainbus.c
--- atari/mainbus.c     28 Apr 2008 20:23:15 -0000      1.6
+++ atari/mainbus.c     19 Dec 2008 12:35:50 -0000
@@ -142,25 +142,25 @@
        ((u_long)(base) + ((off) << (stride)) + (wm))
 
 #define __read_1(t, h, o)      \
-       (*((u_int8_t *)(calc_addr(h, o, (t)->stride, (t)->wo_1))))
+       (*((volatile u_int8_t *)(calc_addr(h, o, (t)->stride, (t)->wo_1))))
 #define __read_2(t, h, o)      \
-       (*((u_int16_t *)(calc_addr(h, o, (t)->stride, (t)->wo_2))))
+       (*((volatile u_int16_t *)(calc_addr(h, o, (t)->stride, (t)->wo_2))))
 #define        __read_4(t, h, o)       \
-       (*((u_int32_t *)(calc_addr(h, o, (t)->stride, (t)->wo_4))))
+       (*((volatile u_int32_t *)(calc_addr(h, o, (t)->stride, (t)->wo_4))))
 #define        __read_8(t, h, o)       \
-       (*((u_int64_t *)(calc_addr(h, o, (t)->stride, (t)->wo_8))))
+       (*((volatile u_int64_t *)(calc_addr(h, o, (t)->stride, (t)->wo_8))))
 
 #define __write_1(t, h, o, v)  \
-    *((u_int8_t *)(calc_addr(h, o, (t)->stride, (t)->wo_1))) = v
+    *((volatile u_int8_t *)(calc_addr(h, o, (t)->stride, (t)->wo_1))) = v
 
 #define __write_2(t, h, o, v)  \
-    *((u_int16_t *)(calc_addr(h, o, (t)->stride, (t)->wo_2))) = v
+    *((volatile u_int16_t *)(calc_addr(h, o, (t)->stride, (t)->wo_2))) = v
 
 #define __write_4(t, h, o, v)  \
-    *((u_int32_t *)(calc_addr(h, o, (t)->stride, (t)->wo_4))) = v
+    *((volatile u_int32_t *)(calc_addr(h, o, (t)->stride, (t)->wo_4))) = v
 
 #define __write_8(t, h, o, v)  \
-    *((u_int64_t *)(calc_addr(h, o, (t)->stride, (t)->wo_8))) = v
+    *((volatile u_int64_t *)(calc_addr(h, o, (t)->stride, (t)->wo_8))) = v
 
 bus_space_tag_t
 mb_alloc_bus_space_tag()
@@ -364,9 +364,9 @@
        bus_size_t              o, c;
        u_int8_t                *a;
 {
-       u_int8_t        *ba;
+       volatile u_int8_t       *ba;
 
-       ba = (u_int8_t *)calc_addr(h, o, t->stride, t->wo_1);
+       ba = (volatile u_int8_t *)calc_addr(h, o, t->stride, t->wo_1);
        for (; c; a++, c--)
                *a = *ba;
 }
@@ -378,9 +378,9 @@
        bus_size_t              o, c;
        u_int16_t               *a;
 {
-       u_int16_t       *ba;
+       volatile u_int16_t      *ba;
 
-       ba = (u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
+       ba = (volatile u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
        for (; c; a++, c--)
                *a = *ba;
 }
@@ -392,9 +392,9 @@
        bus_size_t              o, c;
        u_int32_t               *a;
 {
-       u_int32_t       *ba;
+       volatile u_int32_t      *ba;
 
-       ba = (u_int32_t *)calc_addr(h, o, t->stride, t->wo_4);
+       ba = (volatile u_int32_t *)calc_addr(h, o, t->stride, t->wo_4);
        for (; c; a++, c--)
                *a = *ba;
 }
@@ -406,9 +406,9 @@
        bus_size_t              o, c;
        u_int64_t               *a;
 {
-       u_int64_t       *ba;
+       volatile u_int64_t      *ba;
 
-       ba = (u_int64_t *)calc_addr(h, o, t->stride, t->wo_8);
+       ba = (volatile u_int64_t *)calc_addr(h, o, t->stride, t->wo_8);
        for (; c; a++, c--)
                *a = *ba;
 }
@@ -420,9 +420,9 @@
        bus_size_t              o, c;
        const u_int8_t          *a;
 {
-       u_int8_t        *ba;
+       volatile u_int8_t       *ba;
 
-       ba = (u_int8_t *)calc_addr(h, o, t->stride, t->wo_1);
+       ba = (volatile u_int8_t *)calc_addr(h, o, t->stride, t->wo_1);
        for (; c; a++, c--)
                *ba = *a;
 }
@@ -434,9 +434,9 @@
        bus_size_t              o, c;
        const u_int16_t         *a;
 {
-       u_int16_t       *ba;
+       volatile u_int16_t      *ba;
 
-       ba = (u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
+       ba = (volatile u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
        for (; c; a++, c--)
                *ba = *a;
 }
@@ -448,9 +448,9 @@
        bus_size_t              o, c;
        const u_int32_t         *a;
 {
-       u_int32_t       *ba;
+       volatile u_int32_t      *ba;
 
-       ba = (u_int32_t *)calc_addr(h, o, t->stride, t->wo_4);
+       ba = (volatile u_int32_t *)calc_addr(h, o, t->stride, t->wo_4);
        for (; c; a++, c--)
                *ba = *a;
 }
@@ -462,9 +462,9 @@
        bus_size_t              o, c;
        const u_int64_t         *a;
 {
-       u_int64_t       *ba;
+       volatile u_int64_t      *ba;
 
-       ba = (u_int64_t *)calc_addr(h, o, t->stride, t->wo_8);
+       ba = (volatile u_int64_t *)calc_addr(h, o, t->stride, t->wo_8);
        for (; c; a++, c--)
                *ba = *a;
 }
@@ -590,9 +590,9 @@
        bus_size_t              o, c;
        u_int8_t                v;
 {
-       u_int8_t        *ba;
+       volatile u_int8_t       *ba;
 
-       ba = (u_int8_t *)calc_addr(h, o, t->stride, t->wo_1);
+       ba = (volatile u_int8_t *)calc_addr(h, o, t->stride, t->wo_1);
        for (; c; c--)
                *ba = v;
 }
@@ -604,9 +604,9 @@
        bus_size_t              o, c;
        u_int16_t               v;
 {
-       u_int16_t       *ba;
+       volatile u_int16_t      *ba;
 
-       ba = (u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
+       ba = (volatile u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
        for (; c; c--)
                *ba = v;
 }
@@ -618,9 +618,9 @@
        bus_size_t              o, c;
        u_int32_t               v;
 {
-       u_int32_t       *ba;
+       volatile u_int32_t      *ba;
 
-       ba = (u_int32_t *)calc_addr(h, o, t->stride, t->wo_4);
+       ba = (volatile u_int32_t *)calc_addr(h, o, t->stride, t->wo_4);
        for (; c; c--)
                *ba = v;
 }
@@ -632,9 +632,9 @@
        bus_size_t              o, c;
        u_int64_t               v;
 {
-       u_int64_t       *ba;
+       volatile u_int64_t      *ba;
 
-       ba = (u_int64_t *)calc_addr(h, o, t->stride, t->wo_8);
+       ba = (volatile u_int64_t *)calc_addr(h, o, t->stride, t->wo_8);
        for (; c; c--)
                *ba = v;
 }
Index: dev/wdc_mb.c
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/dev/wdc_mb.c,v
retrieving revision 1.32
diff -u -r1.32 wdc_mb.c
--- dev/wdc_mb.c        28 Apr 2008 20:23:15 -0000      1.32
+++ dev/wdc_mb.c        19 Dec 2008 12:35:50 -0000
@@ -277,9 +277,9 @@
        bus_size_t              o, c;
        u_int16_t               *a;
 {
-       u_int16_t       *ba;
+       volatile u_int16_t      *ba;
 
-       ba = (u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
+       ba = (volatile u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
        for (; c; a++, c--)
                *a = bswap16(*ba);
 }
@@ -291,9 +291,9 @@
        bus_size_t              o, c;
        const u_int16_t         *a;
 {
-       u_int16_t       *ba;
+       volatile u_int16_t      *ba;
 
-       ba = (u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
+       ba = (volatile u_int16_t *)calc_addr(h, o, t->stride, t->wo_2);
        for (; c; a++, c--)
                *ba = bswap16(*a);
 }
 
---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index