1 /* $NetBSD: ev64260_locore.S,v 1.11 2009/02/13 22:41:01 apb Exp $ */
2 /* $OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $ */
5 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
6 * Copyright (C) 1995, 1996 TooLs GmbH.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
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.
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.
36 #include "fs_kernfs.h"
37 #include "opt_ppcparam.h"
38 #include "opt_ipkdb.h"
39 #include "opt_modular.h"
40 #include "opt_multiprocessor.h"
41 #include "opt_openpic.h"
44 #include <sys/syscall.h>
46 #include <machine/param.h>
47 #include <machine/vmparam.h>
48 #include <machine/pmap.h>
49 #include <machine/psl.h>
50 #include <machine/trap.h>
52 #include <machine/asm.h>
54 #include <powerpc/spr.h>
55 #include <powerpc/oea/bat.h>
56 #include <powerpc/oea/hid.h>
59 * Some instructions gas doesn't understand (yet?)
61 #define bdneq bdnzf 2,
67 .long 0 /* start symbol table */
69 .long 0 /* end symbol table */
71 .long 0 /* cpu features */
73 * File-scope for locore.S
78 .long 0 /* fake uarea during idle after exit */
80 .long 0 /* fake uarea during idle after exit */
85 * This symbol is here for the benefit of kvm_mkdb, and is supposed to
86 * mark the start of kernel text.
89 .globl _C_LABEL(kernel_text)
90 _C_LABEL(kernel_text):
93 * Startup entry. Note, this must be the first thing in the text
102 stw 1, dink_stack@l(8)
103 lis 8, dink_return@ha
104 stw 0, dink_return@l(8)
118 * Make sure that .bss is zeroed.
125 5: cmpw 0,8,9 /* edata & end are >= word aligned */
133 mtmsr 0 /* Disable FPU/MMU/exceptions */
143 /* flush and disable L2 */
145 lis 0,(L2CR_L2E|L2CR_L2WT)@h /* disable the L2 mode */
147 ori 8,8,L2CR_L2HWF /* enable hardware flush */
149 mtspr SPR_L2CR,8 /* do it */
150 sync /* wait for it to finish */
152 /* Disable data lock mode */
164 oris 8,8,MSSCR0_DL1HWF@h
170 /* disable data and instruction caches */
181 /* disable data and instruction caches */
183 li 0,(HID0_ICE|HID0_DCE)@l
192 /* Enable and flush data and instruction caches */
193 ori 8,8,(HID0_ICFI|HID0_ICE|HID0_DCFI|HID0_DCE)
194 # ori 8,8,(HID0_ICFI|HID0_ICE)
199 andi. 0,8,(HID0_ICFI|HID0_DCFI)
213 /* compute end of kernel memory */
214 lis 8,_C_LABEL(end)@ha
215 addi 8,8,_C_LABEL(end)@l
216 #if NKSYMS || defined(DDB) || defined(MODULAR) || defined(KERNFS)
217 lis 7,_C_LABEL(startsym)@ha
218 addi 7,7,_C_LABEL(startsym)@l
220 lis 7,_C_LABEL(endsym)@ha
221 addi 7,7,_C_LABEL(endsym)@l
223 /* mr 8,4 * end of symbol table */
225 mr 4,8 /* end of mem reserved for kernel */
226 INIT_CPUINFO(4,1,9,0)
236 loop: b loop /* XXX not reached */
239 .globl _C_LABEL(extintr_enable)
240 _C_LABEL(extintr_enable):
247 .globl _C_LABEL(extintr_restore)
248 _C_LABEL(extintr_restore):
255 .globl _C_LABEL(extintr_disable)
256 _C_LABEL(extintr_disable):
264 .globl _C_LABEL(mvpppc_reboot)
265 _C_LABEL(mvpppc_reboot):
274 .globl _C_LABEL(return_to_dink)
275 _C_LABEL(return_to_dink):
278 lwz 1, dink_stack@l(4)
279 lis 4, dink_return@ha
280 lwz 5, dink_return@l(4)
286 * Include common switch / setfault code
288 #include <powerpc/powerpc/locore_subr.S>
291 * Include common trap / execption code
293 #include <powerpc/powerpc/trap_subr.S>
296 * Include PIO routines
298 #include <powerpc/powerpc/pio_subr.S>