GNU Linux-libre 4.19.245-gnu1
[releases.git] / arch / xtensa / boot / boot-elf / bootstrap.S
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/initialize_mmu.h>
19 #include <asm/vectors.h>
20 #include <linux/linkage.h>
21
22         .section        .ResetVector.text, "ax"
23         .global         _ResetVector
24         .global         reset
25
26 _ResetVector:
27         _j _SetupMMU
28
29         .begin  no-absolute-literals
30         .literal_position
31
32 #if defined(CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX) && \
33         XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
34         .literal RomInitAddr, CONFIG_KERNEL_LOAD_ADDRESS
35 #else
36         .literal RomInitAddr, KERNELOFFSET
37 #endif
38 #ifndef CONFIG_PARSE_BOOTPARAM
39         .literal RomBootParam, 0
40 #else
41         .literal RomBootParam, _bootparam
42
43         .align 4
44 _bootparam:
45         .short  BP_TAG_FIRST
46         .short  4
47         .long   BP_VERSION
48         .short  BP_TAG_LAST
49         .short  0
50         .long   0
51 #endif
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 #ifndef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
66         initialize_mmu
67 #endif
68
69         .end    no-absolute-literals
70
71         rsil    a0, XCHAL_DEBUGLEVEL-1
72         rsync
73 reset:
74         l32r    a0, RomInitAddr
75         l32r    a2, RomBootParam
76         movi    a3, 0
77         movi    a4, 0
78         jx      a0