blob: 29c68426ab56a15ad7bfc8f1794692e5b3b3b1f4 [file] [log] [blame]
Max Filippove85e3352012-12-03 15:01:43 +04001/*
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 */
Chris Zankel4bedea92005-06-23 22:01:12 -070016
Chris Zankel4bedea92005-06-23 22:01:12 -070017#include <asm/bootparam.h>
Max Filippove85e3352012-12-03 15:01:43 +040018#include <asm/initialize_mmu.h>
Max Filippovccd0ef32014-10-02 22:03:27 +040019#include <asm/vectors.h>
Max Filippove85e3352012-12-03 15:01:43 +040020#include <linux/linkage.h>
Chris Zankel4bedea92005-06-23 22:01:12 -070021
Max Filippove85e3352012-12-03 15:01:43 +040022 .section .ResetVector.text, "ax"
Chris Zankel4bedea92005-06-23 22:01:12 -070023 .global _ResetVector
Max Filippove85e3352012-12-03 15:01:43 +040024 .global reset
25
Chris Zankel4bedea92005-06-23 22:01:12 -070026_ResetVector:
Max Filippove85e3352012-12-03 15:01:43 +040027 _j _SetupMMU
28
29 .begin no-absolute-literals
30 .literal_position
31
Max Filippova9f2fc62016-04-13 05:20:02 +030032#if defined(CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX) && \
33 XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
Max Filippov0c692562018-08-13 20:43:10 -070034 .literal RomInitAddr, CONFIG_KERNEL_LOAD_ADDRESS
Max Filippova9f2fc62016-04-13 05:20:02 +030035#else
Max Filippov0c692562018-08-13 20:43:10 -070036 .literal RomInitAddr, KERNELOFFSET
Max Filippova9f2fc62016-04-13 05:20:02 +030037#endif
Max Filippovbaac1d32018-08-13 18:56:37 -070038#ifndef CONFIG_PARSE_BOOTPARAM
Max Filippov0c692562018-08-13 20:43:10 -070039 .literal RomBootParam, 0
Max Filippovbaac1d32018-08-13 18:56:37 -070040#else
Max Filippov0c692562018-08-13 20:43:10 -070041 .literal RomBootParam, _bootparam
42
43 .align 4
Max Filippove85e3352012-12-03 15:01:43 +040044_bootparam:
45 .short BP_TAG_FIRST
46 .short 4
47 .long BP_VERSION
48 .short BP_TAG_LAST
49 .short 0
50 .long 0
Max Filippovbaac1d32018-08-13 18:56:37 -070051#endif
Max Filippove85e3352012-12-03 15:01:43 +040052
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
Max Filippove85e3352012-12-03 15:01:43 +040065#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
Chris Zankel4bedea92005-06-23 22:01:12 -070073reset:
74 l32r a0, RomInitAddr
75 l32r a2, RomBootParam
76 movi a3, 0
77 movi a4, 0
78 jx a0