diff options
| author | martin <martin@NetBSD.org> | 2020-02-25 20:22:14 +0000 |
|---|---|---|
| committer | martin <martin@NetBSD.org> | 2020-02-25 20:22:14 +0000 |
| commit | 68fbc0b0f3306e1e8bd0da757d0eec08096ac7d3 (patch) | |
| tree | 47bbefa9a06a32e6761eb771d7fa32cae2dc8fd6 /sys | |
| parent | e3fa4c72a6bef45463fd45e38502f459338cf35c (diff) | |
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 (limited to 'sys')
| -rw-r--r-- | sys/arch/powerpc/conf/files.powerpc | 4 | ||||
| -rw-r--r-- | sys/arch/powerpc/include/pio.h | 51 | ||||
| -rw-r--r-- | sys/arch/powerpc/pic/intr.c | 25 | ||||
| -rw-r--r-- | sys/arch/powerpc/powerpc/bus_dma.c | 10 | ||||
| -rw-r--r-- | sys/arch/powerpc/powerpc/pio_subr.S | 6 |
5 files changed, 61 insertions, 35 deletions
diff --git a/sys/arch/powerpc/conf/files.powerpc b/sys/arch/powerpc/conf/files.powerpc index 03aa5164bc1..9a811dfe389 100644 --- a/sys/arch/powerpc/conf/files.powerpc +++ b/sys/arch/powerpc/conf/files.powerpc @@ -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 --git a/sys/arch/powerpc/include/pio.h b/sys/arch/powerpc/include/pio.h index f48ecf787ad..8cc6a37db99 100644 --- a/sys/arch/powerpc/include/pio.h +++ b/sys/arch/powerpc/include/pio.h @@ -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 @@ static __inline void __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 @@ __inb(volatile uint8_t *a) uint8_t _v_; _v_ = *a; - __asm volatile("eieio; sync"); + IO_BARRIER(); return _v_; } @@ -111,7 +118,7 @@ __inw(volatile uint16_t *a) uint16_t _v_; _v_ = *a; - __asm volatile("eieio; sync"); + IO_BARRIER(); return _v_; } @@ -121,7 +128,7 @@ __inl(volatile uint32_t *a) uint32_t _v_; _v_ = *a; - __asm volatile("eieio; sync"); + IO_BARRIER(); return _v_; } @@ -131,7 +138,7 @@ __inwrb(volatile uint16_t *a) 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 @@ __inlrb(volatile uint32_t *a) 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 @@ __outsb(volatile uint8_t *a, const uint8_t *s, size_t c) { while (c--) *a = *s++; - __asm volatile("eieio; sync"); + IO_BARRIER(); } static __inline void @@ -183,7 +190,7 @@ __outsw(volatile uint16_t *a, const uint16_t *s, size_t c) { while (c--) *a = *s++; - __asm volatile("eieio; sync"); + IO_BARRIER(); } static __inline void @@ -191,7 +198,7 @@ __outsl(volatile uint32_t *a, const uint32_t *s, size_t c) { while (c--) *a = *s++; - __asm volatile("eieio; sync"); + IO_BARRIER(); } static __inline void @@ -199,7 +206,7 @@ __outswrb(volatile uint16_t *a, const uint16_t *s, size_t c) { 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 @@ __outslrb(volatile uint32_t *a, const uint32_t *s, size_t c) { 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 @@ __insb(volatile uint8_t *a, uint8_t *d, size_t c) { while (c--) *d++ = *a; - __asm volatile("eieio; sync"); + IO_BARRIER(); } static __inline void @@ -223,7 +230,7 @@ __insw(volatile uint16_t *a, uint16_t *d, size_t c) { while (c--) *d++ = *a; - __asm volatile("eieio; sync"); + IO_BARRIER(); } static __inline void @@ -231,7 +238,7 @@ __insl(volatile uint32_t *a, uint32_t *d, size_t c) { while (c--) *d++ = *a; - __asm volatile("eieio; sync"); + IO_BARRIER(); } static __inline void @@ -239,7 +246,7 @@ __inswrb(volatile uint16_t *a, uint16_t *d, size_t c) { 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 @@ __inslrb(volatile uint32_t *a, uint32_t *d, size_t c) { 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 @@ __inslrb(volatile uint32_t *a, uint32_t *d, size_t c) #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 --git a/sys/arch/powerpc/pic/intr.c b/sys/arch/powerpc/pic/intr.c index fb018efc04d..71812981ee5 100644 --- a/sys/arch/powerpc/pic/intr.c +++ b/sys/arch/powerpc/pic/intr.c @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.26 2018/09/03 16:29:26 riastradh Exp $"); #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 @@ splraise(int ncpl) 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 @@ splx(int ncpl) 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 @@ spllower(int ncpl) 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 @@ interrupt_distribute_handler(const char *intrid, const kcpuset_t *newset, { return EOPNOTSUPP; } + +#undef REORDER_PROTECT diff --git a/sys/arch/powerpc/powerpc/bus_dma.c b/sys/arch/powerpc/powerpc/bus_dma.c index f3433325fb6..9e1dc313bb0 100644 --- a/sys/arch/powerpc/powerpc/bus_dma.c +++ b/sys/arch/powerpc/powerpc/bus_dma.c @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma.c,v 1.49 2018/09/03 16:29:26 riastradh Exp $ */ +/* $NetBSD: bus_dma.c,v 1.49.4.1 2020/02/25 20:22:14 martin Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #define _POWERPC_BUS_DMA_PRIVATE #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.49 2018/09/03 16:29:26 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.49.4.1 2020/02/25 20:22:14 martin Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -47,9 +47,13 @@ __KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.49 2018/09/03 16:29:26 riastradh Exp $ #include <uvm/uvm.h> #include <uvm/uvm_physseg.h> -#ifdef PPC_BOOKE +#if defined(PPC_BOOKE) #define EIEIO __asm volatile("mbar\t0") #define SYNC __asm volatile("msync") +#elif defined(PPC_IBM4XX) && !defined(PPC_IBM440) +/* eieio is implemented as sync */ +#define EIEIO __asm volatile("eieio") +#define SYNC /* nothing */ #else #define EIEIO __asm volatile("eieio") #define SYNC __asm volatile("sync") diff --git a/sys/arch/powerpc/powerpc/pio_subr.S b/sys/arch/powerpc/powerpc/pio_subr.S index d7c5e20f774..dcc03b10087 100644 --- a/sys/arch/powerpc/powerpc/pio_subr.S +++ b/sys/arch/powerpc/powerpc/pio_subr.S @@ -1,4 +1,4 @@ -/* $NetBSD: pio_subr.S,v 1.16 2014/07/29 16:19:45 joerg Exp $ */ +/* $NetBSD: pio_subr.S,v 1.16.32.1 2020/02/25 20:22:14 martin Exp $ */ /* * Copyright (c) 2003 Matt Thomas @@ -41,7 +41,11 @@ #endif #undef DBGSYNC +#if defined(PPC_IBM4XX) && !defined(PPC_IBM440) +#define DBGSYNC /* nothing; eieio is implemented as sync */ +#else #define DBGSYNC msync +#endif #define eieio mbar 0 /* LINTSTUB: include <sys/param.h> */ |
