wii_locore.S revision 1.1 1 /* $NetBSD: wii_locore.S,v 1.1 2024/01/20 21:36:00 jmcneill Exp $ */
2 /* $OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $ */
3
4 /*
5 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
6 * Copyright (C) 1995, 1996 TooLs GmbH.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by TooLs GmbH.
20 * 4. The name of TooLs GmbH may not be used to endorse or promote products
21 * derived from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
29 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
31 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
32 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 #include "opt_ddb.h"
36 #include "opt_kgdb.h"
37 #include "opt_multiprocessor.h"
38 #include "opt_openpic.h"
39 #include "opt_ppcparam.h"
40 #include "assym.h"
41
42 #include <sys/syscall.h>
43
44 #include <machine/param.h>
45 #include <machine/psl.h>
46 #include <machine/trap.h>
47 #include <machine/asm.h>
48
49 #include <powerpc/spr.h>
50 #include <powerpc/oea/spr.h>
51 #include <powerpc/oea/hid.h>
52
53 #include "ksyms.h"
54
55 /*
56 * Some instructions gas doesn't understand (yet?)
57 */
58 #define bdneq bdnzf 2,
59
60 /*
61 * Globals
62 */
63 GLOBAL(startsym)
64 .long 0 /* start symbol table */
65 GLOBAL(endsym)
66 .long 0 /* end symbol table */
67 /*
68 * This symbol is here for the benefit of kvm_mkdb, and is supposed to
69 * mark the start of kernel text.
70 */
71 .text
72 .globl _C_LABEL(kernel_text)
73 _C_LABEL(kernel_text):
74
75 /*
76 * Startup entry. Note, this must be the first thing in the text
77 * segment!
78 */
79 .text
80 .globl __start
81 __start:
82
83 /* reset MMU to a known state */
84 #include "wii_mmuinit.S"
85
86 /* compute end of kernel memory */
87 lis 4,_C_LABEL(end)@ha
88 addi 4,4,_C_LABEL(end)@l
89 rlwinm 4,4,0,1,31
90
91 INIT_CPUINFO(4,1,9,5)
92
93 lis 3,__start@ha
94 addi 3,3,__start@l
95 rlwinm 3,3,0,1,31
96
97 xor 5,5,5
98 xor 6,6,6
99 bl _C_LABEL(cpu_model_init)
100 bl _C_LABEL(initppc)
101
102 sync
103 isync
104 mfspr 8,SPR_HID0
105 ori 8, 8, (HID0_ICE | HID0_DCE)@l
106 isync
107 mtspr SPR_HID0,8
108 sync
109 isync
110
111 bl _C_LABEL(main)
112
113 loop: b loop /* XXX not reached */
114
115 .globl _C_LABEL(enable_intr)
116 _C_LABEL(enable_intr):
117 mfmsr 3
118 ori 3,3,PSL_EE@l
119 mtmsr 3
120 blr
121
122 .globl _C_LABEL(disable_intr)
123 _C_LABEL(disable_intr):
124 mfmsr 3
125 andi. 3,3,~PSL_EE@l
126 mtmsr 3
127 blr
128
129 /*
130 * Include common switch / setfault code
131 */
132 #include <powerpc/powerpc/locore_subr.S>
133
134 /*
135 * Include common trap / exception code
136 */
137 #include <powerpc/powerpc/trap_subr.S>
138
139 /*
140 * Include PIO routines
141 */
142 #include <powerpc/powerpc/pio_subr.S>
143