From patchwork Sun Jul 18 20:14:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1506637 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=fYuNrN+9; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GSbn019Ftz9sWS for ; Mon, 19 Jul 2021 06:14:59 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AD4C980563; Sun, 18 Jul 2021 22:14:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="fYuNrN+9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 98243805E7; Sun, 18 Jul 2021 22:14:44 +0200 (CEST) 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,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc2f.google.com (mail-oo1-xc2f.google.com [IPv6:2607:f8b0:4864:20::c2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 755258039D for ; Sun, 18 Jul 2021 22:14:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oo1-xc2f.google.com with SMTP id a17-20020a4ad5d10000b0290263c143bcb2so2497204oot.7 for ; Sun, 18 Jul 2021 13:14:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PaFrJzxMDXFBUHux2xvLxK9zJcEcfeNZibvMsDxOW8o=; b=fYuNrN+9SaBBLzimvVZYUJnqwOxemXOKE7uLd/WPBIUsiKJVOk3OUumZYxS8TT/d2C dajMLbAIhpCBD6l10GzlN0vG7ZdVeqDIYSSbSlBjtDh17VvLyHIu3XAJMFfY2kifA7Mj MT9NtLrqB5wEg9R82fv5U/hK1SDocctqbHJMk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PaFrJzxMDXFBUHux2xvLxK9zJcEcfeNZibvMsDxOW8o=; b=QnO0P3be4e4331ZjnCdHM6rqZ+nlVUnG3joPxGt4E7QC9EEeC/xKx0w5Wm3IUNeoTf qm1Kas6YBs0dx3A+wlSTNBHIS30XAwC6zbdNzO6/k7tyGZWrbvZYWmGlSkG0jNhy1kCD jU/YWJ1GZDVZBO/lXrAuWLLDUY61Ki5tVhdPqgGpazg9o3vaMTXVWbgRV6cnxy7fg1tu XKfbcAIjoYyYzdxVB+O6aEQW+21vzb/6cZUF1ylCywbFJletKK9vd79nXfrqF1bhRFGc jrseZ3HrSv/ZeXp2FoxrcOwLKbZkhtcULTYYD+uiN8hzBWcMJn7Bn8iM1MBvkAB7sFnA hDOA== X-Gm-Message-State: AOAM531UJ/4EnEwzy0PsetutCahgt6e8msnCb9a1zymoC4GgRxVpKud8 MTLy9S/fpeRK4In/r/5jCT7NinbdfyRmj98g X-Google-Smtp-Source: ABdhPJzjbwAfnubIduaVI/9l9dnnMNCH1gwYPoixCfVxXT59/T2RDDttmQgyz8fDCUBcwixEPPjcVA== X-Received: by 2002:a4a:b5c4:: with SMTP id u4mr15516926ooo.18.1626639279463; Sun, 18 Jul 2021 13:14:39 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id k13sm3170598otl.50.2021.07.18.13.14.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Jul 2021 13:14:39 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Joe Perches , Simon Glass , Alper Nebi Yasak , Evan Benn , =?utf-8?q?Marek_Beh=C3=BAn?= , Sean Anderson , Wasim Khan Subject: [PATCH v2 1/5] checkpatch: Support wide strings Date: Sun, 18 Jul 2021 14:14:22 -0600 Message-Id: <20210718201426.759240-2-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.402.g57bb445576-goog In-Reply-To: <20210718201426.759240-1-sjg@chromium.org> References: <20210718201426.759240-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 From: Joe Perches Allow prefixing typical strings with L for wide strings and u for unicode strings. Signed-off-by: Joe Perches Signed-off-by: Simon Glass --- This was found on LKML: https://lore.kernel.org/lkml/1508280192.6530.31.camel@perches.com/T/ It likely wasn't applied because it did not show up in patchwork correctly, due to the patch being inline: https://lore.kernel.org/patchwork/patch/842121/ In any case, it needed rebasing and updating to support 'u'. Heinrich, perhaps you can send this upstream since you have the context? Changes in v2: - Add new patch to reduce checkpatch unicode-string spam scripts/checkpatch.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 08a827535aa..b244682c7c9 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -411,7 +411,7 @@ our $Binary = qr{(?i)0b[01]+$Int_type?}; our $Hex = qr{(?i)0x[0-9a-f]+$Int_type?}; our $Int = qr{[0-9]+$Int_type?}; our $Octal = qr{0[0-7]+$Int_type?}; -our $String = qr{"[X\t]*"}; +our $String = qr{(?:\b[Lu])?"[X\t]*"}; our $Float_hex = qr{(?i)0x[0-9a-f]+p-?[0-9]+[fl]?}; our $Float_dec = qr{(?i)(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?}; our $Float_int = qr{(?i)[0-9]+e-?[0-9]+[fl]?}; @@ -5673,7 +5673,8 @@ sub process { } # concatenated string without spaces between elements - if ($line =~ /$String[A-Za-z0-9_]/ || $line =~ /[A-Za-z0-9_]$String/) { + if ($line =~ /$String[A-Z_]/ || + ($line =~ /([A-Za-z0-9_]+)$String/ && $1 !~ /^[Lu]$/)) { if (CHK("CONCATENATED_STRING", "Concatenated strings should use spaces between elements\n" . $herecurr) && $fix) { @@ -5686,7 +5687,7 @@ sub process { } # uncoalesced string fragments - if ($line =~ /$String\s*"/) { + if ($line =~ /$String\s*[Lu]?"/) { if (WARN("STRING_FRAGMENTS", "Consecutive strings are generally better as a single string\n" . $herecurr) && $fix) { From patchwork Sun Jul 18 20:14:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1506638 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=JaXS8ZGb; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GSbnB1v0Fz9sWS for ; Mon, 19 Jul 2021 06:15:10 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DE2A681EBD; Sun, 18 Jul 2021 22:14:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="JaXS8ZGb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 60FB080EE5; Sun, 18 Jul 2021 22:14:46 +0200 (CEST) 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,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DBE5E80488 for ; Sun, 18 Jul 2021 22:14:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oi1-x22a.google.com with SMTP id h9so18297323oih.4 for ; Sun, 18 Jul 2021 13:14:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6aPPpvDqJ5ddwq4HUjv5NTgYuRXghsQerRessW1pMng=; b=JaXS8ZGbBPVoHqQDfjaovtS5joC8LuIY4eOixjp+WrjL2MPCsoZXJ9jfmxlV8rfmhU eJc6SqnJMuluDtzzyuI9sGrnmHsHXw2/YXrImJuHUYPwXqT2fxuWFU/TvuZPWj2TZuMH vGIscOhTLqudZukhqusbhlD7ilcykUBSkxVG8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6aPPpvDqJ5ddwq4HUjv5NTgYuRXghsQerRessW1pMng=; b=kZ3mxdSiH2oPLC3Q77YtmFUxBG3deAoSMYR94PlGWZR/ch5iU/n8OJrOQvNP/7oPfH G//XUlpTetzY6fEPeQZkD2QtnNabi526EBIYHTTmD/wO5skpYCW4m9DtSIPc9FDXoDrG 4Y6VZvR0HqenSdDTc85rHhY4bmCXl8MlxCs99PJy4P2GnyGigOY2RojxjcU2QyvHSEKv rjO8dRUbPM2gPhc/0perZqsJyMCj2Q7/ffdlD3QD1aXwZgdtr6J3pG/rd/DO8Q62oUZ1 huWcVtOm2LfnzpeLs+y9/azRbrWPkQrDvC8O+1NvnPmq57xO8d+3URofw5HK74zfWh+V yfTA== X-Gm-Message-State: AOAM531ObYlAiidTAevtTK3nmlFw9Sk8bi4XDIvx9S74NGcMb8DM2VSP pc3QNntvew4qTjQEzeDeX8qXJyo1Kf6Qw4zB X-Google-Smtp-Source: ABdhPJwNAjVsKJBIenAfw/NL+MK291DLtCUDWpZTfY3CWT5/E60flWImp6/natVEBqdaKf35PoxThg== X-Received: by 2002:a05:6808:210e:: with SMTP id r14mr15770895oiw.90.1626639280359; Sun, 18 Jul 2021 13:14:40 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id k13sm3170598otl.50.2021.07.18.13.14.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Jul 2021 13:14:40 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v2 2/5] pci: swap_case: Allow compilation on 32-bit machines Date: Sun, 18 Jul 2021 14:14:23 -0600 Message-Id: <20210718201426.759240-3-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.402.g57bb445576-goog In-Reply-To: <20210718201426.759240-1-sjg@chromium.org> References: <20210718201426.759240-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 At present this driver assumes that ulong is 64-bits long. On 32-bit machines it is not. Use the 64-bit code only on 64-bit machines. This makes things work correctly on 32-bit machines. Signed-off-by: Simon Glass --- Changes in v2: - Update commit message to indicate that things work now drivers/misc/swap_case.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/misc/swap_case.c b/drivers/misc/swap_case.c index 3cbc8f37ec5..7093ad1cd4f 100644 --- a/drivers/misc/swap_case.c +++ b/drivers/misc/swap_case.c @@ -302,7 +302,6 @@ static int sandbox_swap_case_write_io(struct udevice *dev, unsigned int addr, } static int pci_ea_bar2_magic = PCI_EA_BAR2_MAGIC; -static int pci_ea_bar4_magic = PCI_EA_BAR4_MAGIC; static int sandbox_swap_case_map_physmem(struct udevice *dev, phys_addr_t addr, unsigned long *lenp, void **ptrp) @@ -332,12 +331,22 @@ static int sandbox_swap_case_map_physmem(struct udevice *dev, *ptrp = &pci_ea_bar2_magic; *lenp = PCI_CAP_EA_SIZE_LO; break; +#ifdef CONFIG_HOST_64BIT + /* + * This cannot be work on a 32-bit machine since *lenp is ulong + * which is 32-bits, but it needs to have a 64-bit value + * assigned + */ case (phys_addr_t)((PCI_CAP_EA_BASE_HI4 << 32) | - PCI_CAP_EA_BASE_LO4): + PCI_CAP_EA_BASE_LO4): { + static int pci_ea_bar4_magic = PCI_EA_BAR4_MAGIC; + *ptrp = &pci_ea_bar4_magic; *lenp = (PCI_CAP_EA_SIZE_HI << 32) | PCI_CAP_EA_SIZE_LO; break; + } +#endif default: return -ENOENT; } From patchwork Sun Jul 18 20:14:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1506639 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=TnhjeKI9; dkim-atps=neutral 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GSbnN5xhpz9sWS for ; Mon, 19 Jul 2021 06:15:20 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EC503829FB; Sun, 18 Jul 2021 22:14:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="TnhjeKI9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 469CF80EC5; Sun, 18 Jul 2021 22:14:47 +0200 (CEST) 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,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CF34580563 for ; Sun, 18 Jul 2021 22:14:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ot1-x32b.google.com with SMTP id o17-20020a9d76510000b02903eabfc221a9so16109015otl.0 for ; Sun, 18 Jul 2021 13:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J5TUvLxlAB678IA6UpfGzozSJnukCsZziQnjWrItwak=; b=TnhjeKI9HJ7ihJ8kdlWdACsjBf2DI7ww9uPKcRjLCVybIy7Xyc7rMH7M1fzW/5f8+2 XrzXoB1AkxAxsyhWTrK3iZfqSJSe9UPeQL9YanZwDqBHexb3saWWHl91uHkgfILnbDzg DBPSCowt44Tw/uEC4huXPUyl2VaITxeMIoFv8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J5TUvLxlAB678IA6UpfGzozSJnukCsZziQnjWrItwak=; b=EyKF4lw9Iao0RpBe401/GJX2DlR/ME73jr/XfiGCa5JLEhfEoamzjlNqiuNxaQnT+B IqOXfhhispk1fxWIxDasUpjZUrxXOmELWwXcS96sGVvyb7CsprcerCGZJQjV8XCJkq0C ZMaMMwVbfAsQ2ozDOMe9gQARof7ETlyQHNt2TgxvdG2W7qKKjHapDKNPFOYGNjGsm3iC rHjyma66LENlcPuU0py6O22SrFX24A15ZHb5XgTbQ/UzjXoCy04P4vgvtF2gGpnYvY4+ Ac49uNfsGKtp6A9vASNVmqw3E88Bet9iJpgtQ+lniilNPybV/oGUs2hsWr594pYzEUPm 01FQ== X-Gm-Message-State: AOAM532jod0MzPoAU/FNJ0plukvY37cIvr5KZxesSEOy2bfjdEXPsYgP 4T6a8TbU/JSzCGeWud9GT6YJKgiMq55uiB+c X-Google-Smtp-Source: ABdhPJyQJd0/+3vigOCbKqtpwolhkVXVUvPv7uak8IyC8mdQHr3rEMMf/0utFW2AAlGi2HrlfSgt8g== X-Received: by 2002:a9d:77d4:: with SMTP id w20mr16674257otl.84.1626639281229; Sun, 18 Jul 2021 13:14:41 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id k13sm3170598otl.50.2021.07.18.13.14.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Jul 2021 13:14:40 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v2 3/5] doc: sandbox: Fix up dependencies Date: Sun, 18 Jul 2021 14:14:24 -0600 Message-Id: <20210718201426.759240-4-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.402.g57bb445576-goog In-Reply-To: <20210718201426.759240-1-sjg@chromium.org> References: <20210718201426.759240-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 These are out of date. Update them and point to the existing build instructions to avoid duplication. Add a few that are missing. Signed-off-by: Simon Glass --- Changes in v2: - Add python3-pycryptodome also, for test_fit_ecdsa.py doc/arch/sandbox.rst | 6 +----- doc/build/gcc.rst | 6 ++++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/doc/arch/sandbox.rst b/doc/arch/sandbox.rst index e052b6bdb09..493d6deaf00 100644 --- a/doc/arch/sandbox.rst +++ b/doc/arch/sandbox.rst @@ -43,11 +43,7 @@ Note that standalone/API support is not available at present. Prerequisites ------------- -Here are some packages that are worth installing if you are doing sandbox or -tools development in U-Boot: - - python3-pytest lzma lzma-alone lz4 python3 python3-virtualenv - libssl1.0-dev +Install the dependencies noted in :doc:`../build/gcc`. Basic Operation diff --git a/doc/build/gcc.rst b/doc/build/gcc.rst index c51b3e73b83..8ffb4e3447b 100644 --- a/doc/build/gcc.rst +++ b/doc/build/gcc.rst @@ -26,8 +26,10 @@ Depending on the build targets further packages maybe needed sudo apt-get install bc bison build-essential coccinelle \ device-tree-compiler dfu-util efitools flex gdisk liblz4-tool \ libguestfs-tools libncurses-dev libpython3-dev libsdl2-dev libssl-dev \ - lzma-alone openssl python3 python3-coverage python3-pyelftools \ - python3-pytest python3-sphinxcontrib.apidoc python3-sphinx-rtd-theme swig + lz4 lzma lzma-alone openssl python3 python3-coverage \ + python3-pycryptodome python3-pyelftools python3-pytest \ + python3-sphinxcontrib.apidoc python3-sphinx-rtd-theme python3-virtualenv \ + swig SUSE based ~~~~~~~~~~ From patchwork Sun Jul 18 20:14:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1506641 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=IprEpbKa; dkim-atps=neutral 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GSbnn64k8z9sWS for ; Mon, 19 Jul 2021 06:15:41 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1CBE982BE0; Sun, 18 Jul 2021 22:15:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="IprEpbKa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 69707829F9; Sun, 18 Jul 2021 22:14:53 +0200 (CEST) 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,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc31.google.com (mail-oo1-xc31.google.com [IPv6:2607:f8b0:4864:20::c31]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D11648033E for ; Sun, 18 Jul 2021 22:14:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oo1-xc31.google.com with SMTP id y17-20020a4ae7110000b0290262f3c22a63so3929087oou.9 for ; Sun, 18 Jul 2021 13:14:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o1ggfIJyJFUO5wPoui8YiFPDTm0mh7uu+f7u7y5r7Hc=; b=IprEpbKaIRmF79UbLC8rVxUVbOxZs5abcaG14ZwzTRUT/G+x7ZP85WbAGKXWKye30n xO34fyEumFPln22QISThM1cQd2uKFYXo5AquIWGFC9zqmF/qsVZkYhVdgOqukad4q/FV hhF9z9uxDyCvnq53bNJWH/8NMc1EBsC6z3Fxc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o1ggfIJyJFUO5wPoui8YiFPDTm0mh7uu+f7u7y5r7Hc=; b=Hh2JVGsJ6yydJBDdIc7u/CfRdVBvrwxAakwTjmrIYu1XUzseJ5AT7b0LDYna7CJm/d cddq3xKFMSQpYQam8HpBHOt4o6adHm7fLcSghJgKVFdrQQLJ02E3hhnIQ3H/t9u+xkuX CU94YfeTL2wbfDT/zbDMyvmTci3sr/8WPmZXECOaR0H7WjB4dskW+MIyNTnzxkWZzA6r qqQMdIX7OR93N8E7jKsYYWg+TGzV1kSqfgJXe5FC47T7XuMjk2KjwBklV+d/wX+QXidP HLQuTBqEwEC2J8J91XgX4TltSbNJethiztXHCQY+pZE2BtuokfQ8xOFftp3RktnzLN0I 7tzw== X-Gm-Message-State: AOAM53165Ax+JLZwWaK3EXPnlNqmVERtZeAEIoiADHsHSxE5B64JDP7z Sqsy21xEFiUA2et/Ms07ccAK5gG5ok67HCZm X-Google-Smtp-Source: ABdhPJxWXUnj1i/3U+Da/lU3DCvdcfVgykiUZmnep5LawaMaTJFVpbnmyDjEVEgnd9quWJBiga04UA== X-Received: by 2002:a4a:cb0e:: with SMTP id r14mr15327932ooq.70.1626639282298; Sun, 18 Jul 2021 13:14:42 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id k13sm3170598otl.50.2021.07.18.13.14.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Jul 2021 13:14:41 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Simon Glass , Alexander Graf , Ilias Apalodimas Subject: [PATCH v2 4/5] efi: Use 16-bit unicode strings Date: Sun, 18 Jul 2021 14:14:25 -0600 Message-Id: <20210718201426.759240-5-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.402.g57bb445576-goog In-Reply-To: <20210718201426.759240-1-sjg@chromium.org> References: <20210718201426.759240-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 At present we use wide characters for unicode but this is not necessary. Change the code to use the 'u' literal instead. This helps to fix build warnings for sandbox on rpi. Signed-off-by: Simon Glass Suggested-by: Heinrich Schuchardt Reviewed-by: Heinrich Schuchardt --- (no changes since v1) include/efi_loader.h | 2 +- lib/efi_loader/efi_bootmgr.c | 12 +- lib/efi_loader/efi_boottime.c | 2 +- lib/efi_loader/efi_capsule.c | 20 ++-- lib/efi_loader/efi_helper.c | 2 +- lib/efi_loader/efi_image_loader.c | 8 +- lib/efi_loader/efi_setup.c | 20 ++-- lib/efi_loader/efi_signature.c | 4 +- lib/efi_loader/efi_string.c | 2 +- lib/efi_loader/efi_var_common.c | 14 +-- lib/efi_loader/efi_variable.c | 6 +- lib/efi_loader/efi_variable_tee.c | 2 +- lib/efi_loader/helloworld.c | 40 +++---- lib/efi_selftest/dtbdump.c | 82 +++++++------- lib/efi_selftest/efi_selftest.c | 2 +- lib/efi_selftest/efi_selftest_block_device.c | 6 +- lib/efi_selftest/efi_selftest_devicepath.c | 2 +- lib/efi_selftest/efi_selftest_exception.c | 2 +- lib/efi_selftest/efi_selftest_fdt.c | 6 +- lib/efi_selftest/efi_selftest_hii.c | 8 +- lib/efi_selftest/efi_selftest_load_file.c | 4 +- lib/efi_selftest/efi_selftest_loadimage.c | 4 +- .../efi_selftest_miniapp_exception.c | 4 +- lib/efi_selftest/efi_selftest_miniapp_exit.c | 8 +- .../efi_selftest_miniapp_return.c | 2 +- lib/efi_selftest/efi_selftest_reset.c | 2 +- lib/efi_selftest/efi_selftest_textoutput.c | 12 +- .../efi_selftest_unicode_collation.c | 38 +++---- lib/efi_selftest/efi_selftest_util.c | 106 +++++++++--------- lib/efi_selftest/efi_selftest_variables.c | 22 ++-- .../efi_selftest_variables_runtime.c | 4 +- lib/efi_selftest/initrddump.c | 60 +++++----- 32 files changed, 254 insertions(+), 254 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index b81180cfda8..cad7961942b 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -924,7 +924,7 @@ efi_status_t efi_capsule_authenticate(const void *capsule, efi_uintn_t capsule_size, void **image, efi_uintn_t *image_size); -#define EFI_CAPSULE_DIR L"\\EFI\\UpdateCapsule\\" +#define EFI_CAPSULE_DIR u"\\EFI\\UpdateCapsule\\" /* Hook at initialization */ efi_status_t efi_launch_capsules(void); diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c index 1fe19237f9a..8c04ecbdc83 100644 --- a/lib/efi_loader/efi_bootmgr.c +++ b/lib/efi_loader/efi_bootmgr.c @@ -46,8 +46,8 @@ static efi_status_t try_load_entry(u16 n, efi_handle_t *handle, void **load_options) { struct efi_load_option lo; - u16 varname[] = L"Boot0000"; - u16 hexmap[] = L"0123456789ABCDEF"; + u16 varname[] = u"Boot0000"; + u16 hexmap[] = u"0123456789ABCDEF"; void *load_option; efi_uintn_t size; efi_status_t ret; @@ -83,7 +83,7 @@ static efi_status_t try_load_entry(u16 n, efi_handle_t *handle, attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS; - ret = efi_set_variable_int(L"BootCurrent", + ret = efi_set_variable_int(u"BootCurrent", &efi_global_variable_guid, attributes, sizeof(n), &n, false); if (ret != EFI_SUCCESS) @@ -149,7 +149,7 @@ efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options) /* BootNext */ size = sizeof(bootnext); - ret = efi_get_variable_int(L"BootNext", + ret = efi_get_variable_int(u"BootNext", &efi_global_variable_guid, NULL, &size, &bootnext, NULL); if (ret == EFI_SUCCESS || ret == EFI_BUFFER_TOO_SMALL) { @@ -158,7 +158,7 @@ efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options) log_err("BootNext must be 16-bit integer\n"); /* delete BootNext */ - ret = efi_set_variable_int(L"BootNext", + ret = efi_set_variable_int(u"BootNext", &efi_global_variable_guid, 0, 0, NULL, false); @@ -178,7 +178,7 @@ efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options) } /* BootOrder */ - bootorder = efi_get_var(L"BootOrder", &efi_global_variable_guid, &size); + bootorder = efi_get_var(u"BootOrder", &efi_global_variable_guid, &size); if (!bootorder) { log_info("BootOrder not defined\n"); ret = EFI_NOT_FOUND; diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index f6d5ba05e34..448d2ef321f 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -3735,7 +3735,7 @@ static struct efi_boot_services efi_boot_services = { .create_event_ex = efi_create_event_ex, }; -static u16 __efi_runtime_data firmware_vendor[] = L"Das U-Boot"; +static u16 __efi_runtime_data firmware_vendor[] = u"Das U-Boot"; struct efi_system_table __efi_runtime_data systab = { .hdr = { diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index b878e71438b..50963414aaa 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -51,10 +51,10 @@ static __maybe_unused unsigned int get_last_capsule(void) int i; size = sizeof(value16); - ret = efi_get_variable_int(L"CapsuleLast", &efi_guid_capsule_report, + ret = efi_get_variable_int(u"CapsuleLast", &efi_guid_capsule_report, NULL, &size, value16, NULL); if (ret != EFI_SUCCESS || size != 22 || - u16_strncmp(value16, L"Capsule", 7)) + u16_strncmp(value16, u"Capsule", 7)) goto err; for (i = 0; i < 4; ++i) { u16 c = value16[i + 7]; @@ -108,14 +108,14 @@ void set_capsule_result(int index, struct efi_capsule_header *capsule, } /* Variable CapsuleLast must not include terminating 0x0000 */ - ret = efi_set_variable_int(L"CapsuleLast", &efi_guid_capsule_report, + ret = efi_set_variable_int(u"CapsuleLast", &efi_guid_capsule_report, EFI_VARIABLE_READ_ONLY | EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, 22, variable_name16, false); if (ret != EFI_SUCCESS) - log_err("Setting %ls failed\n", L"CapsuleLast"); + log_err("Setting %ls failed\n", u"CapsuleLast"); } #ifdef CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT @@ -630,7 +630,7 @@ static efi_status_t find_boot_device(void) /* find active boot device in BootNext */ bootnext = 0; size = sizeof(bootnext); - ret = efi_get_variable_int(L"BootNext", + ret = efi_get_variable_int(u"BootNext", (efi_guid_t *)&efi_global_variable_guid, NULL, &size, &bootnext, NULL); if (ret == EFI_SUCCESS || ret == EFI_BUFFER_TOO_SMALL) { @@ -657,7 +657,7 @@ static efi_status_t find_boot_device(void) skip: /* find active boot device in BootOrder */ size = 0; - ret = efi_get_variable_int(L"BootOrder", &efi_global_variable_guid, + ret = efi_get_variable_int(u"BootOrder", &efi_global_variable_guid, NULL, &size, NULL, NULL); if (ret == EFI_BUFFER_TOO_SMALL) { boot_order = malloc(size); @@ -666,7 +666,7 @@ skip: goto out; } - ret = efi_get_variable_int(L"BootOrder", + ret = efi_get_variable_int(u"BootOrder", &efi_global_variable_guid, NULL, &size, boot_order, NULL); } @@ -802,8 +802,8 @@ static efi_status_t efi_capsule_scan_dir(u16 ***files, unsigned int *num) break; if (!(dirent->attribute & EFI_FILE_DIRECTORY) && - u16_strcmp(dirent->file_name, L".") && - u16_strcmp(dirent->file_name, L"..")) + u16_strcmp(dirent->file_name, u".") && + u16_strcmp(dirent->file_name, u"..")) tmp_files[count++] = u16_strdup(dirent->file_name); } /* ignore an error */ @@ -980,7 +980,7 @@ static bool check_run_capsules(void) return true; size = sizeof(os_indications); - ret = efi_get_variable_int(L"OsIndications", &efi_global_variable_guid, + ret = efi_get_variable_int(u"OsIndications", &efi_global_variable_guid, NULL, &size, &os_indications, NULL); if (ret == EFI_SUCCESS && (os_indications diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c index d03a7364615..e30adb3cb2b 100644 --- a/lib/efi_loader/efi_helper.c +++ b/lib/efi_loader/efi_helper.c @@ -31,7 +31,7 @@ static efi_status_t efi_create_current_boot_var(u16 var_name[], u16 *pos; boot_current_size = sizeof(boot_current); - ret = efi_get_variable_int(L"BootCurrent", + ret = efi_get_variable_int(u"BootCurrent", &efi_global_variable_guid, NULL, &boot_current_size, &boot_current, NULL); if (ret != EFI_SUCCESS) diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c index a0eb63fcebe..b1f853b6fcd 100644 --- a/lib/efi_loader/efi_image_loader.c +++ b/lib/efi_loader/efi_image_loader.c @@ -532,13 +532,13 @@ static bool efi_image_unsigned_authenticate(struct efi_image_regions *regs) struct efi_signature_store *db = NULL, *dbx = NULL; bool ret = false; - dbx = efi_sigstore_parse_sigdb(L"dbx"); + dbx = efi_sigstore_parse_sigdb(u"dbx"); if (!dbx) { EFI_PRINT("Getting signature database(dbx) failed\n"); goto out; } - db = efi_sigstore_parse_sigdb(L"db"); + db = efi_sigstore_parse_sigdb(u"db"); if (!db) { EFI_PRINT("Getting signature database(db) failed\n"); goto out; @@ -621,13 +621,13 @@ static bool efi_image_authenticate(void *efi, size_t efi_size) /* * verify signature using db and dbx */ - db = efi_sigstore_parse_sigdb(L"db"); + db = efi_sigstore_parse_sigdb(u"db"); if (!db) { EFI_PRINT("Getting signature database(db) failed\n"); goto err; } - dbx = efi_sigstore_parse_sigdb(L"dbx"); + dbx = efi_sigstore_parse_sigdb(u"dbx"); if (!dbx) { EFI_PRINT("Getting signature database(dbx) failed\n"); goto err; diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c index a2338d74afa..ddbee057ceb 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -43,7 +43,7 @@ static efi_status_t efi_init_platform_lang(void) * Variable PlatformLangCodes defines the language codes that the * machine can support. */ - ret = efi_set_variable_int(L"PlatformLangCodes", + ret = efi_set_variable_int(u"PlatformLangCodes", &efi_global_variable_guid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | @@ -57,7 +57,7 @@ static efi_status_t efi_init_platform_lang(void) * Variable PlatformLang defines the language that the machine has been * configured for. */ - ret = efi_get_variable_int(L"PlatformLang", + ret = efi_get_variable_int(u"PlatformLang", &efi_global_variable_guid, NULL, &data_size, &pos, NULL); if (ret == EFI_BUFFER_TOO_SMALL) { @@ -74,7 +74,7 @@ static efi_status_t efi_init_platform_lang(void) if (pos) *pos = 0; - ret = efi_set_variable_int(L"PlatformLang", + ret = efi_set_variable_int(u"PlatformLang", &efi_global_variable_guid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | @@ -100,7 +100,7 @@ static efi_status_t efi_init_secure_boot(void) }; efi_status_t ret; - ret = efi_set_variable_int(L"SignatureSupport", + ret = efi_set_variable_int(u"SignatureSupport", &efi_global_variable_guid, EFI_VARIABLE_READ_ONLY | EFI_VARIABLE_BOOTSERVICE_ACCESS | @@ -129,12 +129,12 @@ static efi_status_t efi_init_capsule(void) efi_status_t ret = EFI_SUCCESS; if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_UPDATE)) { - ret = efi_set_variable_int(L"CapsuleMax", + ret = efi_set_variable_int(u"CapsuleMax", &efi_guid_capsule_report, EFI_VARIABLE_READ_ONLY | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - 22, L"CapsuleFFFF", false); + 22, u"CapsuleFFFF", false); if (ret != EFI_SUCCESS) printf("EFI: cannot initialize CapsuleMax variable\n"); } @@ -165,7 +165,7 @@ static efi_status_t efi_init_os_indications(void) os_indications_supported |= EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED; - return efi_set_variable_int(L"OsIndicationsSupported", + return efi_set_variable_int(u"OsIndicationsSupported", &efi_global_variable_guid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | @@ -187,21 +187,21 @@ static efi_status_t efi_clear_os_indications(void) efi_status_t ret; size = sizeof(os_indications); - ret = efi_get_variable_int(L"OsIndications", &efi_global_variable_guid, + ret = efi_get_variable_int(u"OsIndications", &efi_global_variable_guid, NULL, &size, &os_indications, NULL); if (ret != EFI_SUCCESS) os_indications = 0; else os_indications &= ~EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED; - ret = efi_set_variable_int(L"OsIndications", &efi_global_variable_guid, + ret = efi_set_variable_int(u"OsIndications", &efi_global_variable_guid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, sizeof(os_indications), &os_indications, false); if (ret != EFI_SUCCESS) - log_err("Setting %ls failed\n", L"OsIndications"); + log_err("Setting %ls failed\n", u"OsIndications"); return ret; } diff --git a/lib/efi_loader/efi_signature.c b/lib/efi_loader/efi_signature.c index bdd09881fc9..e25edfeda50 100644 --- a/lib/efi_loader/efi_signature.c +++ b/lib/efi_loader/efi_signature.c @@ -746,9 +746,9 @@ struct efi_signature_store *efi_sigstore_parse_sigdb(u16 *name) efi_uintn_t db_size; efi_status_t ret; - if (!u16_strcmp(name, L"PK") || !u16_strcmp(name, L"KEK")) { + if (!u16_strcmp(name, u"PK") || !u16_strcmp(name, u"KEK")) { vendor = &efi_global_variable_guid; - } else if (!u16_strcmp(name, L"db") || !u16_strcmp(name, L"dbx")) { + } else if (!u16_strcmp(name, u"db") || !u16_strcmp(name, u"dbx")) { vendor = &efi_guid_image_security_database; } else { EFI_PRINT("unknown signature database, %ls\n", name); diff --git a/lib/efi_loader/efi_string.c b/lib/efi_loader/efi_string.c index a3b8edf5a80..8bf1e493b89 100644 --- a/lib/efi_loader/efi_string.c +++ b/lib/efi_loader/efi_string.c @@ -16,7 +16,7 @@ * @index: Index * * Create a utf-16 string with @name, appending @index. - * For example, L"Capsule0001" + * For example, u"Capsule0001" * * The caller must ensure that the buffer has enough space for the resulting * string including the trailing L'\0'. diff --git a/lib/efi_loader/efi_var_common.c b/lib/efi_loader/efi_var_common.c index 3d92afe2ebd..181221ad3b2 100644 --- a/lib/efi_loader/efi_var_common.c +++ b/lib/efi_loader/efi_var_common.c @@ -229,26 +229,26 @@ static efi_status_t efi_set_secure_state(u8 secure_boot, u8 setup_mode, efi_secure_boot = secure_boot; - ret = efi_set_variable_int(L"SecureBoot", &efi_global_variable_guid, + ret = efi_set_variable_int(u"SecureBoot", &efi_global_variable_guid, attributes_ro, sizeof(secure_boot), &secure_boot, false); if (ret != EFI_SUCCESS) goto err; - ret = efi_set_variable_int(L"SetupMode", &efi_global_variable_guid, + ret = efi_set_variable_int(u"SetupMode", &efi_global_variable_guid, attributes_ro, sizeof(setup_mode), &setup_mode, false); if (ret != EFI_SUCCESS) goto err; - ret = efi_set_variable_int(L"AuditMode", &efi_global_variable_guid, + ret = efi_set_variable_int(u"AuditMode", &efi_global_variable_guid, audit_mode || setup_mode ? attributes_ro : attributes_rw, sizeof(audit_mode), &audit_mode, false); if (ret != EFI_SUCCESS) goto err; - ret = efi_set_variable_int(L"DeployedMode", + ret = efi_set_variable_int(u"DeployedMode", &efi_global_variable_guid, audit_mode || deployed_mode || setup_mode ? attributes_ro : attributes_rw, @@ -280,7 +280,7 @@ static efi_status_t efi_transfer_secure_state(enum efi_secure_mode mode) if (ret != EFI_SUCCESS) goto err; } else if (mode == EFI_MODE_AUDIT) { - ret = efi_set_variable_int(L"PK", &efi_global_variable_guid, + ret = efi_set_variable_int(u"PK", &efi_global_variable_guid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, 0, NULL, false); @@ -319,7 +319,7 @@ efi_status_t efi_init_secure_state(void) efi_uintn_t size = 0; efi_status_t ret; - ret = efi_get_variable_int(L"PK", &efi_global_variable_guid, + ret = efi_get_variable_int(u"PK", &efi_global_variable_guid, NULL, &size, NULL, NULL); if (ret == EFI_BUFFER_TOO_SMALL) { if (IS_ENABLED(CONFIG_EFI_SECURE_BOOT)) @@ -331,7 +331,7 @@ efi_status_t efi_init_secure_state(void) return ret; /* As we do not provide vendor keys this variable is always 0. */ - ret = efi_set_variable_int(L"VendorKeys", + ret = efi_set_variable_int(u"VendorKeys", &efi_global_variable_guid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index ba0874e9e78..eb58abd3436 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -145,15 +145,15 @@ static efi_status_t efi_variable_authenticate(u16 *variable, case EFI_AUTH_VAR_PK: case EFI_AUTH_VAR_KEK: /* with PK */ - truststore = efi_sigstore_parse_sigdb(L"PK"); + truststore = efi_sigstore_parse_sigdb(u"PK"); if (!truststore) goto err; break; case EFI_AUTH_VAR_DB: case EFI_AUTH_VAR_DBX: /* with PK and KEK */ - truststore = efi_sigstore_parse_sigdb(L"KEK"); - truststore2 = efi_sigstore_parse_sigdb(L"PK"); + truststore = efi_sigstore_parse_sigdb(u"KEK"); + truststore2 = efi_sigstore_parse_sigdb(u"PK"); if (!truststore) { if (!truststore2) goto err; diff --git a/lib/efi_loader/efi_variable_tee.c b/lib/efi_loader/efi_variable_tee.c index 51920bcb51a..85e2079279c 100644 --- a/lib/efi_loader/efi_variable_tee.c +++ b/lib/efi_loader/efi_variable_tee.c @@ -590,7 +590,7 @@ efi_status_t efi_set_variable_int(u16 *variable_name, const efi_guid_t *vendor, if (alt_ret != EFI_SUCCESS) goto out; - if (!u16_strcmp(variable_name, L"PK")) + if (!u16_strcmp(variable_name, u"PK")) alt_ret = efi_init_secure_state(); out: free(comm_buf); diff --git a/lib/efi_loader/helloworld.c b/lib/efi_loader/helloworld.c index 3f215e2a46e..ec17c73a5e1 100644 --- a/lib/efi_loader/helloworld.c +++ b/lib/efi_loader/helloworld.c @@ -34,7 +34,7 @@ static struct efi_simple_text_output_protocol *con_out; */ static void print_uefi_revision(void) { - u16 rev[] = L"0.0.0"; + u16 rev[] = u"0.0.0"; rev[0] = (systable->hdr.revision >> 16) + '0'; rev[4] = systable->hdr.revision & 0xffff; @@ -48,9 +48,9 @@ static void print_uefi_revision(void) else rev[3] = 0; - con_out->output_string(con_out, L"Running on UEFI "); + con_out->output_string(con_out, u"Running on UEFI "); con_out->output_string(con_out, rev); - con_out->output_string(con_out, L"\r\n"); + con_out->output_string(con_out, u"\r\n"); } /** @@ -65,15 +65,15 @@ static void print_config_tables(void) if (!memcmp(&systable->tables[i].guid, &fdt_guid, sizeof(efi_guid_t))) con_out->output_string - (con_out, L"Have device tree\r\n"); + (con_out, u"Have device tree\r\n"); if (!memcmp(&systable->tables[i].guid, &acpi_guid, sizeof(efi_guid_t))) con_out->output_string - (con_out, L"Have ACPI 2.0 table\r\n"); + (con_out, u"Have ACPI 2.0 table\r\n"); if (!memcmp(&systable->tables[i].guid, &smbios_guid, sizeof(efi_guid_t))) con_out->output_string - (con_out, L"Have SMBIOS table\r\n"); + (con_out, u"Have SMBIOS table\r\n"); } } @@ -86,13 +86,13 @@ static void print_config_tables(void) void print_load_options(struct efi_loaded_image *loaded_image) { /* Output the load options */ - con_out->output_string(con_out, L"Load options: "); + con_out->output_string(con_out, u"Load options: "); if (loaded_image->load_options_size && loaded_image->load_options) con_out->output_string(con_out, (u16 *)loaded_image->load_options); else - con_out->output_string(con_out, L""); - con_out->output_string(con_out, L"\r\n"); + con_out->output_string(con_out, u""); + con_out->output_string(con_out, u"\r\n"); } /** @@ -108,21 +108,21 @@ efi_status_t print_device_path(struct efi_device_path *device_path, efi_status_t ret; if (!device_path) { - con_out->output_string(con_out, L"\r\n"); + con_out->output_string(con_out, u"\r\n"); return EFI_SUCCESS; } string = dp2txt->convert_device_path_to_text(device_path, true, false); if (!string) { con_out->output_string - (con_out, L"Cannot convert device path to text\r\n"); + (con_out, u"Cannot convert device path to text\r\n"); return EFI_OUT_OF_RESOURCES; } con_out->output_string(con_out, string); - con_out->output_string(con_out, L"\r\n"); + con_out->output_string(con_out, u"\r\n"); ret = boottime->free_pool(string); if (ret != EFI_SUCCESS) { - con_out->output_string(con_out, L"Cannot free pool memory\r\n"); + con_out->output_string(con_out, u"Cannot free pool memory\r\n"); return ret; } return EFI_SUCCESS; @@ -148,7 +148,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, con_out = systable->con_out; /* UEFI requires CR LF */ - con_out->output_string(con_out, L"Hello, world!\r\n"); + con_out->output_string(con_out, u"Hello, world!\r\n"); print_uefi_revision(); print_config_tables(); @@ -158,7 +158,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, (void **)&loaded_image); if (ret != EFI_SUCCESS) { con_out->output_string - (con_out, L"Cannot open loaded image protocol\r\n"); + (con_out, u"Cannot open loaded image protocol\r\n"); goto out; } print_load_options(loaded_image); @@ -168,12 +168,12 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, NULL, (void **)&device_path_to_text); if (ret != EFI_SUCCESS) { con_out->output_string - (con_out, L"Cannot open device path to text protocol\r\n"); + (con_out, u"Cannot open device path to text protocol\r\n"); goto out; } if (!loaded_image->device_handle) { con_out->output_string - (con_out, L"Missing device handle\r\n"); + (con_out, u"Missing device handle\r\n"); goto out; } ret = boottime->handle_protocol(loaded_image->device_handle, @@ -181,14 +181,14 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, (void **)&device_path); if (ret != EFI_SUCCESS) { con_out->output_string - (con_out, L"Missing device path for device handle\r\n"); + (con_out, u"Missing device path for device handle\r\n"); goto out; } - con_out->output_string(con_out, L"Boot device: "); + con_out->output_string(con_out, u"Boot device: "); ret = print_device_path(device_path, device_path_to_text); if (ret != EFI_SUCCESS) goto out; - con_out->output_string(con_out, L"File path: "); + con_out->output_string(con_out, u"File path: "); ret = print_device_path(loaded_image->file_path, device_path_to_text); if (ret != EFI_SUCCESS) goto out; diff --git a/lib/efi_selftest/dtbdump.c b/lib/efi_selftest/dtbdump.c index f6ddaa30726..6afdb7970f5 100644 --- a/lib/efi_selftest/dtbdump.c +++ b/lib/efi_selftest/dtbdump.c @@ -109,7 +109,7 @@ static efi_status_t efi_input(u16 *buffer, efi_uintn_t buffer_size) struct efi_input_key key = {0}; efi_uintn_t index; efi_uintn_t pos = 0; - u16 outbuf[2] = L" "; + u16 outbuf[2] = u" "; efi_status_t ret; /* Drain the console input */ @@ -124,7 +124,7 @@ static efi_status_t efi_input(u16 *buffer, efi_uintn_t buffer_size) continue; switch (key.scan_code) { case 0x17: /* Escape */ - print(L"\r\nAborted\r\n"); + print(u"\r\nAborted\r\n"); return EFI_ABORTED; default: break; @@ -133,12 +133,12 @@ static efi_status_t efi_input(u16 *buffer, efi_uintn_t buffer_size) case 0x08: /* Backspace */ if (pos) { buffer[pos--] = 0; - print(L"\b \b"); + print(u"\b \b"); } break; case 0x0a: /* Linefeed */ case 0x0d: /* Carriage return */ - print(L"\r\n"); + print(u"\r\n"); return EFI_SUCCESS; default: break; @@ -228,9 +228,9 @@ bool starts_with(u16 *string, u16 *keyword) */ void do_help(void) { - error(L"load - load device-tree from file\r\n"); - error(L"save - save device-tree to file\r\n"); - error(L"exit - exit the shell\r\n"); + error(u"load - load device-tree from file\r\n"); + error(u"save - save device-tree to file\r\n"); + error(u"exit - exit the shell\r\n"); } /** @@ -251,7 +251,7 @@ open_file_system(struct efi_simple_file_system_protocol **file_system) (void **)&loaded_image, NULL, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); if (ret != EFI_SUCCESS) { - error(L"Loaded image protocol not found\r\n"); + error(u"Loaded image protocol not found\r\n"); return ret; } @@ -272,7 +272,7 @@ open_file_system(struct efi_simple_file_system_protocol **file_system) (void **)file_system, NULL, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); if (ret != EFI_SUCCESS) - error(L"Failed to open simple file system protocol\r\n"); + error(u"Failed to open simple file system protocol\r\n"); if (handle) bs->free_pool(handle_buffer); @@ -300,7 +300,7 @@ efi_status_t do_load(u16 *filename) ret = bs->locate_protocol(&efi_dt_fixup_protocol_guid, NULL, (void **)&dt_fixup_prot); if (ret != EFI_SUCCESS) { - error(L"Device-tree fix-up protocol not found\r\n"); + error(u"Device-tree fix-up protocol not found\r\n"); return ret; } @@ -313,50 +313,50 @@ efi_status_t do_load(u16 *filename) /* Open volume */ ret = file_system->open_volume(file_system, &root); if (ret != EFI_SUCCESS) { - error(L"Failed to open volume\r\n"); + error(u"Failed to open volume\r\n"); goto out; } /* Open file */ ret = root->open(root, &file, filename, EFI_FILE_MODE_READ, 0); if (ret != EFI_SUCCESS) { - error(L"File not found\r\n"); + error(u"File not found\r\n"); goto out; } /* Get file size */ buffer_size = 0; ret = file->getinfo(file, &efi_file_info_guid, &buffer_size, NULL); if (ret != EFI_BUFFER_TOO_SMALL) { - error(L"Can't get file info size\r\n"); + error(u"Can't get file info size\r\n"); goto out; } ret = bs->allocate_pool(EFI_LOADER_DATA, buffer_size, (void **)&info); if (ret != EFI_SUCCESS) { - error(L"Out of memory\r\n"); + error(u"Out of memory\r\n"); goto out; } ret = file->getinfo(file, &efi_file_info_guid, &buffer_size, info); if (ret != EFI_SUCCESS) { - error(L"Can't get file info\r\n"); + error(u"Can't get file info\r\n"); goto out; } buffer_size = info->file_size; pages = efi_size_in_pages(buffer_size); ret = bs->free_pool(info); if (ret != EFI_SUCCESS) - error(L"Can't free memory pool\r\n"); + error(u"Can't free memory pool\r\n"); /* Read file */ ret = bs->allocate_pages(EFI_ALLOCATE_ANY_PAGES, EFI_ACPI_RECLAIM_MEMORY, pages, &addr); if (ret != EFI_SUCCESS) { - error(L"Out of memory\r\n"); + error(u"Out of memory\r\n"); goto out; } dtb = (struct fdt_header *)(uintptr_t)addr; ret = file->read(file, &buffer_size, dtb); if (ret != EFI_SUCCESS) { - error(L"Can't read file\r\n"); + error(u"Can't read file\r\n"); goto out; } /* Fixup file, expecting EFI_BUFFER_TOO_SMALL */ @@ -367,24 +367,24 @@ efi_status_t do_load(u16 *filename) /* Read file into larger buffer */ ret = bs->free_pages(addr, pages); if (ret != EFI_SUCCESS) - error(L"Can't free memory pages\r\n"); + error(u"Can't free memory pages\r\n"); pages = efi_size_in_pages(buffer_size); ret = bs->allocate_pages(EFI_ALLOCATE_ANY_PAGES, EFI_ACPI_RECLAIM_MEMORY, pages, &addr); if (ret != EFI_SUCCESS) { - error(L"Out of memory\r\n"); + error(u"Out of memory\r\n"); goto out; } dtb = (struct fdt_header *)(uintptr_t)addr; ret = file->setpos(file, 0); if (ret != EFI_SUCCESS) { - error(L"Can't position file\r\n"); + error(u"Can't position file\r\n"); goto out; } ret = file->read(file, &buffer_size, dtb); if (ret != EFI_SUCCESS) { - error(L"Can't read file\r\n"); + error(u"Can't read file\r\n"); goto out; } buffer_size = pages << EFI_PAGE_SHIFT; @@ -394,24 +394,24 @@ efi_status_t do_load(u16 *filename) EFI_DT_INSTALL_TABLE); } if (ret == EFI_SUCCESS) - print(L"device-tree installed\r\n"); + print(u"device-tree installed\r\n"); else - error(L"Device-tree fix-up failed\r\n"); + error(u"Device-tree fix-up failed\r\n"); out: if (addr) { ret2 = bs->free_pages(addr, pages); if (ret2 != EFI_SUCCESS) - error(L"Can't free memory pages\r\n"); + error(u"Can't free memory pages\r\n"); } if (file) { ret2 = file->close(file); if (ret2 != EFI_SUCCESS) - error(L"Can't close file\r\n"); + error(u"Can't close file\r\n"); } if (root) { ret2 = root->close(root); if (ret2 != EFI_SUCCESS) - error(L"Can't close volume\r\n"); + error(u"Can't close volume\r\n"); } return ret; } @@ -432,11 +432,11 @@ efi_status_t do_save(u16 *filename) dtb = get_dtb(systable); if (!dtb) { - error(L"DTB not found\r\n"); + error(u"DTB not found\r\n"); return EFI_NOT_FOUND; } if (f2h(dtb->magic) != FDT_MAGIC) { - error(L"Wrong device tree magic\r\n"); + error(u"Wrong device tree magic\r\n"); return EFI_NOT_FOUND; } dtb_size = f2h(dtb->totalsize); @@ -450,19 +450,19 @@ efi_status_t do_save(u16 *filename) /* Open volume */ ret = file_system->open_volume(file_system, &root); if (ret != EFI_SUCCESS) { - error(L"Failed to open volume\r\n"); + error(u"Failed to open volume\r\n"); return ret; } /* Check if file already exists */ ret = root->open(root, &file, filename, EFI_FILE_MODE_READ, 0); if (ret == EFI_SUCCESS) { file->close(file); - print(L"Overwrite existing file (y/n)? "); + print(u"Overwrite existing file (y/n)? "); ret = efi_input_yn(); - print(L"\r\n"); + print(u"\r\n"); if (ret != EFI_SUCCESS) { root->close(root); - error(L"Aborted by user\r\n"); + error(u"Aborted by user\r\n"); return ret; } } @@ -475,16 +475,16 @@ efi_status_t do_save(u16 *filename) /* Write file */ ret = file->write(file, &dtb_size, dtb); if (ret != EFI_SUCCESS) - error(L"Failed to write file\r\n"); + error(u"Failed to write file\r\n"); file->close(file); } else { - error(L"Failed to open file\r\n"); + error(u"Failed to open file\r\n"); } root->close(root); if (ret == EFI_SUCCESS) { print(filename); - print(L" written\r\n"); + print(u" written\r\n"); } return ret; @@ -510,7 +510,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image_handle, cout->set_attribute(cout, EFI_LIGHTBLUE | EFI_BACKGROUND_BLACK); cout->clear_screen(cout); cout->set_attribute(cout, EFI_WHITE | EFI_BACKGROUND_BLACK); - print(L"DTB Dump\r\n========\r\n\r\n"); + print(u"DTB Dump\r\n========\r\n\r\n"); cout->set_attribute(cout, EFI_LIGHTBLUE | EFI_BACKGROUND_BLACK); for (;;) { @@ -518,16 +518,16 @@ efi_status_t EFIAPI efi_main(efi_handle_t image_handle, u16 *pos; efi_uintn_t ret; - print(L"=> "); + print(u"=> "); ret = efi_input(command, sizeof(command)); if (ret == EFI_ABORTED) break; pos = skip_whitespace(command); - if (starts_with(pos, L"exit")) + if (starts_with(pos, u"exit")) break; - else if (starts_with(pos, L"load ")) + else if (starts_with(pos, u"load ")) do_load(pos + 5); - else if (starts_with(pos, L"save ")) + else if (starts_with(pos, u"save ")) do_save(pos + 5); else do_help(); diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c index 39ee2edf5de..35021118707 100644 --- a/lib/efi_selftest/efi_selftest.c +++ b/lib/efi_selftest/efi_selftest.c @@ -18,7 +18,7 @@ static const struct efi_system_table *systable; static const struct efi_boot_services *boottime; static const struct efi_runtime_services *runtime; static efi_handle_t handle; -static u16 reset_message[] = L"Selftest completed"; +static u16 reset_message[] = u"Selftest completed"; static int *setup_status; /* diff --git a/lib/efi_selftest/efi_selftest_block_device.c b/lib/efi_selftest/efi_selftest_block_device.c index 15f03751ac8..6b58e94a043 100644 --- a/lib/efi_selftest/efi_selftest_block_device.c +++ b/lib/efi_selftest/efi_selftest_block_device.c @@ -407,7 +407,7 @@ static int execute(void) } /* Read file */ - ret = root->open(root, &file, L"hello.txt", EFI_FILE_MODE_READ, + ret = root->open(root, &file, u"hello.txt", EFI_FILE_MODE_READ, 0); if (ret != EFI_SUCCESS) { efi_st_error("Failed to open file\n"); @@ -451,7 +451,7 @@ static int execute(void) #ifdef CONFIG_FAT_WRITE /* Write file */ - ret = root->open(root, &file, L"u-boot.txt", EFI_FILE_MODE_READ | + ret = root->open(root, &file, u"u-boot.txt", EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0); if (ret != EFI_SUCCESS) { efi_st_error("Failed to open file\n"); @@ -483,7 +483,7 @@ static int execute(void) /* Verify file */ boottime->set_mem(buf, sizeof(buf), 0); - ret = root->open(root, &file, L"u-boot.txt", EFI_FILE_MODE_READ, + ret = root->open(root, &file, u"u-boot.txt", EFI_FILE_MODE_READ, 0); if (ret != EFI_SUCCESS) { efi_st_error("Failed to open file\n"); diff --git a/lib/efi_selftest/efi_selftest_devicepath.c b/lib/efi_selftest/efi_selftest_devicepath.c index d87b9f7dcd0..8a22a5d4d9c 100644 --- a/lib/efi_selftest/efi_selftest_devicepath.c +++ b/lib/efi_selftest/efi_selftest_devicepath.c @@ -319,7 +319,7 @@ static int execute(void) { DEVICE_PATH_TYPE_MEDIA_DEVICE, DEVICE_PATH_SUB_TYPE_FILE_PATH, sizeof(struct efi_device_path) + 12}, - L"u-boot.bin", + u"u-boot.bin", }; u16 *string; efi_status_t ret; diff --git a/lib/efi_selftest/efi_selftest_exception.c b/lib/efi_selftest/efi_selftest_exception.c index 6e900a35dc2..b115a9545da 100644 --- a/lib/efi_selftest/efi_selftest_exception.c +++ b/lib/efi_selftest/efi_selftest_exception.c @@ -31,7 +31,7 @@ static struct { DEVICE_PATH_SUB_TYPE_FILE_PATH, sizeof(dp.dp) + sizeof(dp.filename), }, - L"bug.efi", + u"bug.efi", { DEVICE_PATH_TYPE_END, DEVICE_PATH_SUB_TYPE_END, diff --git a/lib/efi_selftest/efi_selftest_fdt.c b/lib/efi_selftest/efi_selftest_fdt.c index eae98208f6e..c321188164e 100644 --- a/lib/efi_selftest/efi_selftest_fdt.c +++ b/lib/efi_selftest/efi_selftest_fdt.c @@ -198,7 +198,7 @@ static int execute(void) char *str; efi_status_t ret; - str = get_property(L"compatible", NULL); + str = get_property(u"compatible", NULL); if (str) { efi_st_printf("compatible: %s\n", str); ret = boottime->free_pool(str); @@ -210,7 +210,7 @@ static int execute(void) efi_st_error("Missing property 'compatible'\n"); return EFI_ST_FAILURE; } - str = get_property(L"serial-number", NULL); + str = get_property(u"serial-number", NULL); if (str) { efi_st_printf("serial-number: %s\n", str); ret = boottime->free_pool(str); @@ -219,7 +219,7 @@ static int execute(void) return EFI_ST_FAILURE; } } - str = get_property(L"boot-hartid", L"chosen"); + str = get_property(u"boot-hartid", u"chosen"); if (IS_ENABLED(CONFIG_RISCV)) { if (str) { efi_st_printf("boot-hartid: %u\n", diff --git a/lib/efi_selftest/efi_selftest_hii.c b/lib/efi_selftest/efi_selftest_hii.c index f4b70f79508..432b038475b 100644 --- a/lib/efi_selftest/efi_selftest_hii.c +++ b/lib/efi_selftest/efi_selftest_hii.c @@ -699,7 +699,7 @@ static int test_hii_string_new_string(void) ret = hii_string_protocol->new_string(hii_string_protocol, handle, &id, (u8 *)"en-US", - L"Japanese", L"Japanese", NULL); + u"Japanese", u"Japanese", NULL); if (ret != EFI_SUCCESS) { efi_st_error("new_string returned %u\n", (unsigned int)ret); @@ -752,7 +752,7 @@ static int test_hii_string_get_string(void) ret = hii_string_protocol->new_string(hii_string_protocol, handle, &id, (u8 *)"en-US", - L"Japanese", L"Japanese", NULL); + u"Japanese", u"Japanese", NULL); if (ret != EFI_SUCCESS) { efi_st_error("new_string returned %u\n", (unsigned int)ret); @@ -831,7 +831,7 @@ static int test_hii_string_set_string(void) ret = hii_string_protocol->new_string(hii_string_protocol, handle, &id, (u8 *)"en-US", - L"Japanese", L"Japanese", NULL); + u"Japanese", u"Japanese", NULL); if (ret != EFI_SUCCESS) { efi_st_error("new_string returned %u\n", (unsigned int)ret); @@ -840,7 +840,7 @@ static int test_hii_string_set_string(void) ret = hii_string_protocol->set_string(hii_string_protocol, handle, id, (u8 *)"en-US", - L"Nihongo", NULL); + u"Nihongo", NULL); if (ret != EFI_SUCCESS) { efi_st_error("set_string returned %u\n", (unsigned int)ret); diff --git a/lib/efi_selftest/efi_selftest_load_file.c b/lib/efi_selftest/efi_selftest_load_file.c index 4473e7c36ed..2453f942b54 100644 --- a/lib/efi_selftest/efi_selftest_load_file.c +++ b/lib/efi_selftest/efi_selftest_load_file.c @@ -101,7 +101,7 @@ static struct { FILE_NAME_SIZE * sizeof(u16), } }, - L"\\lf.efi", + u"\\lf.efi", { DEVICE_PATH_TYPE_END, DEVICE_PATH_SUB_TYPE_END, @@ -152,7 +152,7 @@ static struct { FILE_NAME_SIZE * sizeof(u16), } }, - L"\\lf2.efi", + u"\\lf2.efi", { DEVICE_PATH_TYPE_END, DEVICE_PATH_SUB_TYPE_END, diff --git a/lib/efi_selftest/efi_selftest_loadimage.c b/lib/efi_selftest/efi_selftest_loadimage.c index 06a87df8620..cf0884d0aac 100644 --- a/lib/efi_selftest/efi_selftest_loadimage.c +++ b/lib/efi_selftest/efi_selftest_loadimage.c @@ -20,8 +20,8 @@ /* Binary logarithm of the block size */ #define LB_BLOCK_SIZE 9 -#define FILE_NAME L"app.efi" -#define VOLUME_NAME L"EfiDisk" +#define FILE_NAME u"app.efi" +#define VOLUME_NAME u"EfiDisk" static struct efi_boot_services *boottime; static efi_handle_t handle_image; diff --git a/lib/efi_selftest/efi_selftest_miniapp_exception.c b/lib/efi_selftest/efi_selftest_miniapp_exception.c index 59b7e5100ad..4639aa8a04c 100644 --- a/lib/efi_selftest/efi_selftest_miniapp_exception.c +++ b/lib/efi_selftest/efi_selftest_miniapp_exception.c @@ -23,7 +23,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, struct efi_simple_text_output_protocol *con_out = systable->con_out; con_out->output_string(con_out, - L"EFI application triggers exception.\n"); + u"EFI application triggers exception.\n"); #if defined(CONFIG_ARM) /* @@ -38,6 +38,6 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, #elif defined(CONFIG_X86) asm volatile (".word 0xffff\n"); #endif - con_out->output_string(con_out, L"Exception not triggered.\n"); + con_out->output_string(con_out, u"Exception not triggered.\n"); return EFI_ABORTED; } diff --git a/lib/efi_selftest/efi_selftest_miniapp_exit.c b/lib/efi_selftest/efi_selftest_miniapp_exit.c index 6b5cfb01cf7..77a1869e47d 100644 --- a/lib/efi_selftest/efi_selftest_miniapp_exit.c +++ b/lib/efi_selftest/efi_selftest_miniapp_exit.c @@ -40,7 +40,7 @@ static efi_status_t EFIAPI check_loaded_image_protocol NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); if (ret != EFI_SUCCESS) { cout->output_string(cout, - L"Could not open loaded image protocol"); + u"Could not open loaded image protocol"); return ret; } if ((void *)check_loaded_image_protocol < @@ -49,7 +49,7 @@ static efi_status_t EFIAPI check_loaded_image_protocol loaded_image_protocol->image_base + loaded_image_protocol->image_size) { cout->output_string(cout, - L"Incorrect image_base or image_size\n"); + u"Incorrect image_base or image_size\n"); return EFI_NOT_FOUND; } return EFI_SUCCESS; @@ -69,11 +69,11 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, efi_status_t ret; u16 text[] = EFI_ST_SUCCESS_STR; - con_out->output_string(con_out, L"EFI application calling Exit\n"); + con_out->output_string(con_out, u"EFI application calling Exit\n"); if (check_loaded_image_protocol(handle, systable) != EFI_SUCCESS) { con_out->output_string(con_out, - L"Loaded image protocol missing\n"); + u"Loaded image protocol missing\n"); ret = EFI_NOT_FOUND; goto out; } diff --git a/lib/efi_selftest/efi_selftest_miniapp_return.c b/lib/efi_selftest/efi_selftest_miniapp_return.c index 5709e39cac7..5da95392ce2 100644 --- a/lib/efi_selftest/efi_selftest_miniapp_return.c +++ b/lib/efi_selftest/efi_selftest_miniapp_return.c @@ -24,7 +24,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, struct efi_simple_text_output_protocol *con_out = systable->con_out; con_out->output_string(con_out, - L"EFI application returning w/o calling Exit\n"); + u"EFI application returning w/o calling Exit\n"); /* The return value is checked by the calling test */ return EFI_INCOMPATIBLE_VERSION; diff --git a/lib/efi_selftest/efi_selftest_reset.c b/lib/efi_selftest/efi_selftest_reset.c index 8b6ac24cb15..24e8cc06bd4 100644 --- a/lib/efi_selftest/efi_selftest_reset.c +++ b/lib/efi_selftest/efi_selftest_reset.c @@ -33,7 +33,7 @@ static int setup(const efi_handle_t handle, */ static int execute(void) { - u16 reset_data[] = L"Reset by selftest"; + u16 reset_data[] = u"Reset by selftest"; runtime->reset_system(EFI_RESET_COLD, EFI_SUCCESS, sizeof(reset_data), reset_data); diff --git a/lib/efi_selftest/efi_selftest_textoutput.c b/lib/efi_selftest/efi_selftest_textoutput.c index a87f65e197f..f6b029df23d 100644 --- a/lib/efi_selftest/efi_selftest_textoutput.c +++ b/lib/efi_selftest/efi_selftest_textoutput.c @@ -44,14 +44,14 @@ static int execute(void) } /* TestString */ ret = con_out->test_string(con_out, - L" !\"#$%&'()*+,-./0-9:;<=>?@A-Z[\\]^_`a-z{|}~\n"); + u" !\"#$%&'()*+,-./0-9:;<=>?@A-Z[\\]^_`a-z{|}~\n"); if (ret != EFI_ST_SUCCESS) { efi_st_error("TestString failed for ANSI characters\n"); return EFI_ST_FAILURE; } /* OutputString */ ret = con_out->output_string(con_out, - L"Testing cursor column update\n"); + u"Testing cursor column update\n"); if (ret != EFI_ST_SUCCESS) { efi_st_error("OutputString failed for ANSI characters"); return EFI_ST_FAILURE; @@ -75,7 +75,7 @@ static int execute(void) efi_st_error("Cursor column not 0 at beginning of line\n"); return EFI_ST_FAILURE; } - ret = con_out->output_string(con_out, L"123"); + ret = con_out->output_string(con_out, u"123"); if (ret != EFI_ST_SUCCESS) { efi_st_error("OutputString failed for ANSI characters\n"); return EFI_ST_FAILURE; @@ -84,7 +84,7 @@ static int execute(void) efi_st_error("Cursor column not incremented properly\n"); return EFI_ST_FAILURE; } - ret = con_out->output_string(con_out, L"\b"); + ret = con_out->output_string(con_out, u"\b"); if (ret != EFI_ST_SUCCESS) { efi_st_error("OutputString failed for backspace\n"); return EFI_ST_FAILURE; @@ -93,7 +93,7 @@ static int execute(void) efi_st_error("Cursor column not decremented properly\n"); return EFI_ST_FAILURE; } - ret = con_out->output_string(con_out, L"\b\b"); + ret = con_out->output_string(con_out, u"\b\b"); if (ret != EFI_ST_SUCCESS) { efi_st_error("OutputString failed for backspace\n"); return EFI_ST_FAILURE; @@ -102,7 +102,7 @@ static int execute(void) efi_st_error("Cursor column not decremented properly\n"); return EFI_ST_FAILURE; } - ret = con_out->output_string(con_out, L"\b\b"); + ret = con_out->output_string(con_out, u"\b\b"); if (ret != EFI_ST_SUCCESS) { efi_st_error("OutputString failed for backspace\n"); return EFI_ST_FAILURE; diff --git a/lib/efi_selftest/efi_selftest_unicode_collation.c b/lib/efi_selftest/efi_selftest_unicode_collation.c index 75294307d9f..c63a1b51e4e 100644 --- a/lib/efi_selftest/efi_selftest_unicode_collation.c +++ b/lib/efi_selftest/efi_selftest_unicode_collation.c @@ -44,9 +44,9 @@ static int setup(const efi_handle_t handle, static int test_stri_coll(void) { efi_intn_t ret; - u16 c1[] = L"first"; - u16 c2[] = L"FIRST"; - u16 c3[] = L"second"; + u16 c1[] = u"first"; + u16 c2[] = u"FIRST"; + u16 c3[] = u"second"; ret = unicode_collation_protocol->stri_coll(unicode_collation_protocol, c1, c2); @@ -78,66 +78,66 @@ static int test_stri_coll(void) static int test_metai_match(void) { bool ret; - const u16 c[] = L"Das U-Boot"; + const u16 c[] = u"Das U-Boot"; ret = unicode_collation_protocol->metai_match( - unicode_collation_protocol, c, L"*"); + unicode_collation_protocol, c, u"*"); if (!ret) { efi_st_error("metai_match returned %u\n", ret); return EFI_ST_FAILURE; } ret = unicode_collation_protocol->metai_match( - unicode_collation_protocol, c, L"Da[rstu] U-Boot"); + unicode_collation_protocol, c, u"Da[rstu] U-Boot"); if (!ret) { efi_st_error("metai_match returned %u\n", ret); return EFI_ST_FAILURE; } ret = unicode_collation_protocol->metai_match( - unicode_collation_protocol, c, L"Da[q-v] U-Boot"); + unicode_collation_protocol, c, u"Da[q-v] U-Boot"); if (!ret) { efi_st_error("metai_match returned %u\n", ret); return EFI_ST_FAILURE; } ret = unicode_collation_protocol->metai_match( - unicode_collation_protocol, c, L"Da? U-Boot"); + unicode_collation_protocol, c, u"Da? U-Boot"); if (!ret) { efi_st_error("metai_match returned %u\n", ret); return EFI_ST_FAILURE; } ret = unicode_collation_protocol->metai_match( - unicode_collation_protocol, c, L"D*Bo*t"); + unicode_collation_protocol, c, u"D*Bo*t"); if (!ret) { efi_st_error("metai_match returned %u\n", ret); return EFI_ST_FAILURE; } ret = unicode_collation_protocol->metai_match( - unicode_collation_protocol, c, L"Da[xyz] U-Boot"); + unicode_collation_protocol, c, u"Da[xyz] U-Boot"); if (ret) { efi_st_error("metai_match returned %u\n", ret); return EFI_ST_FAILURE; } ret = unicode_collation_protocol->metai_match( - unicode_collation_protocol, c, L"Da[a-d] U-Boot"); + unicode_collation_protocol, c, u"Da[a-d] U-Boot"); if (ret) { efi_st_error("metai_match returned %u\n", ret); return EFI_ST_FAILURE; } ret = unicode_collation_protocol->metai_match( - unicode_collation_protocol, c, L"Da?? U-Boot"); + unicode_collation_protocol, c, u"Da?? U-Boot"); if (ret) { efi_st_error("metai_match returned %u\n", ret); return EFI_ST_FAILURE; } ret = unicode_collation_protocol->metai_match( - unicode_collation_protocol, c, L"D*Bo*tt"); + unicode_collation_protocol, c, u"D*Bo*tt"); if (ret) { efi_st_error("metai_match returned %u\n", ret); return EFI_ST_FAILURE; @@ -148,7 +148,7 @@ static int test_metai_match(void) static int test_str_lwr(void) { - u16 c[] = L"U-Boot"; + u16 c[] = u"U-Boot"; unicode_collation_protocol->str_lwr(unicode_collation_protocol, c); if (efi_st_strcmp_16_8(c, "u-boot")) { @@ -161,7 +161,7 @@ static int test_str_lwr(void) static int test_str_upr(void) { - u16 c[] = L"U-Boot"; + u16 c[] = u"U-Boot"; unicode_collation_protocol->str_upr(unicode_collation_protocol, c); if (efi_st_strcmp_16_8(c, "U-BOOT")) { @@ -194,16 +194,16 @@ static int test_str_to_fat(void) boottime->set_mem(fat, sizeof(fat), 0); ret = unicode_collation_protocol->str_to_fat(unicode_collation_protocol, - L"U -Boo.t", 6, fat); - if (ret || efi_st_strcmp_16_8(L"U-BOOT", fat)) { + u"U -Boo.t", 6, fat); + if (ret || efi_st_strcmp_16_8(u"U-BOOT", fat)) { efi_st_error("str_to_fat returned %u, \"%s\"\n", ret, fat); return EFI_ST_FAILURE; } boottime->set_mem(fat, 16, 0); ret = unicode_collation_protocol->str_to_fat(unicode_collation_protocol, - L"U\\Boot", 6, fat); - if (!ret || efi_st_strcmp_16_8(L"U_BOOT", fat)) { + u"U\\Boot", 6, fat); + if (!ret || efi_st_strcmp_16_8(u"U_BOOT", fat)) { efi_st_error("str_to_fat returned %u, \"%s\"\n", ret, fat); return EFI_ST_FAILURE; } diff --git a/lib/efi_selftest/efi_selftest_util.c b/lib/efi_selftest/efi_selftest_util.c index ea73c25220f..dba02d6b567 100644 --- a/lib/efi_selftest/efi_selftest_util.c +++ b/lib/efi_selftest/efi_selftest_util.c @@ -15,64 +15,64 @@ struct efi_st_translate { }; static struct efi_st_translate efi_st_control_characters[] = { - {0, L"Null"}, - {8, L"BS"}, - {9, L"TAB"}, - {10, L"LF"}, - {13, L"CR"}, + {0, u"Null"}, + {8, u"BS"}, + {9, u"TAB"}, + {10, u"LF"}, + {13, u"CR"}, {0, NULL}, }; -static u16 efi_st_ch[] = L"' '"; -static u16 efi_st_unknown[] = L"unknown"; +static u16 efi_st_ch[] = u"' '"; +static u16 efi_st_unknown[] = u"unknown"; static struct efi_st_translate efi_st_scan_codes[] = { - {0x00, L"Null"}, - {0x01, L"Up"}, - {0x02, L"Down"}, - {0x03, L"Right"}, - {0x04, L"Left"}, - {0x05, L"Home"}, - {0x06, L"End"}, - {0x07, L"Insert"}, - {0x08, L"Delete"}, - {0x09, L"Page Up"}, - {0x0a, L"Page Down"}, - {0x0b, L"FN 1"}, - {0x0c, L"FN 2"}, - {0x0d, L"FN 3"}, - {0x0e, L"FN 4"}, - {0x0f, L"FN 5"}, - {0x10, L"FN 6"}, - {0x11, L"FN 7"}, - {0x12, L"FN 8"}, - {0x13, L"FN 9"}, - {0x14, L"FN 10"}, - {0x15, L"FN 11"}, - {0x16, L"FN 12"}, - {0x17, L"Escape"}, - {0x68, L"FN 13"}, - {0x69, L"FN 14"}, - {0x6a, L"FN 15"}, - {0x6b, L"FN 16"}, - {0x6c, L"FN 17"}, - {0x6d, L"FN 18"}, - {0x6e, L"FN 19"}, - {0x6f, L"FN 20"}, - {0x70, L"FN 21"}, - {0x71, L"FN 22"}, - {0x72, L"FN 23"}, - {0x73, L"FN 24"}, - {0x7f, L"Mute"}, - {0x80, L"Volume Up"}, - {0x81, L"Volume Down"}, - {0x100, L"Brightness Up"}, - {0x101, L"Brightness Down"}, - {0x102, L"Suspend"}, - {0x103, L"Hibernate"}, - {0x104, L"Toggle Display"}, - {0x105, L"Recovery"}, - {0x106, L"Reject"}, + {0x00, u"Null"}, + {0x01, u"Up"}, + {0x02, u"Down"}, + {0x03, u"Right"}, + {0x04, u"Left"}, + {0x05, u"Home"}, + {0x06, u"End"}, + {0x07, u"Insert"}, + {0x08, u"Delete"}, + {0x09, u"Page Up"}, + {0x0a, u"Page Down"}, + {0x0b, u"FN 1"}, + {0x0c, u"FN 2"}, + {0x0d, u"FN 3"}, + {0x0e, u"FN 4"}, + {0x0f, u"FN 5"}, + {0x10, u"FN 6"}, + {0x11, u"FN 7"}, + {0x12, u"FN 8"}, + {0x13, u"FN 9"}, + {0x14, u"FN 10"}, + {0x15, u"FN 11"}, + {0x16, u"FN 12"}, + {0x17, u"Escape"}, + {0x68, u"FN 13"}, + {0x69, u"FN 14"}, + {0x6a, u"FN 15"}, + {0x6b, u"FN 16"}, + {0x6c, u"FN 17"}, + {0x6d, u"FN 18"}, + {0x6e, u"FN 19"}, + {0x6f, u"FN 20"}, + {0x70, u"FN 21"}, + {0x71, u"FN 22"}, + {0x72, u"FN 23"}, + {0x73, u"FN 24"}, + {0x7f, u"Mute"}, + {0x80, u"Volume Up"}, + {0x81, u"Volume Down"}, + {0x100, u"Brightness Up"}, + {0x101, u"Brightness Down"}, + {0x102, u"Suspend"}, + {0x103, u"Hibernate"}, + {0x104, u"Toggle Display"}, + {0x105, u"Recovery"}, + {0x106, u"Reject"}, {0x0, NULL}, }; diff --git a/lib/efi_selftest/efi_selftest_variables.c b/lib/efi_selftest/efi_selftest_variables.c index 2c16f3db6cc..dc1d5c8f43e 100644 --- a/lib/efi_selftest/efi_selftest_variables.c +++ b/lib/efi_selftest/efi_selftest_variables.c @@ -63,7 +63,7 @@ static int execute(void) return EFI_ST_FAILURE; } /* Set variable 0 */ - ret = runtime->set_variable(L"efi_st_var0", &guid_vendor0, + ret = runtime->set_variable(u"efi_st_var0", &guid_vendor0, EFI_VARIABLE_BOOTSERVICE_ACCESS, 3, v + 4); if (ret != EFI_SUCCESS) { @@ -72,7 +72,7 @@ static int execute(void) } data[3] = 0xff; len = 3; - ret = runtime->get_variable(L"efi_st_var0", &guid_vendor0, + ret = runtime->get_variable(u"efi_st_var0", &guid_vendor0, &attr, &len, data); if (ret != EFI_SUCCESS) { efi_st_error("GetVariable failed\n"); @@ -87,7 +87,7 @@ static int execute(void) return EFI_ST_FAILURE; } /* Set variable 1 */ - ret = runtime->set_variable(L"efi_st_var1", &guid_vendor1, + ret = runtime->set_variable(u"efi_st_var1", &guid_vendor1, EFI_VARIABLE_BOOTSERVICE_ACCESS, 8, v); if (ret != EFI_SUCCESS) { @@ -95,7 +95,7 @@ static int execute(void) return EFI_ST_FAILURE; } len = EFI_ST_MAX_DATA_SIZE; - ret = runtime->get_variable(L"efi_st_var1", &guid_vendor1, + ret = runtime->get_variable(u"efi_st_var1", &guid_vendor1, &attr, &len, data); if (ret != EFI_SUCCESS) { efi_st_error("GetVariable failed\n"); @@ -111,7 +111,7 @@ static int execute(void) return EFI_ST_FAILURE; } /* Append variable 1 */ - ret = runtime->set_variable(L"efi_st_var1", &guid_vendor1, + ret = runtime->set_variable(u"efi_st_var1", &guid_vendor1, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_APPEND_WRITE, 7, v + 8); @@ -120,7 +120,7 @@ static int execute(void) return EFI_ST_FAILURE; } len = EFI_ST_MAX_DATA_SIZE; - ret = runtime->get_variable(L"efi_st_var1", &guid_vendor1, + ret = runtime->get_variable(u"efi_st_var1", &guid_vendor1, &attr, &len, data); if (ret != EFI_SUCCESS) { efi_st_error("GetVariable failed\n"); @@ -132,7 +132,7 @@ static int execute(void) if (memcmp(data, v, len)) efi_st_todo("GetVariable returned wrong value\n"); /* Append variable 2 */ - ret = runtime->set_variable(L"efi_none", &guid_vendor1, + ret = runtime->set_variable(u"efi_none", &guid_vendor1, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_APPEND_WRITE, 15, v); @@ -173,28 +173,28 @@ static int execute(void) return EFI_ST_FAILURE; } /* Delete variable 1 */ - ret = runtime->set_variable(L"efi_st_var1", &guid_vendor1, + ret = runtime->set_variable(u"efi_st_var1", &guid_vendor1, 0, 0, NULL); if (ret != EFI_SUCCESS) { efi_st_error("SetVariable failed\n"); return EFI_ST_FAILURE; } len = EFI_ST_MAX_DATA_SIZE; - ret = runtime->get_variable(L"efi_st_var1", &guid_vendor1, + ret = runtime->get_variable(u"efi_st_var1", &guid_vendor1, &attr, &len, data); if (ret != EFI_NOT_FOUND) { efi_st_error("Variable was not deleted\n"); return EFI_ST_FAILURE; } /* Delete variable 0 */ - ret = runtime->set_variable(L"efi_st_var0", &guid_vendor0, + ret = runtime->set_variable(u"efi_st_var0", &guid_vendor0, 0, 0, NULL); if (ret != EFI_SUCCESS) { efi_st_error("SetVariable failed\n"); return EFI_ST_FAILURE; } len = EFI_ST_MAX_DATA_SIZE; - ret = runtime->get_variable(L"efi_st_var0", &guid_vendor0, + ret = runtime->get_variable(u"efi_st_var0", &guid_vendor0, &attr, &len, data); if (ret != EFI_NOT_FOUND) { efi_st_error("Variable was not deleted\n"); diff --git a/lib/efi_selftest/efi_selftest_variables_runtime.c b/lib/efi_selftest/efi_selftest_variables_runtime.c index 3226069c0b2..4700d942410 100644 --- a/lib/efi_selftest/efi_selftest_variables_runtime.c +++ b/lib/efi_selftest/efi_selftest_variables_runtime.c @@ -58,7 +58,7 @@ static int execute(void) return EFI_ST_FAILURE; } - ret = runtime->set_variable(L"efi_st_var0", &guid_vendor0, + ret = runtime->set_variable(u"efi_st_var0", &guid_vendor0, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, 3, v + 4); @@ -67,7 +67,7 @@ static int execute(void) return EFI_ST_FAILURE; } len = EFI_ST_MAX_DATA_SIZE; - ret = runtime->get_variable(L"PlatformLangCodes", &guid_vendor0, + ret = runtime->get_variable(u"PlatformLangCodes", &guid_vendor0, &attr, &len, data); if (ret != EFI_SUCCESS) { efi_st_error("GetVariable failed\n"); diff --git a/lib/efi_selftest/initrddump.c b/lib/efi_selftest/initrddump.c index 325951b4986..c1083bbb239 100644 --- a/lib/efi_selftest/initrddump.c +++ b/lib/efi_selftest/initrddump.c @@ -150,7 +150,7 @@ static efi_status_t efi_input(u16 *buffer, efi_uintn_t buffer_size) struct efi_input_key key = {0}; efi_uintn_t index; efi_uintn_t pos = 0; - u16 outbuf[2] = L" "; + u16 outbuf[2] = u" "; efi_status_t ret; /* Drain the console input */ @@ -165,7 +165,7 @@ static efi_status_t efi_input(u16 *buffer, efi_uintn_t buffer_size) continue; switch (key.scan_code) { case 0x17: /* Escape */ - print(L"\r\nAborted\r\n"); + print(u"\r\nAborted\r\n"); return EFI_ABORTED; default: break; @@ -174,12 +174,12 @@ static efi_status_t efi_input(u16 *buffer, efi_uintn_t buffer_size) case 0x08: /* Backspace */ if (pos) { buffer[pos--] = 0; - print(L"\b \b"); + print(u"\b \b"); } break; case 0x0a: /* Linefeed */ case 0x0d: /* Carriage return */ - print(L"\r\n"); + print(u"\r\n"); return EFI_SUCCESS; default: break; @@ -231,9 +231,9 @@ static bool starts_with(u16 *string, u16 *keyword) */ static void do_help(void) { - error(L"load - show length and CRC32 of initial RAM disk\r\n"); - error(L"save - save initial RAM disk to file\r\n"); - error(L"exit - exit the shell\r\n"); + error(u"load - show length and CRC32 of initial RAM disk\r\n"); + error(u"save - save initial RAM disk to file\r\n"); + error(u"exit - exit the shell\r\n"); } /** @@ -255,7 +255,7 @@ static efi_status_t get_initrd(void **initrd, efi_uintn_t *initrd_size) *initrd_size = 0; ret = bs->locate_device_path(&load_file2_guid, &dp, &handle); if (ret != EFI_SUCCESS) { - error(L"Load File2 protocol not found\r\n"); + error(u"Load File2 protocol not found\r\n"); return ret; } ret = bs->handle_protocol(handle, &load_file2_guid, @@ -263,20 +263,20 @@ static efi_status_t get_initrd(void **initrd, efi_uintn_t *initrd_size) ret = load_file2_prot->load_file(load_file2_prot, dp, false, initrd_size, NULL); if (ret != EFI_BUFFER_TOO_SMALL) { - error(L"Load File2 protocol does not provide file length\r\n"); + error(u"Load File2 protocol does not provide file length\r\n"); return EFI_LOAD_ERROR; } ret = bs->allocate_pages(EFI_ALLOCATE_ANY_PAGES, EFI_LOADER_DATA, efi_size_in_pages(*initrd_size), &buffer); if (ret != EFI_SUCCESS) { - error(L"Out of memory\r\n"); + error(u"Out of memory\r\n"); return ret; } *initrd = (void *)(uintptr_t)buffer; ret = load_file2_prot->load_file(load_file2_prot, dp, false, initrd_size, *initrd); if (ret != EFI_SUCCESS) { - error(L"Load File2 protocol failed to provide file\r\n"); + error(u"Load File2 protocol failed to provide file\r\n"); bs->free_pages(buffer, efi_size_in_pages(*initrd_size)); return EFI_LOAD_ERROR; } @@ -299,18 +299,18 @@ static efi_status_t do_load(void) ret = get_initrd(&initrd, &initrd_size); if (ret != EFI_SUCCESS) return ret; - print(L"length: 0x"); + print(u"length: 0x"); printx(initrd_size, 1); - print(L"\r\n"); + print(u"\r\n"); ret = bs->calculate_crc32(initrd, initrd_size, &crc32); if (ret != EFI_SUCCESS) { - error(L"Calculating CRC32 failed\r\n"); + error(u"Calculating CRC32 failed\r\n"); return EFI_LOAD_ERROR; } - print(L"crc32: 0x"); + print(u"crc32: 0x"); printx(crc32, 8); - print(L"\r\n"); + print(u"\r\n"); return EFI_SUCCESS; } @@ -340,7 +340,7 @@ static efi_status_t do_save(u16 *filename) (void **)&loaded_image, NULL, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); if (ret != EFI_SUCCESS) { - error(L"Loaded image protocol not found\r\n"); + error(u"Loaded image protocol not found\r\n"); goto out; } @@ -350,26 +350,26 @@ static efi_status_t do_save(u16 *filename) (void **)&file_system, NULL, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); if (ret != EFI_SUCCESS) { - error(L"Failed to open simple file system protocol\r\n"); + error(u"Failed to open simple file system protocol\r\n"); goto out; } /* Open volume */ ret = file_system->open_volume(file_system, &root); if (ret != EFI_SUCCESS) { - error(L"Failed to open volume\r\n"); + error(u"Failed to open volume\r\n"); goto out; } /* Check if file already exists */ ret = root->open(root, &file, filename, EFI_FILE_MODE_READ, 0); if (ret == EFI_SUCCESS) { file->close(file); - print(L"Overwrite existing file (y/n)? "); + print(u"Overwrite existing file (y/n)? "); ret = efi_input_yn(); - print(L"\r\n"); + print(u"\r\n"); if (ret != EFI_SUCCESS) { root->close(root); - error(L"Aborted by user\r\n"); + error(u"Aborted by user\r\n"); goto out; } } @@ -382,14 +382,14 @@ static efi_status_t do_save(u16 *filename) /* Write file */ ret = file->write(file, &initrd_size, initrd); if (ret != EFI_SUCCESS) { - error(L"Failed to write file\r\n"); + error(u"Failed to write file\r\n"); } else { print(filename); - print(L" written\r\n"); + print(u" written\r\n"); } file->close(file); } else { - error(L"Failed to open file\r\n"); + error(u"Failed to open file\r\n"); } root->close(root); @@ -420,7 +420,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image_handle, cout->set_attribute(cout, EFI_LIGHTBLUE | EFI_BACKGROUND_BLACK); cout->clear_screen(cout); cout->set_attribute(cout, EFI_WHITE | EFI_BACKGROUND_BLACK); - print(L"INITRD Dump\r\n========\r\n\r\n"); + print(u"INITRD Dump\r\n========\r\n\r\n"); cout->set_attribute(cout, EFI_LIGHTBLUE | EFI_BACKGROUND_BLACK); for (;;) { @@ -428,16 +428,16 @@ efi_status_t EFIAPI efi_main(efi_handle_t image_handle, u16 *pos; efi_uintn_t ret; - print(L"=> "); + print(u"=> "); ret = efi_input(command, sizeof(command)); if (ret == EFI_ABORTED) break; pos = skip_whitespace(command); - if (starts_with(pos, L"exit")) + if (starts_with(pos, u"exit")) break; - else if (starts_with(pos, L"load")) + else if (starts_with(pos, u"load")) do_load(); - else if (starts_with(pos, L"save ")) + else if (starts_with(pos, u"save ")) do_save(pos + 5); else do_help(); From patchwork Sun Jul 18 20:14:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1506640 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=N+/jXQcs; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GSbnb2p7tz9sWS for ; Mon, 19 Jul 2021 06:15:31 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 52C3881E47; Sun, 18 Jul 2021 22:14:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="N+/jXQcs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CC61A80C8A; Sun, 18 Jul 2021 22:14:48 +0200 (CEST) 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,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1601B8039D for ; Sun, 18 Jul 2021 22:14:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ot1-x330.google.com with SMTP id o72-20020a9d224e0000b02904bb9756274cso16043450ota.6 for ; Sun, 18 Jul 2021 13:14:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KQJi6P/Uvzz7PH+geCYonXxO3Y/GYStLNAIC2qCXXPE=; b=N+/jXQcsfNmXdERlcwvSzrfDtl+ehB0rg84TlQlJK2SZL4r9k8M70KCnLbh4MqfuqX 56PNKf00Q+Pecyj27sSqFLs8Kx0ZMlDkDxGqkc5AWIsaRgtMOr72PQQqCSxUs7D4kRJr 9rn/+HAHOHCpJMWmrcdODhWehPiDP3VzxRfQQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KQJi6P/Uvzz7PH+geCYonXxO3Y/GYStLNAIC2qCXXPE=; b=bHmmwFdDSEAYiQi43+L4GTMdY7URX77At1Y3MVw+MUlWMfrVeqepJIA2iTrV0BRhCu dSy8m/sGoEbV2nipXPYsnHOYBoc24R0yJT3N/yDV4xfw5DN0wb9p68HRie86W40A/xaU scikxpqnyHCY4ZyHtsXvjGJfj1DZ/UxZLBi84ic3On/zlvoh7lUaac4iSpzJwltAtkaj KPwerlwxzbdDkNpjKH5OjTvl8nHjNesbKIbCEALkPhMS9bJz0Lq47e2toCBhVitrG0bV 0wXLM+DL20C/pytyuj9nFepanPFhu5tMfIjV8Lrm4ouqZVFsGJVYKO+wusGV/ATZuxFy qNkg== X-Gm-Message-State: AOAM533BjgveIaUns3ETR/f0zjI/LOMvJJCSRmGen08LRCCnnnPc7aWO RP/GASFcY/bQUlGZ9MbjJqD1zCRdYzVRQEpj X-Google-Smtp-Source: ABdhPJz0Pix16QI1yWSd50UQqyAZaGJccKBv3KDaB2HQFoeVXOhnSA7UIDx47/vRiPp/o1g0ZJB2wA== X-Received: by 2002:a9d:903:: with SMTP id 3mr16466488otp.146.1626639283239; Sun, 18 Jul 2021 13:14:43 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id k13sm3170598otl.50.2021.07.18.13.14.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Jul 2021 13:14:42 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Simon Glass , Bin Meng , =?utf-8?q?Ma?= =?utf-8?q?rek_Beh=C3=BAn?= Subject: [PATCH v2 5/5] sandbox: Detect the host bit size automatically Date: Sun, 18 Jul 2021 14:14:26 -0600 Message-Id: <20210718201426.759240-6-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.402.g57bb445576-goog In-Reply-To: <20210718201426.759240-1-sjg@chromium.org> References: <20210718201426.759240-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 At present if you build sandbox on a 32-bit host a lot of errors are produced. This is because CONFIG_HOST_64BIT is enabled by default. It is quite annoying to have to change that manually before building sandbox. It is also quite confusing for new users. Add a way to detect the setting and add the appropriate CONFIG_HOST_64BIT=y or CONFIG_HOST_32BIT=y to the defconfig, to avoid this issue. Signed-off-by: Simon Glass --- Changes in v2: - Drop patches previously applied - Put all the packages in gcc.rst Makefile | 11 ++++++++++- arch/sandbox/Kconfig | 13 ++++++++----- scripts/kconfig/Makefile | 14 +++++++++++++- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index bc404c8f989..0257d202597 100644 --- a/Makefile +++ b/Makefile @@ -565,8 +565,17 @@ export KBUILD_DEFCONFIG KBUILD_KCONFIG config: scripts_basic outputmakefile FORCE $(Q)$(MAKE) $(build)=scripts/kconfig $@ +# If nothing is specified explicitly, detect the bit size for sandbox, +# referred to from arch/sandbox/Kconfig +# Add it to the end of the defconfig file %config: scripts_basic outputmakefile FORCE - $(Q)$(MAKE) $(build)=scripts/kconfig $@ + $(Q)if test -f $(srctree)/configs/$@ && \ + ! grep -Eq "CONFIG_HOST_(32|64)BIT=y" $(srctree)/configs/$@; then \ + echo '#include \nint main(void) { printf("CONFIG_HOST_%dBIT=y\\n", __WORDSIZE); return 0; }' \ + | gcc -x c - -o get_word_size; \ + extra=$$(./get_word_size); \ + fi; \ + $(MAKE) $(build)=scripts/kconfig EXTRA_DEFCONFIG=$$extra $@ else # =========================================================================== diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index f83282d9d56..01b2a3fcad1 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -35,12 +35,12 @@ config SYS_CONFIG_NAME choice prompt "Run sandbox on 32/64-bit host" - default HOST_64BIT + default HOST_DETECT_BIT help - Sandbox can be built on 32-bit and 64-bit hosts. - The default is to build on a 64-bit host and run - on a 64-bit host. If you want to run sandbox on - a 32-bit host, change it here. + Sandbox can be built on 32-bit and 64-bit hosts. This is generally + auto-detected but you can force a particular word size here. If you + see strange warnings about SANDBOX_BITS_PER_LONG then you may have + selected the wrong value. config HOST_32BIT bool "32-bit host" @@ -49,6 +49,9 @@ config HOST_32BIT config HOST_64BIT bool "64-bit host" +config HOST_DETECT_BIT + bool "Auto-detect bit size" + endchoice config SANDBOX_CRASH_RESET diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index d52128425ce..8e14db7ade3 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -12,6 +12,9 @@ PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig \ # Set SRCARCH to .. fake this Makefile. SRCARCH := .. +# For U-Boot, EXTRA_DEFCONFIG contains a line to be added to the defconfig +# before processing. If empty, no line is added. + ifdef KBUILD_KCONFIG Kconfig := $(KBUILD_KCONFIG) else @@ -92,8 +95,17 @@ else endif endif +# If EXTRA_DEFCONFIG is defined, add it to the end of the defconfig, before +# processing. This allows the caller to change a setting on the fly %_defconfig: $(obj)/conf - $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) + $(Q)defconfig="$(srctree)/arch/$(SRCARCH)/configs/$@"; \ + if [ -n "$(EXTRA_DEFCONFIG)" ]; then \ + cat $$defconfig >defconfig_tmp; \ + echo $(EXTRA_DEFCONFIG) >>defconfig_tmp; \ + $< $(silent) --defconfig=defconfig_tmp $(Kconfig); \ + else \ + $< $(silent) --defconfig=$$defconfig $(Kconfig); \ + fi # Added for U-Boot (backward compatibility) %_config: %_defconfig