[coreboot-gerrit] Patch set updated for coreboot: [WIP] arch/riscv: Make SBI support optional
Jonathan Neuschäfer (j.neuschaefer@gmx.net)
gerrit at coreboot.org
Fri Jul 1 00:22:22 CEST 2016
Jonathan Neuschäfer (j.neuschaefer at gmx.net) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15510
-gerrit
commit 6417d8d426d976730fa03b502dcfa431d837e9d9
Author: Jonathan Neuschäfer <j.neuschaefer at gmx.net>
Date: Thu Jun 30 22:58:53 2016 +0200
[WIP] arch/riscv: Make SBI support optional
I'm posting this patch early so I can link to it from the wiki.
Change-Id: I5cbfc90afd3febab33835935f08005136a3f47e9
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer at gmx.net>
---
payloads/Kconfig | 12 ++++++++++++
src/arch/riscv/boot.c | 4 ++++
src/arch/riscv/virtual_memory.c | 1 +
3 files changed, 17 insertions(+)
diff --git a/payloads/Kconfig b/payloads/Kconfig
index 8cce778..69d2e41 100644
--- a/payloads/Kconfig
+++ b/payloads/Kconfig
@@ -47,6 +47,18 @@ config COMPRESSED_PAYLOAD_LZMA
In order to reduce the size payloads take up in the ROM chip
coreboot can compress them using the LZMA algorithm.
+config PAYLOAD_RISCV_SMODE
+ bool "Run payload in S-mode and provide SBI"
+ depends on ARCH_RISCV
+ default y
+ help
+ If Y is selected, coreboot will start the payload in supervisor mode
+ (S-mode) and provide a an implementation of the System Binary
+ Interface (SBI).
+
+ Otherwise, the payload will be run in M-mode and will have to provide
+ its own SBI implementation, if it needs one.
+
config PAYLOAD_OPTIONS
string
default ""
diff --git a/src/arch/riscv/boot.c b/src/arch/riscv/boot.c
index 96526bf..5830ac4 100644
--- a/src/arch/riscv/boot.c
+++ b/src/arch/riscv/boot.c
@@ -22,6 +22,7 @@ void arch_prog_run(struct prog *prog)
{
void (*doit)(void *) = prog_entry(prog);
+#if IS_ENABLED(CONFIG_PAYLOAD_RISCV_SMODE)
if (ENV_RAMSTAGE && prog_type(prog) == PROG_PAYLOAD) {
initVirtualMemory();
write_csr(mepc, doit);
@@ -29,6 +30,9 @@ void arch_prog_run(struct prog *prog)
} else {
doit(prog_entry_arg(prog));
}
+#else
+ doit(prog_entry_arg(prog));
+#endif
}
int arch_supports_bounce_buffer(void)
diff --git a/src/arch/riscv/virtual_memory.c b/src/arch/riscv/virtual_memory.c
index 64ea2b1..dce0887 100644
--- a/src/arch/riscv/virtual_memory.c
+++ b/src/arch/riscv/virtual_memory.c
@@ -101,6 +101,7 @@ void init_vm(uintptr_t virtMemStart, uintptr_t physMemStart, uintptr_t pageTable
void initVirtualMemory(void) {
printk(BIOS_DEBUG, "Initializing virtual memory...\n");
+ return;
uintptr_t physicalStart = 0x1000000; // TODO: Figure out how to grab this from cbfs
uintptr_t virtualStart = 0xffffffff81000000;
uintptr_t pageTableStart = 0x1400000;
More information about the coreboot-gerrit
mailing list