blob: 1461a9cbc55dbca2aff014839b7e519dd67b389d [file] [log] [blame]
Ronald G. Minniche0e784a2014-11-26 19:25:47 +00001/*
2 * Early initialization code for aarch64 (a.k.a. armv8)
3 *
4 * Copyright 2013Google 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// See LICENSE for license details. relating to the _start code in this file.
22#include <arch/encoding.h>
23
Julius Wernerec5e5e02014-08-20 15:29:56 -070024.section ".text._start", "ax", %progbits
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000025// Maybe there's a better way.
26.space 0x2000
27.globl _start
28_start:
29
30 // pending figuring out this f-ing toolchain. Hardcode what we know works.
31 la sp, 0x4ef0 // .stacktop
32// la a0, trap_entry
33// la gp, _gp
34// csrw evec, a0
35
36 # clear any pending interrupts
37 csrwi clear_ipi, 0
38
39 li a0, SR_S | SR_PS | SR_EI | SR_S64 | SR_U64
40 or a1, a0, SR_EF | SR_EA
41 csrw status, a1
42 csrr a1, status
43 csrw status, a0
44
45// and a2, a1, SR_EF
46// sw a2, have_fp, t0
47
48// and a2, a1, SR_EA
49// sw a2, have_accelerator, t0
50 call main
51.=0x4000
52.stack:
53.align 8
54 .space 0xf00
55.stacktop:
56 .quad 0
57.align 3
58.stack_size:
59 .quad 0xf00
60
61.globl _cbfs_master_header
62_cbfs_master_header:
63 .balignl 16,0xdeadbeef
64 .align 8
65 // this assembler SUCKS
66 .long 0x4F524243
67 .long 0xdeadbeef
68 .long 0xdeadbeef
69 .long 0xdeadbeef
70 .long 0xdeadbeef
71 .long 0xdeadbeef
72 .long 0xdeadbeef
73 /* The CBFS master header is inserted by cbfstool at the first
74 * aligned offset after the above anchor string is found.
75 * Hence, we leave some space for it.
76 * Assumes 64-byte alignment.
77 */
78 .space 128
79
80reset:
81init_stack_loop:
82
83 .word CONFIG_STACK_SIZE
84 .section ".id", "a", %progbits
85
86 .section ".id", "a", @progbits
87
88 .globl __id_start
89 // fix this bs later. What's wrong with the riscv gcc?
90__id_start:
91ver:
92 .asciz "1" //COREBOOT_VERSION
93vendor:
94 .asciz "ucb" //CONFIG_MAINBOARD_VENDOR
95part:
96 .asciz "1" //CONFIG_MAINBOARD_PART_NUMBER
97.long __id_end + CONFIG_ID_SECTION_OFFSET - ver /* Reverse offset to the vendor id */
98.long __id_end + CONFIG_ID_SECTION_OFFSET - vendor /* Reverse offset to the vendor id */
99.long __id_end + CONFIG_ID_SECTION_OFFSET - part /* Reverse offset to the part number */
100.long CONFIG_ROM_SIZE /* Size of this romimage */
101 .globl __id_end
102
103__id_end:
104.previous