Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/arch/powerpc Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/832c1c4b1d70
branches:  netbsd-9
changeset: 745238:832c1c4b1d70
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Feb 25 20:22:14 2020 +0000

description:
Pull up following revision(s) (requested by rin in ticket #730):

        sys/arch/powerpc/conf/files.powerpc: revision 1.93
        sys/arch/powerpc/include/pio.h: revision 1.8
        sys/arch/powerpc/pic/intr.c: revision 1.27
        sys/arch/powerpc/powerpc/bus_dma.c: revision 1.50
        sys/arch/powerpc/powerpc/pio_subr.S: revision 1.17

Add PPC_IBM440 flag as 440 is significantly different from 40x processors.
(It may be more easily supported by booke than by ibm4xx.)

 -

eieio is implemented as sync on 40x. Therefore, "sync; eieio" and
"eieio; sync" can be replaced by a single sync.

diffstat:

 sys/arch/powerpc/conf/files.powerpc |   4 +-
 sys/arch/powerpc/include/pio.h      |  51 +++++++++++++++++++++---------------
 sys/arch/powerpc/pic/intr.c         |  25 ++++++++++++-----
 sys/arch/powerpc/powerpc/bus_dma.c  |  10 +++++--
 sys/arch/powerpc/powerpc/pio_subr.S |   6 +++-
 5 files changed, 61 insertions(+), 35 deletions(-)

diffs (truncated from 357 to 300 lines):

diff -r 630a5b8c9179 -r 832c1c4b1d70 sys/arch/powerpc/conf/files.powerpc
--- a/sys/arch/powerpc/conf/files.powerpc       Tue Feb 25 20:14:04 2020 +0000
+++ b/sys/arch/powerpc/conf/files.powerpc       Tue Feb 25 20:22:14 2020 +0000
@@ -1,9 +1,9 @@
-#      $NetBSD: files.powerpc,v 1.92 2019/04/06 03:06:26 thorpej Exp $
+#      $NetBSD: files.powerpc,v 1.92.4.1 2020/02/25 20:22:14 martin Exp $
 
 defflag        opt_altivec.h   ALTIVEC K_ALTIVEC PPC_HAVE_SPE
 defflag        opt_openpic.h   OPENPIC_DISTRIBUTE
 defparam opt_ppcparam.h        L2CR_CONFIG L3CR_CONFIG INTSTK CLOCKBASE VERBOSE_INITPPC
-defflag        opt_ppcarch.h   PPC_OEA PPC_OEA601 PPC_OEA64 PPC_OEA64_BRIDGE PPC_MPC8XX PPC_IBM4XX PPC_IBM403 PPC_BOOKE
+defflag        opt_ppcarch.h   PPC_OEA PPC_OEA601 PPC_OEA64 PPC_OEA64_BRIDGE PPC_MPC8XX PPC_IBM4XX PPC_IBM403 PPC_IBM440 PPC_BOOKE
 defflag opt_ppccache.h CACHE_PROTO_MEI
 defflag opt_pmap.h     PMAPDEBUG PMAPCHECK PMAPCOUNTERS PMAP_MINIMALTLB
 defparam opt_pmap.h    PTEGCOUNT PMAP_MEMLIMIT
diff -r 630a5b8c9179 -r 832c1c4b1d70 sys/arch/powerpc/include/pio.h
--- a/sys/arch/powerpc/include/pio.h    Tue Feb 25 20:14:04 2020 +0000
+++ b/sys/arch/powerpc/include/pio.h    Tue Feb 25 20:22:14 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pio.h,v 1.7 2012/01/30 23:34:58 matt Exp $ */
+/*     $NetBSD: pio.h,v 1.7.52.1 2020/02/25 20:22:14 martin Exp $ */
 /*     $OpenBSD: pio.h,v 1.1 1997/10/13 10:53:47 pefo Exp $ */
 
 /*
@@ -39,6 +39,13 @@
  * I/O macros.
  */
 
+#if defined(PPC_IBM4XX) && !defined(PPC_IBM440)
+/* eieio is implemented as sync */
+#define IO_BARRIER() __asm volatile("sync")
+#else
+#define IO_BARRIER() __asm volatile("eieio; sync")
+#endif
+
 static __inline void __outb(volatile uint8_t *a, uint8_t v);
 static __inline void __outw(volatile uint16_t *a, uint16_t v);
 static __inline void __outl(volatile uint32_t *a, uint32_t v);
@@ -64,35 +71,35 @@
 __outb(volatile uint8_t *a, uint8_t v)
 {
        *a = v;
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
 }
 
 static __inline void
 __outw(volatile uint16_t *a, uint16_t v)
 {
        *a = v;
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
 }
 
 static __inline void
 __outl(volatile uint32_t *a, uint32_t v)
 {
        *a = v;
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
 }
 
 static __inline void
 __outwrb(volatile uint16_t *a, uint16_t v)
 {
        __asm volatile("sthbrx %0, 0, %1" :: "r"(v), "r"(a));
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
 }
 
 static __inline void
 __outlrb(volatile uint32_t *a, uint32_t v)
 {
        __asm volatile("stwbrx %0, 0, %1" :: "r"(v), "r"(a));
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
 }
 
 static __inline uint8_t
@@ -101,7 +108,7 @@
        uint8_t _v_;
 
        _v_ = *a;
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
        return _v_;
 }
 
@@ -111,7 +118,7 @@
        uint16_t _v_;
 
        _v_ = *a;
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
        return _v_;
 }
 
@@ -121,7 +128,7 @@
        uint32_t _v_;
 
        _v_ = *a;
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
        return _v_;
 }
 
@@ -131,7 +138,7 @@
        uint16_t _v_;
 
        __asm volatile("lhbrx %0, 0, %1" : "=r"(_v_) : "r"(a));
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
        return _v_;
 }
 
@@ -141,7 +148,7 @@
        uint32_t _v_;
 
        __asm volatile("lwbrx %0, 0, %1" : "=r"(_v_) : "r"(a));
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
        return _v_;
 }
 
@@ -175,7 +182,7 @@
 {
        while (c--)
                *a = *s++;
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
 }
 
 static __inline void
@@ -183,7 +190,7 @@
 {
        while (c--)
                *a = *s++;
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
 }
 
 static __inline void
@@ -191,7 +198,7 @@
 {
        while (c--)
                *a = *s++;
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
 }
 
 static __inline void
@@ -199,7 +206,7 @@
 {
        while (c--)
                __asm volatile("sthbrx %0, 0, %1" :: "r"(*s++), "r"(a));
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
 }
 
 static __inline void
@@ -207,7 +214,7 @@
 {
        while (c--)
                __asm volatile("stwbrx %0, 0, %1" :: "r"(*s++), "r"(a));
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
 }
 
 static __inline void
@@ -215,7 +222,7 @@
 {
        while (c--)
                *d++ = *a;
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
 }
 
 static __inline void
@@ -223,7 +230,7 @@
 {
        while (c--)
                *d++ = *a;
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
 }
 
 static __inline void
@@ -231,7 +238,7 @@
 {
        while (c--)
                *d++ = *a;
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
 }
 
 static __inline void
@@ -239,7 +246,7 @@
 {
        while (c--)
                __asm volatile("lhbrx %0, 0, %1" : "=r"(*d++) : "r"(a));
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
 }
 
 static __inline void
@@ -247,7 +254,7 @@
 {
        while (c--)
                __asm volatile("lwbrx %0, 0, %1" : "=r"(*d++) : "r"(a));
-       __asm volatile("eieio; sync");
+       IO_BARRIER();
 }
 
 #define        outsb(a,s,c)    (__outsb((volatile uint8_t *)(a), s, c))
@@ -274,4 +281,6 @@
 #define        inslrb(a,d,c)   (__inslrb((volatile uint32_t *)(a), d, c))
 #define        ins32rb(a,d,c)  inslrb(a,d,c)
 
+#undef IO_BARRIER
+
 #endif /*_POWERPC_PIO_H_*/
diff -r 630a5b8c9179 -r 832c1c4b1d70 sys/arch/powerpc/pic/intr.c
--- a/sys/arch/powerpc/pic/intr.c       Tue Feb 25 20:14:04 2020 +0000
+++ b/sys/arch/powerpc/pic/intr.c       Tue Feb 25 20:22:14 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intr.c,v 1.26 2018/09/03 16:29:26 riastradh Exp $ */
+/*     $NetBSD: intr.c,v 1.26.4.1 2020/02/25 20:22:14 martin Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.26 2018/09/03 16:29:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.26.4.1 2020/02/25 20:22:14 martin Exp $");
 
 #include "opt_interrupt.h"
 #include "opt_multiprocessor.h"
@@ -60,6 +60,13 @@
 
 #define        PIC_VIRQ_LEGAL_P(x)     ((u_int)(x) < NVIRQ)
 
+#if defined(PPC_IBM4XX) && !defined(PPC_IBM440)
+/* eieio is implemented as sync */
+#define REORDER_PROTECT() __asm volatile("sync")
+#else
+#define REORDER_PROTECT() __asm volatile("sync; eieio")
+#endif
+
 struct pic_ops *pics[MAX_PICS];
 int num_pics = 0;
 int max_base = 0;
@@ -608,11 +615,11 @@
        int ocpl;
 
        if (ncpl == ci->ci_cpl) return ncpl;
-       __asm volatile("sync; eieio");  /* don't reorder.... */
+       REORDER_PROTECT();
        ocpl = ci->ci_cpl;
        KASSERT(ncpl < NIPL);
        ci->ci_cpl = uimax(ncpl, ocpl);
-       __asm volatile("sync; eieio");  /* reorder protect */
+       REORDER_PROTECT();
        __insn_barrier();
        return ocpl;
 }
@@ -635,12 +642,12 @@
        struct cpu_info *ci = curcpu();
 
        __insn_barrier();
-       __asm volatile("sync; eieio");  /* reorder protect */
+       REORDER_PROTECT();
        ci->ci_cpl = ncpl;
        if (have_pending_intr_p(ci, ncpl))
                pic_do_pending_int();
 
-       __asm volatile("sync; eieio");  /* reorder protect */
+       REORDER_PROTECT();
 }
 
 int
@@ -650,12 +657,12 @@
        int ocpl;
 
        __insn_barrier();
-       __asm volatile("sync; eieio");  /* reorder protect */
+       REORDER_PROTECT();
        ocpl = ci->ci_cpl;
        ci->ci_cpl = ncpl;
        if (have_pending_intr_p(ci, ncpl))
                pic_do_pending_int();
-       __asm volatile("sync; eieio");  /* reorder protect */
+       REORDER_PROTECT();
        return ocpl;
 }
 
@@ -879,3 +886,5 @@
 {
        return EOPNOTSUPP;



Home | Main Index | Thread Index | Old Index