]> git.baikalelectronics.ru Git - uboot.git/commitdiff
efi_loader: boottime: add loaded image device path protocol to image handle
authorAKASHI Takahiro <takahiro.akashi@linaro.org>
Wed, 27 Mar 2019 04:40:32 +0000 (13:40 +0900)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 7 Apr 2019 12:17:06 +0000 (14:17 +0200)
To meet UEFI spec v2.7a section 9.2, we should add
EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL to image handle,
instead of EFI_DEVICE_PATH_PROTOCOL.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
include/efi_api.h
include/efi_loader.h
lib/efi_loader/efi_boottime.c
lib/efi_loader/efi_image_loader.c

index 8647bfa6629bb576083dc394757dc4a821e0d890..5b0a10063548755167dafac24517c5dfe5f2161b 100644 (file)
@@ -333,6 +333,10 @@ struct efi_system_table {
        EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, \
                 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
 
+#define LOADED_IMAGE_DEVICE_PATH_GUID \
+       EFI_GUID(0xbc62157e, 0x3e33, 0x4fec, \
+                0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf)
+
 #define EFI_LOADED_IMAGE_PROTOCOL_REVISION 0x1000
 
 struct efi_loaded_image {
index 9f776021ab18b5e9eae23f1204641d35b4c1c4ce..cd6ceaccbf56ab150d421731e14e1f9d1e3f7faa 100644 (file)
@@ -135,6 +135,7 @@ extern const efi_guid_t efi_guid_event_group_reset_system;
 /* GUID of the device tree table */
 extern const efi_guid_t efi_guid_fdt;
 extern const efi_guid_t efi_guid_loaded_image;
+extern const efi_guid_t efi_guid_loaded_image_device_path;
 extern const efi_guid_t efi_guid_device_path_to_text_protocol;
 extern const efi_guid_t efi_simple_file_system_protocol_guid;
 extern const efi_guid_t efi_file_info_guid;
index 970c01614e2a523ab7c31e7450c2106dbf89060e..a9032606339bb6c8254b51ce2c7daa7c94c10dbc 100644 (file)
@@ -1522,6 +1522,7 @@ efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path,
        efi_status_t ret;
        struct efi_loaded_image *info = NULL;
        struct efi_loaded_image_obj *obj = NULL;
+       struct efi_device_path *dp;
 
        /* In case of EFI_OUT_OF_RESOURCES avoid illegal free by caller. */
        *handle_ptr = NULL;
@@ -1545,15 +1546,19 @@ efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path,
 
        if (device_path) {
                info->device_handle = efi_dp_find_obj(device_path, NULL);
-               /*
-                * When asking for the device path interface, return
-                * bootefi_device_path
-                */
-               ret = efi_add_protocol(&obj->header,
-                                      &efi_guid_device_path, device_path);
-               if (ret != EFI_SUCCESS)
+
+               dp = efi_dp_append(device_path, file_path);
+               if (!dp) {
+                       ret = EFI_OUT_OF_RESOURCES;
                        goto failure;
+               }
+       } else {
+               dp = NULL;
        }
+       ret = efi_add_protocol(&obj->header,
+                              &efi_guid_loaded_image_device_path, dp);
+       if (ret != EFI_SUCCESS)
+               goto failure;
 
        /*
         * When asking for the loaded_image interface, just
index 6101e6d0371fa1e864005d61ed4dd906031cf572..93feefd366cd0a267cb01bff247d51bf5e461ff3 100644 (file)
@@ -14,6 +14,8 @@
 const efi_guid_t efi_global_variable_guid = EFI_GLOBAL_VARIABLE_GUID;
 const efi_guid_t efi_guid_device_path = DEVICE_PATH_GUID;
 const efi_guid_t efi_guid_loaded_image = LOADED_IMAGE_GUID;
+const efi_guid_t efi_guid_loaded_image_device_path
+               = LOADED_IMAGE_DEVICE_PATH_GUID;
 const efi_guid_t efi_simple_file_system_protocol_guid =
                EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
 const efi_guid_t efi_file_info_guid = EFI_FILE_INFO_GUID;