Ronald G. Minnich (rminnich@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11699
-gerrit
commit 18118044bc5281281e8135de977e9d7d1c6230de Author: Ronald G. Minnich rminnich@gmail.com Date: Tue Sep 22 15:53:32 2015 -0700
RISCV: use a different prog_run for the payload.
Unlike the other stages, the payload requires virtual memory to be set up and also a privelege level change.
Change-Id: Ibbe2a55f7719d917f121a53a17c6d90e6b2ab3d1 Signed-off-by: Ronald G. Minnich rminnich@gmail.com --- src/arch/riscv/Makefile.inc | 2 +- src/arch/riscv/bootpayload.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/src/arch/riscv/Makefile.inc b/src/arch/riscv/Makefile.inc index de6eb91..b7f2592 100644 --- a/src/arch/riscv/Makefile.inc +++ b/src/arch/riscv/Makefile.inc @@ -91,7 +91,7 @@ ramstage-y += virtual_memory.c ramstage-y += rom_media.c ramstage-y += stages.c ramstage-y += misc.c -ramstage-y += boot.c +ramstage-y += bootpayload.c ramstage-y += tables.c ramstage-y += \ $(top)/src/lib/memchr.c \ diff --git a/src/arch/riscv/bootpayload.c b/src/arch/riscv/bootpayload.c new file mode 100644 index 0000000..a6e9767 --- /dev/null +++ b/src/arch/riscv/bootpayload.c @@ -0,0 +1,29 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2013 Google Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc. + */ + +#include <program_loading.h> +#include <vm.h> +#include <arch/encoding.h> + +void arch_prog_run(struct prog *prog) +{ + initVirtualMemory(); + write_csr(mepc, prog_entry(prog)); + asm volatile("eret"); +}