1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Early initialization code for RISC-V
6 #include <arch/encoding.h>
10 .section ".text._start", "ax", %progbits
16 # The boot ROM may pass the following arguments to coreboot:
17 # a0: the value of mhartid
18 # a1: a pointer to the flattened devicetree
20 # Preserve only the FDT pointer. We can query mhartid ourselves at any
25 # initialize cache as ram
28 # initialize stack point for each hart
29 # and the stack must be page-aligned.
30 # 0xDEADBEEF used to check stack overflow
33 slli t1, a0, RISCV_PGSHIFT
37 li t1, RISCV_PGSIZE - HLS_SIZE
40 # initialize hart-local storage
42 csrrw a1, mscratch, zero
45 li a0, CONFIG_RISCV_WORKING_HARTID
48 # initialize entry of interrupt/exception
52 # clear any pending interrupts
55 # set up the mstatus register
59 // These codes need to be implemented on a specific SoC.