xref: /linux/arch/xtensa/boot/boot-elf/bootstrap.S (revision ca55b2fef3a9373fcfc30f82fd26bc7fccbda732)
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 <asm/vectors.h>
24#include <linux/linkage.h>
25
26	.section	.ResetVector.text, "ax"
27	.global         _ResetVector
28	.global         reset
29
30_ResetVector:
31	_j _SetupMMU
32
33	.begin  no-absolute-literals
34	.literal_position
35
36	.align 4
37RomInitAddr:
38	.word	LOAD_MEMORY_ADDRESS
39RomBootParam:
40	.word _bootparam
41_bootparam:
42	.short	BP_TAG_FIRST
43	.short	4
44	.long	BP_VERSION
45	.short	BP_TAG_LAST
46	.short	0
47	.long	0
48
49	.align  4
50_SetupMMU:
51	movi	a0, 0
52	wsr	a0, windowbase
53	rsync
54	movi	a0, 1
55	wsr	a0, windowstart
56	rsync
57	movi	a0, 0x1F
58	wsr	a0, ps
59	rsync
60
61	Offset = _SetupMMU - _ResetVector
62
63#ifndef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
64	initialize_mmu
65#endif
66
67	.end    no-absolute-literals
68
69	rsil    a0, XCHAL_DEBUGLEVEL-1
70	rsync
71reset:
72	l32r    a0, RomInitAddr
73	l32r	a2, RomBootParam
74	movi	a3, 0
75	movi	a4, 0
76	jx      a0
77
78#ifdef CONFIG_MMU
79	.align 4
80
81	.section	.ResetVector.remapped_text, "x"
82	.global         _RemappedResetVector
83
84	/* Do org before literals */
85	.org 0
86
87_RemappedResetVector:
88	.begin  no-absolute-literals
89	.literal_position
90
91	_j	_RemappedSetupMMU
92
93	/* Position Remapped code at the same location as the original code */
94	. = _RemappedResetVector + Offset
95
96_RemappedSetupMMU:
97#ifndef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
98	initialize_mmu
99#endif
100
101	.end    no-absolute-literals
102#endif
103