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 Allow use of large (>256MB) bats for io...



details:   https://anonhg.NetBSD.org/src/rev/13c9bef49397
branches:  trunk
changeset: 777359:13c9bef49397
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Feb 16 07:59:46 2012 +0000

description:
Allow use of large (>256MB) bats for iobats.  If XBSEN isn't present, they
will be "downsized" into multiple 256MB bats.  Tested by riz.

diffstat:

 sys/arch/powerpc/oea/oea_machdep.c    |  20 +++++++++++++++++---
 sys/arch/powerpc/oea/ofwoea_machdep.c |  11 ++++-------
 2 files changed, 21 insertions(+), 10 deletions(-)

diffs (89 lines):

diff -r d215ff3ee801 -r 13c9bef49397 sys/arch/powerpc/oea/oea_machdep.c
--- a/sys/arch/powerpc/oea/oea_machdep.c        Thu Feb 16 06:52:03 2012 +0000
+++ b/sys/arch/powerpc/oea/oea_machdep.c        Thu Feb 16 07:59:46 2012 +0000
@@ -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 @@
 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 @@
        va_list ap;
 
        cpuvers = mfpvr() >> 16;
+
        /*
         * we need to call this before zapping BATs so OF calls work
         */
diff -r d215ff3ee801 -r 13c9bef49397 sys/arch/powerpc/oea/ofwoea_machdep.c
--- a/sys/arch/powerpc/oea/ofwoea_machdep.c     Thu Feb 16 06:52:03 2012 +0000
+++ b/sys/arch/powerpc/oea/ofwoea_machdep.c     Thu Feb 16 07:59:46 2012 +0000
@@ -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 @@
        /*
         * 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("/");



Home | Main Index | Thread Index | Old Index