For debugging efi_loader we need the capability to print EFI
device paths. With this patch we can write:

    debug("device path: %pD", dp);

A possible output would be

    device path: /MemoryMapped(0x0,0x3ff93a82,0x3ff93a82)

Suggested-by: Rob Clark <robdcl...@gmail.com>
Signed-off-by: Heinrich Schuchardt <xypron.g...@gmx.de>
---
I suggest Alex picks up this patch for the EFI tree.
---
 lib/vsprintf.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index dd572d2868..68797c672c 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -18,6 +18,7 @@
 
 #include <common.h>
 #include <charset.h>
+#include <efi_loader.h>
 #include <uuid.h>
 
 #include <div64.h>
@@ -292,6 +293,18 @@ static char *string16(char *buf, char *end, u16 *s, int 
field_width,
        return buf;
 }
 
+#ifdef CONFIG_EFI_LOADER
+static char *device_path_string(char *buf, char *end, void *dp, int 
field_width,
+                               int precision, int flags)
+{
+       u16 *str = efi_dp_str((struct efi_device_path *)dp);
+
+       buf = string16(buf, end, str, field_width, precision, flags);
+       efi_free_pool(str);
+       return buf;
+}
+#endif
+
 #ifdef CONFIG_CMD_NET
 static const char hex_asc[] = "0123456789abcdef";
 #define hex_asc_lo(x)  hex_asc[((x) & 0x0f)]
@@ -435,6 +448,11 @@ static char *pointer(const char *fmt, char *buf, char 
*end, void *ptr,
 #endif
 
        switch (*fmt) {
+#ifdef CONFIG_EFI_LOADER
+       case 'D':
+               return device_path_string(buf, end, ptr, field_width,
+                                         precision, flags);
+#endif
 #ifdef CONFIG_CMD_NET
        case 'a':
                flags |= SPECIAL | ZEROPAD;
-- 
2.15.0

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to