From patchwork Sun Jan 16 14:55:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1580468 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=VWLBFoz0; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JcJ560y8rz9t0Z for ; Mon, 17 Jan 2022 01:56:08 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4A85A81DF1; Sun, 16 Jan 2022 15:55:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.b="VWLBFoz0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 45A7A81E04; Sun, 16 Jan 2022 15:55:52 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3DA6581DD6 for ; Sun, 16 Jan 2022 15:55:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from workstation5.fritz.box (ip-88-152-144-107.hsi03.unitymediagroup.de [88.152.144.107]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 3D8FD3F1C0; Sun, 16 Jan 2022 14:55:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1642344946; bh=8G79wqUw+BxwxNmuxu4CzMhYW9NDaknSvM7W1/HvpLM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=VWLBFoz03n6Vvyr2TBEF0n1ROTFt+GBXJdNsRZxaewd2K+AtRJ1I8YQ6di1NEY3+H FGm2S0duljMrtdeDgGuhRwSRqnBmwVc+8EHg1yaXyx2mIrxwnoebXDWeG5oOha+x50 vqMsPSNQMNropwu9zcBkwNqipgF4bYRT/HatalktBtp+UZXjK70WuXFYmmbCIOdCeV nMEwMqA4VVbkLbIerody04qlOU6st0Ae15HLpFE8g6+lP5QO+QSF/rr/XMlnv6atm/ s4/O8zPr11WkJujzRyA/aeNnlc9UCLlxmlnj6cWAcgvA68QGy5VHkGgCukIqDc2HaC EfLekvD6ro2TA== From: Heinrich Schuchardt To: u-boot@lists.denx.de Cc: Jose Marinho , Heinrich Schuchardt Subject: [PATCH 1/1] efi_selftest: implement printing GUIDs Date: Sun, 16 Jan 2022 15:55:44 +0100 Message-Id: <20220116145544.218441-1-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean 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 --- 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; }