Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/oea Rather than putting it on the caller, j...



details:   https://anonhg.NetBSD.org/src/rev/050e2f128939
branches:  trunk
changeset: 959841:050e2f128939
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Feb 27 01:16:52 2021 +0000

description:
Rather than putting it on the caller, just let oea_iobat_add() decide
whether to call mpc601_ioseg_add().

diffstat:

 sys/arch/powerpc/include/oea/sr_601.h |   6 +----
 sys/arch/powerpc/oea/oea_machdep.c    |  38 ++++++++++++++--------------------
 2 files changed, 17 insertions(+), 27 deletions(-)

diffs (95 lines):

diff -r fa0ada218b53 -r 050e2f128939 sys/arch/powerpc/include/oea/sr_601.h
--- a/sys/arch/powerpc/include/oea/sr_601.h     Fri Feb 26 21:15:20 2021 +0000
+++ b/sys/arch/powerpc/include/oea/sr_601.h     Sat Feb 27 01:16:52 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sr_601.h,v 1.5 2008/04/28 20:23:32 martin Exp $        */
+/*     $NetBSD: sr_601.h,v 1.6 2021/02/27 01:16:52 thorpej Exp $       */
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -64,8 +64,4 @@
 #define        SR601_PA_MATCH_P(sr, pa)                                \
         (((sr) & SR601_PACKET1) == ((pa) >> ADDR_SR_SHFT))
 
-#ifdef _KERNEL
-void mpc601_ioseg_add(paddr_t, register_t);
-#endif
-
 #endif /* !_POWERPC_OEA_SR_601_H_ */
diff -r fa0ada218b53 -r 050e2f128939 sys/arch/powerpc/oea/oea_machdep.c
--- a/sys/arch/powerpc/oea/oea_machdep.c        Fri Feb 26 21:15:20 2021 +0000
+++ b/sys/arch/powerpc/oea/oea_machdep.c        Sat Feb 27 01:16:52 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: oea_machdep.c,v 1.81 2020/07/06 10:34:23 rin Exp $     */
+/*     $NetBSD: oea_machdep.c,v 1.82 2021/02/27 01:16:52 thorpej Exp $ */
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.81 2020/07/06 10:34:23 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.82 2021/02/27 01:16:52 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -480,7 +480,7 @@
 }
 
 #ifdef PPC_OEA601
-void
+static void
 mpc601_ioseg_add(paddr_t pa, register_t len)
 {
        const u_int i = pa >> ADDR_SR_SHFT;
@@ -531,6 +531,14 @@
 
        KASSERT(len >= BAT_BL_8M);
 
+#ifdef PPC_OEA601
+       if (mfpvr() >> 16 == MPC601) {
+               /* Use I/O segments on the BAT-starved 601. */
+               mpc601_ioseg_add(pa, len);
+               return;
+       }
+#endif /* PPC_OEA601 */
+
        /*
         * If the caller wanted a bigger BAT than the hardware supports,
         * split it into smaller BATs.
@@ -778,29 +786,15 @@
         * registers were cleared above.
         */
 
-       va_start(ap, pa);
-
        /*
         * Add any I/O BATs specificed;
-        * use I/O segments on the BAT-starved 601.
         */
-#ifdef PPC_OEA601
-       if (cpuvers == MPC601) {
-               while (pa != 0) {
-                       register_t len = va_arg(ap, register_t);
-                       mpc601_ioseg_add(pa, len);
-                       pa = va_arg(ap, paddr_t);
-               }
-       } else
-#endif
-       {
-               while (pa != 0) {
-                       register_t len = va_arg(ap, register_t);
-                       oea_iobat_add(pa, len);
-                       pa = va_arg(ap, paddr_t);
-               }
+       va_start(ap, pa);
+       while (pa != 0) {
+               register_t len = va_arg(ap, register_t);
+               oea_iobat_add(pa, len);
+               pa = va_arg(ap, paddr_t);
        }
-
        va_end(ap);
 
        /*



Home | Main Index | Thread Index | Old Index