[U-Boot] [RFC v3 01/10] efi_loader: device_path: handle special case of loading

AKASHI Takahiro takahiro.akashi at linaro.org
Tue Apr 16 04:24:19 UTC 2019


This is a preparatory patch.

efi_dp_split_file_path() is used to create device_path and file_path
from file_path for efi_setup_loaded_image().
In a special case, however, of HARDWARE_DEVICE/MEMORY, it doesn't
work expectedly since this path doesn't contain any FILE_PATH sub-type.

This patch makes a workaround.

Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
---
 lib/efi_loader/efi_device_path.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index 53b40c8c3c2d..e283fad767ed 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -933,6 +933,14 @@ efi_status_t efi_dp_split_file_path(struct efi_device_path *full_path,
 	dp = efi_dp_dup(full_path);
 	if (!dp)
 		return EFI_OUT_OF_RESOURCES;
+
+	if (EFI_DP_TYPE(dp, HARDWARE_DEVICE, MEMORY)) {
+		/* no FILE_PATH */
+		*device_path = dp;
+
+		return EFI_SUCCESS;
+	}
+
 	p = dp;
 	while (!EFI_DP_TYPE(p, MEDIA_DEVICE, FILE_PATH)) {
 		p = efi_dp_next(p);
-- 
2.20.1



More information about the U-Boot mailing list