]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: fix display of NVMe EUI-64
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Wed, 23 Feb 2022 08:06:24 +0000 (09:06 +0100)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sat, 3 Sep 2022 08:49:17 +0000 (10:49 +0200)
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>
lib/efi_loader/efi_device_path_to_text.c

index 6c428ee061f54d5d5dea7d25376bb807da59386d..9062058ac22966ef4c1d8d40e89f5f4acbf343c0 100644 (file)
@@ -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;