1/*
2 * arch/xtensa/boot/boot-elf/bootstrap.S
3 *
4 * Low-level exception handling
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License.  See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2004 - 2013 by Tensilica Inc.
11 *
12 * Chris Zankel <chris@zankel.net>
13 * Marc Gauthier <marc@tensilica.com>
14 * Piet Delaney <piet@tensilica.com>
15 */
16
17#include <asm/bootparam.h>
18#include <asm/processor.h>
19#include <asm/pgtable.h>
20#include <asm/page.h>
21#include <asm/cacheasm.h>
22#include <asm/initialize_mmu.h>
23#include <linux/linkage.h>
24
25	.section	.ResetVector.text, "ax"
26	.global         _ResetVector
27	.global         reset
28
29_ResetVector:
30	_j _SetupMMU
31
32	.begin  no-absolute-literals
33	.literal_position
34
35	.align 4
36RomInitAddr:
37#if defined(CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX) && \
38	XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
39	.word 0x00003000
40#else
41	.word 0xd0003000
42#endif
43RomBootParam:
44	.word _bootparam
45_bootparam:
46	.short	BP_TAG_FIRST
47	.short	4
48	.long	BP_VERSION
49	.short	BP_TAG_LAST
50	.short	0
51	.long	0
52
53	.align  4
54_SetupMMU:
55	movi	a0, 0
56	wsr	a0, windowbase
57	rsync
58	movi	a0, 1
59	wsr	a0, windowstart
60	rsync
61	movi	a0, 0x1F
62	wsr	a0, ps
63	rsync
64
65	Offset = _SetupMMU - _ResetVector
66
67#ifndef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
68	initialize_mmu
69#endif
70
71	.end    no-absolute-literals
72
73	rsil    a0, XCHAL_DEBUGLEVEL-1
74	rsync
75reset:
76	l32r    a0, RomInitAddr
77	l32r	a2, RomBootParam
78	movi	a3, 0
79	movi	a4, 0
80	jx      a0
81
82	.align 4
83
84	.section	.ResetVector.remapped_text, "x"
85	.global         _RemappedResetVector
86
87	/* Do org before literals */
88	.org 0
89
90_RemappedResetVector:
91	.begin  no-absolute-literals
92	.literal_position
93
94	_j	_RemappedSetupMMU
95
96	/* Position Remapped code at the same location as the original code */
97	. = _RemappedResetVector + Offset
98
99_RemappedSetupMMU:
100#ifndef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
101	initialize_mmu
102#endif
103
104	.end    no-absolute-literals
105