summaryrefslogtreecommitdiff
path: root/src/arch/riscv/include
diff options
context:
space:
mode:
authorXiang Wang <wxjstz@126.com>2018-07-19 17:35:39 +0800
committerron minnich <rminnich@gmail.com>2019-02-02 16:53:21 +0000
commit820dcfceb3901dbb00bb90c876e374126ca14e20 (patch)
tree2f0ba3f1038291f9dda7755680551cbe425f7922 /src/arch/riscv/include
parentc47d43a8af5dfdbdb7afebb39f999f18f36c9d23 (diff)
riscv: Simplify payload handling
1. Simplify payload code and convert it to C 2. Save the FDT pointer to HLS (hart-local storage). 3. Don't use mscratch to pass FDT pointer as it is used for exception handling. Change-Id: I32bf2a99e07a65358a7f19b899259f0816eb45e8 Signed-off-by: Xiang Wang <wxjstz@126.com> Signed-off-by: Philipp Hug <philipp@hug.cx> Reviewed-on: https://review.coreboot.org/c/31179 Reviewed-by: ron minnich <rminnich@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/arch/riscv/include')
-rw-r--r--src/arch/riscv/include/arch/boot.h8
-rw-r--r--src/arch/riscv/include/arch/stages.h3
-rw-r--r--src/arch/riscv/include/mcall.h8
3 files changed, 16 insertions, 3 deletions
diff --git a/src/arch/riscv/include/arch/boot.h b/src/arch/riscv/include/arch/boot.h
index 24c1bedebf..34a507edec 100644
--- a/src/arch/riscv/include/arch/boot.h
+++ b/src/arch/riscv/include/arch/boot.h
@@ -16,6 +16,12 @@
#ifndef ARCH_RISCV_INCLUDE_ARCH_BOOT_H
#define ARCH_RISCV_INCLUDE_ARCH_BOOT_H
-extern const void *rom_fdt;
+#include <program_loading.h>
+
+#define RISCV_PAYLOAD_MODE_U 0
+#define RISCV_PAYLOAD_MODE_S 1
+#define RISCV_PAYLOAD_MODE_M 3
+
+void run_payload(struct prog *prog, void *fdt, int payload_mode);
#endif
diff --git a/src/arch/riscv/include/arch/stages.h b/src/arch/riscv/include/arch/stages.h
index 90bd60b9a6..138298fd03 100644
--- a/src/arch/riscv/include/arch/stages.h
+++ b/src/arch/riscv/include/arch/stages.h
@@ -18,6 +18,7 @@
#include <main_decl.h>
-void stage_entry(void) __attribute__((section(".text.stage_entry")));
+void stage_entry(int hart_id, void *fdt)
+ __attribute__((section(".text.stage_entry")));
#endif
diff --git a/src/arch/riscv/include/mcall.h b/src/arch/riscv/include/mcall.h
index 29df736d1b..cd1ed6dc18 100644
--- a/src/arch/riscv/include/mcall.h
+++ b/src/arch/riscv/include/mcall.h
@@ -52,9 +52,14 @@ typedef struct {
int ipi_pending;
uint64_t *timecmp;
uint64_t *time;
+ void *fdt;
struct blocker entry;
} hls_t;
+_Static_assert(
+ sizeof(hls_t) == HLS_SIZE,
+ "HLS_SIZE must equal to sizeof(hls_t)");
+
#define MACHINE_STACK_TOP() ({ \
/* coverity[uninit_use] : FALSE */ \
register uintptr_t sp asm ("sp"); \
@@ -66,7 +71,8 @@ typedef struct {
#define MACHINE_STACK_SIZE RISCV_PGSIZE
-void hls_init(uint32_t hart_id); // need to call this before launching linux
+// need to call this before launching linux
+void hls_init(uint32_t hart_id, void *fdt);
/* This function is used to initialize HLS()->time/HLS()->timecmp */
void mtime_init(void);