2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * arch/shmedia/boot/compressed/head.S
9 * arch/shmedia/kernel/head.S
10 * which carried the copyright:
11 * Copyright (C) 2000, 2001 Paolo Alberelli
13 * Modification for compressed loader:
14 * Copyright (C) 2002 Stuart Menefy (stuart.menefy@st.com)
17 #include <linux/linkage.h>
18 #include <asm/registers.h>
19 #include <asm/cache.h>
20 #include <asm/mmu_context.h>
23 * Fixed TLB entries to identity map the beginning of RAM
25 #define MMUIR_TEXT_H 0x0000000000000003 | CONFIG_MEMORY_START
26 /* Enabled, Shared, ASID 0, Eff. Add. 0xA0000000 */
27 #define MMUIR_TEXT_L 0x000000000000009a | CONFIG_MEMORY_START
28 /* 512 Mb, Cacheable (Write-back), execute, Not User, Ph. Add. */
30 #define MMUDR_CACHED_H 0x0000000000000003 | CONFIG_MEMORY_START
31 /* Enabled, Shared, ASID 0, Eff. Add. 0xA0000000 */
32 #define MMUDR_CACHED_L 0x000000000000015a | CONFIG_MEMORY_START
33 /* 512 Mb, Cacheable (Write-back), read/write, Not User, Ph. Add. */
35 #define ICCR0_INIT_VAL ICCR0_ON | ICCR0_ICI /* ICE + ICI */
36 #define ICCR1_INIT_VAL ICCR1_NOLOCK /* No locking */
39 #define OCCR0_INIT_VAL OCCR0_ON | OCCR0_OCI | OCCR0_WB /* OCE + OCI + WB */
41 #define OCCR0_INIT_VAL OCCR0_OFF
43 #define OCCR1_INIT_VAL OCCR1_NOLOCK /* No locking */
50 * Prevent speculative fetch on device memory due to
51 * uninitialized target registers.
52 * This must be executed before the first branch.
65 * Set initial TLB entries for cached and uncached regions.
66 * Note: PTA/BLINK is PIC code, PTABS/BLINK isn't !
71 movi ITLB_LAST_VAR_UNRESTRICTED+TLB_STEP, r22
72 1: putcfg r21, 0, ZERO /* Clear MMUIR[n].PTEH.V */
73 addi r21, TLB_STEP, r21
79 movi DTLB_LAST_VAR_UNRESTRICTED+TLB_STEP, r22
80 1: putcfg r21, 0, ZERO /* Clear MMUDR[n].PTEH.V */
81 addi r21, TLB_STEP, r21
84 /* Map one big (512Mb) page for ITLB */
86 movi MMUIR_TEXT_L, r22 /* PTEL first */
87 putcfg r21, 1, r22 /* Set MMUIR[0].PTEL */
88 movi MMUIR_TEXT_H, r22 /* PTEH last */
89 putcfg r21, 0, r22 /* Set MMUIR[0].PTEH */
91 /* Map one big CACHED (512Mb) page for DTLB */
93 movi MMUDR_CACHED_L, r22 /* PTEL first */
94 putcfg r21, 1, r22 /* Set MMUDR[0].PTEL */
95 movi MMUDR_CACHED_H, r22 /* PTEH last */
96 putcfg r21, 0, r22 /* Set MMUDR[0].PTEH */
100 movi ICCR0_INIT_VAL, r22
101 movi ICCR1_INIT_VAL, r23
102 putcfg r21, ICCR_REG0, r22
103 putcfg r21, ICCR_REG1, r23
108 movi OCCR0_INIT_VAL, r22
109 movi OCCR1_INIT_VAL, r23
110 putcfg r21, OCCR_REG0, r22
111 putcfg r21, OCCR_REG1, r23
116 * From here-on code can be non-PIC.
118 movi SR_HARMLESS | SR_ENABLE_MMU, r22
123 rte /* And now go into the hyperspace ... */
124 1: /* ... that's the next instruction ! */
126 /* Set initial stack pointer */
127 movi datalabel stack_start, r0
134 movi datalabel __bss_start, r22
135 movi datalabel _end, r23
141 * Decompress the kernel.
143 pt decompress_kernel, tr0
149 movi SR_HARMLESS, r22
154 rte /* And now go into the hyperspace ... */
155 1: /* ... that's the next instruction ! */
157 /* Jump into the decompressed kernel */
158 movi datalabel (CONFIG_MEMORY_START + 0x2000)+1, r19
162 /* Shouldn't return here, but just in case, loop forever */