2 * linux/arch/arm/kernel/head-armv.S
4 * Copyright (C) 1994-1999 Russell King
6 * 32-bit kernel startup code for all architectures
8 #include <linux/config.h>
9 #include <linux/linkage.h>
11 #include <asm/assembler.h>
12 #include <asm/hardware.h>
13 #include <asm/dec21285.h>
15 #if (TEXTADDR & 0xffff) != 0x8000
16 #error TEXTADDR must start at 0xXXXX8000
19 #define SWAPPER_PGDIR_OFFSET 0x4000
21 .globl SYMBOL_NAME(swapper_pg_dir)
22 .equ SYMBOL_NAME(swapper_pg_dir), TEXTADDR - 0x8000 + SWAPPER_PGDIR_OFFSET
24 .section ".text.init",#alloc,#execinstr
25 .type stext, #function
29 #ifdef CONFIG_ARCH_NETWINDER
31 * Compatability cruft for old NetWinder NeTTroms. This
32 * code is currently scheduled for destruction in 2.5.xx
55 ldmia r2!, {r6, r7, r8, r9}
56 stmia r3!, {r6, r7, r8, r9}
69 * Entry point. Entry *must* be called with r0 == 0, with the MMU off.
70 * r1 contains the unique architecture number. See
71 * linux/arch/arm/kernel/setup.c machine_desc[] array for the complete
72 * list. If you require a new number, please follow the instructions
73 * given in Documentation/arm/README.
78 bl __lookup_processor_type
79 teq r10, #0 @ invalid processor?
82 bl __lookup_architecture_type
83 teq r7, #0 @ invalid architecture?
86 bl __create_page_tables
88 add pc, r10, #12 @ flush caches (returns ctrl reg)
90 __switch_data: .long __mmap_switched
91 .long SYMBOL_NAME(__bss_start)
92 .long SYMBOL_NAME(_end)
93 .long SYMBOL_NAME(processor_id)
94 .long SYMBOL_NAME(__machine_arch_type)
95 .long SYMBOL_NAME(cr_alignment)
96 .long SYMBOL_NAME(init_task_union)+8192
98 __ret: ldr lr, __switch_data
99 mcr p15, 0, r0, c1, c0
106 * This code follows on after the page
107 * table switch and jump above.
109 * r0 = processor control register
115 adr r3, __switch_data + 4
116 ldmia r3, {r4, r5, r6, r7, r8, sp} @ Setup stack
118 mov fp, #0 @ Clear BSS
123 str r9, [r6] @ Save processor ID
124 str r1, [r7] @ Save machine type
125 #ifdef CONFIG_ALIGNMENT_TRAP
126 orr r0, r0, #2 @ ...........A.
128 bic r2, r0, #2 @ Clear 'A' bit
129 stmia r8, {r0, r2} @ Save control register values
130 b SYMBOL_NAME(start_kernel)
135 * Setup the initial page tables. We only setup the barest
136 * amount which are required to get the kernel running, which
137 * generally means mapping in the kernel code.
139 * We only map in 4MB of RAM, which should be sufficient in
142 * r5 = physical address of start of RAM
143 * r6 = physical IO address
144 * r7 = byte offset into page tables for IO
145 * r8 = page table flags
147 __create_page_tables:
148 add r4, r5, #SWAPPER_PGDIR_OFFSET
151 add r2, r0, #0x4000 @ Clear page table
159 * Create identity mapping for first MB of kernel.
160 * map in four sections (4MB) for kernel.
161 * these are marked cacheable and bufferable.
163 * The identity mapping will be removed by paging_init()
168 add r0, r4, r5, lsr #18
170 add r0, r4, #(TEXTADDR - 0x8000) >> 18
178 #ifdef CONFIG_DEBUG_LL
180 * Map in IO space for serial debugging.
181 * This allows debug messages to be output
182 * via a serial before paging_init.
185 rsb r3, r7, #0x4000 @ PTRS_PER_PGD*sizeof(long)
187 addge r2, r0, #0x0800
194 #ifdef CONFIG_ARCH_NETWINDER
206 #ifdef CONFIG_ARCH_RPC
208 * Map in screen at 0x02000000 & SCREEN2_BASE
209 * Similar reasons here - for debug. This is
210 * only for Acorn RiscPC architectures.
213 addne r0, r4, #0x80 @ 02000000
214 movne r3, #0x02000000
217 addne r0, r4, #0x3600 @ d8000000
225 * Exception handling. Something went wrong and we can't
226 * proceed. We ought to tell the user, but since we
227 * don't have any guarantee that we're even running on
228 * the right architecture, we do virtually nothing.
229 * r0 = ascii error character
231 * Generally, only serious errors cause this.
234 #ifdef CONFIG_ARCH_RPC
236 * Turn the screen red on a error - RiscPC only.
240 orr r3, r3, r3, lsl #8
241 orr r3, r3, r3, lsl #16
253 * Read processor ID register (CP#15, CR0), and determine
257 * r5, r6, r7 corrupted
258 * r8 = page table flags
260 * r10 = pointer to processor structure
262 __lookup_processor_type:
264 ldmia r5, {r7, r9, r10}
268 mrc p15, 0, r9, c0, c0 @ get processor id
269 1: ldmia r10, {r5, r6, r8} @ value, mask, mmuflags
273 add r10, r10, #36 @ sizeof(proc_info_list)
279 2: .long __proc_info_end
281 .long __proc_info_begin
284 * Lookup machine architecture
285 * r1 = machine architecture number
288 * r5 = physical start address of RAM
289 * r6 = physical address of IO
290 * r7 = byte offset into page tables for IO
292 __lookup_architecture_type:
293 cmp r1, #(__arch_types_end - __arch_types_start) / 16
295 adr r4, __arch_types_start
296 add r4, r4, r1, lsl #4
297 ldmia r4, {r4, r5, r6, r7}
304 * Machine parameters. Each machine requires 4 words, which are:
307 * word1: physical start address of RAM
308 * word2: physical start address of IO
309 * word3: virtual start address of IO
311 * The IO mappings entered here are used to set up mappings
312 * required for debugging information to be shown to the user.
313 * paging_init() does the real page table initialisation.
315 .type __arch_types_start, #object
323 @ 0x01 - Acorn RiscPC
344 .long DC21285_ARMCSR_BASE
347 @ 0x05 - Rebel.com NetWinder
350 .long DC21285_ARMCSR_BASE
356 .long DC21285_ARMCSR_BASE
362 .long 0x00400000 @ Uart
365 @ 0x08 - DEC EBSA285 as co-processor
368 .long DC21285_ARMCSR_BASE @ Physical I/O base address
369 .long 0x7cf00000 @ Virtual I/O base address
377 @ 0x0a - Acorn Archimedes
407 @ 0x0f - Digital Shark (DNARD)
420 * Don't add anything here unless you have an
421 * architecture number allocated - see
422 * Documentation/arm/README