Module Name:    src
Committed By:   martin
Date:           Tue Feb 25 20:22:14 UTC 2020

Modified Files:
        src/sys/arch/powerpc/conf [netbsd-9]: files.powerpc
        src/sys/arch/powerpc/include [netbsd-9]: pio.h
        src/sys/arch/powerpc/pic [netbsd-9]: intr.c
        src/sys/arch/powerpc/powerpc [netbsd-9]: bus_dma.c pio_subr.S

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.92.4.1 src/sys/arch/powerpc/conf/files.powerpc
cvs rdiff -u -r1.7 -r1.7.52.1 src/sys/arch/powerpc/include/pio.h
cvs rdiff -u -r1.26 -r1.26.4.1 src/sys/arch/powerpc/pic/intr.c
cvs rdiff -u -r1.49 -r1.49.4.1 src/sys/arch/powerpc/powerpc/bus_dma.c
cvs rdiff -u -r1.16 -r1.16.32.1 src/sys/arch/powerpc/powerpc/pio_subr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/powerpc/conf/files.powerpc
diff -u src/sys/arch/powerpc/conf/files.powerpc:1.92 src/sys/arch/powerpc/conf/files.powerpc:1.92.4.1
--- src/sys/arch/powerpc/conf/files.powerpc:1.92	Sat Apr  6 03:06:26 2019
+++ src/sys/arch/powerpc/conf/files.powerpc	Tue Feb 25 20:22:14 2020
@@ -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

Index: src/sys/arch/powerpc/include/pio.h
diff -u src/sys/arch/powerpc/include/pio.h:1.7 src/sys/arch/powerpc/include/pio.h:1.7.52.1
--- src/sys/arch/powerpc/include/pio.h:1.7	Mon Jan 30 23:34:58 2012
+++ src/sys/arch/powerpc/include/pio.h	Tue Feb 25 20:22:14 2020
@@ -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
 {
 	while (c--)
 		*a = *s++;
-	__asm volatile("eieio; sync");
+	IO_BARRIER();
 }
 
 static __inline void
@@ -183,7 +190,7 @@ __outsw(volatile uint16_t *a, const uint
 {
 	while (c--)
 		*a = *s++;
-	__asm volatile("eieio; sync");
+	IO_BARRIER();
 }
 
 static __inline void
@@ -191,7 +198,7 @@ __outsl(volatile uint32_t *a, const uint
 {
 	while (c--)
 		*a = *s++;
-	__asm volatile("eieio; sync");
+	IO_BARRIER();
 }
 
 static __inline void
@@ -199,7 +206,7 @@ __outswrb(volatile uint16_t *a, const ui
 {
 	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 ui
 {
 	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, 
 {
 	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
 {
 	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
 {
 	while (c--)
 		*d++ = *a;
-	__asm volatile("eieio; sync");
+	IO_BARRIER();
 }
 
 static __inline void
@@ -239,7 +246,7 @@ __inswrb(volatile uint16_t *a, uint16_t 
 {
 	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 
 {
 	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 
 #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_*/

Index: src/sys/arch/powerpc/pic/intr.c
diff -u src/sys/arch/powerpc/pic/intr.c:1.26 src/sys/arch/powerpc/pic/intr.c:1.26.4.1
--- src/sys/arch/powerpc/pic/intr.c:1.26	Mon Sep  3 16:29:26 2018
+++ src/sys/arch/powerpc/pic/intr.c	Tue Feb 25 20:22:14 2020
@@ -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.2
 
 #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 
 {
 	return EOPNOTSUPP;
 }
+
+#undef REORDER_PROTECT

Index: src/sys/arch/powerpc/powerpc/bus_dma.c
diff -u src/sys/arch/powerpc/powerpc/bus_dma.c:1.49 src/sys/arch/powerpc/powerpc/bus_dma.c:1.49.4.1
--- src/sys/arch/powerpc/powerpc/bus_dma.c:1.49	Mon Sep  3 16:29:26 2018
+++ src/sys/arch/powerpc/powerpc/bus_dma.c	Tue Feb 25 20:22:14 2020
@@ -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 
 #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")

Index: src/sys/arch/powerpc/powerpc/pio_subr.S
diff -u src/sys/arch/powerpc/powerpc/pio_subr.S:1.16 src/sys/arch/powerpc/powerpc/pio_subr.S:1.16.32.1
--- src/sys/arch/powerpc/powerpc/pio_subr.S:1.16	Tue Jul 29 16:19:45 2014
+++ src/sys/arch/powerpc/powerpc/pio_subr.S	Tue Feb 25 20:22:14 2020
@@ -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> */

Reply via email to