All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] efi_selftest: implement printing GUIDs
@ 2022-01-16 14:55 Heinrich Schuchardt
  0 siblings, 0 replies; only message in thread
From: Heinrich Schuchardt @ 2022-01-16 14:55 UTC (permalink / raw)
  To: u-boot; +Cc: Jose Marinho, Heinrich Schuchardt

The ESRT test may try to print a GUID if an error occurs.
Implement the %pU print code.

Correct the ESRT test to use %pU instead of %pUl to avoid the output
of character 'l'.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 lib/efi_selftest/efi_selftest_console.c | 25 +++++++++++++++++++++++++
 lib/efi_selftest/efi_selftest_esrt.c    |  8 ++++----
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/lib/efi_selftest/efi_selftest_console.c b/lib/efi_selftest/efi_selftest_console.c
index ffd88a1e26..3187e104c4 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 *),
diff --git a/lib/efi_selftest/efi_selftest_esrt.c b/lib/efi_selftest/efi_selftest_esrt.c
index 99251f22a5..99793dee72 100644
--- a/lib/efi_selftest/efi_selftest_esrt.c
+++ b/lib/efi_selftest/efi_selftest_esrt.c
@@ -121,28 +121,28 @@ static bool lib_test_check_uuid_entry(struct efi_system_resource_table *esrt,
 	for (u32 idx = 0; idx < filled_entries; idx++) {
 		if (!guidcmp(&entry[idx].fw_class, &img_info->image_type_id)) {
 			if (entry[idx].fw_version != img_info->version) {
-				efi_st_error("ESRT field mismatch for entry with fw_class=%pUl\n",
+				efi_st_error("ESRT field mismatch for entry with fw_class=%pU\n",
 					     &img_info->image_type_id);
 				return false;
 			}
 
 			if (entry[idx].lowest_supported_fw_version !=
 				img_info->lowest_supported_image_version) {
-				efi_st_error("ESRT field mismatch for entry with fw_class=%pUl\n",
+				efi_st_error("ESRT field mismatch for entry with fw_class=%pU\n",
 					     &img_info->image_type_id);
 				return false;
 			}
 
 			if (entry[idx].last_attempt_version !=
 				img_info->last_attempt_version) {
-				efi_st_error("ESRT field mismatch for entry with fw_class=%pUl\n",
+				efi_st_error("ESRT field mismatch for entry with fw_class=%pU\n",
 					     &img_info->image_type_id);
 				return false;
 			}
 
 			if (entry[idx].last_attempt_status !=
 				img_info->last_attempt_status) {
-				efi_st_error("ESRT field mismatch for entry with fw_class=%pUl\n",
+				efi_st_error("ESRT field mismatch for entry with fw_class=%pU\n",
 					     &img_info->image_type_id);
 				return false;
 			}
-- 
2.33.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-16 14:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-16 14:55 [PATCH 1/1] efi_selftest: implement printing GUIDs Heinrich Schuchardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.