aboutsummaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_device_path_to_text.c
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-02-23 09:06:24 +0100
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-09-03 10:49:17 +0200
commitfbc04c0dab139c12ed61500fac3cc204009e8c54 (patch)
tree959b6b5ea052096dd40a8e09e3c74c5c7fb8fde8 /lib/efi_loader/efi_device_path_to_text.c
parent648a8dcb39306ebd32353d6c503ac3b69e064190 (diff)
efi_loader: fix display of NVMe EUI-64
UEFI specification 2.9A requires to display the EUI-64 "in hexadecimal format with byte 7 first (i.e., on the left) and byte 0 last". This is in contrast to what the NVMe specification wants. But it is what EDK II has been implementing. Here is an example with the patch applied: qemu-system-aarch64 -machine virt -cpu cortex-a72 -nographic \ -bios denx/u-boot.bin \ -device nvme,id=nvme1,serial=9ff81223 \ -device nvme-ns,bus=nvme1,drive=nvme1n0,eui64=0x123456789ABCDEF0 \ -drive file=arm64.img,if=none,format=raw,id=nvme1n0 => nvme scan => efidebug devices Device Path ==================== /VenHw(…)/NVMe(0x1,f0-de-bc-9a-78-56-34-12) Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'lib/efi_loader/efi_device_path_to_text.c')
-rw-r--r--lib/efi_loader/efi_device_path_to_text.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c
index 6c428ee061..9062058ac2 100644
--- a/lib/efi_loader/efi_device_path_to_text.c
+++ b/lib/efi_loader/efi_device_path_to_text.c
@@ -190,13 +190,14 @@ static char *dp_msging(char *s, struct efi_device_path *dp)
struct efi_device_path_nvme *ndp =
(struct efi_device_path_nvme *)dp;
u32 ns_id;
- int i;
memcpy(&ns_id, &ndp->ns_id, sizeof(ns_id));
s += sprintf(s, "NVMe(0x%x,", ns_id);
- for (i = 0; i < sizeof(ndp->eui64); ++i)
+
+ /* Display byte 7 first, byte 0 last */
+ for (int i = 0; i < 8; ++i)
s += sprintf(s, "%s%02x", i ? "-" : "",
- ndp->eui64[i]);
+ ndp->eui64[i ^ 7]);
s += sprintf(s, ")");
break;