summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-02-18 18:30:44 +0100
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2021-02-21 09:21:35 +0100
commit1edfc3fa9b027aab5551e0a906be0a8c710a0e14 (patch)
tree07fb11d8bee0c18df29f54fd3564bcfc929dacb0 /lib
parent512f092da2bae4dd1fb72801a6bcfe1c5e7c3044 (diff)
downloadu-boot-1edfc3fa9b027aab5551e0a906be0a8c710a0e14.tar.gz
u-boot-1edfc3fa9b027aab5551e0a906be0a8c710a0e14.tar.xz
u-boot-1edfc3fa9b027aab5551e0a906be0a8c710a0e14.zip
efi_selftest: multi part device path to text
Test EFI_DEVICE_PATH_TO_TEXT_PROTOCOL.ConvertDevicePathToText() for a multi part device path. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_selftest/efi_selftest_devicepath.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/lib/efi_selftest/efi_selftest_devicepath.c b/lib/efi_selftest/efi_selftest_devicepath.c
index 4ce3fad895..d87b9f7dcd 100644
--- a/lib/efi_selftest/efi_selftest_devicepath.c
+++ b/lib/efi_selftest/efi_selftest_devicepath.c
@@ -45,6 +45,55 @@ static u8 *dp1;
static u8 *dp2;
static u8 *dp3;
+static struct {
+ struct efi_device_path_sd_mmc_path sd1;
+ struct efi_device_path sep1;
+ struct efi_device_path_sd_mmc_path sd2;
+ struct efi_device_path sep2;
+ struct efi_device_path_sd_mmc_path sd3;
+ struct efi_device_path end;
+} multi_part_dp = {
+ {
+ {
+ DEVICE_PATH_TYPE_MESSAGING_DEVICE,
+ DEVICE_PATH_SUB_TYPE_MSG_SD,
+ sizeof(struct efi_device_path_sd_mmc_path),
+ },
+ 0,
+ },
+ {
+ DEVICE_PATH_TYPE_END,
+ DEVICE_PATH_SUB_TYPE_INSTANCE_END,
+ sizeof(struct efi_device_path),
+ },
+ {
+ {
+ DEVICE_PATH_TYPE_MESSAGING_DEVICE,
+ DEVICE_PATH_SUB_TYPE_MSG_SD,
+ sizeof(struct efi_device_path_sd_mmc_path),
+ },
+ 1,
+ },
+ {
+ DEVICE_PATH_TYPE_END,
+ DEVICE_PATH_SUB_TYPE_INSTANCE_END,
+ sizeof(struct efi_device_path),
+ },
+ {
+ {
+ DEVICE_PATH_TYPE_MESSAGING_DEVICE,
+ DEVICE_PATH_SUB_TYPE_MSG_SD,
+ sizeof(struct efi_device_path_sd_mmc_path),
+ },
+ 2,
+ },
+ {
+ DEVICE_PATH_TYPE_END,
+ DEVICE_PATH_SUB_TYPE_END,
+ sizeof(struct efi_device_path),
+ },
+};
+
struct efi_device_path_to_text_protocol *device_path_to_text;
/*
@@ -340,6 +389,22 @@ static int execute(void)
return EFI_ST_FAILURE;
}
+ string = device_path_to_text->convert_device_path_to_text(
+ (struct efi_device_path *)&multi_part_dp, true, false);
+ if (efi_st_strcmp_16_8(
+ string,
+ "/SD(0),/SD(1),/SD(2)")
+ ) {
+ efi_st_printf("multi_part_dp: %ps\n", string);
+ efi_st_error("Incorrect text from ConvertDevicePathToText\n");
+ return EFI_ST_FAILURE;
+ }
+ ret = boottime->free_pool(string);
+ if (ret != EFI_SUCCESS) {
+ efi_st_error("FreePool failed\n");
+ return EFI_ST_FAILURE;
+ }
+
/* Test ConvertDeviceNodeToText */
string = device_path_to_text->convert_device_node_to_text(
(struct efi_device_path *)&dp_node, true, false);