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 fix crash during early startup - we can...



details:   https://anonhg.NetBSD.org/src/rev/9c86b4a16f39
branches:  trunk
changeset: 773748:9c86b4a16f39
user:      macallan <macallan%NetBSD.org@localhost>
date:      Wed Feb 15 01:56:57 2012 +0000

description:
fix crash during early startup - we can't call OpenFirmware between zapping
the BATs and complete setting them up again
ok releng

diffstat:

 sys/arch/powerpc/oea/oea_machdep.c    |  12 +++++++-----
 sys/arch/powerpc/oea/ofwoea_machdep.c |  27 ++++++++++++++++++++-------
 2 files changed, 27 insertions(+), 12 deletions(-)

diffs (129 lines):

diff -r 31b2471047d5 -r 9c86b4a16f39 sys/arch/powerpc/oea/oea_machdep.c
--- a/sys/arch/powerpc/oea/oea_machdep.c        Wed Feb 15 01:46:42 2012 +0000
+++ b/sys/arch/powerpc/oea/oea_machdep.c        Wed Feb 15 01:56:57 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: oea_machdep.c,v 1.62 2012/02/01 09:54:03 matt Exp $    */
+/*     $NetBSD: oea_machdep.c,v 1.63 2012/02/15 01:56:57 macallan Exp $        */
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.62 2012/02/01 09:54:03 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.63 2012/02/15 01:56:57 macallan Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_compat_netbsd.h"
@@ -600,6 +600,10 @@
        va_list ap;
 
        cpuvers = mfpvr() >> 16;
+       /*
+        * we need to call this before zapping BATs so OF calls work
+        */
+       mem_regions(&allmem, &availmem);
 
        /*
         * Initialize BAT registers to unmapped to not generate
@@ -698,7 +702,7 @@
                       "r"(battable[0x01800000 >> 23].batu));
        }
 #endif /* PPC_OEA601 */
-
+       
        /*
         * Now setup other fixed bat registers
         *
@@ -733,9 +737,7 @@
 
        /*
         * Set up battable to map all RAM regions.
-        * This is here because mem_regions() call needs bat0 set up.
         */
-       mem_regions(&allmem, &availmem);
 #ifdef PPC_OEA601
        if (cpuvers == MPC601) {
                for (mp = allmem; mp->size; mp++) {
diff -r 31b2471047d5 -r 9c86b4a16f39 sys/arch/powerpc/oea/ofwoea_machdep.c
--- a/sys/arch/powerpc/oea/ofwoea_machdep.c     Wed Feb 15 01:46:42 2012 +0000
+++ b/sys/arch/powerpc/oea/ofwoea_machdep.c     Wed Feb 15 01:56:57 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.26 2011/08/04 20:02:48 phx Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.27 2012/02/15 01:56:58 macallan 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.26 2011/08/04 20:02:48 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.27 2012/02/15 01:56:58 macallan Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_compat_netbsd.h"
@@ -166,6 +166,7 @@
                            sizeof(model_name));
                model_init();
        }
+
        /* Initialize bus_space */
        ofwoea_bus_space_init();
 
@@ -363,7 +364,7 @@
 /*
  * Scan the device tree for ranges, and return them as bitmap 0..15
  */
-
+#ifndef macppc
 static u_int16_t
 ranges_bitmap(int node, u_int16_t bitmap)
 {
@@ -404,22 +405,33 @@
        }
        return bitmap;
 }
+#endif /* !macppc */
 
 void
 ofwoea_batinit(void)
 {
 #if defined (PPC_OEA)
+
+#ifdef macppc
+       /*
+        * 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,
+                   0xf0000000, BAT_BL_128M,
+                   0xf8000000, BAT_BL_64M,
+                   0);
+#else
         u_int16_t bitmap;
        int node, i;
 
        node = OF_finddevice("/");
+
        bitmap = ranges_bitmap(node, 0);
        oea_batinit(0);
 
-#ifdef macppc
-       /* XXX this is a macppc-specific hack */
-       bitmap = 0x8f00;
-#endif
        for (i=1; i < 0x10; i++) {
                /* skip the three vital SR regions */
                if (i == USER_SR || i == KERNEL_SR || i == KERNEL2_SR)
@@ -429,6 +441,7 @@
                        DPRINTF("Batmapped 256M at 0x%x\n", 0x10000000 * i);
                }
        }
+#endif
 #endif /* OEA */
 }
 



Home | Main Index | Thread Index | Old Index