]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
efi_loader: Expose efi_install_configuration_table
authorAlexander Graf <agraf@suse.de>
Thu, 18 Aug 2016 23:23:24 +0000 (01:23 +0200)
committerAlexander Graf <agraf@suse.de>
Wed, 19 Oct 2016 07:01:51 +0000 (09:01 +0200)
We want to be able to add configuration table entries from our own code as
well as from EFI payload code. Export the boot service function internally
too, so that we can reuse it.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
include/efi_loader.h
lib/efi_loader/efi_boottime.c

index 1e4eb46a9c17e00f330efb8e5740d9f42068aafb..56b2b4719a80bdb6bf45b7964b64b8bb9c4ed580 100644 (file)
@@ -135,6 +135,8 @@ uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
                            bool overlap_only_ram);
 /* Called by board init to initialize the EFI memory map */
 int efi_memory_init(void);
+/* Adds new or overrides configuration table entry to the system table */
+efi_status_t efi_install_configuration_table(const efi_guid_t *guid, void *table);
 
 #ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER
 extern void *efi_bounce_buffer;
index 6c8d93b26134cfb279ae485ec70d4af1bb08de28..51961d2060695da90ee968b52bfb96b1c62062ef 100644 (file)
@@ -37,7 +37,7 @@ static bool efi_is_direct_boot = true;
  * In most cases we want to pass an FDT to the payload, so reserve one slot of
  * config table space for it. The pointer gets populated by do_bootefi_exec().
  */
-static struct efi_configuration_table EFI_RUNTIME_DATA efi_conf_table[1];
+static struct efi_configuration_table EFI_RUNTIME_DATA efi_conf_table[2];
 
 /*
  * The "gd" pointer lives in a register on ARM and AArch64 that we declare
@@ -376,31 +376,35 @@ static efi_status_t EFIAPI efi_locate_device_path(efi_guid_t *protocol,
        return EFI_EXIT(EFI_NOT_FOUND);
 }
 
-static efi_status_t EFIAPI efi_install_configuration_table(efi_guid_t *guid,
-                                                          void *table)
+efi_status_t efi_install_configuration_table(const efi_guid_t *guid, void *table)
 {
        int i;
 
-       EFI_ENTRY("%p, %p", guid, table);
-
        /* Check for guid override */
        for (i = 0; i < systab.nr_tables; i++) {
                if (!guidcmp(guid, &efi_conf_table[i].guid)) {
                        efi_conf_table[i].table = table;
-                       return EFI_EXIT(EFI_SUCCESS);
+                       return EFI_SUCCESS;
                }
        }
 
        /* No override, check for overflow */
        if (i >= ARRAY_SIZE(efi_conf_table))
-               return EFI_EXIT(EFI_OUT_OF_RESOURCES);
+               return EFI_OUT_OF_RESOURCES;
 
        /* Add a new entry */
        memcpy(&efi_conf_table[i].guid, guid, sizeof(*guid));
        efi_conf_table[i].table = table;
        systab.nr_tables = i;
 
-       return EFI_EXIT(EFI_SUCCESS);
+       return EFI_SUCCESS;
+}
+
+static efi_status_t EFIAPI efi_install_configuration_table_ext(efi_guid_t *guid,
+                                                              void *table)
+{
+       EFI_ENTRY("%p, %p", guid, table);
+       return EFI_EXIT(efi_install_configuration_table(guid, table));
 }
 
 static efi_status_t EFIAPI efi_load_image(bool boot_policy,
@@ -751,7 +755,7 @@ static const struct efi_boot_services efi_boot_services = {
        .register_protocol_notify = efi_register_protocol_notify,
        .locate_handle = efi_locate_handle,
        .locate_device_path = efi_locate_device_path,
-       .install_configuration_table = efi_install_configuration_table,
+       .install_configuration_table = efi_install_configuration_table_ext,
        .load_image = efi_load_image,
        .start_image = efi_start_image,
        .exit = efi_exit,