2 * linux/arch/m32r/kernel/head.S
6 * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata,
12 #include <linux/init.h>
17 #include <linux/linkage.h>
18 #include <asm/segment.h>
20 #include <asm/pgtable.h>
21 #include <asm/assembler.h>
23 #include <asm/mmu_context.h>
26 * References to members of the boot_cpu_data structure.
35 /* Setup up the stack pointer */
36 LDIMM (r0, spi_stack_top)
37 LDIMM (r1, spu_stack_top)
42 ldi r0, #0x0000 /* use SPI, disable EI */
45 /* Set up the stack pointer */
46 LDIMM (r0, stack_start)
51 * Clear BSS first so that there are no surprises...
53 #ifdef CONFIG_ISA_DUAL_ISSUE
55 LDIMM (r2, __bss_start)
57 sub r3, r2 ; BSS size in bytes
58 ; R4 = BSS size in longwords (rounded down)
59 mv r4, r3 || ldi r1, #0
60 srli r4, #4 || addi r2, #-4
63 #ifndef CONFIG_CHIP_M32310
64 ; Touch memory for the no-write-allocating cache.
67 st r1, @+r2 || addi r4, #-1
70 st r1, @+r2 || cmpeq r1, r4 ; R4 = 0?
77 stb r1, @r2 || addi r4, #-1
82 #else /* not CONFIG_ISA_DUAL_ISSUE */
84 LDIMM (r2, __bss_start)
86 sub r3, r2 ; BSS size in bytes
88 srli r4, #2 ; R4 = BSS size in longwords (rounded down)
89 ldi r1, #0 ; clear R1 for longwords store
90 addi r2, #-4 ; account for pre-inc store
91 beqz r4, .Lendloop1 ; any more to go?
93 st r1, @+r2 ; yep, zero out another longword
94 addi r4, #-1 ; decrement count
95 bnez r4, .Lloop1 ; go do some more
97 and3 r4, r3, #3 ; get no. of remaining BSS bytes to clear
98 addi r2, #4 ; account for pre-inc store
99 beqz r4, .Lendloop2 ; any more to go?
101 stb r1, @r2 ; yep, zero out another byte
102 addi r2, #1 ; bump address
103 addi r4, #-1 ; decrement count
104 bnez r4, .Lloop2 ; go do some more
107 #endif /* not CONFIG_ISA_DUAL_ISSUE */
109 #if 0 /* M32R_FIXME */
111 * Copy data segment from ROM to RAM.
113 .global ROM_D, TOP_DATA, END_DATA
128 LDIMM (r2, start_kernel)
132 bra 1b ; main should never return here, but
133 ; just in case, we know what happens.
143 LDIMM (r4, eit_vector)
150 or3 r4, r4, #low(MATM)
152 st r5, @r4 ; Set MATM Reg(T bit ON)
153 ld r6, @r4 ; MATM Check
160 ld r6, @r4 ; MATM Check
161 seth r4, #high(M32R_ICU_ISTS_ADDR)
162 or3 r4, r4, #low(M32R_ICU_ISTS_ADDR)
163 ld r5, @r4 ; Read ISTSi reg.
165 slli r5, #13 ; PIML check
167 seth r4, #high(M32R_ICU_IMASK_ADDR)
168 or3 r4, r4, #low(M32R_ICU_IMASK_ADDR)
169 st r5, @r4 ; Write IMASKi reg.
170 slli r6, #4 ; ISN check
172 seth r4, #high(M32R_IRQ_IPI5)
173 or3 r4, r4, #low(M32R_IRQ_IPI5)
174 bne r4, r6, 2f ; if (ISN != CPU_BOOT_IPI) goto sleep;
176 ;; check cpu_bootout_map and set cpu_bootin_map
177 LDIMM (r4, cpu_bootout_map)
179 seth r5, #high(M32R_CPUID_PORTL)
180 or3 r5, r5, #low(M32R_CPUID_PORTL)
186 LDIMM (r4, cpu_bootin_map)
196 LDIMM (r4, stack_start)
200 ;; setup BPC (start_secondary)
201 LDIMM (r4, start_secondary)
204 rte ; goto startup_secondary
212 or3 r4, r4, #low(MATM)
214 st r5, @r4 ; Set MATM Reg(T bit OFF)
215 ld r6, @r4 ; MATM Check
217 seth r5, #high(__PAGE_OFFSET)
218 or3 r5, r5, #low(__PAGE_OFFSET)
225 ;; SLEEP and wait IPI
227 seth r5, #high(__PAGE_OFFSET)
228 or3 r5, r5, #low(__PAGE_OFFSET)
234 #endif /* CONFIG_SMP */
237 .long init_thread_union+8192
241 * This is initialized to create a identity-mapping at 0-4M (for bootup
242 * purposes) and another mapping of the 0-4M area at virtual address
247 #define MOUNT_ROOT_RDONLY 1
248 #define RAMDISK_FLAGS 0 ; 1024KB
249 #define ORIG_ROOT_DEV 0x0100 ; /dev/ram0 (major:01, minor:00)
250 #define LOADER_TYPE 1 ; (??? - non-zero value seems
251 ; to be needed to boot from initrd)
253 #define COMMAND_LINE ""
255 .section .empty_zero_page, "aw"
256 ENTRY(empty_zero_page)
257 .long MOUNT_ROOT_RDONLY /* offset: +0x00 */
261 .long 0 /* INITRD_START */ /* +0x10 */
262 .long 0 /* INITRD_SIZE */
263 .long 0 /* CPU_CLOCK */
264 .long 0 /* BUS_CLOCK */
265 .long 0 /* TIMER_DIVIDE */ /* +0x20 */
271 /*------------------------------------------------------------------------
276 .global spi_stack_top
282 .global spu_stack_top