sh: Generalize SH7786 PCIe support.
[deliverable/linux.git] / arch / sh / kernel / head_32.S
CommitLineData
1da177e4
LT
1/* $Id: head.S,v 1.7 2003/09/01 17:58:19 lethal Exp $
2 *
3 * arch/sh/kernel/head.S
4 *
5 * Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 *
11 * Head.S contains the SH exception handlers and startup code.
12 */
bbe215c2 13#include <linux/init.h>
1da177e4 14#include <linux/linkage.h>
d153ea88 15#include <asm/thread_info.h>
a0ab3668
PM
16#include <asm/mmu.h>
17#include <cpu/mmu_context.h>
1da177e4 18
b7e108ee
PM
19#ifdef CONFIG_CPU_SH4A
20#define SYNCO() synco
21
22#define PREFI(label, reg) \
23 mov.l label, reg; \
24 prefi @reg
25#else
26#define SYNCO()
27#define PREFI(label, reg)
28#endif
29
1da177e4
LT
30 .section .empty_zero_page, "aw"
31ENTRY(empty_zero_page)
32 .long 1 /* MOUNT_ROOT_RDONLY */
33 .long 0 /* RAMDISK_FLAGS */
34 .long 0x0200 /* ORIG_ROOT_DEV */
35 .long 1 /* LOADER_TYPE */
972ad0e0
PM
36 .long 0x00000000 /* INITRD_START */
37 .long 0x00000000 /* INITRD_SIZE */
a0ab3668 38#ifdef CONFIG_32BIT
7a2eacb7
SM
39 .long 0x53453f00 + 32 /* "SE?" = 32 bit */
40#else
41 .long 0x53453f00 + 29 /* "SE?" = 29 bit */
42#endif
e2dfb912
PM
431:
44 .skip PAGE_SIZE - empty_zero_page - 1b
1da177e4 45
bbe215c2 46 __HEAD
339547bf 47
1da177e4
LT
48/*
49 * Condition at the entry of _stext:
50 *
51 * BSC has already been initialized.
52 * INTC may or may not be initialized.
53 * VBR may or may not be initialized.
54 * MMU may or may not be initialized.
55 * Cache may or may not be initialized.
56 * Hardware (including on-chip modules) may or may not be initialized.
57 *
58 */
59ENTRY(_stext)
60 ! Initialize Status Register
61 mov.l 1f, r0 ! MD=1, RB=0, BL=0, IMASK=0xF
62 ldc r0, sr
63 ! Initialize global interrupt mask
de398406 64#ifdef CONFIG_CPU_HAS_SR_RB
aba1030a 65 mov #0, r0
1da177e4 66 ldc r0, r6_bank
de398406
YS
67#endif
68
b7e108ee
PM
69 /*
70 * Prefetch if possible to reduce cache miss penalty.
71 *
72 * We do this early on for SH-4A as a micro-optimization,
73 * as later on we will have speculative execution enabled
74 * and this will become less of an issue.
75 */
76 PREFI(5f, r0)
77 PREFI(6f, r0)
78
1da177e4
LT
79 !
80 mov.l 2f, r0
81 mov r0, r15 ! Set initial r15 (stack pointer)
de398406 82#ifdef CONFIG_CPU_HAS_SR_RB
aba1030a 83 mov.l 7f, r0
1da177e4 84 ldc r0, r7_bank ! ... and initial thread_info
de398406 85#endif
740a3e67
PM
86
87#ifndef CONFIG_SH_NO_BSS_INIT
88 /*
89 * Don't clear BSS if running on slow platforms such as an RTL simulation,
90 * remote memory via SHdebug link, etc. For these the memory can be guaranteed
91 * to be all zero on boot anyway.
92 */
93 ! Clear BSS area
aba1030a
PM
94#ifdef CONFIG_SMP
95 mov.l 3f, r0
96 cmp/eq #0, r0 ! skip clear if set to zero
97 bt 10f
98#endif
99
1da177e4
LT
100 mov.l 3f, r1
101 add #4, r1
102 mov.l 4f, r2
103 mov #0, r0
1049: cmp/hs r2, r1
105 bf/s 9b ! while (r1 < r2)
106 mov.l r0,@-r2
b7e108ee 107
aba1030a 10810:
740a3e67
PM
109#endif
110
b7e108ee
PM
111 ! Additional CPU initialization
112 mov.l 6f, r0
113 jsr @r0
114 nop
115
116 SYNCO() ! Wait for pending instructions..
aba1030a 117
1da177e4
LT
118 ! Start kernel
119 mov.l 5f, r0
120 jmp @r0
121 nop
122
123 .balign 4
de398406
YS
124#if defined(CONFIG_CPU_SH2)
1251: .long 0x000000F0 ! IMASK=0xF
126#else
1da177e4 1271: .long 0x400080F0 ! MD=1, RB=0, BL=0, FD=1, IMASK=0xF
de398406 128#endif
aba1030a 129ENTRY(stack_start)
d153ea88 1302: .long init_thread_union+THREAD_SIZE
1da177e4
LT
1313: .long __bss_start
1324: .long _end
1335: .long start_kernel
1346: .long sh_cpu_init
aba1030a 1357: .long init_thread_union
This page took 0.420224 seconds and 5 git commands to generate.