From 4cea3a19f886cf8154af235fb233dc35cd60d0ea Mon Sep 17 00:00:00 2001 From: "Ronald G. Minnich" Date: Mon, 13 Aug 2018 15:24:30 -0700 Subject: Add support for ram payloads This is enabled by CONFIG_RAMPAYLOAD. The code will look for a ram payload and, if it is found, try to run it. If the load fails or the payload returns it will continue with ramstage. We also include a new payload, linuxcheck, which is intended to verify that linux can be loaded and run, e.g. as a LinuxBoot payload. Currently, it fails. This does not yet work but it makes sense as a foundation on which to build. For one thing, we need to build at least a few tables for Linux. The goal for LinuxBoot is to build as few as possible. To test with linuxcheck (linux is not even close to working): cd payloads/linuxcheck/ cp x86config .config make cd ../.. make ./build/cbfstool build/coreboot.rom add-payload -n fallback/rampayload -f payloads/linuxcheck/linuxcheck.elf qemu-system-x86_64 -nographic -m 8192 -bios build/coreboot.rom -monitor /dev/pts/$1 -s We need to change the payload menu so we can add a rampayload but it's a bit tricky as written, so that must come later. Note that I'm still creating a special purpose romselfboot. The idea of merging romselfboot and selfboot is probably a good idea -- in the future. I think until we know how this should look, such a merge is premature. Signed-off-by: Ronald G. Minnich Change-Id: I8199aae6776f6dee969b370b0e6a41ef96e854d8 clang-formatted-by: Ronald G. Minnich Reviewed-on: https://review.coreboot.org/28402 Reviewed-by: Philipp Deppenwiese Tested-by: Philipp Deppenwiese --- src/include/program_loading.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/include/program_loading.h') diff --git a/src/include/program_loading.h b/src/include/program_loading.h index 482c8b89951e..62a703080bc9 100644 --- a/src/include/program_loading.h +++ b/src/include/program_loading.h @@ -68,10 +68,10 @@ struct prog { void *arg; }; -#define PROG_INIT(type_, name_) \ - { \ - .type = (type_), \ - .name = (name_), \ +#define PROG_INIT(type_, name_) \ + { \ + .type = (type_), \ + .name = (name_), \ } static inline const char *prog_name(const struct prog *prog) @@ -120,7 +120,7 @@ static inline void *prog_entry_arg(const struct prog *prog) extern const struct mem_region_device addrspace_32bit; static inline void prog_memory_init(struct prog *prog, uintptr_t ptr, - size_t size) + size_t size) { rdev_chain(&prog->rdev, &addrspace_32bit.rdev, ptr, size); } @@ -174,8 +174,12 @@ void run_romstage(void); /* Run ramstage from romstage. */ void run_ramstage(void); +/* Run a prog (stage or payload) from romstage. */ +void run_ramprog(void); + /* Determine where stack for ramstage loader is located. */ -enum { ROMSTAGE_STACK_CBMEM, ROMSTAGE_STACK_LOW_MEM }; +enum { ROMSTAGE_STACK_CBMEM, + ROMSTAGE_STACK_LOW_MEM }; uintptr_t romstage_ram_stack_base(size_t size, int src); uintptr_t romstage_ram_stack_top(void); uintptr_t romstage_ram_stack_bottom(void); -- cgit v1.2.3