Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/macppc/stand/ofwboot - add some G5-specific setup



details:   https://anonhg.NetBSD.org/src/rev/1264439bb33f
branches:  trunk
changeset: 365489:1264439bb33f
user:      macallan <macallan%NetBSD.org@localhost>
date:      Fri Aug 17 16:04:39 2018 +0000

description:
- add some G5-specific setup
- OF_claim() more heap space on G5
With this, and -DHEAP_VARIABLE my G5s boot from harddisk

diffstat:

 sys/arch/macppc/stand/ofwboot/Locore.c |  48 ++++++++++++++++++++++++++++-----
 1 files changed, 40 insertions(+), 8 deletions(-)

diffs (92 lines):

diff -r 0d6621a804b8 -r 1264439bb33f sys/arch/macppc/stand/ofwboot/Locore.c
--- a/sys/arch/macppc/stand/ofwboot/Locore.c    Fri Aug 17 15:54:35 2018 +0000
+++ b/sys/arch/macppc/stand/ofwboot/Locore.c    Fri Aug 17 16:04:39 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: Locore.c,v 1.31 2018/06/06 23:50:29 uwe Exp $  */
+/*     $NetBSD: Locore.c,v 1.32 2018/08/17 16:04:39 macallan Exp $     */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -35,6 +35,7 @@
 #include <lib/libsa/stand.h>
 
 #include <machine/cpu.h>
+#include <powerpc/oea/spr.h>
 
 #include "openfirm.h"
 
@@ -81,9 +82,13 @@
 "      mfspr   %r0,287         \n" /* mfpvbr %r0 PVR = 287 */
 "      srwi    %r0,%r0,0x10    \n"
 "      cmpi    0,1,%r0,0x02    \n" /* 601 CPU = 0x0001 */
-"      blt     1f              \n" /* skip over non-601 BAT setup */
+"      blt     2f              \n" /* skip over non-601 BAT setup */
+"      cmpi    0,1,%r0,0x39    \n" /* PPC970 */
+"      blt     0f              \n"
+"      cmpi    0,1,%r0,0x45    \n" /* PPC970GX */
+"      ble     1f              \n"
        /* non PPC 601 BATs */
-"      li      %r0,0           \n"
+"0:    li      %r0,0           \n"
 "      mtibatu 0,%r0           \n"
 "      mtibatu 1,%r0           \n"
 "      mtibatu 2,%r0           \n"
@@ -99,10 +104,31 @@
 "      li      %r9,0x1ffe      \n"     /* BATU(0, BAT_BL_256M, BAT_Vs) */
 "      mtibatu 0,%r9           \n"
 "      mtdbatu 0,%r9           \n"
-"      b       2f              \n"
-
+"      b       3f              \n"
+       /* 970 initialization stuff */
+"1:                            \n"
+       /* make sure we're in bridge mode */
+"      clrldi  %r8,%r8,3       \n"
+"      mtmsrd  %r8             \n"
+"      isync                   \n"
+        /* clear HID5 DCBZ bits (56/57), need to do this early */
+"      mfspr   %r9,0x3f6       \n"
+"      rldimi  %r9,0,6,56      \n"
+"      sync                    \n"
+"      mtspr   0x3f6,%r9       \n"
+"      isync                   \n"
+"      sync                    \n"
+       /* Setup HID1 features, prefetch + i-cacheability controlled by PTE */
+"      mfspr   %r9,0x3f1       \n"
+"      li      %r11,0x1200     \n"
+"      sldi    %r11,%r11,44    \n"
+"      or      %r9,%r9,%r11    \n"
+"      mtspr   0x3f1,%r9       \n"
+"      isync                   \n"
+"      sync                    \n"
+"      b       3f              \n"     
        /* PPC 601 BATs */
-"1:    li      %r0,0           \n"
+"2:    li      %r0,0           \n"
 "      mtibatu 0,%r0           \n"
 "      mtibatu 1,%r0           \n"
 "      mtibatu 2,%r0           \n"
@@ -134,7 +160,7 @@
 "      addi    %r9,%r9,0x1a    \n"
 "      mtibatu 3,%r9           \n"
 "                              \n"
-"2:    isync                   \n"
+"3:    isync                   \n"
 "                              \n"
 "      mtmsr   %r8             \n"
 "      isync                   \n"
@@ -649,7 +675,13 @@
                OF_exit();
 
 #ifdef HEAP_VARIABLE
-       heapspace = OF_claim(0, HEAP_SIZE, NBPG);
+       uint32_t pvr, vers, hsize = HEAP_SIZE;
+
+       __asm volatile ("mfpvr %0" : "=r"(pvr));
+       vers = pvr >> 16;
+       if (vers >= IBM970 && vers <= IBM970GX) hsize = 0x800000;
+
+       heapspace = OF_claim(0, hsize, NBPG);
        if (heapspace == (char *)-1) {
                panic("Failed to allocate heap");
        }



Home | Main Index | Thread Index | Old Index