]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
efi/arm: libstub: add a root memreserve config table
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 21 Sep 2018 16:32:45 +0000 (09:32 -0700)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 26 Sep 2018 10:03:55 +0000 (12:03 +0200)
Installing UEFI configuration tables can only be done before calling
ExitBootServices(), so if we want to use the new MEMRESRVE config table
from the kernel proper, we need to install a dummy entry from the stub.

Tested-by: Jeremy Linton <jeremy.linton@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
drivers/firmware/efi/libstub/arm-stub.c

index 6920033de6d411689719e64226112a19a8c8021d..30ac0c975f8a1cc6bd544ba90991a4330ea05cd9 100644 (file)
@@ -69,6 +69,31 @@ static struct screen_info *setup_graphics(efi_system_table_t *sys_table_arg)
        return si;
 }
 
+void install_memreserve_table(efi_system_table_t *sys_table_arg)
+{
+       struct linux_efi_memreserve *rsv;
+       efi_guid_t memreserve_table_guid = LINUX_EFI_MEMRESERVE_TABLE_GUID;
+       efi_status_t status;
+
+       status = efi_call_early(allocate_pool, EFI_LOADER_DATA, sizeof(*rsv),
+                               (void **)&rsv);
+       if (status != EFI_SUCCESS) {
+               pr_efi_err(sys_table_arg, "Failed to allocate memreserve entry!\n");
+               return;
+       }
+
+       rsv->next = 0;
+       rsv->base = 0;
+       rsv->size = 0;
+
+       status = efi_call_early(install_configuration_table,
+                               &memreserve_table_guid,
+                               rsv);
+       if (status != EFI_SUCCESS)
+               pr_efi_err(sys_table_arg, "Failed to install memreserve config table!\n");
+}
+
+
 /*
  * This function handles the architcture specific differences between arm and
  * arm64 regarding where the kernel image must be loaded and any memory that
@@ -235,6 +260,8 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
                }
        }
 
+       install_memreserve_table(sys_table);
+
        new_fdt_addr = fdt_addr;
        status = allocate_new_fdt_and_exit_boot(sys_table, handle,
                                &new_fdt_addr, efi_get_max_fdt_addr(dram_base),