diff --git a/common/protos/linux_risc.c b/common/protos/linux_risc.c index 9d1b9e5b..e5c4b0af 100644 --- a/common/protos/linux_risc.c +++ b/common/protos/linux_risc.c @@ -36,6 +36,12 @@ struct linux_header { uint32_t res4; } __attribute__((packed)); +struct linux_efi_memreserve { + int size; + int count; + uint64_t next; +}; + // End of Linux code #if defined(__riscv64) @@ -154,6 +160,21 @@ void *prepare_device_tree_blob(char *config, char *cmdline) { panic(true, "linux: failed to set bootargs: '%s'", fdt_strerror(ret)); } + { + struct linux_efi_memreserve *rsv = ext_mem_alloc(sizeof(struct linux_efi_memreserve)); + + rsv->size = 0; + rsv->count = 0; + rsv->next = 0; + + EFI_GUID memreserve_table_guid = {0x888eb0c6, 0x8ede, 0x4ff5, {0xa8, 0xf0, 0x9a, 0xee, 0x5c, 0xb9, 0x77, 0xc2}}; + EFI_STATUS ret = gBS->InstallConfigurationTable(&memreserve_table_guid, rsv); + + if (ret != EFI_SUCCESS) { + panic(true, "linux: failed to install memory reservation configuration table: '%x'", ret); + } + } + efi_exit_boot_services(); // Tell Linux about the UEFI memory map and system table.