summaryrefslogtreecommitdiff
path: root/lib/efi_selftest/efi_selftest_console.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-01-22 15:43:36 -0500
committerTom Rini <trini@konsulko.com>2022-01-22 15:43:36 -0500
commitda158ec5f2db86d88a631c05c540ba5ee1937a77 (patch)
tree2aec2712bc2db6417fc9e5660b8a5c2e7b04ecee /lib/efi_selftest/efi_selftest_console.c
parente6786b0354372c8a68d01e4d633a19cdce373b70 (diff)
parentf5e9035043fb48baea93ccb3165e75f486906213 (diff)
Merge tag 'efi-2022-04-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2022-04-rc1-2 Documentation: * describe printf() format codes UEFI * enable more algorithms for UEFI image verification, e.g. SHA256-RSA2048 General * simplify printing short texts for GUIDs * provide a unit test for printing GUIDs
Diffstat (limited to 'lib/efi_selftest/efi_selftest_console.c')
-rw-r--r--lib/efi_selftest/efi_selftest_console.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/efi_selftest/efi_selftest_console.c b/lib/efi_selftest/efi_selftest_console.c
index ffd88a1e26d..3187e104c44 100644
--- a/lib/efi_selftest/efi_selftest_console.c
+++ b/lib/efi_selftest/efi_selftest_console.c
@@ -70,6 +70,28 @@ static void printx(u64 p, int prec, u16 **buf)
*buf = pos;
}
+/**
+ * print_guid() - print GUID to an u16 string
+ *
+ * @p: GUID to print
+ * @buf: pointer to buffer address,
+ * on return position of terminating zero word
+ */
+static void print_uuid(u8 *p, u16 **buf)
+{
+ int i;
+ const u8 seq[] = {
+ 3, 2, 1, 0, '-', 5, 4, '-', 7, 6, '-',
+ 8, 9, 10, 11, 12, 13, 14, 15 };
+
+ for (i = 0; i < sizeof(seq); ++i) {
+ if (seq[i] == '-')
+ *(*buf)++ = u'-';
+ else
+ printx(p[seq[i]], 2, buf);
+ }
+}
+
/*
* Print an unsigned 32bit value as decimal number to an u16 string
*
@@ -212,6 +234,9 @@ void efi_st_printc(int color, const char *fmt, ...)
con_out->output_string(con_out, u);
pos = buf;
break;
+ case 'U':
+ print_uuid(va_arg(args, void*), &pos);
+ break;
default:
--c;
printx((uintptr_t)va_arg(args, void *),