Module Name: src
Committed By: matt
Date: Thu Feb 16 07:59:46 UTC 2012
Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c ofwoea_machdep.c
Log Message:
Allow use of large (>256MB) bats for iobats. If XBSEN isn't present, they
will be "downsized" into multiple 256MB bats. Tested by riz.
To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/powerpc/oea/oea_machdep.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/powerpc/oea/ofwoea_machdep.c
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/oea/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.63 src/sys/arch/powerpc/oea/oea_machdep.c:1.64
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.63 Wed Feb 15 01:56:57 2012
+++ src/sys/arch/powerpc/oea/oea_machdep.c Thu Feb 16 07:59:46 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: oea_machdep.c,v 1.63 2012/02/15 01:56:57 macallan Exp $ */
+/* $NetBSD: oea_machdep.c,v 1.64 2012/02/16 07:59:46 matt Exp $ */
/*
* Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.63 2012/02/15 01:56:57 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.64 2012/02/16 07:59:46 matt Exp $");
#include "opt_ppcarch.h"
#include "opt_compat_netbsd.h"
@@ -473,12 +473,25 @@ void
oea_iobat_add(paddr_t pa, register_t len)
{
static int z = 1;
- const u_int n = __SHIFTOUT(len, (BAT_XBL|BAT_BL) & ~BAT_BL_8M);
+ const u_int n = BAT_BL_TO_SIZE(len) / BAT_BL_TO_SIZE(BAT_BL_8M);
const u_int i = BAT_VA2IDX(pa) & -n; /* in case pa was in the middle */
const int after_bat3 = (oeacpufeat & OEACPU_HIGHBAT) ? 4 : 8;
KASSERT(len >= BAT_BL_8M);
+ /*
+ * If the caller wanted a bigger BAT than the hardware supports,
+ * split it into smaller BATs.
+ */
+ if (len > BAT_BL_256M && (oeacpufeat & OEACPU_XBSEN) == 0) {
+ u_int xn = BAT_BL_TO_SIZE(len) >> 28;
+ while (xn-- > 0) {
+ oea_iobat_add(pa, BAT_BL_256M);
+ pa += 0x10000000;
+ }
+ return;
+ }
+
const register_t batl = BATL(pa, BAT_I|BAT_G, BAT_PP_RW);
const register_t batu = BATU(pa, len, BAT_Vs);
@@ -600,6 +613,7 @@ oea_batinit(paddr_t pa, ...)
va_list ap;
cpuvers = mfpvr() >> 16;
+
/*
* we need to call this before zapping BATs so OF calls work
*/
Index: src/sys/arch/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.27 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.28
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.27 Wed Feb 15 01:56:58 2012
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c Thu Feb 16 07:59:46 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.27 2012/02/15 01:56:58 macallan Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.28 2012/02/16 07:59:46 matt Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.27 2012/02/15 01:56:58 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.28 2012/02/16 07:59:46 matt Exp $");
#include "opt_ppcarch.h"
#include "opt_compat_netbsd.h"
@@ -416,15 +416,12 @@ ofwoea_batinit(void)
/*
* cover PCI and register space but not the firmware ROM
*/
- oea_batinit(0x80000000, BAT_BL_256M,
- 0x90000000, BAT_BL_256M,
- 0xa0000000, BAT_BL_256M,
- 0xb0000000, BAT_BL_256M,
+ oea_batinit(0x80000000, BAT_BL_1G,
0xf0000000, BAT_BL_128M,
0xf8000000, BAT_BL_64M,
0);
#else
- u_int16_t bitmap;
+ uint16_t bitmap;
int node, i;
node = OF_finddevice("/");