blob: e65515f20bb806d17cde38894811307851bb9274 [file] [log] [blame]
Furquan Shaikh2af76f42014-04-28 16:39:40 -07001/*
2 * Early initialization code for aarch64 (a.k.a. armv8)
3 *
4 * Copyright 2013 Google Inc.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
9 * the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19 * MA 02111-1307 USA
20 */
21
22.section ".start", "a", %progbits
23.globl _start
24_start: b reset
25 .balignl 16,0xdeadbeef
26
27_cbfs_master_header:
28 /* The CBFS master header is inserted by cbfstool at the first
29 * aligned offset after the above anchor string is found.
30 * Hence, we leave some space for it.
31 * Assumes 64-byte alignment.
32 */
33 .skip 128
34
35reset:
36 /*
37 * Set the cpu to SVC32 mode and unmask aborts. Aborts might happen
38 * before logging is turned on and may crash the machine, but at least
39 * the problem will show up near the code that causes it.
40 */
41 /* FIXME: Not using supervisor mode, does it apply for aarch64? */
42
43 msr daifclr, #0xc /* Unmask Debug and System exceptions */
44 msr daifset, #0x3 /* Mask IRQ, FIQ */
45
46 bl arm_init_caches
47
48 /*
49 * Initialize the stack to a known value. This is used to check for
50 * stack overflow later in the boot process.
51 */
52 ldr x0, .Stack
53 ldr x1, .Stack_size
54 sub x0, x0, x1
55 ldr x1, .Stack
56 ldr x2, =0xdeadbeefdeadbeef
57init_stack_loop:
58 str x2, [x0]
59 add x0, x0, #8
60 cmp x0, x1
61 bne init_stack_loop
62
63/* Set stackpointer in internal RAM to call bootblock main() */
64call_bootblock:
65 ldr x0, .Stack /* Set up stack pointer */
66 mov sp, x0
67 ldr x0, =0x00000000
68
69 sub sp, sp, #16
70
71 /*
72 * Switch to EL2 already because Linux requires to be
73 * in EL1 or EL2, see its "Booting AArch64 Linux" doc
74 */
75 bl switch_el3_to_el2
76 bl main
77
78.align 3
79.Stack:
80 .word CONFIG_STACK_TOP
81.align 3
82.Stack_size:
83 .word CONFIG_STACK_SIZE
84 .section ".id", "a", %progbits
85
86 .globl __id_start
87__id_start:
88ver:
89 .asciz COREBOOT_VERSION
90vendor:
91 .asciz CONFIG_MAINBOARD_VENDOR
92part:
93 .asciz CONFIG_MAINBOARD_PART_NUMBER
94.long __id_end - ver /* Reverse offset to the vendor id */
95.long __id_end - vendor /* Reverse offset to the vendor id */
96.long __id_end - part /* Reverse offset to the part number */
97.long CONFIG_ROM_SIZE /* Size of this romimage */
98 .globl __id_end
99
100__id_end:
101.previous