summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-01-22 20:45:21 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-01-22 20:45:21 +0000
commit8105491e021791b682e4b1edf19b57fe6223d010 (patch)
tree2f931b0b69e06e88d5152edd4dff3d4298fef40b /sys/arch
parent3273b6209f5ecb5118129a39b7e212ffabf458ef (diff)
Make locore and the early initialization code closer to other ppc ports;
also remove ipkbd and other dead code.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/mvmeppc/include/powerpc.h3
-rw-r--r--sys/arch/mvmeppc/mvmeppc/locore.S339
-rw-r--r--sys/arch/mvmeppc/mvmeppc/machdep.c230
3 files changed, 158 insertions, 414 deletions
diff --git a/sys/arch/mvmeppc/include/powerpc.h b/sys/arch/mvmeppc/include/powerpc.h
index 5ef80509dba..1b5bd13abbd 100644
--- a/sys/arch/mvmeppc/include/powerpc.h
+++ b/sys/arch/mvmeppc/include/powerpc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: powerpc.h,v 1.2 2002/03/14 01:26:41 millert Exp $ */
+/* $OpenBSD: powerpc.h,v 1.3 2004/01/22 20:45:18 miod Exp $ */
/* $NetBSD: powerpc.h,v 1.1 1996/09/30 16:34:30 ws Exp $ */
/*
@@ -96,7 +96,6 @@ extern struct firmware *fw;
#define ppc_exit() if (fw->exit != NULL) (fw->exit)()
#define ppc_boot(x) if (fw->boot != NULL) (fw->boot)(x)
-#define ppc_vmon() if (fw->vmon != NULL) (fw->vmon)()
#define ppc_nvram_rd(a) ({unsigned char val; \
if (fw->nvram_rd !=NULL) \
val = (fw->nvram_rd)(a); \
diff --git a/sys/arch/mvmeppc/mvmeppc/locore.S b/sys/arch/mvmeppc/mvmeppc/locore.S
index b187d469ed4..a494caeb75f 100644
--- a/sys/arch/mvmeppc/mvmeppc/locore.S
+++ b/sys/arch/mvmeppc/mvmeppc/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.3 2002/07/24 02:29:57 drahn Exp $ */
+/* $OpenBSD: locore.S,v 1.4 2004/01/22 20:45:20 miod Exp $ */
/* $NetBSD: locore.S,v 1.2 1996/10/16 19:33:09 ws Exp $ */
/*
@@ -32,8 +32,6 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "machine/ipkdb.h"
-
#include "assym.h"
#include <sys/syscall.h>
@@ -55,10 +53,6 @@ _C_LABEL(esym): .long 0 /* end of symbol table */
_C_LABEL(proc0paddr): .long 0 /* proc0 p_addr */
idle_u: .long 0 /* fake uarea during idle after exit */
- .globl _C_LABEL(where)
- .type _C_LABEL(where),@object
-_C_LABEL(where): .long 0
-
/*
* Startup entry
*/
@@ -98,66 +92,28 @@ start:
stw 8,_C_LABEL(proc0paddr)@l(9)
addi 1,8,USPACE-FRAMELEN /* stackpointer for proc0 */
mr 4,1 /* end of mem reserved for kernel */
- xor 0,0,0
+ li 0,0
stwu 0,-16(1) /* end of stack chain */
- li 0, 2
- lis 9,_C_LABEL(where)@ha
- stw 0,_C_LABEL(where)@l(9)
-
lis 3,start@ha
addi 3,3,start@l
mr 5,6 /* args string */
bl _C_LABEL(initppc)
bl _C_LABEL(main)
-#if 0
+#if 0
b _C_LABEL(OF_exit)
+#else
+ /* XXX bugreturn */
#endif
-#define LED_ADDR 0x800008c0
-_ENTRY(_C_LABEL(led_dbg))
- stwu 1,-32(1)
- mflr 0
- stw 0,36(1)
-
- stw 4,8(1)
- stw 5,12(1)
- stw 6,16(1)
- stw 7,20(1)
- mfmsr 5
-
- mr 6,5
- ori 6,6,(PSL_IR|PSL_DR)@l /* turn on MMU */
- mtmsr 6
- sync
- isync
-
- lis 4,LED_ADDR@ha
- addi 4,4,LED_ADDR@l
- li 7,0
- ori 3,3,0x2000
- sthbrx 3,7,4
-
- sync
- mtmsr 5
- isync
- lwz 4,8(1)
- lwz 5,12(1)
- lwz 6,16(1)
- lwz 7,20(1)
-
- lwz 0,36(1)
- mtlr 0
- addi 1,1,32
- blr
-
/*
* No processes are runnable, so loop waiting for one.
* Separate label here for accounting purposes.
*/
_C_LABEL(idle):
mfmsr 3
- andi. 3,3,~PSL_EE@l /* disable interrupts while manipulating runque */
+ /* disable interrupts while manipulating runque */
+ andi. 3,3,~PSL_EE@l
mtmsr 3
lis 8,_C_LABEL(whichqs)@ha
@@ -216,12 +172,13 @@ _ENTRY(_C_LABEL(cpu_switch))
mr 30,3
lis 3,_C_LABEL(curproc)@ha
- xor 31,31,31
- stw 31,_C_LABEL(curproc)@l(3) /* Zero to not accumulate cpu time */
+ li 31,0
+ /* Zero to not accumulate cpu time */
+ stw 31,_C_LABEL(curproc)@l(3)
lis 3,_C_LABEL(curpcb)@ha
lwz 31,_C_LABEL(curpcb)@l(3)
- xor 3,3,3
+ li 3,0
bl _C_LABEL(lcsplx)
stw 3,PCB_SPL(31) /* save spl */
@@ -255,12 +212,13 @@ _C_LABEL(sw1):
lis 3,0x80000000@ha
srw 3,3,10
andc 9,9,3
- stw 9,_C_LABEL(whichqs)@l(8) /* mark it empty */
+ stw 9,_C_LABEL(whichqs)@l(8) /* mark it empty */
1:
- xor 3,3,3
+ /* just did this resched thing */
+ li 3,0
lis 4,_C_LABEL(want_resched)@ha
- stw 3,_C_LABEL(want_resched)@l(4) /* just did this resched thing */
+ stw 3,_C_LABEL(want_resched)@l(4)
stw 3,P_BACK(31) /* probably superfluous */
@@ -286,8 +244,9 @@ _C_LABEL(sw1):
stw 1,PCB_SP(3) /* save SP */
switch_exited:
+ /* disable interrupts while actually switching */
mfmsr 3
- andi. 3,3,~PSL_EE@l /* disable interrupts while actually switching */
+ andi. 3,3,~PSL_EE@l
mtmsr 3
lwz 4,P_ADDR(31)
@@ -295,8 +254,10 @@ switch_exited:
stw 4,_C_LABEL(curpcb)@l(5) /* indicate new pcb */
lwz 5,PCB_PMR(4)
+
+ /* save real pmap pointer for spill fill */
lis 6,_C_LABEL(curpm)@ha
- stwu 5,_C_LABEL(curpm)@l(6) /* save real pmap pointer for spill fill */
+ stwu 5,_C_LABEL(curpm)@l(6)
stwcx. 5,0,6 /* clear possible reservation */
addic. 5,5,64
@@ -329,7 +290,7 @@ switch_return:
lwz 3,PCB_SPL(4)
bl _C_LABEL(lcsplx)
- mr 3,30 /* get curproc for special fork returns */
+ mr 3,30 /* curproc for special fork returns */
lwz 31,12(1)
lwz 30,8(1)
@@ -356,8 +317,7 @@ _C_LABEL(intr_depth):
/*
* This code gets copied to all the trap vectors
- * (except ISI/DSI, ALI, the interrupts, and possibly the debugging traps
- * when using IPKDB).
+ * except ISI/DSI, ALI, the interrupts
*/
.text
.globl _C_LABEL(trapcode),_C_LABEL(trapsize)
@@ -368,7 +328,8 @@ _C_LABEL(trapcode):
stmw 28,tempsave(0) /* free r28-r31 */
mflr 28 /* save LR */
mfcr 29 /* save CR */
-/* Test whether we already had PR set */
+
+ /* Test whether we already had PR set */
mfsrr1 31
mtcr 31
bc 4,17,1f /* branch if PSL_PR is clear */
@@ -391,7 +352,8 @@ _C_LABEL(alitrap):
stmw 30,tempsave+16(0)
mflr 28 /* save LR */
mfcr 29 /* save CR */
-/* Test whether we already had PR set */
+
+ /* Test whether we already had PR set */
mfsrr1 31
mtcr 31
bc 4,17,1f /* branch if PSL_PR is clear */
@@ -416,6 +378,7 @@ _C_LABEL(dsitrap):
mfxer 30 /* save XER */
mtsprg 2,30 /* in SPRG2 */
mfsrr1 31 /* test kernel mode */
+#if 0
mtcr 31
bc 12,17,1f /* branch if PSL_PR is set */
mfdar 31 /* get fault address */
@@ -442,6 +405,7 @@ _C_LABEL(dsitrap):
lmw 28,disisave(0) /* restore r28-r31 */
rfi /* return to trapped code */
1:
+#endif
mflr 28 /* save LR */
bla s_dsitrap
_C_LABEL(dsisize) = .-_C_LABEL(dsitrap)
@@ -457,6 +421,7 @@ _C_LABEL(isitrap):
mflr 28 /* save LR */
mfcr 29 /* save CR */
mfsrr1 31 /* test kernel mode */
+#if 0
mtcr 31
bc 12,17,1f /* branch if PSL_PR is set */
mfsrr0 31 /* get fault address */
@@ -472,6 +437,7 @@ _C_LABEL(isitrap):
lmw 28,disisave(0) /* restore r28-r31 */
rfi /* return to trapped code */
1:
+#endif
bla s_isitrap
_C_LABEL(isisize) = .-_C_LABEL(isitrap)
@@ -691,7 +657,7 @@ _C_LABEL(tlbdsmiss):
beq+ 8f
9: /* found, but protection violation (PP==00)*/
mfsrr1 3
- lis 1,0xa00 /* indicate protection violation on store */
+ lis 1,0xa00 /* indicate protection violation on store */
b 1f
7: /* found, PP=1x */
mfspr 3,DMISS /* get the miss address */
@@ -744,26 +710,6 @@ _C_LABEL(ddblow):
_C_LABEL(ddbsize) = .-_C_LABEL(ddblow)
#endif /* DDB */
-#if NIPKDB > 0
-#define ipkdbsave 0xde0 /* primary save area for IPKDB */
-/*
- * In case of IPKDB we want a separate trap catcher for it
- */
-.lcomm ipkdbstk,INTSTK /* ipkdb stack */
-
- .globl _C_LABEL(ipkdblow),_C_LABEL(ipkdbsize)
- .type _C_LABEL(ipkdblow),@function
- .type _C_LABEL(ipkdbsize),@object
-_C_LABEL(ipkdblow):
- mtsprg 1,1 /* save SP */
- stmw 28,ipkdbsave(0) /* free r28-r31 */
- lis 1,ipkdbstk+INTSTK@ha /* get new SP */
- addi 1,1,ipkdbstk+INTSTK@l
- mflr 28
- mfcr 29
- bla ipkdbtrap
-_C_LABEL(ipkdbsize) = .-_C_LABEL(ipkdblow)
-#endif /* NIPKDB > 0 */
/*
* FRAME_SETUP assumes:
@@ -863,10 +809,11 @@ disitrap:
mfdsisr 31
stmw 30,tempsave+16(0)
realtrap:
-/* Test whether we already had PR set */
+ /* Test whether we already had PR set */
mfsrr1 1
mtcr 1
- mfsprg 1,1 /* restore SP (might have been overwritten) */
+ /* restore SP (might have been overwritten) */
+ mfsprg 1,1
bc 4,17,s_trap /* branch if PSL_PR is false */
lis 1,_C_LABEL(curpcb)@ha
lwz 1,_C_LABEL(curpcb)@l(1)
@@ -882,7 +829,10 @@ s_trap:
FRAME_SETUP(tempsave)
/* Now we can recover interrupts again: */
mfmsr 7
- ori 7,7,(PSL_EE|PSL_ME|PSL_RI)
+ mfsrr1 %r31
+ andi. %r31,%r31,PSL_EE /* restore EE from previous context */
+ or %r7,%r7,%r31
+ ori 7,7,(PSL_ME|PSL_RI)
mtmsr 7
isync
/* Call C trap code: */
@@ -927,7 +877,7 @@ _C_LABEL(fork_trampoline):
* DSI second stage fault handler
*/
s_dsitrap:
- mfdsisr 31 /* test whether this may be a spill fault */
+ mfdsisr 31 /* test if this is spill fault */
mtcr 31
mtsprg 1,1 /* save SP */
bc 4,1,disitrap /* branch if table miss is false */
@@ -982,7 +932,7 @@ s_pte_spill:
* ISI second stage fault handler
*/
s_isitrap:
- mfsrr1 31 /* test whether this may be a spill fault */
+ mfsrr1 31 /* test if this may be a spill fault */
mtcr 31
mtsprg 1,1 /* save SP */
bc 4,1,disitrap /* branch if table miss is false */
@@ -1134,166 +1084,7 @@ decrintr:
bl _C_LABEL(decr_intr)
b intr_exit
-#ifdef DDB
-/*
- * Deliberate entry to ddbtrap
- */
- .globl _C_LABEL(ddb_trap)
-_C_LABEL(ddb_trap):
- mtsprg 1,1
- mfmsr 3
- mtsrr1 3
- andi. 3,3,~(PSL_EE|PSL_ME)@l
- mtmsr 3 /* disable interrupts */
- isync
- stmw 28,ddbsave(0)
- mflr 28
- li 29,EXC_BPT
- mtlr 29
- mfcr 29
- mtsrr0 28
-
-/*
- * Now the ddb trap catching code.
- */
-ddbtrap:
- FRAME_SETUP(ddbsave)
-/* Call C trap code: */
- addi 3,1,8
- bl _C_LABEL(ddb_trap_glue)
- or. 3,3,3
- bne ddbleave
-/* This wasn't for DDB, so switch to real trap: */
- lwz 3,FRAME_EXC+8(1) /* save exception */
- stw 3,ddbsave+8(0)
- FRAME_LEAVE(ddbsave)
- mtsprg 1,1 /* prepare for entrance to realtrap */
- stmw 28,tempsave(0)
- mflr 28
- mfcr 29
- lwz 31,ddbsave+8(0)
- mtlr 31
- b realtrap
-ddbleave:
- FRAME_LEAVE(ddbsave)
- rfi
-#endif /* DDB */
-#if NIPKDB > 0
-/*
- * Deliberate entry to ipkdbtrap
- */
- .globl _C_LABEL(ipkdb_trap)
- .type _C_LABEL(ipkdb_trap),@function
-_C_LABEL(ipkdb_trap):
-
- mtsprg 2,2
- mfmsr 3
- mtsrr1 3
- andi. 3,3,~(PSL_EE|PSL_ME)@l
- mtmsr 3 /* disable interrupts */
- isync
- stmw 28,ipkdbsave(0)
- mflr 28
- li 29,EXC_BPT
- mtlr 29
- mfcr 29
- mtsrr0 28
-
-/*
- * Now the ipkdb trap catching code.
- */
-ipkdbtrap:
- FRAME_SETUP(ipkdbsave)
-/* Call C trap code: */
- addi 3,1,8
- bl _C_LABEL(ipkdb_trap_glue)
- or. 3,3,3
- bne ipkdbleave
-/* This wasn't for IPKDB, so switch to real trap: */
- lwz 3,FRAME_EXC+8(1) /* save exception */
- stw 3,ipkdbsave+8(0)
- FRAME_LEAVE(ipkdbsave)
- mtsprg 1,1 /* prepare for entrance to realtrap */
- stmw 28,tempsave(0)
- mflr 28
- mfcr 29
- lwz 31,ipkdbsave+8(0)
- mtlr 31
- b realtrap
-ipkdbleave:
- FRAME_LEAVE(ipkdbsave)
- rfi
-
-ipkdbfault:
- ba _C_LABEL(ipkdbfault)
-_C_LABEL(ipkdbfault):
- mfsrr0 3
- addi 3,3,4
- mtsrr0 3
- li 3,-1
- rfi
-
-/*
- * int ipkdbfbyte(unsigned char *p)
- */
- .globl _C_LABEL(ipkdbfbyte)
- .type _C_LABEL(ipkdbfbyte),@function
-_C_LABEL(ipkdbfbyte):
- li 9,EXC_DSI /* establish new fault routine */
- lwz 5,0(9)
- lis 6,ipkdbfault@ha
- lwz 6,ipkdbfault@l(6)
- stw 6,0(9)
-#ifdef IPKDBUSERHACK
- lis 8,_C_LABEL(ipkdbsr)@ha
- lwz 8,_C_LABEL(ipkdbsr)@l(8)
- mtsr USER_SR,8
- isync
-#endif
- dcbst 0,9 /* flush data... */
- sync
- icbi 0,9 /* and instruction caches */
- lbz 3,0(3) /* fetch data */
- stw 5,0(9) /* restore previous fault handler */
- dcbst 0,9 /* and flush data... */
- sync
- icbi 0,9 /* and instruction caches */
- blr
-
-/*
- * int ipkdbsbyte(unsigned char *p, int c)
- */
- .globl _C_LABEL(ipkdbsbyte)
- .type _C_LABEL(ipkdbsbyte),@function
-_C_LABEL(ipkdbsbyte):
- li 9,EXC_DSI /* establish new fault routine */
- lwz 5,0(9)
- lis 6,ipkdbfault@ha
- lwz 6,ipkdbfault@l(6)
- stw 6,0(9)
-#ifdef IPKDBUSERHACK
- lis 8,_C_LABEL(ipkdbsr)@ha
- lwz 8,_C_LABEL(ipkdbsr)@l(8)
- mtsr USER_SR,8
- isync
-#endif
- dcbst 0,9 /* flush data... */
- sync
- icbi 0,9 /* and instruction caches */
- mr 6,3
- xor 3,3,3
- stb 4,0(6)
- dcbst 0,6 /* Now do appropriate flushes to data... */
- sync
- icbi 0,6 /* and instruction caches */
- stw 5,0(9) /* restore previous fault handler */
- dcbst 0,9 /* and flush data... */
- sync
- icbi 0,9 /* and instruction caches */
- blr
-#endif /* NIPKDB > 0 */
-
/*
* int setfault()
*
@@ -1315,7 +1106,7 @@ _C_LABEL(setfault):
stw 2,4(3)
stw 1,8(3)
stmw 12,12(3)
- xor 3,3,3
+ li %r3,0
blr
/*
@@ -1363,6 +1154,7 @@ _C_LABEL(intrnames):
.string "irq56" "irq57" "irq58" "irq59"
.string "irq60" "irq61" "irq62" "irq63"
.string "clock"
+ .string "stat"
.space 512
_C_LABEL(eintrnames):
.align 4
@@ -1388,4 +1180,51 @@ _C_LABEL(intrcnt):
.long 0,0,0,0
.long 0,0,0,0
.long 0
+ .long 0
_C_LABEL(eintrcnt):
+
+#ifdef DDB
+/*
+ * Deliberate entry to ddbtrap
+ */
+ .globl _C_LABEL(ddb_trap)
+_C_LABEL(ddb_trap):
+ mtsprg 1,1
+ mfmsr 3
+ mtsrr1 3
+ andi. 3,3,~(PSL_EE|PSL_ME)@l
+ mtmsr 3 /* disable interrupts */
+ isync
+ stmw 28,ddbsave(0)
+ mflr 28
+ li 29,EXC_BPT
+ mtlr 29
+ mfcr 29
+ mtsrr0 28
+
+/*
+ * Now the ddb trap catching code.
+ */
+ddbtrap:
+ FRAME_SETUP(ddbsave)
+/* Call C trap code: */
+ addi 3,1,8
+ bl _C_LABEL(ddb_trap_glue)
+ or. 3,3,3
+ bne ddbleave
+/* This wasn't for DDB, so switch to real trap: */
+ lwz 3,FRAME_EXC+8(1) /* save exception */
+ stw 3,ddbsave+8(0)
+ FRAME_LEAVE(ddbsave)
+ mtsprg 1,1 /* prepare for entrance to realtrap */
+ stmw 28,tempsave(0)
+ mflr 28
+ mfcr 29
+ lwz 31,ddbsave+8(0)
+ mtlr 31
+ b realtrap
+ddbleave:
+ FRAME_LEAVE(ddbsave)
+ rfi
+#endif /* DDB */
+
diff --git a/sys/arch/mvmeppc/mvmeppc/machdep.c b/sys/arch/mvmeppc/mvmeppc/machdep.c
index 23212a26786..146aa668dcb 100644
--- a/sys/arch/mvmeppc/mvmeppc/machdep.c
+++ b/sys/arch/mvmeppc/mvmeppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.36 2003/12/20 22:40:27 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.37 2004/01/22 20:45:20 miod Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -31,9 +31,6 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*
-#include "machine/ipkdb.h"
-*/
#include <sys/param.h>
#include <sys/buf.h>
@@ -79,7 +76,6 @@ void initppc(u_int, u_int, char *);
void dumpsys(void);
int lcsplx(int);
void myetheraddr(u_char *);
-void systype(char *);
void nameinterrupt(int, char *);
/*
@@ -171,11 +167,8 @@ static int devio_malloc_safe = 0;
/* HACK - XXX */
int segment8_mapped = 0;
-int segment0_mapped = 0;
int segmentC_mapped = 0;
-extern int where;
-
void
initppc(startkernel, endkernel, args)
u_int startkernel, endkernel;
@@ -192,9 +185,6 @@ initppc(startkernel, endkernel, args)
#ifdef DDB
extern caddr_t ddblow, ddbsize;
#endif
-#if NIPKDB > 0
- extern caddr_t ipkdblow, ipkdbsize;
-#endif
extern void consinit(void);
extern void callback(void *);
extern void *msgbuf_addr;
@@ -205,7 +195,6 @@ initppc(startkernel, endkernel, args)
fw = &ppc1_firmware; /* Just PPC1-Bug for now... */
-where = 3;
curpcb = &proc0paddr->u_pcb;
curpm = curpcb->pcb_pmreal = curpcb->pcb_pm = pmap_kernel();
@@ -217,45 +206,28 @@ where = 3;
* Initialize BAT registers to unmapped to not generate
* overlapping mappings below.
*/
- __asm__ volatile ("mtibatu 0,%0" :: "r"(0));
- __asm__ volatile ("mtibatu 1,%0" :: "r"(0));
- __asm__ volatile ("mtibatu 2,%0" :: "r"(0));
- __asm__ volatile ("mtibatu 3,%0" :: "r"(0));
- __asm__ volatile ("mtdbatu 0,%0" :: "r"(0));
- __asm__ volatile ("mtdbatu 1,%0" :: "r"(0));
- __asm__ volatile ("mtdbatu 2,%0" :: "r"(0));
- __asm__ volatile ("mtdbatu 3,%0" :: "r"(0));
+ ppc_mtibat0u(0);
+ ppc_mtibat1u(0);
+ ppc_mtibat2u(0);
+ ppc_mtibat3u(0);
+ ppc_mtdbat0u(0);
+ ppc_mtdbat1u(0);
+ ppc_mtdbat2u(0);
+ ppc_mtdbat3u(0);
/*
- * Set up initial BAT table to only map the lowest 256 MB area
+ * Set up initial BAT table
*/
- battable[0].batl = BATL(0x00000000, BAT_M);
- battable[0].batu = BATU(0x00000000);
-
- /* map all of possible physical memory, ick */
- battable[0x1].batl = BATL(0x10000000, BAT_M);
- battable[0x1].batu = BATU(0x10000000);
- battable[0x2].batl = BATL(0x20000000, BAT_M);
- battable[0x2].batu = BATU(0x20000000);
- battable[0x3].batl = BATL(0x30000000, BAT_M);
- battable[0x3].batu = BATU(0x30000000);
- battable[0x4].batl = BATL(0x40000000, BAT_M);
- battable[0x4].batu = BATU(0x40000000);
- battable[0x5].batl = BATL(0x50000000, BAT_M);
- battable[0x5].batu = BATU(0x50000000);
- battable[0x6].batl = BATL(0x60000000, BAT_M);
- battable[0x6].batu = BATU(0x60000000);
- battable[0x7].batl = BATL(0x70000000, BAT_M);
- battable[0x7].batu = BATU(0x70000000);
-
+ battable[0x0].batl = BATL(0x00000000, BAT_M);
+ battable[0x0].batu = BATU(0x00000000);
battable[0x8].batl = BATL(0x80000000, BAT_I);
battable[0x8].batu = BATU(0x80000000);
battable[0x9].batl = BATL(0x90000000, BAT_I);
battable[0x9].batu = BATU(0x90000000);
- battable[0xa].batl = BATL(0xf0000000, BAT_I);
- battable[0xa].batu = BATU(0xf0000000);
+ battable[0xf].batl = BATL(0xf0000000, BAT_I);
+ battable[0xf].batu = BATU(0xf0000000);
- segment0_mapped = 1;
+ /* XXX */
segment8_mapped = 1;
segmentC_mapped = 0;
@@ -266,43 +238,29 @@ where = 3;
* registers were cleared above.
*/
/* IBAT0 used for initial 256 MB segment */
- __asm__ volatile ("mtibatl 0,%0; mtibatu 0,%1"
- :: "r"(battable[0].batl), "r"(battable[0].batu));
+ ppc_mtibat0l(battable[0].batl);
+ ppc_mtibat0u(battable[0].batu);
+
/* DBAT0 used similar */
- __asm__ volatile ("mtdbatl 0,%0; mtdbatu 0,%1"
- :: "r"(battable[0].batl), "r"(battable[0].batu));
+ ppc_mtdbat0l(battable[0].batl);
+ ppc_mtdbat0u(battable[0].batu);
-#if 0
- __asm__ volatile ("mtdbatl 1,%0; mtdbatu 1,%1"
- :: "r"(battable[1].batl), "r"(battable[1].batu));
- __asm__ volatile ("sync;isync");
-#endif
- /* IBAT1 used for last 256 MB segment ROM */
- __asm__ volatile ("mtibatl 1,%0; mtibatu 1,%1"
- :: "r"(battable[0xa].batl), "r"(battable[0xa].batu));
- /* DBAT1 used similar */
- __asm__ volatile ("mtdbatl 1,%0; mtdbatu 1,%1"
- :: "r"(battable[0xa].batl), "r"(battable[0xa].batu));
- /* IBAT2 used for last 256 MB segment ROM */
- __asm__ volatile ("mtibatl 2,%0; mtibatu 2,%1"
- :: "r"(battable[0x8].batl), "r"(battable[0x8].batu));
- /* DBAT2 used similar */
- __asm__ volatile ("mtdbatl 2,%0; mtdbatu 2,%1"
- :: "r"(battable[0x8].batl), "r"(battable[0x8].batu));
-
-#if 0
- /* IBAT3 used for last 256 MB segment ROM */
- __asm__ volatile ("mtibatl 3,%0; mtibatu 3,%1"
- :: "r"(battable[0x3].batl), "r"(battable[0x3].batu));
- /* DBAT3 used similar */
- __asm__ volatile ("mtdbatl 3,%0; mtdbatu 3,%1"
- :: "r"(battable[0x3].batl), "r"(battable[0x3].batu));
-#endif
+ /* DBAT1, DBAT2 -> PCI I/O space */
+ ppc_mtdbat1l(battable[8].batl);
+ ppc_mtdbat1u(battable[8].batu);
+ ppc_mtdbat2l(battable[9].batl);
+ ppc_mtdbat2u(battable[9].batu);
+
+ /* IBAT3, DBAT3 -> Raven and BUG */
+ ppc_mtibat3l(battable[0x0f].batl);
+ ppc_mtibat3u(battable[0x0f].batu);
+ ppc_mtdbat3l(battable[0x0f].batl);
+ ppc_mtdbat3u(battable[0x0f].batu);
/*
* Set up trap vectors
*/
- for (exc = EXC_RSVD; exc <= EXC_LAST; exc += 0x100)
+ for (exc = EXC_RSVD; exc <= EXC_LAST; exc += 0x100) {
switch (exc) {
default:
bcopy(&trapcode, (void *)exc, (size_t)&trapsize);
@@ -312,6 +270,7 @@ where = 3;
* This one is (potentially) installed during autoconf
*/
break;
+
case EXC_DSI:
bcopy(&dsitrap, (void *)EXC_DSI, (size_t)&dsisize);
break;
@@ -333,18 +292,15 @@ where = 3;
case EXC_DSMISS:
bcopy(&tlbdsmiss, (void *)EXC_DSMISS, (size_t)&tlbdsmsize);
break;
-#if NIPKDB > 0 || defined(DDB)
+#ifdef DDB
case EXC_PGM:
case EXC_TRC:
case EXC_BPT:
-#ifdef DDB
bcopy(&ddblow, (void *)exc, (size_t)&ddbsize);
-#else
- bcopy(&ipkdblow, (void *)exc, (size_t)&ipkdbsize);
-#endif
break;
#endif
}
+ }
/* Grr, ALTIVEC_UNAVAIL is a vector not ~0xff aligned: 0x0f20 */
bcopy(&trapcode, (void *)0xf20, (size_t)&trapsize);
@@ -367,12 +323,29 @@ where = 3;
*/
pmap_bootstrap(startkernel, endkernel);
+#if 1
+ /* MVME2[67]00 max out at 256MB, and we need the other BAT anyway */
+#else
+ /* use BATs to map 1GB memory, no pageable BATs now */
+ if (physmem > btoc(0x10000000)) {
+ ppc_mtdbat1l(BATL(0x10000000, BAT_M));
+ ppc_mtdbat1u(BATU(0x10000000));
+ }
+ if (physmem > btoc(0x20000000)) {
+ ppc_mtdbat2l(BATL(0x20000000, BAT_M));
+ ppc_mtdbat2u(BATU(0x20000000));
+ }
+ if (physmem > btoc(0x30000000)) {
+ ppc_mtdbat3l(BATL(0x30000000, BAT_M));
+ ppc_mtdbat3u(BATU(0x30000000));
+ }
+#endif
/*
* Now enable translation (and machine checks/recoverable interrupts).
* This will also start using the exception vector prefix of 0x000.
*/
- ppc_vmon();
+ (fw->vmon)();
__asm__ volatile ("eieio; mfmsr %0; ori %0,%0,%1; mtmsr %0; sync;isync"
: "=r"(scratch) : "K"(PSL_IR|PSL_DR|PSL_ME|PSL_RI));
@@ -382,17 +355,6 @@ where = 3;
*/
initmsgbuf(msgbuf_addr, MSGBUFSIZE);
- /*
- * Look at arguments passed to us and compute boothowto.
- * Default to SINGLE and ASKNAME if no args or
- * SINGLE and DFLTROOT if this is a ramdisk kernel.
- */
-#ifdef RAMDISK_HOOKS
- boothowto = RB_SINGLE | RB_DFLTROOT;
-#else
- boothowto = RB_AUTOBOOT;
-#endif /* RAMDISK_HOOKS */
-
/*
* Parse arg string.
*/
@@ -466,23 +428,11 @@ where = 3;
* Replace with real console.
*/
cninit();
-#ifdef OWF
- ofwconprobe();
-#endif
-#if NIPKDB > 0
- /*
- * Now trap to IPKDB
- */
- ipkdb_init();
- if (boothowto & RB_KDB)
- ipkdb_connect(0);
-#else
#ifdef DDB
if (boothowto & RB_KDB)
Debugger();
#endif
-#endif
}
void
@@ -492,19 +442,18 @@ install_extint(handler)
extern caddr_t extint, extsize;
extern u_long extint_call;
u_long offset = (u_long)handler - (u_long)&extint_call;
- int omsr, msr;
+ int msr;
#ifdef DIAGNOSTIC
if (offset > 0x1ffffff)
panic("install_extint: too far away");
#endif
- __asm__ volatile ("mfmsr %0; andi. %1, %0, %2; mtmsr %1"
- : "=r"(omsr), "=r"(msr) : "K"((u_short)~PSL_EE));
+ msr = ppc_intr_disable();
extint_call = (extint_call & 0xfc000003) | offset;
bcopy(&extint, (void *)EXC_EXI, (size_t)&extsize);
syncicache((void *)&extint_call, sizeof extint_call);
syncicache((void *)EXC_EXI, (int)&extsize);
- __asm__ volatile ("mtmsr %0" :: "r"(omsr));
+ ppc_intr_enable(msr);
}
/*
@@ -541,9 +490,9 @@ cpu_startup()
*/
sz = MAXBSIZE * nbuf;
if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(sz),
- NULL, UVM_UNKNOWN_OFFSET, 0,
- UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
- UVM_ADV_NORMAL, 0)))
+ NULL, UVM_UNKNOWN_OFFSET, 0,
+ UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
+ UVM_ADV_NORMAL, 0)))
panic("cpu_startup: cannot allocate VM for buffers");
/*
addr = (vaddr_t)buffers;
@@ -579,6 +528,9 @@ cpu_startup()
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
*/
+#if 1
+ minaddr = vm_map_min(kernel_map);
+#endif
exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, 16 * NCARGS,
VM_MAP_PAGEABLE, FALSE, NULL);
@@ -594,7 +546,6 @@ cpu_startup()
printf("using %d buffers containing %d bytes of memory\n", nbuf,
bufpages * PAGE_SIZE);
-
/*
* Set up the buffers.
*/
@@ -674,7 +625,7 @@ setregs(p, pack, stack, retval)
{
u_int32_t newstack;
u_int32_t pargs;
- u_int32_t args[4];
+ u_int32_t args[4];
struct trapframe *tf = trapframe(p);
pargs = -roundup(-stack + 8, 16);
@@ -709,9 +660,6 @@ sendsig(catcher, sig, mask, code, type, val)
struct sigframe *fp, frame;
struct sigacts *psp = p->p_sigacts;
int oldonstack;
-#if WHEN_WE_ONLY_FLUSH_DATA_WHEN_DOING_PMAP_ENTER
- int pa;
-#endif
frame.sf_signum = sig;
@@ -729,6 +677,7 @@ sendsig(catcher, sig, mask, code, type, val)
psp->ps_sigstk.ss_flags |= SS_ONSTACK;
} else
fp = (struct sigframe *)tf->fixreg[1];
+
fp = (struct sigframe *)((int)(fp - 1) & ~0xf);
/*
@@ -819,7 +768,7 @@ dumpsys()
}
volatile int cpl, ipending, astpending, tickspending;
-int imask[7];
+int imask[IPL_NUM/*7*/];
int netisr;
/*
@@ -854,9 +803,6 @@ lcsplx(ipl)
void
boot(howto)
int howto;
-#if 0
- char *what;
-#endif
{
static int syncing;
static char str[256];
@@ -887,6 +833,7 @@ boot(howto)
dumpsys();
doshutdownhooks();
printf("rebooting\n\n");
+
ppc_boot(str);
while(1) /* forever */;
}
@@ -920,43 +867,6 @@ do_pending_int()
}
}
-/*
- * set system type from string
- */
-void
-systype(char *name)
-{
- /* this table may be order specific if substrings match several
- * computers but a longer string matches a specific
- */
- int i;
- struct systyp {
- char *name;
- char *systypename;
- int type;
- } systypes[] = {
- { "MOT", "(PWRSTK) MCG powerstack family", PWRSTK },
- { "V-I Power", "(POWER4e) V-I ppc vme boards ", POWER4e},
- { "iMac", "(APPL) Apple iMac ", APPL},
- { "PowerMac", "(APPL) Apple PowerMac ", APPL},
- { "PowerBook", "(APPL) Apple Powerbook ", APPL},
- { NULL,"",0}
- };
- for (i = 0; systypes[i].name != NULL; i++) {
- if (strncmp( name , systypes[i].name,
- strlen (systypes[i].name)) == 0)
- {
- system_type = systypes[i].type;
- printf("recognized system type of %s as %s\n",
- name, systypes[i].systypename);
- break;
- }
- }
- if (system_type == OFWMACH) {
- printf("System type %snot recognized, good luck\n",
- name);
- }
-}
/*
* one attempt at interrupt stuff..
*
@@ -1185,7 +1095,7 @@ mapiodev(pa, len)
return (void *)pa;
}
}
- va = vaddr = uvm_km_valloc(phys_map, size);
+ va = vaddr = uvm_km_valloc_wait(phys_map, size);
if (va == 0)
return NULL;
@@ -1213,11 +1123,7 @@ unmapiodev(kva, p_size)
uvm_km_free_wakeup(phys_map, vaddr, size);
for (; size > 0; size -= NBPG) {
-#if 0
- pmap_remove(vm_map_pmap(phys_map), vaddr, vaddr+NBPG-1);
-#else
pmap_remove(pmap_kernel(), vaddr, vaddr+NBPG-1);
-#endif
vaddr += NBPG;
}
pmap_update(pmap_kernel());
@@ -1351,7 +1257,7 @@ kcopy(from, to, size)
size_t size;
{
faultbuf env;
- register void *oldh = curproc->p_addr->u_pcb.pcb_onfault;
+ void *oldh = curproc->p_addr->u_pcb.pcb_onfault;
if (setfault(&env)) {
curproc->p_addr->u_pcb.pcb_onfault = oldh;