The EFI_LOAD_FILE_PROTOCOL_GUID and EFI_LOAD_FILE2_PROTOCOL_GUID are needed
to complement the implementation of the LoadFile() boot service.

Remove a duplicate declaration of a variable for the
EFI_LOAD_FILE2_PROTOCOL_GUID.
Move the remaining declaration to efi_boottime.c.
Add a variable for the EFI_LOAD_FILE_PROTOCOL_GUID.

Signed-off-by: Heinrich Schuchardt <[email protected]>
---
 include/efi_loader.h                        | 3 +++
 lib/efi_loader/efi_boottime.c               | 3 +++
 lib/efi_loader/efi_load_initrd.c            | 3 ---
 lib/efi_selftest/efi_selftest_load_initrd.c | 7 ++++---
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index 76cd2b36f2..4c6eb8616d 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -195,6 +195,9 @@ extern const efi_guid_t efi_file_system_info_guid;
 extern const efi_guid_t efi_guid_device_path_utilities_protocol;
 /* GUID of the deprecated Unicode collation protocol */
 extern const efi_guid_t efi_guid_unicode_collation_protocol;
+/* GUIDs of the Load File and Load File2 protocol */
+extern const efi_guid_t efi_guid_load_file_protocol;
+extern const efi_guid_t efi_guid_load_file2_protocol;
 /* GUID of the Unicode collation protocol */
 extern const efi_guid_t efi_guid_unicode_collation_protocol2;
 extern const efi_guid_t efi_guid_hii_config_routing_protocol;
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 4f7479d4df..afe8adb91e 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -81,6 +81,9 @@ const efi_guid_t efi_guid_event_group_ready_to_boot =
 /* event group ResetSystem() invoked (before ExitBootServices) */
 const efi_guid_t efi_guid_event_group_reset_system =
                        EFI_EVENT_GROUP_RESET_SYSTEM;
+/* GUIDs of the Load File and Load File2 protocols */
+const efi_guid_t efi_guid_load_file_protocol = EFI_LOAD_FILE_PROTOCOL_GUID;
+const efi_guid_t efi_guid_load_file2_protocol = EFI_LOAD_FILE2_PROTOCOL_GUID;

 static efi_status_t EFIAPI efi_disconnect_controller(
                                        efi_handle_t controller_handle,
diff --git a/lib/efi_loader/efi_load_initrd.c b/lib/efi_loader/efi_load_initrd.c
index d517d686c3..4bf3b5ef68 100644
--- a/lib/efi_loader/efi_load_initrd.c
+++ b/lib/efi_loader/efi_load_initrd.c
@@ -12,9 +12,6 @@
 #include <efi_loader.h>
 #include <efi_load_initrd.h>

-static const efi_guid_t efi_guid_load_file2_protocol =
-               EFI_LOAD_FILE2_PROTOCOL_GUID;
-
 static efi_status_t EFIAPI
 efi_load_file2_initrd(struct efi_load_file_protocol *this,
                      struct efi_device_path *file_path, bool boot_policy,
diff --git a/lib/efi_selftest/efi_selftest_load_initrd.c 
b/lib/efi_selftest/efi_selftest_load_initrd.c
index fe060a6644..f591dcd211 100644
--- a/lib/efi_selftest/efi_selftest_load_initrd.c
+++ b/lib/efi_selftest/efi_selftest_load_initrd.c
@@ -86,7 +86,6 @@ static int setup(const efi_handle_t handle,

 static int execute(void)
 {
-       efi_guid_t lf2_proto_guid = EFI_LOAD_FILE2_PROTOCOL_GUID;
        struct efi_load_file_protocol *lf2;
        struct efi_device_path *dp2, *dp2_invalid;
        efi_status_t status;
@@ -99,13 +98,15 @@ static int execute(void)
        memset(buffer, 0, sizeof(buffer));

        dp2 = (struct efi_device_path *)&dp;
-       status = boottime->locate_device_path(&lf2_proto_guid, &dp2, &handle);
+       status = boottime->locate_device_path(&efi_guid_load_file2_protocol,
+                                             &dp2, &handle);
        if (status != EFI_SUCCESS) {
                efi_st_error("Unable to locate device path\n");
                return EFI_ST_FAILURE;
        }

-       status = boottime->handle_protocol(handle, &lf2_proto_guid,
+       status = boottime->handle_protocol(handle,
+                                          &efi_guid_load_file2_protocol,
                                           (void **)&lf2);
        if (status != EFI_SUCCESS) {
                efi_st_error("Unable to locate protocol\n");
--
2.29.2

Reply via email to