summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2021-02-27 01:16:52 +0000
committerthorpej <thorpej@NetBSD.org>2021-02-27 01:16:52 +0000
commit1efadc9fec139bfba3045af94034ce680a25d171 (patch)
tree8cfa9fde62c0ed1823674dcf708d695053ed76ba /sys
parent77a65f26fce993cf4e5af1cd18fe590bcda77460 (diff)
Rather than putting it on the caller, just let oea_iobat_add() decide
whether to call mpc601_ioseg_add().
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/powerpc/include/oea/sr_601.h6
-rw-r--r--sys/arch/powerpc/oea/oea_machdep.c38
2 files changed, 17 insertions, 27 deletions
diff --git a/sys/arch/powerpc/include/oea/sr_601.h b/sys/arch/powerpc/include/oea/sr_601.h
index 140828cd9b7..837177fb8f1 100644
--- a/sys/arch/powerpc/include/oea/sr_601.h
+++ b/sys/arch/powerpc/include/oea/sr_601.h
@@ -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 --git a/sys/arch/powerpc/oea/oea_machdep.c b/sys/arch/powerpc/oea/oea_machdep.c
index fd462192206..60a837a5938 100644
--- a/sys/arch/powerpc/oea/oea_machdep.c
+++ b/sys/arch/powerpc/oea/oea_machdep.c
@@ -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 @@ oea_init(void (*handler)(void))
}
#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 @@ oea_iobat_add(paddr_t pa, register_t len)
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 @@ oea_batinit(paddr_t pa, ...)
* 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);
/*