Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Common OFW code has been moved to powerpc/mpc6xx/of...



details:   https://anonhg.NetBSD.org/src/rev/57df2918821b
branches:  trunk
changeset: 533798:57df2918821b
user:      matt <matt%NetBSD.org@localhost>
date:      Tue Jul 09 19:21:03 2002 +0000

description:
Common OFW code has been moved to powerpc/mpc6xx/ofw_subr.S.  Now use it.

diffstat:

 sys/arch/macppc/macppc/locore.S  |  187 +-------------------------------------
 sys/arch/macppc/macppc/machdep.c |    5 +-
 sys/arch/ofppc/ofppc/locore.S    |  116 +-----------------------
 sys/arch/ofppc/ofppc/machdep.c   |    4 +-
 4 files changed, 18 insertions(+), 294 deletions(-)

diffs (truncated from 426 to 300 lines):

diff -r 205bc6dfd600 -r 57df2918821b sys/arch/macppc/macppc/locore.S
--- a/sys/arch/macppc/macppc/locore.S   Tue Jul 09 19:05:00 2002 +0000
+++ b/sys/arch/macppc/macppc/locore.S   Tue Jul 09 19:21:03 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.44 2002/03/09 23:35:57 chs Exp $  */
+/*     $NetBSD: locore.S,v 1.45 2002/07/09 19:21:03 matt Exp $ */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -111,9 +111,6 @@
        .long   0,0,0,0
 GLOBAL(eintrcnt)
 
-GLOBAL(ofmsr)
-       .long   0,0,0,0,0               /* msr & sprg[0-3] used in Open Firmware */
-
 /*
  * File-scope for locore.S
  */
@@ -121,10 +118,6 @@
 idle_u:
        .long   0                       /* fake uarea during idle after exit */
 #endif
-openfirmware_entry:
-       .long   0                       /* openfirmware entry point */
-srsave:
-       .long   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 
 /*
  * This symbol is here for the benefit of kvm_mkdb, and is supposed to
@@ -141,25 +134,7 @@
        .text
        .globl  __start
 __start:
-#ifdef FIRMWORKSBUGS
-       mfmsr   0
-       andi.   0,0,PSL_IR|PSL_DR
-       beq     1f
-
-       bl      _C_LABEL(ofwr_init)
-1:
-#endif
-       mfmsr   0
-       lis     9,ofmsr@ha
-       stw     0,ofmsr@l(9)
-        mfsprg  0,0
-               stw     0,ofmsr+4@l(9)
-        mfsprg  0,1
-               stw     0,ofmsr+8@l(9)
-        mfsprg  0,2
-               stw     0,ofmsr+12@l(9)
-        mfsprg  0,3
-               stw     0,ofmsr+16@l(9)
+       bl      _C_LABEL(ofwinit)       /* init OF */
 
        li      0,0
        mtmsr   0                       /* Disable FPU/MMU/exceptions */
@@ -205,8 +180,6 @@
        xor     0,0,0
        stwu    0,-16(1)                /* end of stack chain */
 
-       lis     8,openfirmware_entry@ha
-       stw     5,openfirmware_entry@l(8) /* save client interface handler */
        lis     3,__start@ha
        addi    3,3,__start@l
        mr      5,6                     /* args string */
@@ -214,157 +187,6 @@
        bl      _C_LABEL(main)
        b       _C_LABEL(OF_exit)
 
-/*
- * OpenFirmware entry point
- */
-ENTRY(openfirmware)
-       mflr    0                       /* save return address */
-       stw     0,4(1)
-       stwu    1,-16(1)                /* setup stack frame */
-
-       mfmsr   4                       /* save msr */
-       stw     4,8(1)
-
-       lis     4,openfirmware_entry@ha /* get firmware entry point */
-       lwz     4,openfirmware_entry@l(4)
-       mtlr    4
-
-       li      0,0                     /* clear battable translations */
-       mtdbatu 2,0
-       mtdbatu 3,0
-       mtibatu 2,0
-       mtibatu 3,0
-
-       lis     4,srsave@ha             /* save old SR */
-       addi    4,4,srsave@l
-       li      5,0
-1:     mfsrin  0,5
-       stw     0,0(4)
-       addi    4,4,4
-       addis   5,5,0x10000000@h
-       cmpwi   5,0
-       bne     1b
-
-       lis     4,_C_LABEL(ofw_pmap)@ha /* load OFW SR */
-       addi    4,4,_C_LABEL(ofw_pmap)@l
-       lwz     0,PM_KERNELSR(4)
-       cmpwi   0,0                     /* pm_sr[KERNEL_SR] == 0? */
-       beq     2f                      /* then skip (not initialized yet) */
-       li      5,0
-1:     lwz     0,0(4)
-       mtsrin  0,5
-       addi    4,4,4
-       addis   5,5,0x10000000@h
-       cmpwi   5,0
-       bne     1b
-2:
-       lis     4,ofmsr@ha              /* Open Firmware msr + sprg[0-3] */
-       lwz     5,ofmsr+4@l(4)
-       mtsprg  0,5
-       lwz     5,ofmsr+8@l(4)
-       mtsprg  1,5
-       lwz     5,ofmsr+12@l(4)
-       mtsprg  2,5
-       lwz     5,ofmsr+16@l(4)
-       mtsprg  3,5
-       lwz     5,ofmsr@l(4)
-       mtmsr   5
-       isync
-
-       blrl                            /* call Open Firmware */
-
-       lis     4,srsave@ha             /* restore saved SR */
-       addi    4,4,srsave@l
-       li      5,0
-1:     lwz     0,0(4)
-       mtsrin  0,5
-       addi    4,4,4
-       addis   5,5,0x10000000@h
-       cmpwi   5,0
-       bne     1b
-
-       lwz     4,8(1)                  /* restore msr */
-       mtmsr   4
-       isync
-
-       lwz     1,0(1)                  /* and return */
-       lwz     0,4(1)
-       mtlr    0
-       blr
-
-/*
- * Switch to/from OpenFirmware real mode stack
- *
- * Note: has to be called as the very first thing in OpenFirmware interface
- * routines.
- * E.g.:
- * int
- * OF_xxx(arg1, arg2)
- * type arg1, arg2;
- * {
- *     static struct {
- *             char *name;
- *             int nargs;
- *             int nreturns;
- *             char *method;
- *             int arg1;
- *             int arg2;
- *             int ret;
- *     } args = {
- *             "xxx",
- *             2,
- *             1,
- *     };
- *
- *     ofw_stack();
- *     args.arg1 = arg1;
- *     args.arg2 = arg2;
- *     if (openfirmware(&args) < 0)
- *             return -1;
- *     return args.ret;
- * }
- */
-
-       .local  firmstk
-       .comm   firmstk,NBPG,8
-
-ENTRY(ofw_stack)
-       mfmsr   8                       /* turn off interrupts */
-       andi.   0,8,~(PSL_EE|PSL_RI)@l
-       mtmsr   0
-       stw     8,4(1)                  /* abuse return address slot */
-
-       lwz     5,0(1)                  /* get length of stack frame */
-       subf    5,1,5
-
-       lis     7,firmstk+NBPG-8@ha
-       addi    7,7,firmstk+NBPG-8@l
-       lis     6,ofw_back@ha
-       addi    6,6,ofw_back@l
-       subf    4,5,7                   /* make room for stack frame on
-                                          new stack */
-       stw     6,-4(7)                 /* setup return pointer */
-       stwu    1,-8(7)
-
-       stw     7,-8(4)
-
-       addi    3,1,8
-       addi    1,4,-8
-       subi    5,5,8
-
-       b       _C_LABEL(ofbcopy)       /* and copy it */
-
-ofw_back:
-       lwz     1,0(1)                  /* get callers original stack pointer */
-
-       lwz     0,4(1)                  /* get saved msr from abused slot */
-       mtmsr   0
-
-       lwz     1,0(1)                  /* return */
-       lwz     0,4(1)
-       mtlr    0
-       blr
-
 #if defined(MULTIPROCESSOR)
        .globl  _C_LABEL(cpu_spinup_trampoline)
 _C_LABEL(cpu_spinup_trampoline):
@@ -382,6 +204,11 @@
 #endif
 
 /*
+ * Pull in common Open Firmware code.
+ */
+#include <powerpc/mpc6xx/ofw_subr.S>
+
+/*
  * Pull in common switch and setfault code.
  */
 #include <powerpc/powerpc/locore_subr.S>
diff -r 205bc6dfd600 -r 57df2918821b sys/arch/macppc/macppc/machdep.c
--- a/sys/arch/macppc/macppc/machdep.c  Tue Jul 09 19:05:00 2002 +0000
+++ b/sys/arch/macppc/macppc/machdep.c  Tue Jul 09 19:21:03 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.115 2002/07/05 18:45:18 matt Exp $       */
+/*     $NetBSD: machdep.c,v 1.116 2002/07/09 19:21:03 matt Exp $       */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -250,6 +250,9 @@
        pmap_pinit(&ofw_pmap);
 
        ofw_pmap.pm_sr[KERNEL_SR] = KERNEL_SEGMENT;
+#ifdef KERNEL2_SR
+       ofw_pmap.pm_sr[KERNEL2_SR] = KERNEL2_SEGMENT;
+#endif
 
        for (i = 0; i < n; i++) {
                paddr_t pa = ofmap[i].pa;
diff -r 205bc6dfd600 -r 57df2918821b sys/arch/ofppc/ofppc/locore.S
--- a/sys/arch/ofppc/ofppc/locore.S     Tue Jul 09 19:05:00 2002 +0000
+++ b/sys/arch/ofppc/ofppc/locore.S     Tue Jul 09 19:21:03 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.26 2002/03/09 23:35:58 chs Exp $  */
+/*     $NetBSD: locore.S,v 1.27 2002/07/09 19:21:04 matt Exp $ */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -74,8 +74,6 @@
        .data
 idle_u:
        .long   0                       /* fake uarea during idle after exit */
-openfirmware_entry:
-       .long   0                       /* openfirmware entry point */
 
 /*
  * This symbol is here for the benefit of kvm_mkdb, and is supposed to
@@ -92,14 +90,8 @@
        .text
        .globl  __start
 __start:
-#ifdef FIRMWORKSBUGS
-       mfmsr   0
-       andi.   0,0,PSL_IR|PSL_DR
-       beq     1f
+       bl      _C_LABEL(ofwinit)       /* init our OF hooks */
 
-       bl      _C_LABEL(ofwr_init)
-1:
-#endif
        li      0,0
        mtmsr   0                       /* Disable FPU/MMU/exceptions */
        isync
@@ -159,8 +151,6 @@
        xor     0,0,0
        stwu    0,-16(1)                /* end of stack chain */
        
-       lis     8,openfirmware_entry@ha
-       stw     5,openfirmware_entry@l(8) /* save client interface handler */
        lis     3,__start@ha
        addi    3,3,__start@l
        mr      5,6                     /* args string */
@@ -169,107 +159,9 @@
        b       _C_LABEL(OF_exit)



Home | Main Index | Thread Index | Old Index