2 * linux/arch/m32r/kernel/head.S
6 * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata,
10 #include <linux/init.h>
15 #include <linux/linkage.h>
16 #include <asm/segment.h>
18 #include <asm/pgtable.h>
19 #include <asm/assembler.h>
21 #include <asm/mmu_context.h>
24 * References to members of the boot_cpu_data structure.
32 /* Setup up the stack pointer */
33 LDIMM (r0, spi_stack_top)
34 LDIMM (r1, spu_stack_top)
39 ldi r0, #0x0000 /* use SPI, disable EI */
42 /* Set up the stack pointer */
43 LDIMM (r0, stack_start)
48 * Clear BSS first so that there are no surprises...
50 #ifdef CONFIG_ISA_DUAL_ISSUE
52 LDIMM (r2, __bss_start)
54 sub r3, r2 ; BSS size in bytes
55 ; R4 = BSS size in longwords (rounded down)
56 mv r4, r3 || ldi r1, #0
57 srli r4, #4 || addi r2, #-4
60 #ifndef CONFIG_CHIP_M32310
61 ; Touch memory for the no-write-allocating cache.
64 st r1, @+r2 || addi r4, #-1
67 st r1, @+r2 || cmpeq r1, r4 ; R4 = 0?
74 stb r1, @r2 || addi r4, #-1
79 #else /* not CONFIG_ISA_DUAL_ISSUE */
81 LDIMM (r2, __bss_start)
83 sub r3, r2 ; BSS size in bytes
85 srli r4, #2 ; R4 = BSS size in longwords (rounded down)
86 ldi r1, #0 ; clear R1 for longwords store
87 addi r2, #-4 ; account for pre-inc store
88 beqz r4, .Lendloop1 ; any more to go?
90 st r1, @+r2 ; yep, zero out another longword
91 addi r4, #-1 ; decrement count
92 bnez r4, .Lloop1 ; go do some more
94 and3 r4, r3, #3 ; get no. of remaining BSS bytes to clear
95 addi r2, #4 ; account for pre-inc store
96 beqz r4, .Lendloop2 ; any more to go?
98 stb r1, @r2 ; yep, zero out another byte
99 addi r2, #1 ; bump address
100 addi r4, #-1 ; decrement count
101 bnez r4, .Lloop2 ; go do some more
104 #endif /* not CONFIG_ISA_DUAL_ISSUE */
106 #if 0 /* M32R_FIXME */
108 * Copy data segment from ROM to RAM.
110 .global ROM_D, TOP_DATA, END_DATA
125 LDIMM (r2, start_kernel)
129 bra 1b ; main should never return here, but
130 ; just in case, we know what happens.
140 LDIMM (r4, eit_vector)
147 or3 r4, r4, #low(MATM)
149 st r5, @r4 ; Set MATM Reg(T bit ON)
150 ld r6, @r4 ; MATM Check
157 ld r6, @r4 ; MATM Check
158 seth r4, #high(M32R_ICU_ISTS_ADDR)
159 or3 r4, r4, #low(M32R_ICU_ISTS_ADDR)
160 ld r5, @r4 ; Read ISTSi reg.
162 slli r5, #13 ; PIML check
164 seth r4, #high(M32R_ICU_IMASK_ADDR)
165 or3 r4, r4, #low(M32R_ICU_IMASK_ADDR)
166 st r5, @r4 ; Write IMASKi reg.
167 slli r6, #4 ; ISN check
169 seth r4, #high(M32R_IRQ_IPI5)
170 or3 r4, r4, #low(M32R_IRQ_IPI5)
171 bne r4, r6, 2f ; if (ISN != CPU_BOOT_IPI) goto sleep;
173 ;; check cpu_bootout_map and set cpu_bootin_map
174 LDIMM (r4, cpu_bootout_map)
176 seth r5, #high(M32R_CPUID_PORTL)
177 or3 r5, r5, #low(M32R_CPUID_PORTL)
183 LDIMM (r4, cpu_bootin_map)
193 LDIMM (r4, stack_start)
197 ;; setup BPC (start_secondary)
198 LDIMM (r4, start_secondary)
201 rte ; goto startup_secondary
209 or3 r4, r4, #low(MATM)
211 st r5, @r4 ; Set MATM Reg(T bit OFF)
212 ld r6, @r4 ; MATM Check
214 seth r5, #high(__PAGE_OFFSET)
215 or3 r5, r5, #low(__PAGE_OFFSET)
222 ;; SLEEP and wait IPI
224 seth r5, #high(__PAGE_OFFSET)
225 or3 r5, r5, #low(__PAGE_OFFSET)
231 #endif /* CONFIG_SMP */
234 .long init_thread_union+8192
238 * This is initialized to create a identity-mapping at 0-4M (for bootup
239 * purposes) and another mapping of the 0-4M area at virtual address
244 #define MOUNT_ROOT_RDONLY 1
245 #define RAMDISK_FLAGS 0 ; 1024KB
246 #define ORIG_ROOT_DEV 0x0100 ; /dev/ram0 (major:01, minor:00)
247 #define LOADER_TYPE 1 ; (??? - non-zero value seems
248 ; to be needed to boot from initrd)
250 #define COMMAND_LINE ""
252 .section .empty_zero_page, "aw"
253 ENTRY(empty_zero_page)
254 .long MOUNT_ROOT_RDONLY /* offset: +0x00 */
258 .long 0 /* INITRD_START */ /* +0x10 */
259 .long 0 /* INITRD_SIZE */
260 .long 0 /* CPU_CLOCK */
261 .long 0 /* BUS_CLOCK */
262 .long 0 /* TIMER_DIVIDE */ /* +0x20 */
268 /*------------------------------------------------------------------------
273 .global spi_stack_top
279 .global spu_stack_top