Browse Source

efi_loader: move EFI_LOAD_FILE2_PROTOCOL_GUID

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 <xypron.glpk@gmx.de>
Heinrich Schuchardt 3 years ago
parent
commit
b6f11098c9

+ 3 - 0
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;

+ 3 - 0
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,

+ 0 - 3
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,

+ 4 - 3
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");