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.
33 /* Setup up the stack pointer */
34 LDIMM (r0, spi_stack_top)
35 LDIMM (r1, spu_stack_top)
40 ldi r0, #0x0000 /* use SPI, disable EI */
43 /* Set up the stack pointer */
44 LDIMM (r0, stack_start)
49 * Clear BSS first so that there are no surprises...
51 #ifdef CONFIG_ISA_DUAL_ISSUE
53 LDIMM (r2, __bss_start)
55 sub r3, r2 ; BSS size in bytes
56 ; R4 = BSS size in longwords (rounded down)
57 mv r4, r3 || ldi r1, #0
58 srli r4, #4 || addi r2, #-4
61 #ifndef CONFIG_CHIP_M32310
62 ; Touch memory for the no-write-allocating cache.
65 st r1, @+r2 || addi r4, #-1
68 st r1, @+r2 || cmpeq r1, r4 ; R4 = 0?
75 stb r1, @r2 || addi r4, #-1
80 #else /* not CONFIG_ISA_DUAL_ISSUE */
82 LDIMM (r2, __bss_start)
84 sub r3, r2 ; BSS size in bytes
86 srli r4, #2 ; R4 = BSS size in longwords (rounded down)
87 ldi r1, #0 ; clear R1 for longwords store
88 addi r2, #-4 ; account for pre-inc store
89 beqz r4, .Lendloop1 ; any more to go?
91 st r1, @+r2 ; yep, zero out another longword
92 addi r4, #-1 ; decrement count
93 bnez r4, .Lloop1 ; go do some more
95 and3 r4, r3, #3 ; get no. of remaining BSS bytes to clear
96 addi r2, #4 ; account for pre-inc store
97 beqz r4, .Lendloop2 ; any more to go?
99 stb r1, @r2 ; yep, zero out another byte
100 addi r2, #1 ; bump address
101 addi r4, #-1 ; decrement count
102 bnez r4, .Lloop2 ; go do some more
105 #endif /* not CONFIG_ISA_DUAL_ISSUE */
107 #if 0 /* M32R_FIXME */
109 * Copy data segment from ROM to RAM.
111 .global ROM_D, TOP_DATA, END_DATA
126 LDIMM (r2, start_kernel)
130 bra 1b ; main should never return here, but
131 ; just in case, we know what happens.
141 LDIMM (r4, eit_vector)
148 or3 r4, r4, #low(MATM)
150 st r5, @r4 ; Set MATM Reg(T bit ON)
151 ld r6, @r4 ; MATM Check
158 ld r6, @r4 ; MATM Check
159 seth r4, #high(M32R_ICU_ISTS_ADDR)
160 or3 r4, r4, #low(M32R_ICU_ISTS_ADDR)
161 ld r5, @r4 ; Read ISTSi reg.
163 slli r5, #13 ; PIML check
165 seth r4, #high(M32R_ICU_IMASK_ADDR)
166 or3 r4, r4, #low(M32R_ICU_IMASK_ADDR)
167 st r5, @r4 ; Write IMASKi reg.
168 slli r6, #4 ; ISN check
170 seth r4, #high(M32R_IRQ_IPI5)
171 or3 r4, r4, #low(M32R_IRQ_IPI5)
172 bne r4, r6, 2f ; if (ISN != CPU_BOOT_IPI) goto sleep;
174 ;; check cpu_bootout_map and set cpu_bootin_map
175 LDIMM (r4, cpu_bootout_map)
177 seth r5, #high(M32R_CPUID_PORTL)
178 or3 r5, r5, #low(M32R_CPUID_PORTL)
184 LDIMM (r4, cpu_bootin_map)
194 LDIMM (r4, stack_start)
198 ;; setup BPC (start_secondary)
199 LDIMM (r4, start_secondary)
202 rte ; goto startup_secondary
210 or3 r4, r4, #low(MATM)
212 st r5, @r4 ; Set MATM Reg(T bit OFF)
213 ld r6, @r4 ; MATM Check
215 seth r5, #high(__PAGE_OFFSET)
216 or3 r5, r5, #low(__PAGE_OFFSET)
223 ;; SLEEP and wait IPI
225 seth r5, #high(__PAGE_OFFSET)
226 or3 r5, r5, #low(__PAGE_OFFSET)
232 #endif /* CONFIG_SMP */
235 .long init_thread_union+8192
239 * This is initialized to create a identity-mapping at 0-4M (for bootup
240 * purposes) and another mapping of the 0-4M area at virtual address
245 #define MOUNT_ROOT_RDONLY 1
246 #define RAMDISK_FLAGS 0 ; 1024KB
247 #define ORIG_ROOT_DEV 0x0100 ; /dev/ram0 (major:01, minor:00)
248 #define LOADER_TYPE 1 ; (??? - non-zero value seems
249 ; to be needed to boot from initrd)
251 #define COMMAND_LINE ""
253 .section .empty_zero_page, "aw"
254 ENTRY(empty_zero_page)
255 .long MOUNT_ROOT_RDONLY /* offset: +0x00 */
259 .long 0 /* INITRD_START */ /* +0x10 */
260 .long 0 /* INITRD_SIZE */
261 .long 0 /* CPU_CLOCK */
262 .long 0 /* BUS_CLOCK */
263 .long 0 /* TIMER_DIVIDE */ /* +0x20 */
269 /*------------------------------------------------------------------------
274 .global spi_stack_top
280 .global spu_stack_top