From patchwork Sun Aug 11 14:51:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971312 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=NbVCXOm9; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whghz6lWGz1yXh for ; Mon, 12 Aug 2024 00:56:51 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D778788617; Sun, 11 Aug 2024 16:52:36 +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="NbVCXOm9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D4283889DF; Sun, 11 Aug 2024 16:52:35 +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.2 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 mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) (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 C75E588875 for ; Sun, 11 Aug 2024 16:52:33 +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-il1-x136.google.com with SMTP id e9e14a558f8ab-39b0826298cso13071605ab.2 for ; Sun, 11 Aug 2024 07:52:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387952; x=1723992752; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Fn6taKCgx/ZA4Wh9YCprniYz6cyu/bRt9qJKUSb8eus=; b=NbVCXOm9/OLUkoKhXHApjuUDOndKsSaYeKIIiOW9IAWL6ITukxTB/ZO863O8NKzA5s ek2fcSisjuvsSU24lTw/ncpo7mp25E3B5lGF1xmXHV6rD+wr0W/x3L95FFkZn0lYAr1V BS0W53ZJlBYy9/fU9ZJ8DhHVT2EnmJkvhDV3c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387952; x=1723992752; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fn6taKCgx/ZA4Wh9YCprniYz6cyu/bRt9qJKUSb8eus=; b=DhPwt6DKBEE/TVErL8I+VF7tPyIhAXTDQxjtdIT6s54dZcN/gkZOTSKEYb3IZ0ysxQ CkqduCIFGsf+iVv/n0Uwa4hhxLzmnmQnnFJh5fvHRQS5VCSLsHXOb1q1AnSohv17fF99 2dVPGR9NEBgd3EzKmWPnafGIHKGAmpsE+UrZkWCAyWXBqwyy2UwJUcYihcuulmNbUTzi y01tSq01hp2/9bwyk8ybJ0sD2Hgr1Z/eYkxRAPIYA4gJfJFsxiyimc4fwGUZCD+oAbpt QaqqX8Y2Hl4FOjbYH1x8kvKa1M4wS26q6d4zsOfK20D5mG9RKsvPUUi81zMXT8mx/hEf Ebgw== X-Gm-Message-State: AOJu0YyNy1X2W6QBdX3gaF64fvqiUysRlF5bQ5tXm5//enL+hkClZWD2 o82gpM25I7nhGxNcPW0iKxB/+dc/VkWRugpZFyunCqj/V+ELJpYxQYfx/FGqkkNxsRt/PoWTSHQ = X-Google-Smtp-Source: AGHT+IHwndeETcazFOmKZeDpjGeyTgXflFlfPastx+VLKviFB1hreHc/XvKktWj3oyF6r4JCapzjTQ== X-Received: by 2002:a05:6e02:148b:b0:397:3a28:94d7 with SMTP id e9e14a558f8ab-39b7a463157mr90264805ab.25.1723387952415; Sun, 11 Aug 2024 07:52:32 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:32 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 01/40] nvmxip: Drop the message on probe Date: Sun, 11 Aug 2024 08:51:30 -0600 Message-Id: <20240811145209.4191404-2-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean We should not need to announce this device. Drop the message. Signed-off-by: Simon Glass --- (no changes since v1) drivers/mtd/nvmxip/nvmxip-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nvmxip/nvmxip-uclass.c b/drivers/mtd/nvmxip/nvmxip-uclass.c index 254f04e0b99..58e8c3fb74b 100644 --- a/drivers/mtd/nvmxip/nvmxip-uclass.c +++ b/drivers/mtd/nvmxip/nvmxip-uclass.c @@ -47,7 +47,8 @@ int nvmxip_probe(struct udevice *udev) return ret; } - log_info("[%s]: the block device %s ready for use\n", udev->name, bdev_name); + log_debug("[%s]: the block device %s ready for use\n", udev->name, + bdev_name); return 0; } From patchwork Sun Aug 11 14:51:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971313 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=fgqZ6DZL; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhgjB3dL6z1yXh for ; Mon, 12 Aug 2024 00:57:02 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3CAE38860B; Sun, 11 Aug 2024 16:52:39 +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="fgqZ6DZL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B97DA88861; Sun, 11 Aug 2024 16:52:37 +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.2 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 mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (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 8EECA889CB for ; Sun, 11 Aug 2024 16:52:34 +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-il1-x133.google.com with SMTP id e9e14a558f8ab-39b3e12754eso11984615ab.1 for ; Sun, 11 Aug 2024 07:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387953; x=1723992753; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=a7DdkER2RHUOjzF7TxOxm/2QRIyR5m8rS9CgKjZAWUo=; b=fgqZ6DZLZCCORbdU3viC1wG3EJuLBHHhyzgFOTxCcS7BXu7/DOE1FZHWUrAEWAB/0v BHcl+vZTVQfm2m9Kvc+pubaf9Wft1fPmes6pF2dSI/SzpPMFFV9tsAdqUlIPCeKiYGtX xGup7VI4DH45LFYCHBBqsUQS3D/VtcXoMnhfc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387953; x=1723992753; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a7DdkER2RHUOjzF7TxOxm/2QRIyR5m8rS9CgKjZAWUo=; b=Nex74SiWWwgdcfcCiJ26l64C8VijLWo7OrANcjkh/c//q4kmtVm9yyNpHSFiBayt9m Ohw+sVSN76CKmUKs1tnQzrcD2fw/9ibFubuWgAWMVADLicxNO6dxIg/xrVg7NwjKDF0P +RnKfMgdpRxq8/gY6FVUe5Gkv+sdCP0aMMBfVAKrrpGP36HZ99S3As2O6uYuooSPI4r5 3i2OWwwCeQ2qigZUGSihEzdXNF1oHT0qvPv0Msdy4qx0SEyLdFGav56fOdRtq9SRWCEq ba67QtRKv+TYxJolRfi/lUQgF1f4zw5nNM3ljHVeAHxtflPGGzZYWLuKz3D/DWoCAi/h jFgQ== X-Gm-Message-State: AOJu0YyY3VaeoGfVFyZhJDz3fFDffU43CmPmQKPI2Dz6bnk3CQiXL00r jQwZwCMnd/Dl+GDxsOTHnD4/ik5M1JPkiU/Cvny9jmYYj3uQ/z6fIwivyL5uNC2zGA+N9ZAUPgw = X-Google-Smtp-Source: AGHT+IEtHaPUAqmB9J3cENuqkDkAPq9xbhPGnAyIvyeCauoW83T2rJMrrZrqcjJvBRRynPOW6w7gKg== X-Received: by 2002:a05:6e02:1b08:b0:39b:3502:f4f2 with SMTP id e9e14a558f8ab-39b815a164emr73442275ab.18.1723387953194; Sun, 11 Aug 2024 07:52:33 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:32 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 02/40] nvmxip: Avoid probing on boot Date: Sun, 11 Aug 2024 08:51:31 -0600 Message-Id: <20240811145209.4191404-3-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Devices should be probed when they are used, not before. Drop this boot-time probing. Signed-off-by: Simon Glass --- (no changes since v1) drivers/mtd/nvmxip/nvmxip-uclass.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/mtd/nvmxip/nvmxip-uclass.c b/drivers/mtd/nvmxip/nvmxip-uclass.c index 58e8c3fb74b..d18bd0e3d6b 100644 --- a/drivers/mtd/nvmxip/nvmxip-uclass.c +++ b/drivers/mtd/nvmxip/nvmxip-uclass.c @@ -53,14 +53,7 @@ int nvmxip_probe(struct udevice *udev) return 0; } -static int nvmxip_post_bind(struct udevice *udev) -{ - dev_or_flags(udev, DM_FLAG_PROBE_AFTER_BIND); - return 0; -} - UCLASS_DRIVER(nvmxip) = { .name = "nvmxip", .id = UCLASS_NVMXIP, - .post_bind = nvmxip_post_bind, }; From patchwork Sun Aug 11 14:51:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971314 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=HNVgjDAe; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhgjN5Hclz1yXh for ; Mon, 12 Aug 2024 00:57:12 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9B313889E0; Sun, 11 Aug 2024 16:52:39 +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="HNVgjDAe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1666E88875; Sun, 11 Aug 2024 16:52:38 +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.2 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 mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (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 4D8C2889DA for ; Sun, 11 Aug 2024 16:52:35 +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-il1-x133.google.com with SMTP id e9e14a558f8ab-39728bbf949so13945175ab.3 for ; Sun, 11 Aug 2024 07:52:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387954; x=1723992754; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RP3sjiPcGcA/mi36Kt00Rs5CQbTgbt7wjtg5MSV5d9s=; b=HNVgjDAe+6XV/lc9hPiGtl4yqKVBVrtv67cqepYi09u/EqdoVixp5gTQTa9WRaUDIu VeOUfndLjlhGIpEwFpXX00Lef43Hb1ug18bIlMbZ5PqAqzJ9Mzg6NMT7jPZo3zBpzZBI laHLiHfacndjK2GJn0QcGvyhUH7PcBgNjiV70= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387954; x=1723992754; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RP3sjiPcGcA/mi36Kt00Rs5CQbTgbt7wjtg5MSV5d9s=; b=HAponJE9i4KTeq04vRT+aXjFh4qUdWMBBn0DbLZyPzfiNyGwpNo5fUvenITpoWhwEO prsbPAyNBdFK4aO8Yki93oITUfxp/XAKJk6a8/GMPck4jnDXZz+FZlZBjnKEXo1zdw0U xk9/iTNOQgZYar6/I9NFDxteNCOfAdjuF/hrQC3SYvMQuB1KfTqTnO8/ymh7WHve+y8X ztC/cJ1OFQdEGgY0nhgF9bYlmDPvCLns6H7tRO1jrsBrwpAlFbLoo/086qoEVWErN/kL Tj5CmIXgXpcCHYNAVBepfF5lOkoo6qmOwPYHvHeUbMu28vrXFFYgJNT2Au9LGm/K4Qhz NcFA== X-Gm-Message-State: AOJu0YyndgTyQu5BGsqk0oS/MKwhKgsCp7vauOlcDe+n8D2zrU9xEIW5 C5XufN31Dek5bqwDVGlNrqNQLUw5iqA4vj4nvN/CqTZz/H2HlYcTqXj+mDe49aVYeuiBu0wcYe0 = X-Google-Smtp-Source: AGHT+IF/YD8IQ+++vKiCCjjsPqKKg7eGBPcND1o1hqaUTPV9Xb53qKJ4hOHWSlQuGW7p4yZQ6R3Tlg== X-Received: by 2002:a92:c564:0:b0:39b:32f2:c34c with SMTP id e9e14a558f8ab-39b813316a7mr85153995ab.8.1723387953961; Sun, 11 Aug 2024 07:52:33 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:33 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 03/40] bootstd: Add UT_TESTF_CONSOLE_REC to bootflow tests Date: Sun, 11 Aug 2024 08:51:32 -0600 Message-Id: <20240811145209.4191404-4-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Quite a few tests use console recording without indicating this, using the UT_TESTF_CONSOLE_REC flag. Fix this to avoid strange failures. Signed-off-by: Simon Glass --- (no changes since v1) test/boot/bootflow.c | 59 +++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 8b46256fa48..8ea091a36af 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -50,7 +50,6 @@ static int inject_response(struct unit_test_state *uts) /* Check 'bootflow scan/list' commands */ static int bootflow_cmd(struct unit_test_state *uts) { - console_record_reset_enable(); ut_assertok(run_command("bootdev select 1", 0)); ut_assert_console_end(); ut_assertok(run_command("bootflow scan -lH", 0)); @@ -76,14 +75,14 @@ static int bootflow_cmd(struct unit_test_state *uts) return 0; } -BOOTSTD_TEST(bootflow_cmd, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +BOOTSTD_TEST(bootflow_cmd, UT_TESTF_DM | UT_TESTF_SCAN_FDT | + UT_TESTF_CONSOLE_REC); /* Check 'bootflow scan' with a label / seq */ static int bootflow_cmd_label(struct unit_test_state *uts) { test_set_eth_enable(false); - console_record_reset_enable(); ut_assertok(run_command("bootflow scan -lH mmc1", 0)); ut_assert_nextline("Scanning for bootflows with label 'mmc1'"); ut_assert_skip_to_line("(1 bootflow, 1 valid)"); @@ -124,7 +123,7 @@ static int bootflow_cmd_label(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(bootflow_cmd_label, UT_TESTF_DM | UT_TESTF_SCAN_FDT | - UT_TESTF_ETH_BOOTDEV); + UT_TESTF_ETH_BOOTDEV | UT_TESTF_CONSOLE_REC); /* Check 'bootflow scan/list' commands using all bootdevs */ static int bootflow_cmd_glob(struct unit_test_state *uts) @@ -156,14 +155,14 @@ static int bootflow_cmd_glob(struct unit_test_state *uts) return 0; } -BOOTSTD_TEST(bootflow_cmd_glob, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +BOOTSTD_TEST(bootflow_cmd_glob, UT_TESTF_DM | UT_TESTF_SCAN_FDT | + UT_TESTF_CONSOLE_REC); /* Check 'bootflow scan -e' */ static int bootflow_cmd_scan_e(struct unit_test_state *uts) { ut_assertok(bootstd_test_drop_bootdev_order(uts)); - console_record_reset_enable(); ut_assertok(run_command("bootflow scan -aleGH", 0)); ut_assert_nextline("Scanning for bootflows in all bootdevs"); ut_assert_nextline("Seq Method State Uclass Part Name Filename"); @@ -207,12 +206,12 @@ static int bootflow_cmd_scan_e(struct unit_test_state *uts) return 0; } -BOOTSTD_TEST(bootflow_cmd_scan_e, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +BOOTSTD_TEST(bootflow_cmd_scan_e, UT_TESTF_DM | UT_TESTF_SCAN_FDT | + UT_TESTF_CONSOLE_REC); /* Check 'bootflow info' */ static int bootflow_cmd_info(struct unit_test_state *uts) { - console_record_reset_enable(); ut_assertok(run_command("bootdev select 1", 0)); ut_assert_console_end(); ut_assertok(run_command("bootflow scan", 0)); @@ -248,12 +247,12 @@ static int bootflow_cmd_info(struct unit_test_state *uts) return 0; } -BOOTSTD_TEST(bootflow_cmd_info, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +BOOTSTD_TEST(bootflow_cmd_info, UT_TESTF_DM | UT_TESTF_SCAN_FDT | + UT_TESTF_CONSOLE_REC); /* Check 'bootflow scan -b' to boot the first available bootdev */ static int bootflow_scan_boot(struct unit_test_state *uts) { - console_record_reset_enable(); ut_assertok(inject_response(uts)); ut_assertok(run_command("bootflow scan -b", 0)); ut_assert_nextline( @@ -270,7 +269,8 @@ static int bootflow_scan_boot(struct unit_test_state *uts) return 0; } -BOOTSTD_TEST(bootflow_scan_boot, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +BOOTSTD_TEST(bootflow_scan_boot, UT_TESTF_DM | UT_TESTF_SCAN_FDT | + UT_TESTF_CONSOLE_REC); /* Check iterating through available bootflows */ static int bootflow_iter(struct unit_test_state *uts) @@ -368,7 +368,8 @@ static int bootflow_iter(struct unit_test_state *uts) return 0; } -BOOTSTD_TEST(bootflow_iter, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +BOOTSTD_TEST(bootflow_iter, UT_TESTF_DM | UT_TESTF_SCAN_FDT | + UT_TESTF_CONSOLE_REC); #if defined(CONFIG_SANDBOX) && defined(CONFIG_BOOTMETH_GLOBAL) /* Check using the system bootdev */ @@ -386,7 +387,6 @@ static int bootflow_system(struct unit_test_state *uts) /* We should get a single 'bootmgr' method right at the end */ bootstd_clear_glob(); - console_record_reset_enable(); ut_assertok(run_command("bootflow scan -lH", 0)); ut_assert_skip_to_line( " 0 efi_mgr ready (none) 0 "); @@ -397,7 +397,7 @@ static int bootflow_system(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(bootflow_system, UT_TESTF_DM | UT_TESTF_SCAN_PDATA | - UT_TESTF_SCAN_FDT); + UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); #endif /* Check disabling a bootmethod if it requests it */ @@ -438,7 +438,9 @@ static int bootflow_iter_disable(struct unit_test_state *uts) return 0; } -BOOTSTD_TEST(bootflow_iter_disable, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +BOOTSTD_TEST(bootflow_iter_disable, UT_TESTF_DM | UT_TESTF_SCAN_FDT | + UT_TESTF_CONSOLE_REC +); /* Check 'bootflow scan' with a bootmeth ordering including a global bootmeth */ static int bootflow_scan_glob_bootmeth(struct unit_test_state *uts) @@ -452,7 +454,6 @@ static int bootflow_scan_glob_bootmeth(struct unit_test_state *uts) * Make sure that the -G flag makes the scan fail, since this is not * supported when an ordering is provided */ - console_record_reset_enable(); ut_assertok(bootmeth_set_order("efi firmware0")); ut_assertok(run_command("bootflow scan -lGH", 0)); ut_assert_nextline("Scanning for bootflows in all bootdevs"); @@ -479,12 +480,13 @@ static int bootflow_scan_glob_bootmeth(struct unit_test_state *uts) return 0; } -BOOTSTD_TEST(bootflow_scan_glob_bootmeth, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +BOOTSTD_TEST(bootflow_scan_glob_bootmeth, UT_TESTF_DM | UT_TESTF_SCAN_FDT | + UT_TESTF_CONSOLE_REC +); /* Check 'bootflow boot' to boot a selected bootflow */ static int bootflow_cmd_boot(struct unit_test_state *uts) { - console_record_reset_enable(); ut_assertok(run_command("bootdev select 1", 0)); ut_assert_console_end(); ut_assertok(run_command("bootflow scan", 0)); @@ -508,7 +510,8 @@ static int bootflow_cmd_boot(struct unit_test_state *uts) return 0; } -BOOTSTD_TEST(bootflow_cmd_boot, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +BOOTSTD_TEST(bootflow_cmd_boot, UT_TESTF_DM | UT_TESTF_SCAN_FDT | + UT_TESTF_CONSOLE_REC); /** * prep_mmc_bootdev() - Set up an mmc bootdev so we can access other distros @@ -675,7 +678,8 @@ static int bootflow_cmd_menu(struct unit_test_state *uts) return 0; } -BOOTSTD_TEST(bootflow_cmd_menu, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +BOOTSTD_TEST(bootflow_cmd_menu, UT_TESTF_DM | UT_TESTF_SCAN_FDT | + UT_TESTF_CONSOLE_REC); /* Check 'bootflow scan -m' to select a bootflow using a menu */ static int bootflow_scan_menu(struct unit_test_state *uts) @@ -783,7 +787,6 @@ static int bootflow_cmd_hunt_single(struct unit_test_state *uts) ut_assertok(bootstd_test_drop_bootdev_order(uts)); - console_record_reset_enable(); ut_assertok(run_command("bootflow scan -l mmc1", 0)); ut_assert_nextline("Scanning for bootflows with label 'mmc1'"); ut_assert_skip_to_line("(1 bootflow, 1 valid)"); @@ -794,7 +797,8 @@ static int bootflow_cmd_hunt_single(struct unit_test_state *uts) return 0; } -BOOTSTD_TEST(bootflow_cmd_hunt_single, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +BOOTSTD_TEST(bootflow_cmd_hunt_single, UT_TESTF_DM | UT_TESTF_SCAN_FDT | + UT_TESTF_CONSOLE_REC); /* Check searching for a uclass label using the hunters */ static int bootflow_cmd_hunt_label(struct unit_test_state *uts) @@ -808,7 +812,6 @@ static int bootflow_cmd_hunt_label(struct unit_test_state *uts) test_set_eth_enable(false); ut_assertok(bootstd_test_drop_bootdev_order(uts)); - console_record_reset_enable(); ut_assertok(run_command("bootflow scan -l mmc", 0)); /* check that the hunter was used */ @@ -831,7 +834,8 @@ static int bootflow_cmd_hunt_label(struct unit_test_state *uts) return 0; } -BOOTSTD_TEST(bootflow_cmd_hunt_label, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +BOOTSTD_TEST(bootflow_cmd_hunt_label, UT_TESTF_DM | UT_TESTF_SCAN_FDT | + UT_TESTF_CONSOLE_REC); /** * check_font() - Check that the font size for an item matches expectations @@ -1127,7 +1131,6 @@ static int bootflow_cmdline(struct unit_test_state *uts) { ut_assertok(run_command("bootflow scan mmc", 0)); ut_assertok(run_command("bootflow sel 0", 0)); - console_record_reset_enable(); ut_asserteq(1, run_command("bootflow cmdline get fred", 0)); ut_assert_nextline("Argument not found"); @@ -1157,7 +1160,7 @@ static int bootflow_cmdline(struct unit_test_state *uts) return 0; } -BOOTSTD_TEST(bootflow_cmdline, 0); +BOOTSTD_TEST(bootflow_cmdline, UT_TESTF_CONSOLE_REC); /* test a few special changes to a long command line */ static int bootflow_cmdline_special(struct unit_test_state *uts) @@ -1198,7 +1201,7 @@ static int bootflow_cros(struct unit_test_state *uts) return 0; } -BOOTSTD_TEST(bootflow_cros, 0); +BOOTSTD_TEST(bootflow_cros, UT_TESTF_CONSOLE_REC); /* Test Android bootmeth */ static int bootflow_android(struct unit_test_state *uts) @@ -1221,4 +1224,4 @@ static int bootflow_android(struct unit_test_state *uts) return 0; } -BOOTSTD_TEST(bootflow_android, 0); +BOOTSTD_TEST(bootflow_android, UT_TESTF_CONSOLE_REC); From patchwork Sun Aug 11 14:51:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971315 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=Wt7wYX/C; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhgjZ2tb7z1yXh for ; Mon, 12 Aug 2024 00:57:22 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 08622889E9; Sun, 11 Aug 2024 16:52: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=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="Wt7wYX/C"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B5F38889AE; Sun, 11 Aug 2024 16:52:38 +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.2 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 mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) (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 66BAE884C3 for ; Sun, 11 Aug 2024 16:52:36 +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-il1-x129.google.com with SMTP id e9e14a558f8ab-39b3a6a7941so12993015ab.0 for ; Sun, 11 Aug 2024 07:52:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387955; x=1723992755; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JOKXGXx2O0QuWJLmpb70snzkVoo3Pg5CAS+f/O7nx4k=; b=Wt7wYX/C7rd/AXg6Wk2oGjTIj79HwR/mW0CTCaTT1O1nz6cdnvlLFkoXopr0rO2Uj8 Sdw6n0ZgLs/i1+fLCsHOv7yPmcfPDAn9B7Q/GQxRRr4z7KJkJQbcGrmTwGEq9CBowM0r Q+RN5cfXwLB0ZGXl8KQwwrDKyJaMg51Hkjdec= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387955; x=1723992755; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JOKXGXx2O0QuWJLmpb70snzkVoo3Pg5CAS+f/O7nx4k=; b=KAcnubUMNxyQ4ct18suptk6ijWnh38sgcB5f6sNorRSJLQrWfidQtKuIANrfIGQ7CT DbbzCUfKMnZ2mUotzb0ArxnhvMx/5A7HINTknUirEnfB2nUEomuAQOF1gGlEDI2c4Xlj J2KWfHKMdngxpEwGn44DMRkYeFMdVNmTkSLfUFtCu2PxlEcJEtW2G2Fsg+BFKZiArBm/ Ej2ND8JmdC/SBLMgxsfnZfbVYcku6dwIeGI73FhzXQDFIa3Q5YdFQE5usBBulmaUt/M4 BGNNa/X2EupoUIpnJrWpXUZX2gkIxYf5AHjumv+hRO4NEjwqOLlZljvouh7LX5fSmaB8 XjTw== X-Gm-Message-State: AOJu0YzdHtTzPMUc5Vo9xXeqnQ+Xlh/905ofV/M/TIsQKaZoIQ4Fvabp 9DxtkXsIKg6zFr6KbThfqyVmXUgfP4NF/aYUclv1Tux3voZY2lgKNQMgAfIAUKLb+3yDT4UrRws = X-Google-Smtp-Source: AGHT+IHELrvHMlmU0DHgRHndwYMDC3nGXbdNzm6JRPS2ilzyc+AfbMJwePOhPUUP5NvCWiHr9q+Ajw== X-Received: by 2002:a92:c266:0:b0:398:36c0:7968 with SMTP id e9e14a558f8ab-39b7484f65bmr87449485ab.6.1723387954738; Sun, 11 Aug 2024 07:52:34 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:34 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass , Stephen Warren , Stephen Warren Subject: [PATCH v3 04/40] test/py: Fix some pylint warnings in test_ut.py Date: Sun, 11 Aug 2024 08:51:33 -0600 Message-Id: <20240811145209.4191404-5-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Tidy up most of these warnings. Remaining are four of these: R0914: Too many local variables which can only by fixed by splitting things into functions, so that is left for another time. Part of this change was done by the flynt tool. Signed-off-by: Simon Glass --- (no changes since v1) test/py/tests/test_ut.py | 94 ++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 46 deletions(-) diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py index 05e15830590..39aa1035e34 100644 --- a/test/py/tests/test_ut.py +++ b/test/py/tests/test_ut.py @@ -1,6 +1,12 @@ # SPDX-License-Identifier: GPL-2.0 -# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +""" +Unit-test runner + +Provides a test_ut() function which is used by conftest.py to run each unit +test one at a time, as well setting up some files needed by the tests. +# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +""" import collections import getpass import gzip @@ -44,8 +50,8 @@ def setup_image(cons, mmc_dev, part_type, second_part=False): if second_part: spec += '\ntype=c' - u_boot_utils.run_and_log(cons, 'qemu-img create %s 20M' % fname) - u_boot_utils.run_and_log(cons, 'sudo sfdisk %s' % fname, + u_boot_utils.run_and_log(cons, f'qemu-img create {fname} 20M') + u_boot_utils.run_and_log(cons, f'sudo sfdisk {fname}', stdin=spec.encode('utf-8')) return fname, mnt @@ -61,13 +67,13 @@ def mount_image(cons, fname, mnt, fstype): Returns: str: Name of loop device used """ - out = u_boot_utils.run_and_log(cons, 'sudo losetup --show -f -P %s' % fname) + out = u_boot_utils.run_and_log(cons, f'sudo losetup --show -f -P {fname}') loop = out.strip() part = f'{loop}p1' u_boot_utils.run_and_log(cons, f'sudo mkfs.{fstype} {part}') opts = '' if fstype == 'vfat': - opts += f' -o uid={os.getuid()},gid={os.getgid()}' + opts += f' -o uid={os.getuid()},gid={os.getgid()}' u_boot_utils.run_and_log(cons, f'sudo mount -o loop {part} {mnt}{opts}') u_boot_utils.run_and_log(cons, f'sudo chown {getpass.getuser()} {mnt}') return loop @@ -82,9 +88,7 @@ def copy_prepared_image(cons, mmc_dev, fname): """ infname = os.path.join(cons.config.source_dir, f'test/py/tests/bootstd/mmc{mmc_dev}.img.xz') - u_boot_utils.run_and_log( - cons, - ['sh', '-c', 'xz -dc %s >%s' % (infname, fname)]) + u_boot_utils.run_and_log(cons, ['sh', '-c', f'xz -dc {infname} >{fname}']) def setup_bootmenu_image(cons): """Create a 20MB disk image with a single ext4 partition @@ -101,9 +105,6 @@ def setup_bootmenu_image(cons): loop = mount_image(cons, fname, mnt, 'ext4') mounted = True - vmlinux = 'Image' - initrd = 'uInitrd' - dtbdir = 'dtb' script = '''# DO NOT EDIT THIS FILE # # Please edit /boot/armbianEnv.txt to set supported parameters @@ -177,12 +178,12 @@ booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} # Recompile with: # mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr -''' % (mmc_dev) +''' bootdir = os.path.join(mnt, 'boot') mkdir_cond(bootdir) cmd_fname = os.path.join(bootdir, 'boot.cmd') scr_fname = os.path.join(bootdir, 'boot.scr') - with open(cmd_fname, 'w') as outf: + with open(cmd_fname, 'w', encoding='ascii') as outf: print(script, file=outf) infname = os.path.join(cons.config.source_dir, @@ -212,13 +213,12 @@ booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} complete = True except ValueError as exc: - print('Falled to create image, failing back to prepared copy: %s', - str(exc)) + print(f'Falled to create image, failing back to prepared copy: {exc}') finally: if mounted: - u_boot_utils.run_and_log(cons, 'sudo umount --lazy %s' % mnt) + u_boot_utils.run_and_log(cons, f'sudo umount --lazy {mnt}') if loop: - u_boot_utils.run_and_log(cons, 'sudo losetup -d %s' % loop) + u_boot_utils.run_and_log(cons, f'sudo losetup -d {loop}') if not complete: copy_prepared_image(cons, mmc_dev, fname) @@ -254,32 +254,32 @@ label Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl) ext = os.path.join(mnt, 'extlinux') mkdir_cond(ext) - with open(os.path.join(ext, 'extlinux.conf'), 'w') as fd: + conf = os.path.join(ext, 'extlinux.conf') + with open(conf, 'w', encoding='ascii') as fd: print(script, file=fd) inf = os.path.join(cons.config.persistent_data_dir, 'inf') with open(inf, 'wb') as fd: fd.write(gzip.compress(b'vmlinux')) - u_boot_utils.run_and_log(cons, 'mkimage -f auto -d %s %s' % - (inf, os.path.join(mnt, vmlinux))) + u_boot_utils.run_and_log( + cons, f'mkimage -f auto -d {inf} {os.path.join(mnt, vmlinux)}') - with open(os.path.join(mnt, initrd), 'w') as fd: + with open(os.path.join(mnt, initrd), 'w', encoding='ascii') as fd: print('initrd', file=fd) mkdir_cond(os.path.join(mnt, dtbdir)) - dtb_file = os.path.join(mnt, '%s/sandbox.dtb' % dtbdir) + dtb_file = os.path.join(mnt, f'{dtbdir}/sandbox.dtb') u_boot_utils.run_and_log( - cons, 'dtc -o %s' % dtb_file, stdin=b'/dts-v1/; / {};') + cons, f'dtc -o {dtb_file}', stdin=b'/dts-v1/; / {};') complete = True except ValueError as exc: - print('Falled to create image, failing back to prepared copy: %s', - str(exc)) + print(f'Falled to create image, failing back to prepared copy: {exc}') finally: if mounted: - u_boot_utils.run_and_log(cons, 'sudo umount --lazy %s' % mnt) + u_boot_utils.run_and_log(cons, f'sudo umount --lazy {mnt}') if loop: - u_boot_utils.run_and_log(cons, 'sudo losetup -d %s' % loop) + u_boot_utils.run_and_log(cons, f'sudo losetup -d {loop}') if not complete: copy_prepared_image(cons, mmc_dev, fname) @@ -303,7 +303,8 @@ def setup_cros_image(cons): Return: bytes: Packed-kernel data """ - kern_part = os.path.join(cons.config.result_dir, 'kern-part-{arch}.bin') + kern_part = os.path.join(cons.config.result_dir, + f'kern-part-{arch}.bin') u_boot_utils.run_and_log( cons, f'futility vbutil_kernel --pack {kern_part} ' @@ -332,7 +333,7 @@ def setup_cros_image(cons): mmc_dev = 5 fname = os.path.join(cons.config.source_dir, f'mmc{mmc_dev}.img') - u_boot_utils.run_and_log(cons, 'qemu-img create %s 20M' % fname) + u_boot_utils.run_and_log(cons, f'qemu-img create {fname} 20M') #mnt = os.path.join(cons.config.persistent_data_dir, 'mnt') #mkdir_cond(mnt) u_boot_utils.run_and_log(cons, f'cgpt create {fname}') @@ -381,20 +382,20 @@ def setup_cros_image(cons): u_boot_utils.run_and_log(cons, f'cgpt boot -p {fname}') out = u_boot_utils.run_and_log(cons, f'cgpt show -q {fname}') - '''We expect something like this: - 8239 2048 1 Basic data - 45 2048 2 ChromeOS kernel - 8238 1 3 ChromeOS rootfs - 2093 2048 4 ChromeOS kernel - 8237 1 5 ChromeOS rootfs - 41 1 6 ChromeOS kernel - 42 1 7 ChromeOS rootfs - 4141 2048 8 Basic data - 43 1 9 ChromeOS reserved - 44 1 10 ChromeOS reserved - 40 1 11 ChromeOS firmware - 6189 2048 12 EFI System Partition - ''' + + # We expect something like this: + # 8239 2048 1 Basic data + # 45 2048 2 ChromeOS kernel + # 8238 1 3 ChromeOS rootfs + # 2093 2048 4 ChromeOS kernel + # 8237 1 5 ChromeOS rootfs + # 41 1 6 ChromeOS kernel + # 42 1 7 ChromeOS rootfs + # 4141 2048 8 Basic data + # 43 1 9 ChromeOS reserved + # 44 1 10 ChromeOS reserved + # 40 1 11 ChromeOS firmware + # 6189 2048 12 EFI System Partition # Create a dict (indexed by partition number) containing the above info for line in out.splitlines(): @@ -446,7 +447,7 @@ def setup_android_image(cons): mmc_dev = 7 fname = os.path.join(cons.config.source_dir, f'mmc{mmc_dev}.img') - u_boot_utils.run_and_log(cons, 'qemu-img create %s 20M' % fname) + u_boot_utils.run_and_log(cons, f'qemu-img create {fname} 20M') u_boot_utils.run_and_log(cons, f'cgpt create {fname}') ptr = 40 @@ -498,11 +499,12 @@ def setup_android_image(cons): with open(fname, 'wb') as outf: outf.write(disk_data) - print('wrote to {}'.format(fname)) + print(f'wrote to {fname}') return fname def setup_cedit_file(cons): + """Set up a .dtb file for use with testing expo and configuration editor""" infname = os.path.join(cons.config.source_dir, 'test/boot/files/expo_layout.dts') inhname = os.path.join(cons.config.source_dir, @@ -584,7 +586,7 @@ def test_ut(u_boot_console, ut_subtest): # ut hush hush_test_simple_dollar prints "Unknown command" on purpose. with u_boot_console.disable_check('unknown_command'): output = u_boot_console.run_command('ut ' + ut_subtest) - assert('Unknown command \'quux\' - try \'help\'' in output) + assert 'Unknown command \'quux\' - try \'help\'' in output else: output = u_boot_console.run_command('ut ' + ut_subtest) assert output.endswith('Failures: 0') From patchwork Sun Aug 11 14:51:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971316 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=g82axpfi; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgjn3LFjz1yXh for ; Mon, 12 Aug 2024 00:57:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 680B4889FD; Sun, 11 Aug 2024 16:52: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=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="g82axpfi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BA596889ED; Sun, 11 Aug 2024 16:52:39 +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.2 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 mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) (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 14CD9887E8 for ; Sun, 11 Aug 2024 16:52:37 +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-il1-x129.google.com with SMTP id e9e14a558f8ab-39b0826298cso13071775ab.2 for ; Sun, 11 Aug 2024 07:52:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387955; x=1723992755; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xVyTDmUvuhTVv38JnbN24w4MSW3iJraazcROZtvVKiM=; b=g82axpfi4yO0O9UFM0/3jKNi5091pVqE2lt88KryJiGZRtGNrDl+gNs1sApwj5+Hlu 41j2BN9gjlV4ynyzHBDpVxt9CvtZvjzQIcz4T8XrdJI/5q3Zp6xyk8NM1WtiNP1iDaZw rBv1oaJsYoZe/65RlzteW6jsaZq2oV4o/wfeI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387955; x=1723992755; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xVyTDmUvuhTVv38JnbN24w4MSW3iJraazcROZtvVKiM=; b=Bv/BSQAxBhUcpGJxxIVhuIGmn1SkYyKJdPndms69tZnrx1l/vzj+7b/HmUSJqUcLyF R12XzKn2WdI8lobcBqW4jFHW08t6doC5sHeidqZq+OYrWHSzFGLGoTiGEuapJMAZmZdB Oj0Ofdy1uUUEmy8CV5AhxJLIkxaO0kgCq6YRiCZqpHCkeqyhWWkGkGwpaAhyADCwkJTJ qTU9aspZYU/KFDRnAMw5/ilbkPUF3WDXTisFy+zT+7zjwCZ2miNkKupOF5xb5Tpif3In CCzWHixtf5znGvqu0of+BpOLIfRuGQiDXMbuUCgdnXDii9TlfH+6EbUtkQC5Ti4DlheN whEA== X-Gm-Message-State: AOJu0YwViABjHGa9Usw5DBnuM1LW7OXwkJ9f11lv8yZiKqHx2O2TTTyA hsXUzURBUIK2sqfsLivxNZvsbtkTTvQSUwWyG32rTyT6+fOsWsGvVlKOKuzWBtYbi4qammeOGL0 = X-Google-Smtp-Source: AGHT+IGHlQGpCrUIyrs2AaryVZqLXrFE+vmSLwurQV9AyxXYRD2xOP+vw2A0g4NYrxmdXKM6EuPvlw== X-Received: by 2002:a92:ca4a:0:b0:382:b3f8:9f72 with SMTP id e9e14a558f8ab-39b7a416772mr104507335ab.15.1723387955466; Sun, 11 Aug 2024 07:52:35 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:35 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 05/40] scripts: Update pylint.base Date: Sun, 11 Aug 2024 08:51:34 -0600 Message-Id: <20240811145209.4191404-6-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean There have been quite a few changes in the Python scripts, so update the pylint baseline. This was created using: make pylint cp pylint.cur scripts/pylint.base Signed-off-by: Simon Glass --- (no changes since v1) scripts/pylint.base | 462 ++++++++++++++++++++++++++------------------ 1 file changed, 272 insertions(+), 190 deletions(-) diff --git a/scripts/pylint.base b/scripts/pylint.base index c7d141ed393..bc39e2385a3 100644 --- a/scripts/pylint.base +++ b/scripts/pylint.base @@ -1,229 +1,311 @@ -test_conftest.py 6.56 -test_multiplexed_log.py 7.49 -test_test.py 8.18 +test_conftest.py 6.78 +test_multiplexed_log.py 7.68 +test_test.py 9.00 +test_tests_fit_util.py 7.19 +test_tests_fs_helper.py 10.00 test_tests_test_000_version.py 7.50 -test_tests_test_android_test_ab.py 6.50 -test_tests_test_android_test_abootimg.py 6.09 -test_tests_test_android_test_avb.py 5.52 -test_tests_test_bind.py -2.99 +test_tests_test_android_test_ab.py 7.00 +test_tests_test_android_test_abootimg.py 6.52 +test_tests_test_android_test_avb.py 6.38 +test_tests_test_bind.py 8.89 test_tests_test_bootmenu.py 10.00 +test_tests_test_bootstage.py 7.14 test_tests_test_button.py 3.33 -test_tests_test_dfu.py 5.45 -test_tests_test_dm.py 9.52 -test_tests_test_efi_capsule_capsule_defs.py 6.67 -test_tests_test_efi_capsule_conftest.py 1.86 -test_tests_test_efi_capsule_test_capsule_firmware.py 4.52 -test_tests_test_efi_capsule_test_capsule_firmware_signed.py 4.85 -test_tests_test_efi_fit.py 8.16 -test_tests_test_efi_loader.py 7.38 -test_tests_test_efi_secboot_conftest.py -3.29 -test_tests_test_efi_secboot_defs.py 6.67 -test_tests_test_efi_secboot_test_authvar.py 8.93 -test_tests_test_efi_secboot_test_signed.py 8.41 -test_tests_test_efi_secboot_test_signed_intca.py 8.10 -test_tests_test_efi_secboot_test_unsigned.py 8.00 -test_tests_test_efi_selftest.py 6.36 -test_tests_test_env.py 7.15 -test_tests_test_extension.py 2.14 -test_tests_test_fit.py 6.83 -test_tests_test_fit_ecdsa.py 7.94 -test_tests_test_fit_hashes.py 7.70 -test_tests_test_fpga.py 1.81 -test_tests_test_fs_conftest.py 5.13 +test_tests_test_cat_conftest.py 10.00 +test_tests_test_cat_test_cat.py 10.00 +test_tests_test_cleanup_build.py 10.00 +test_tests_test_dfu.py 6.23 +test_tests_test_dm.py 8.98 +test_tests_test_efi_bootmgr_conftest.py 10.00 +test_tests_test_efi_bootmgr_test_efi_bootmgr.py 10.00 +test_tests_test_efi_capsule_capsule_common.py 10.00 +test_tests_test_efi_capsule_capsule_defs.py 10.00 +test_tests_test_efi_capsule_conftest.py 3.26 +test_tests_test_efi_capsule_test_capsule_firmware_fit.py 10.00 +test_tests_test_efi_capsule_test_capsule_firmware_raw.py 9.62 +test_tests_test_efi_capsule_test_capsule_firmware_signed_fit.py 9.74 +test_tests_test_efi_capsule_test_capsule_firmware_signed_raw.py 9.75 +test_tests_test_efi_fit.py 8.84 +test_tests_test_efi_loader.py 8.00 +test_tests_test_efi_secboot_conftest.py 0.00 +test_tests_test_efi_secboot_defs.py 10.00 +test_tests_test_efi_secboot_test_authvar.py 9.38 +test_tests_test_efi_secboot_test_signed.py 8.60 +test_tests_test_efi_secboot_test_signed_intca.py 8.81 +test_tests_test_efi_secboot_test_unsigned.py 8.75 +test_tests_test_efi_selftest.py 8.07 +test_tests_test_eficonfig_conftest.py 10.00 +test_tests_test_eficonfig_test_eficonfig.py 9.47 +test_tests_test_env.py 7.76 +test_tests_test_event_dump.py 2.22 +test_tests_test_extension.py 2.50 +test_tests_test_fit.py 7.54 +test_tests_test_fit_auto_signed.py 9.09 +test_tests_test_fit_ecdsa.py 8.29 +test_tests_test_fit_hashes.py 7.94 +test_tests_test_fpga.py 2.94 +test_tests_test_fs_conftest.py 5.21 test_tests_test_fs_fstest_defs.py 8.33 test_tests_test_fs_fstest_helpers.py 4.29 -test_tests_test_fs_test_basic.py 0.60 -test_tests_test_fs_test_ext.py 0.00 +test_tests_test_fs_test_basic.py 1.90 +test_tests_test_fs_test_erofs.py 8.97 +test_tests_test_fs_test_ext.py 1.48 test_tests_test_fs_test_fs_cmd.py 8.00 -test_tests_test_fs_test_mkdir.py 1.96 -test_tests_test_fs_test_squashfs_sqfs_common.py 8.41 -test_tests_test_fs_test_squashfs_test_sqfs_load.py 7.46 -test_tests_test_fs_test_squashfs_test_sqfs_ls.py 8.00 -test_tests_test_fs_test_symlink.py 1.22 -test_tests_test_fs_test_unlink.py 2.78 -test_tests_test_gpio.py 6.09 -test_tests_test_gpt.py 7.67 +test_tests_test_fs_test_fs_fat.py 2.50 +test_tests_test_fs_test_mkdir.py 3.04 +test_tests_test_fs_test_squashfs_sqfs_common.py 8.38 +test_tests_test_fs_test_squashfs_test_sqfs_load.py 7.63 +test_tests_test_fs_test_squashfs_test_sqfs_ls.py 8.04 +test_tests_test_fs_test_symlink.py 2.04 +test_tests_test_fs_test_unlink.py 4.07 +test_tests_test_gpio.py 7.60 +test_tests_test_gpt.py 8.55 test_tests_test_handoff.py 5.00 -test_tests_test_help.py 5.00 -test_tests_test_hush_if_test.py 9.27 -test_tests_test_log.py 8.64 +test_tests_test_help.py 8.64 +test_tests_test_i2c.py 7.42 +test_tests_test_kconfig.py 5.38 +test_tests_test_log.py 8.75 test_tests_test_lsblk.py 8.00 test_tests_test_md.py 3.64 +test_tests_test_mdio.py 6.82 +test_tests_test_memtest.py 8.39 +test_tests_test_mii.py 8.55 +test_tests_test_mmc.py 7.01 test_tests_test_mmc_rd.py 6.05 test_tests_test_mmc_wr.py 3.33 -test_tests_test_net.py 6.84 +test_tests_test_net.py 8.43 +test_tests_test_net_boot.py 8.23 +test_tests_test_of_migrate.py 7.86 test_tests_test_ofplatdata.py 5.71 +test_tests_test_optee_rpmb.py 0.00 test_tests_test_part.py 8.00 -test_tests_test_pinmux.py 3.27 +test_tests_test_pinmux.py 3.40 test_tests_test_pstore.py 2.31 test_tests_test_qfw.py 8.75 +test_tests_test_reset.py 9.55 test_tests_test_sandbox_exit.py 6.50 +test_tests_test_sandbox_opts.py 1.11 +test_tests_test_saveenv.py 7.87 test_tests_test_scp03.py 3.33 -test_tests_test_sf.py 7.13 +test_tests_test_scsi.py 8.47 +test_tests_test_semihosting_conftest.py 10.00 +test_tests_test_semihosting_test_hostfs.py 10.00 +test_tests_test_sf.py 7.45 test_tests_test_shell_basics.py 9.58 -test_tests_test_sleep.py 7.78 -test_tests_test_spl.py 2.22 +test_tests_test_sleep.py 8.28 +test_tests_test_smbios.py 9.47 +test_tests_test_source.py 7.20 +test_tests_test_spl.py 6.67 test_tests_test_stackprotector.py 5.71 -test_tests_test_tpm2.py 8.51 -test_tests_test_ums.py 6.32 +test_tests_test_tpm2.py 8.45 +test_tests_test_trace.py 8.70 +test_tests_test_ums.py 5.92 test_tests_test_unknown_cmd.py 5.00 -test_tests_test_ut.py 7.06 -test_tests_test_vboot.py 6.01 -test_tests_vboot_evil.py 8.95 +test_tests_test_upl.py 5.33 +test_tests_test_usb.py 7.08 +test_tests_test_ut.py 9.44 +test_tests_test_vbe.py 7.22 +test_tests_test_vbe_vpl.py 6.11 +test_tests_test_vboot.py 5.37 +test_tests_test_vpl.py 2.22 +test_tests_test_xxd_conftest.py 10.00 +test_tests_test_xxd_test_xxd.py 10.00 +test_tests_test_zynq_secure.py 7.60 +test_tests_test_zynqmp_rpu.py 7.54 +test_tests_test_zynqmp_secure.py 7.68 +test_tests_vboot_evil.py 9.45 test_tests_vboot_forge.py 9.22 -test_u_boot_console_base.py 7.08 -test_u_boot_console_exec_attach.py 9.23 -test_u_boot_console_sandbox.py 8.06 -test_u_boot_spawn.py 7.65 -test_u_boot_utils.py 6.94 -tools_binman_bintool 8.59 +test_u_boot_console_base.py 7.73 +test_u_boot_console_exec_attach.py 9.62 +test_u_boot_console_sandbox.py 8.64 +test_u_boot_spawn.py 8.57 +test_u_boot_utils.py 7.83 +tools_binman_bintool 9.16 tools_binman_bintool_test 9.87 -tools_binman_btool__testing 6.09 +tools_binman_btool__testing 6.52 +tools_binman_btool_bootgen 4.50 +tools_binman_btool_btool_gzip 0.00 +tools_binman_btool_bzip2 0.00 tools_binman_btool_cbfstool 7.83 -tools_binman_btool_fiptool 7.62 -tools_binman_btool_futility 7.39 +tools_binman_btool_cst 5.00 +tools_binman_btool_fdt_add_pubkey 7.00 +tools_binman_btool_fdtgrep 5.20 +tools_binman_btool_fiptool 7.22 +tools_binman_btool_futility 6.67 tools_binman_btool_ifwitool 3.81 -tools_binman_btool_lz4 6.30 +tools_binman_btool_lz4 4.76 tools_binman_btool_lzma_alone 6.97 -tools_binman_btool_mkimage 7.86 -tools_binman_cbfs_util 8.46 -tools_binman_cbfs_util_test 9.38 -tools_binman_cmdline 9.03 -tools_binman_comp_util 6.88 -tools_binman_control 5.01 -tools_binman_elf 6.98 -tools_binman_elf_test 5.62 -tools_binman_entry 3.55 -tools_binman_entry_test 5.34 -tools_binman_etype__testing 0.83 -tools_binman_etype_atf_bl31 -6.00 -tools_binman_etype_atf_fip 0.29 -tools_binman_etype_blob -1.58 -tools_binman_etype_blob_dtb -10.00 -tools_binman_etype_blob_ext -19.09 +tools_binman_btool_lzop 0.00 +tools_binman_btool_mkeficapsule 7.69 +tools_binman_btool_mkimage 6.36 +tools_binman_btool_openssl 4.63 +tools_binman_btool_xz 0.00 +tools_binman_btool_zstd 0.00 +tools_binman_cbfs_util 8.93 +tools_binman_cbfs_util_test 9.81 +tools_binman_cmdline 9.33 +tools_binman_control 6.92 +tools_binman_elf 7.52 +tools_binman_elf_test 8.40 +tools_binman_entry 6.40 +tools_binman_entry_test 6.99 +tools_binman_etype__testing 2.02 +tools_binman_etype_alternates_fdt 5.09 +tools_binman_etype_atf_bl31 0.00 +tools_binman_etype_atf_fip 0.44 +tools_binman_etype_blob 0.41 +tools_binman_etype_blob_dtb 0.21 +tools_binman_etype_blob_ext 0.00 tools_binman_etype_blob_ext_list 0.00 -tools_binman_etype_blob_named_by_arg -7.78 -tools_binman_etype_blob_phase -5.00 -tools_binman_etype_cbfs -1.44 +tools_binman_etype_blob_named_by_arg 0.00 +tools_binman_etype_blob_phase 0.50 +tools_binman_etype_cbfs 1.86 tools_binman_etype_collection 2.67 -tools_binman_etype_cros_ec_rw -6.00 -tools_binman_etype_fdtmap -3.28 -tools_binman_etype_files -7.43 -tools_binman_etype_fill -6.43 -tools_binman_etype_fit 6.31 -tools_binman_etype_fmap -0.29 -tools_binman_etype_gbb 0.83 -tools_binman_etype_image_header 5.77 -tools_binman_etype_intel_cmc -12.50 +tools_binman_etype_cros_ec_rw 0.00 +tools_binman_etype_efi_capsule 3.33 +tools_binman_etype_efi_empty_capsule 0.00 +tools_binman_etype_encrypted 1.43 +tools_binman_etype_fdtmap 0.16 +tools_binman_etype_files 0.00 +tools_binman_etype_fill 0.00 +tools_binman_etype_fit 7.52 +tools_binman_etype_fmap 0.54 +tools_binman_etype_gbb 1.35 +tools_binman_etype_image_header 4.81 +tools_binman_etype_intel_cmc 0.00 tools_binman_etype_intel_descriptor 4.62 tools_binman_etype_intel_fit 0.00 tools_binman_etype_intel_fit_ptr 2.35 -tools_binman_etype_intel_fsp -12.50 -tools_binman_etype_intel_fsp_m -12.50 -tools_binman_etype_intel_fsp_s -12.50 -tools_binman_etype_intel_fsp_t -12.50 -tools_binman_etype_intel_ifwi 2.88 -tools_binman_etype_intel_me -12.50 -tools_binman_etype_intel_mrc -10.00 -tools_binman_etype_intel_refcode -10.00 -tools_binman_etype_intel_vbt -12.50 -tools_binman_etype_intel_vga -12.50 -tools_binman_etype_mkimage 1.47 -tools_binman_etype_opensbi -6.00 -tools_binman_etype_powerpc_mpc85xx_bootpg_resetvec -10.00 -tools_binman_etype_scp -6.00 -tools_binman_etype_section 4.57 -tools_binman_etype_tee_os -6.00 -tools_binman_etype_text -0.48 -tools_binman_etype_u_boot -15.71 -tools_binman_etype_u_boot_dtb -12.22 -tools_binman_etype_u_boot_dtb_with_ucode 0.39 -tools_binman_etype_u_boot_elf -8.42 +tools_binman_etype_intel_fsp 0.00 +tools_binman_etype_intel_fsp_m 0.00 +tools_binman_etype_intel_fsp_s 0.00 +tools_binman_etype_intel_fsp_t 0.00 +tools_binman_etype_intel_ifwi 3.13 +tools_binman_etype_intel_me 0.00 +tools_binman_etype_intel_mrc 0.00 +tools_binman_etype_intel_refcode 0.00 +tools_binman_etype_intel_vbt 0.00 +tools_binman_etype_intel_vga 0.00 +tools_binman_etype_mkimage 4.88 +tools_binman_etype_null 0.00 +tools_binman_etype_nxp_imx8mcst 2.44 +tools_binman_etype_nxp_imx8mimage 0.00 +tools_binman_etype_opensbi 0.00 +tools_binman_etype_powerpc_mpc85xx_bootpg_resetvec 0.00 +tools_binman_etype_pre_load 3.68 +tools_binman_etype_rockchip_tpl 0.00 +tools_binman_etype_scp 0.00 +tools_binman_etype_section 6.04 +tools_binman_etype_tee_os 4.00 +tools_binman_etype_text 0.00 +tools_binman_etype_ti_board_config 5.40 +tools_binman_etype_ti_dm 0.00 +tools_binman_etype_ti_secure 4.22 +tools_binman_etype_ti_secure_rom 2.22 +tools_binman_etype_u_boot 0.00 +tools_binman_etype_u_boot_dtb 0.00 +tools_binman_etype_u_boot_dtb_with_ucode 1.73 +tools_binman_etype_u_boot_elf 0.00 tools_binman_etype_u_boot_env 0.74 -tools_binman_etype_u_boot_expanded -10.00 -tools_binman_etype_u_boot_img -15.71 -tools_binman_etype_u_boot_nodtb -15.71 -tools_binman_etype_u_boot_spl -10.91 -tools_binman_etype_u_boot_spl_bss_pad -9.29 -tools_binman_etype_u_boot_spl_dtb -12.22 -tools_binman_etype_u_boot_spl_elf -15.71 -tools_binman_etype_u_boot_spl_expanded -9.09 -tools_binman_etype_u_boot_spl_nodtb -10.91 -tools_binman_etype_u_boot_spl_with_ucode_ptr -5.00 -tools_binman_etype_u_boot_tpl -10.91 -tools_binman_etype_u_boot_tpl_bss_pad -9.29 -tools_binman_etype_u_boot_tpl_dtb -12.22 -tools_binman_etype_u_boot_tpl_dtb_with_ucode -7.50 -tools_binman_etype_u_boot_tpl_elf -15.71 -tools_binman_etype_u_boot_tpl_expanded -9.09 -tools_binman_etype_u_boot_tpl_nodtb -10.91 -tools_binman_etype_u_boot_tpl_with_ucode_ptr -20.83 +tools_binman_etype_u_boot_expanded 0.00 +tools_binman_etype_u_boot_img 0.00 +tools_binman_etype_u_boot_nodtb 0.00 +tools_binman_etype_u_boot_spl 0.00 +tools_binman_etype_u_boot_spl_bss_pad 0.00 +tools_binman_etype_u_boot_spl_dtb 0.00 +tools_binman_etype_u_boot_spl_elf 0.00 +tools_binman_etype_u_boot_spl_expanded 0.00 +tools_binman_etype_u_boot_spl_nodtb 0.00 +tools_binman_etype_u_boot_spl_pubkey_dtb 1.21 +tools_binman_etype_u_boot_spl_with_ucode_ptr 0.00 +tools_binman_etype_u_boot_tpl 0.00 +tools_binman_etype_u_boot_tpl_bss_pad 0.00 +tools_binman_etype_u_boot_tpl_dtb 0.00 +tools_binman_etype_u_boot_tpl_dtb_with_ucode 0.00 +tools_binman_etype_u_boot_tpl_elf 0.00 +tools_binman_etype_u_boot_tpl_expanded 0.00 +tools_binman_etype_u_boot_tpl_nodtb 0.00 +tools_binman_etype_u_boot_tpl_with_ucode_ptr 0.00 tools_binman_etype_u_boot_ucode 1.52 -tools_binman_etype_u_boot_with_ucode_ptr -0.71 -tools_binman_etype_vblock 0.27 -tools_binman_etype_x86_reset16 -15.71 -tools_binman_etype_x86_reset16_spl -15.71 -tools_binman_etype_x86_reset16_tpl -15.71 -tools_binman_etype_x86_start16 -15.71 -tools_binman_etype_x86_start16_spl -15.71 -tools_binman_etype_x86_start16_tpl -15.71 -tools_binman_fdt_test 10.00 +tools_binman_etype_u_boot_vpl 0.00 +tools_binman_etype_u_boot_vpl_bss_pad 0.00 +tools_binman_etype_u_boot_vpl_dtb 0.00 +tools_binman_etype_u_boot_vpl_elf 0.00 +tools_binman_etype_u_boot_vpl_expanded 0.00 +tools_binman_etype_u_boot_vpl_nodtb 0.00 +tools_binman_etype_u_boot_with_ucode_ptr 0.00 +tools_binman_etype_vblock 0.79 +tools_binman_etype_x509_cert 3.10 +tools_binman_etype_x86_reset16 0.00 +tools_binman_etype_x86_reset16_spl 0.00 +tools_binman_etype_x86_reset16_tpl 0.00 +tools_binman_etype_x86_start16 0.00 +tools_binman_etype_x86_start16_spl 0.00 +tools_binman_etype_x86_start16_tpl 0.00 +tools_binman_etype_xilinx_bootgen 6.06 +tools_binman_fdt_test 7.74 tools_binman_fip_util 9.85 tools_binman_fip_util_test 10.00 -tools_binman_fmap_util 6.88 -tools_binman_ftest 7.46 -tools_binman_image 7.12 -tools_binman_image_test 4.48 -tools_binman_main 4.86 -tools_binman_setup 5.00 -tools_binman_state 4.15 -tools_buildman_board 7.82 -tools_buildman_bsettings 1.71 -tools_buildman_builder 6.92 -tools_buildman_builderthread 7.48 -tools_buildman_cfgutil 7.83 -tools_buildman_cmdline 8.89 -tools_buildman_control 8.12 -tools_buildman_func_test 7.18 -tools_buildman_kconfiglib 7.49 -tools_buildman_main -1.11 -tools_buildman_test 6.56 -tools_buildman_toolchain 6.44 -tools_concurrencytest_concurrencytest 7.26 -tools_dtoc_dtb_platdata 7.90 -tools_dtoc_fdt 4.46 -tools_dtoc_fdt_util 6.80 -tools_dtoc_main 7.78 -tools_dtoc_setup 5.00 -tools_dtoc_src_scan 8.91 -tools_dtoc_test_dtoc 8.56 -tools_dtoc_test_fdt 6.88 -tools_dtoc_test_src_scan 9.43 -tools_efivar 6.71 +tools_binman_fmap_util 6.94 +tools_binman_ftest 8.04 +tools_binman_image 7.29 +tools_binman_image_test 5.52 +tools_binman_main 5.63 +tools_binman_setup 0.00 +tools_binman_state 4.88 +tools_buildman_board 6.36 +tools_buildman_boards 9.72 +tools_buildman_bsettings 5.00 +tools_buildman_builder 7.66 +tools_buildman_builderthread 9.63 +tools_buildman_cfgutil 10.00 +tools_buildman_cmdline 10.00 +tools_buildman_control 9.26 +tools_buildman_func_test 8.38 +tools_buildman_kconfiglib 8.33 +tools_buildman_main 8.10 +tools_buildman_test 7.16 +tools_buildman_toolchain 6.99 +tools_dtoc_dtb_platdata 8.10 +tools_dtoc_fdt 6.31 +tools_dtoc_fdt_util 7.62 +tools_dtoc_main 8.54 +tools_dtoc_setup 0.00 +tools_dtoc_src_scan 9.14 +tools_dtoc_test_dtoc 8.97 +tools_dtoc_test_fdt 9.93 +tools_dtoc_test_src_scan 9.46 +tools_efivar 7.39 tools_endian-swap 9.29 -tools_microcode-tool 7.25 -tools_moveconfig 8.34 +tools_expo 9.72 +tools_key2dtsi 7.14 +tools_microcode-tool 6.55 tools_patman___init__ 0.00 -tools_patman_checkpatch 8.48 -tools_patman_command 5.51 -tools_patman_commit 4.50 -tools_patman_control 8.14 -tools_patman_cros_subprocess 7.76 -tools_patman_func_test 8.51 -tools_patman_get_maintainer 7.06 -tools_patman_gitutil 6.65 -tools_patman_main 7.90 -tools_patman_patchstream 9.11 +tools_patman___main__ 9.44 +tools_patman_checkpatch 8.90 +tools_patman_cmdline 10.00 +tools_patman_commit 6.43 +tools_patman_control 8.29 +tools_patman_func_test 9.02 +tools_patman_get_maintainer 7.50 +tools_patman_gitutil 7.37 +tools_patman_patchstream 9.21 tools_patman_project 7.78 -tools_patman_series 6.16 -tools_patman_settings 5.89 +tools_patman_series 7.54 +tools_patman_settings 7.94 tools_patman_setup 5.00 -tools_patman_status 8.62 -tools_patman_terminal 8.00 -tools_patman_test_checkpatch 7.75 -tools_patman_test_util 7.64 -tools_patman_tools 5.68 -tools_patman_tout 5.31 -tools_rkmux 6.90 -tools_rmboard 7.76 +tools_patman_status 8.52 +tools_patman_test_checkpatch 8.51 +tools_patman_test_settings 8.78 +tools_qconfig 9.79 +tools_rkmux 7.10 +tools_rmboard 8.06 +tools_u_bootlib___init__.py 0.00 +tools_u_bootlib___main__.py 7.78 +tools_u_bootlib_command.py 6.48 +tools_u_bootlib_cros_subprocess.py 9.25 +tools_u_bootlib_terminal.py 8.50 +tools_u_bootlib_test_util.py 7.31 +tools_u_bootlib_tools.py 6.97 +tools_u_bootlib_tout.py 6.56 tools_zynqmp_pm_cfg_obj_convert 6.67 From patchwork Sun Aug 11 14:51:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971317 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=Mxc5RS4t; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgk00zsfz1yXh for ; Mon, 12 Aug 2024 00:57:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C2CA2888C2; Sun, 11 Aug 2024 16:52: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=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="Mxc5RS4t"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BDCA6887E8; Sun, 11 Aug 2024 16:52:39 +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.2 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 mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) (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 903B88885E for ; Sun, 11 Aug 2024 16:52:37 +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-il1-x134.google.com with SMTP id e9e14a558f8ab-39b3e12754eso11984715ab.1 for ; Sun, 11 Aug 2024 07:52:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387956; x=1723992756; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ak8OpDqo0cB5My6CyHNGgaMHsy/FXCNcxcdaBj6scSk=; b=Mxc5RS4twBeHvGULF92Tq7laiNGRYRPETBSJrcjq4VWUiZMrNhxdSoBlEL1CkAOqah tZKGbnU0jus+Fll+WCtgibtKRQDBkTvC8qqQI58dbMF01cXQ8F/DuI32vClR02gMtABD BC+7Uw+iFARet9MuSyhRL9+iPWx7ZOyorYFN4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387956; x=1723992756; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ak8OpDqo0cB5My6CyHNGgaMHsy/FXCNcxcdaBj6scSk=; b=FySbU4RlWXuQfpfOfcsS0OxCJtOimqVJSJG9JjWEnlr5Db5YgBxJD+jZBtYa+lM4P4 iiNR+8kGJjd7pJ12F8ESTV83j5UqiwFVkCT1DVVruwZdBXIupRp/587zT6Rfx2ZjO98B GXDyrjm27HVcxwfqjN6ye6S9674Ntmz5sCUxFAtv7bqUqoTNxozKqDwXAButE6YKN/E1 +70YQLI0zQBoq1L9Q37Ls/R8cKPlrLlhkQCVf1+iwDSF1CcvbvlWsvKB5eOFKLI1vDIX g4rSBxq7L3WLtT5uN3YzmdKh/f01Y0p0WTEACdwU39czy85xl950MdP/7yAMXYwJwKeY XKvg== X-Gm-Message-State: AOJu0Yz6XnJRyDBNui39rXAmMtU7rsOuiF9KdpeMo8xEZ6DA8DAnFmvP 3oZTVwyyiLxDFNAqoZ3eNVKUE5Nob1lCWSTHoqf+CVwiuBM9aunYhgA4NFcDViGY1TKYhbJX0Fo = X-Google-Smtp-Source: AGHT+IFpyKwAQ5dYYbdFwTaKrHT+aLKBIp1gY+RBPcn2HOgwJwJqZ0XrwEOHLMSpxBVFoXXBtm0DuA== X-Received: by 2002:a05:6e02:1e0a:b0:39b:211f:7bb6 with SMTP id e9e14a558f8ab-39b81331bf7mr75390585ab.7.1723387956149; Sun, 11 Aug 2024 07:52:36 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:35 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 06/40] bootstd: Create a function to reset USB Date: Sun, 11 Aug 2024 08:51:35 -0600 Message-Id: <20240811145209.4191404-7-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Set up a function for this, since it needs to be used from multiple test files. This test file is only used on sandbox, where USB is enabled, so drop the local declaration of usb_started Signed-off-by: Simon Glass --- Changes in v3: - Include the usb.h header file in all cases test/boot/bootdev.c | 19 ++++++------------- test/boot/bootstd_common.c | 6 ++++++ test/boot/bootstd_common.h | 8 ++++++++ 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c index 1bf5929c396..de16a51956d 100644 --- a/test/boot/bootdev.c +++ b/test/boot/bootdev.c @@ -16,13 +16,6 @@ #include #include "bootstd_common.h" -/* Allow reseting the USB-started flag */ -#if defined(CONFIG_USB_HOST) || defined(CONFIG_USB_GADGET) -extern bool usb_started; -#else -#include -#endif - /* Check 'bootdev list' command */ static int bootdev_test_cmd_list(struct unit_test_state *uts) { @@ -201,7 +194,7 @@ static int bootdev_test_order(struct unit_test_state *uts) test_set_skip_delays(true); /* Start up USB which gives us three additional bootdevs */ - usb_started = false; + bootstd_reset_usb(); ut_assertok(run_command("usb start", 0)); /* @@ -317,7 +310,7 @@ static int bootdev_test_prio(struct unit_test_state *uts) test_set_eth_enable(false); /* Start up USB which gives us three additional bootdevs */ - usb_started = false; + bootstd_reset_usb(); ut_assertok(run_command("usb start", 0)); ut_assertok(bootstd_test_drop_bootdev_order(uts)); @@ -357,7 +350,7 @@ static int bootdev_test_hunter(struct unit_test_state *uts) { struct bootstd_priv *std; - usb_started = false; + bootstd_reset_usb(); test_set_skip_delays(true); /* get access to the used hunters */ @@ -398,7 +391,7 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts) struct bootstd_priv *std; test_set_skip_delays(true); - usb_started = false; + bootstd_reset_usb(); /* get access to the used hunters */ ut_assertok(bootstd_get_priv(&std)); @@ -527,7 +520,7 @@ BOOTSTD_TEST(bootdev_test_bootable, UT_TESTF_DM | UT_TESTF_SCAN_FDT); /* Check hunting for bootdev of a particular priority */ static int bootdev_test_hunt_prio(struct unit_test_state *uts) { - usb_started = false; + bootstd_reset_usb(); test_set_skip_delays(true); console_record_reset_enable(); @@ -556,7 +549,7 @@ static int bootdev_test_hunt_label(struct unit_test_state *uts) struct bootstd_priv *std; int mflags; - usb_started = false; + bootstd_reset_usb(); /* get access to the used hunters */ ut_assertok(bootstd_get_priv(&std)); diff --git a/test/boot/bootstd_common.c b/test/boot/bootstd_common.c index e50539500a0..ff8ed2303b3 100644 --- a/test/boot/bootstd_common.c +++ b/test/boot/bootstd_common.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -88,6 +89,11 @@ int bootstd_test_check_mmc_hunter(struct unit_test_state *uts) return 0; } +void bootstd_reset_usb(void) +{ + usb_started = false; +} + int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct unit_test *tests = UNIT_TEST_SUITE_START(bootstd_test); diff --git a/test/boot/bootstd_common.h b/test/boot/bootstd_common.h index 4a126e43ff4..e29036c897c 100644 --- a/test/boot/bootstd_common.h +++ b/test/boot/bootstd_common.h @@ -53,4 +53,12 @@ int bootstd_setup_for_tests(void); */ int bootstd_test_check_mmc_hunter(struct unit_test_state *uts); +/** + * bootstd_reset_usb() - Reset the USB subsystem + * + * Resets USB so that it can be started (and scanning) again. This is useful in + * tests which need to use USB. + */ +void bootstd_reset_usb(void); + #endif From patchwork Sun Aug 11 14:51:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971318 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=H22LxPDu; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhgkB2M3rz1yXh for ; Mon, 12 Aug 2024 00:57:54 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2B8DD88896; Sun, 11 Aug 2024 16:52:43 +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="H22LxPDu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A3698889E2; Sun, 11 Aug 2024 16:52:40 +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.2 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=unavailable autolearn_force=no version=3.4.2 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) (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 53C6988875 for ; Sun, 11 Aug 2024 16:52:38 +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-il1-x12d.google.com with SMTP id e9e14a558f8ab-39b3f65b387so14949065ab.1 for ; Sun, 11 Aug 2024 07:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387957; x=1723992757; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PgWBVMsTfftLFlwvDhcOJuEK4hUTgo7V5EPEbl+KdgI=; b=H22LxPDuNPOf9uNZHOueu3v5x6eP41n2hjTWezuu0NPdIfqfY8bc3ci4admnSqNgQ/ hKINs0uR8zupzrSgSUhhzmK9pOowoZnSQ4QmJzraaebs3Nuvl7l/d/j7aiQ2HG/WtaP5 UEtLQo5LwJmY/elssU18XMdFeLur41zQuqX2E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387957; x=1723992757; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PgWBVMsTfftLFlwvDhcOJuEK4hUTgo7V5EPEbl+KdgI=; b=ppm8K+u9inmC8Dxj8ttHBE3vLyxP5TMxVFq+MMXKc+AWLjScmQnDRxqrSiyLOm1kbf LhAiydloEOsLg2vaZ9+jmKEJbfhlXS5E3nsaODOdf8ZcDwDwAEvby67TbDdedWW2SY4O pjFq8+PYirsGyRIJluFa8ed9ZCoPBMe07UBlW0Ln10/Owr+oGN+r7mjp11FKlRgBv0kq WzMhHURyMA7EwQQm6Zy3Z/uF7mAlE54VwNBIT1tOtRJVnWz5Go7qS897FjAl9OhhQWnB AoWD6axc7B4B1k5ad1iRt2XMv1Qh/soqxqfiCgGp3S3GPaNgYkHTVag2L0SnlfpyrwYX MWQg== X-Gm-Message-State: AOJu0Yyhr9XIg+EuKMoX3g5PcW/dxMfQg3YY3vcxpC8atpVRpcBkgI5Y lVzidEQotberBQadoiTxiVwhTDGhch7hXVjh21AhQnz6Xqr+LN91x8IKYBjexsEVJlox8niQf3A = X-Google-Smtp-Source: AGHT+IFvqy3c70TkrRUT5kouKOKtQ87krT+oJc8jzL1hxoS38vUXFYV1LLWsUeBet3MvjRQ5x/ye2A== X-Received: by 2002:a05:6e02:1e01:b0:39a:e776:6c5 with SMTP id e9e14a558f8ab-39b748520b1mr97434885ab.1.1723387956966; Sun, 11 Aug 2024 07:52:36 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:36 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass , Marek Vasut Subject: [PATCH v3 07/40] usb: Drop old non-DM code Date: Sun, 11 Aug 2024 08:51:36 -0600 Message-Id: <20240811145209.4191404-8-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean The driver model deadline for USB was in 2019, so drop the old USB keyboard code, to avoid needing to deal with the extra code path. Drop the unnecessary #ifdef around USB_KBD_BOOT_REPORT_SIZE while we are here. Signed-off-by: Simon Glass --- (no changes since v1) cmd/usb.c | 20 -------------- common/usb_kbd.c | 67 --------------------------------------------- drivers/usb/Kconfig | 3 +- include/usb.h | 8 ------ 4 files changed, 2 insertions(+), 96 deletions(-) diff --git a/cmd/usb.c b/cmd/usb.c index 16c081bf128..13a2996c1f0 100644 --- a/cmd/usb.c +++ b/cmd/usb.c @@ -560,17 +560,6 @@ static int do_usbboot(struct cmd_tbl *cmdtp, int flag, int argc, } #endif /* CONFIG_USB_STORAGE */ -static int do_usb_stop_keyboard(int force) -{ -#if !defined CONFIG_DM_USB && defined CONFIG_USB_KEYBOARD - if (usb_kbd_deregister(force) != 0) { - printf("USB not stopped: usbkbd still using USB\n"); - return 1; - } -#endif - return 0; -} - static void do_usb_start(void) { bootstage_mark_name(BOOTSTAGE_ID_USB_START, "usb_start"); @@ -583,11 +572,6 @@ static void do_usb_start(void) /* try to recognize storage devices immediately */ usb_stor_curr_dev = usb_stor_scan(1); # endif -#ifndef CONFIG_DM_USB -# ifdef CONFIG_USB_KEYBOARD - drv_usb_kbd_init(); -# endif -#endif /* !CONFIG_DM_USB */ } #ifdef CONFIG_DM_USB @@ -633,8 +617,6 @@ static int do_usb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) if (strncmp(argv[1], "reset", 5) == 0) { printf("resetting USB...\n"); - if (do_usb_stop_keyboard(1) != 0) - return 1; usb_stop(); do_usb_start(); return 0; @@ -642,8 +624,6 @@ static int do_usb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) if (strncmp(argv[1], "stop", 4) == 0) { if (argc != 2) console_assign(stdin, "serial"); - if (do_usb_stop_keyboard(0) != 0) - return 1; printf("stopping USB..\n"); usb_stop(); return 0; diff --git a/common/usb_kbd.c b/common/usb_kbd.c index f3b4a3c94e6..b834b2f703d 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -643,71 +643,6 @@ static int probe_usb_keyboard(struct usb_device *dev) return 0; } -#if !CONFIG_IS_ENABLED(DM_USB) -/* Search for keyboard and register it if found. */ -int drv_usb_kbd_init(void) -{ - int error, i; - - debug("%s: Probing for keyboard\n", __func__); - /* Scan all USB Devices */ - for (i = 0; i < USB_MAX_DEVICE; i++) { - struct usb_device *dev; - - /* Get USB device. */ - dev = usb_get_dev_index(i); - if (!dev) - break; - - if (dev->devnum == -1) - continue; - - error = probe_usb_keyboard(dev); - if (!error) - return 1; - if (error && error != -ENOENT) - return error; - } - - /* No USB Keyboard found */ - return -1; -} - -/* Deregister the keyboard. */ -int usb_kbd_deregister(int force) -{ -#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) - struct stdio_dev *dev; - struct usb_device *usb_kbd_dev; - struct usb_kbd_pdata *data; - - dev = stdio_get_by_name(DEVNAME); - if (dev) { - usb_kbd_dev = (struct usb_device *)dev->priv; - data = usb_kbd_dev->privptr; -#if CONFIG_IS_ENABLED(CONSOLE_MUX) - if (iomux_replace_device(stdin, DEVNAME, force ? "nulldev" : "")) - return 1; -#endif - if (stdio_deregister_dev(dev, force) != 0) - return 1; -#ifdef CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE - destroy_int_queue(usb_kbd_dev, data->intq); -#endif - free(data->new); - free(data); - } - - return 0; -#else - return 1; -#endif -} - -#endif - -#if CONFIG_IS_ENABLED(DM_USB) - static int usb_kbd_probe(struct udevice *dev) { struct usb_device *udev = dev_get_parent_priv(dev); @@ -788,5 +723,3 @@ static const struct usb_device_id kbd_id_table[] = { }; U_BOOT_USB_DEVICE(usb_kbd, kbd_id_table); - -#endif diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index a972d87c7ad..311aaa7e67f 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig @@ -99,7 +99,8 @@ config USB_STORAGE config USB_KEYBOARD bool "USB Keyboard support" - select DM_KEYBOARD if DM_USB + depends on DM_USB + select DM_KEYBOARD select SYS_STDIO_DEREGISTER ---help--- Say Y here if you want to use a USB keyboard for U-Boot command line diff --git a/include/usb.h b/include/usb.h index fcbe2146f7d..e37f853482c 100644 --- a/include/usb.h +++ b/include/usb.h @@ -250,20 +250,12 @@ int usb_host_eth_scan(int mode); #endif -#ifdef CONFIG_USB_KEYBOARD - /* * USB Keyboard reports are 8 bytes in boot protocol. * Appendix B of HID Device Class Definition 1.11 */ #define USB_KBD_BOOT_REPORT_SIZE 8 -int drv_usb_kbd_init(void); -int usb_kbd_deregister(int force); - -#endif -/* routines */ - /* * usb_init() - initialize the USB Controllers * From patchwork Sun Aug 11 14:51:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971319 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=hVmv/cnG; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhgkN1KLsz1yXh for ; Mon, 12 Aug 2024 00:58:04 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8897988A02; Sun, 11 Aug 2024 16:52:43 +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="hVmv/cnG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 34820889F8; Sun, 11 Aug 2024 16:52:41 +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.2 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 mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) (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 0FF95884C3 for ; Sun, 11 Aug 2024 16:52:39 +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-il1-x136.google.com with SMTP id e9e14a558f8ab-396cc82f6d7so12024535ab.0 for ; Sun, 11 Aug 2024 07:52:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387958; x=1723992758; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VHucv9SvIxlH9ZUiFfnyDS+E5Bs/v1DYrZK8hA8K99E=; b=hVmv/cnGee5sER6GThOR5g8ObYvFcxAvDSVm8f3yzJENZdkJ30KOzUPp+O9IWhF9lF xTLpKojh2klGVebWb5iU7WcUOhpI079aO7woNla206g6hezfPSMeh6OwyDmT/202gHGP +BJX8sb3fd5EmoxlgIbikoflYH7FWVmB3mhIs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387958; x=1723992758; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VHucv9SvIxlH9ZUiFfnyDS+E5Bs/v1DYrZK8hA8K99E=; b=ahf4mSeMsTfwkIAXiDulJLutatKhvhOsd7Qu/oROFZexfEj6MzIkpkEiPBdUv4DpJi vNtx5cA4U4l1HBHNur+RniqTJSO6Ixt5/G9B/vK/7sbzML2JplhuwplIpvl4Z0gOVzPA 8wE9tigcShaYmU8AxZHqhO0b2Ko3RgtltyeqzF8vPL//3e/xQS4wjDyuBpCSapDIjkxL 90I/rvM+waxN2gldXQKVESrSMcyMGQfNAt2Y8IsWtV5RjIWab2O/mrTE3nhTgiUVmvK8 umCRF6VMpKY1Dr5gkr5QFa8efvzCKb4f4OqZzgz/4buctO2cc/D46uyiAb6OwpsZoqDz l/AQ== X-Gm-Message-State: AOJu0YzxfP9HqtY1plw75GIdTRlY/+51OSks1LckdOBzUviNplgconFX CGyha5d6h47SCV9PctRb/QaKGBJLuIdeNj36zlIQFKffVcqbx5C87zTr1fjz3M+lX4gKVuCt0vM = X-Google-Smtp-Source: AGHT+IEPewvsNDguI1w/o3LJFLgsQqCPeI07CYLxugcnuTV5DCZmR9p+2LK7wnmL7MtYmjCMq01/Og== X-Received: by 2002:a05:6e02:17c8:b0:399:df91:bf57 with SMTP id e9e14a558f8ab-39bc7050af6mr75595945ab.0.1723387957687; Sun, 11 Aug 2024 07:52:37 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:37 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 08/40] log: Add a new log category for the console Date: Sun, 11 Aug 2024 08:51:37 -0600 Message-Id: <20240811145209.4191404-9-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Add a new category which covers the console, including the stdio drivers. Signed-off-by: Simon Glass --- (no changes since v1) common/console.c | 2 ++ common/log.c | 1 + include/log.h | 2 ++ 3 files changed, 5 insertions(+) diff --git a/common/console.c b/common/console.c index 63f78004fdb..034942ec4a9 100644 --- a/common/console.c +++ b/common/console.c @@ -4,6 +4,8 @@ * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it */ +#define LOG_CATEGORY LOGC_CONSOLE + #include #include #include diff --git a/common/log.c b/common/log.c index dfee250b158..b83a6618900 100644 --- a/common/log.c +++ b/common/log.c @@ -31,6 +31,7 @@ static const char *const log_cat_name[] = { "event", "fs", "expo", + "console", }; _Static_assert(ARRAY_SIZE(log_cat_name) == LOGC_COUNT - LOGC_NONE, diff --git a/include/log.h b/include/log.h index fc0d5984472..2b86c7da3d4 100644 --- a/include/log.h +++ b/include/log.h @@ -104,6 +104,8 @@ enum log_category_t { LOGC_FS, /** @LOGC_EXPO: Related to expo handling */ LOGC_EXPO, + /** @LOGC_CONSOLE: Related to the console and stdio */ + LOGC_CONSOLE, /** @LOGC_COUNT: Number of log categories */ LOGC_COUNT, /** @LOGC_END: Sentinel value for lists of log categories */ From patchwork Sun Aug 11 14:51:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971320 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=FW2DYTYL; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhgkZ2PrCz1yXh for ; Mon, 12 Aug 2024 00:58:14 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E272388A28; Sun, 11 Aug 2024 16:52:43 +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="FW2DYTYL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CC2B7889E3; Sun, 11 Aug 2024 16:52:41 +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.2 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=unavailable autolearn_force=no version=3.4.2 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (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 C2B2588847 for ; Sun, 11 Aug 2024 16:52:39 +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-il1-x12b.google.com with SMTP id e9e14a558f8ab-39b41306b4dso12800725ab.3 for ; Sun, 11 Aug 2024 07:52:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387958; x=1723992758; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=F9s/eJiayLlbSa/uz8wqLFciI0yl+UMAyBLHukg/URw=; b=FW2DYTYLCqU5peK//bOtme6EZ7iRq17J41rR7gLL6coABTZGfqc6hdKOtiBNMyk5jk JLRIUW4USCWJ/TF7xT/DHBfnVIsl2VGjU5eZP9gXBruqu9ik7Tegz8Q7uM4jd34DjlCQ qoHwhSjrl8WYP7tMN+uEEnCpUqv4XY4CjT3a0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387958; x=1723992758; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F9s/eJiayLlbSa/uz8wqLFciI0yl+UMAyBLHukg/URw=; b=mafs5eDY2hKcwPEVTyuUs9var36mFCtSGT4GCKjcKK59yidHriv0KWaA6E9OgB8n1g lxHEHr9h0k15iCCqC0oabgP3EW0frOxy2i3GTkWK6q4F7I+0HhirJpm69EozbNhgC9gt waYmsQt86bUHDNUncShK4dglQTQQzRjV/K2RffvasR8d7VS9hXcuFmBvCATff8h0NW60 kvWR8FnW7iXJMb122xJO825qI8xqGsi4dMnqmKSBzcpNgE9B1fEYvjBORbNmnVkukJEr mZJ/reTbN5gLn+7wqoDQPNl1vcrB9fyWuqBtqN5yXM82Z7Yx5hE62QclZTzYHqUQfM+y 9AYw== X-Gm-Message-State: AOJu0YzkCVkS6W/dhjPSbvNIormPrpRLwsnLuuMuPy7MFzOKEI9HW86o 4pQ4WqoftKFYm4TQD/5C+7zEyn7RJ88QPzEage55KnwEoIknnEjnnp15Vjx/bHMaXlrFzEFGAWg = X-Google-Smtp-Source: AGHT+IEPQOCrB7/W580ljpdBUsFfUDT4ZNBBCfsT+Yy07EKOS3UtatoYHd/QlFbla8t0rxpSAWKMlg== X-Received: by 2002:a05:6e02:1e0c:b0:385:e2e5:ac37 with SMTP id e9e14a558f8ab-39b815a4ea5mr95389135ab.22.1723387958398; Sun, 11 Aug 2024 07:52:38 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:38 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass , Marek Vasut Subject: [PATCH v3 09/40] usb: Add DEV_FLAGS_DM to stdio for USB keyboard Date: Sun, 11 Aug 2024 08:51:38 -0600 Message-Id: <20240811145209.4191404-10-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean This device contains a pointer to struct udevice so set the flag indicating that, just to be tidy. Signed-off-by: Simon Glass --- (no changes since v1) common/usb_kbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/usb_kbd.c b/common/usb_kbd.c index b834b2f703d..1d9845b01ed 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -612,7 +612,7 @@ static int probe_usb_keyboard(struct usb_device *dev) debug("USB KBD: register.\n"); memset(&usb_kbd_dev, 0, sizeof(struct stdio_dev)); strcpy(usb_kbd_dev.name, DEVNAME); - usb_kbd_dev.flags = DEV_FLAGS_INPUT; + usb_kbd_dev.flags = DEV_FLAGS_INPUT | DEV_FLAGS_DM; usb_kbd_dev.getc = usb_kbd_getc; usb_kbd_dev.tstc = usb_kbd_testc; usb_kbd_dev.priv = (void *)dev; From patchwork Sun Aug 11 14:51:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971321 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=c4FWwViN; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgkm3KHYz1yXh for ; Mon, 12 Aug 2024 00:58:24 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4C5A588A41; Sun, 11 Aug 2024 16:52: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=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="c4FWwViN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C5920884DB; Sun, 11 Aug 2024 16:52:42 +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.2 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=unavailable autolearn_force=no version=3.4.2 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (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 9731088896 for ; Sun, 11 Aug 2024 16:52:40 +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-il1-x12b.google.com with SMTP id e9e14a558f8ab-39b3c36d3adso12547855ab.1 for ; Sun, 11 Aug 2024 07:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387959; x=1723992759; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QYBcHaXbM8ywBDl9v9kvTJKZHbpcbih0ve3Eeqyq6ek=; b=c4FWwViNcL1Yy5ejEZVLlQk9Ps2Bu1Yb0h/iVE4V2+OH383J71LKDhROftAWNwk010 KiL5JUqxS0V+Q8hmKzch3UNd1qTzjimfB9mgsvxKfalFVkeo7JHjpPpAtylRekkt2RWk qApfPo82MJXvcuZI3+/gSBtP/9pj2Eadn4Jd0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387959; x=1723992759; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QYBcHaXbM8ywBDl9v9kvTJKZHbpcbih0ve3Eeqyq6ek=; b=wdgj602HS+nLE8cV3b8zOWwv66/FG8sk0Ad14LUqqvx+Fd8Cznpuqk4mr43IlahwmR BVNXE8oDDLLPkaUdD+Li2PTnIAHAwcpLn5h49pmivYIeJ9/vcI0NT38ucfmQ2B9qfKy0 VEYscdyDrm5uL/V9O0g9y6xRcaNJntEvIjQRPzKZUaNA2XmrAfhzfwfRd8kfaTtfRnAf KHfAbssX+RwnPtz1Z4TT0T0xcm8vawfjRHfV2YKA7xOPtRSe68YGCQqrOouWAUVFdaIs rgn5UTovgAT/jmZzXx+mRzK4/iLaJfIBUlTPBMwslJKsaIbiX88dWepabAfMHBU5ok1c ewbA== X-Gm-Message-State: AOJu0Yz9GgDtKdW5Cp3wsZwbMlGVAVjcvPWj9kSYJgz+sPXfQnFhEkxy RCbqnAyrGFdnJQfyCPVYE/ApyBmmSpNHeE5jstY15WhNszmnfpSckqfDKVhOP/oK/SF5T6AKRpg = X-Google-Smtp-Source: AGHT+IHdN/RFJdtncxpI6sgzuOKVkdrnwLXT9QnLPq9opnrDHt2t+cLV9dG69uLoxQG4RuOdUu9LwQ== X-Received: by 2002:a92:ca4a:0:b0:39a:eb57:dc6 with SMTP id e9e14a558f8ab-39b7a412d8dmr103806655ab.12.1723387959212; Sun, 11 Aug 2024 07:52:39 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:38 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass , Marek Vasut , Pavel Herrmann Subject: [PATCH v3 10/40] dm: usb: Deal with USB keyboard persisting across tests Date: Sun, 11 Aug 2024 08:51:39 -0600 Message-Id: <20240811145209.4191404-11-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Clear any USB-keyboard devices before running a unit test, to avoid using a stale udevice pointer in stdio. Add a long comment to explain this situation and why this solution seems best, at least for now. Signed-off-by: Simon Glass --- (no changes since v1) common/console.c | 34 ++++++++++++++++++++++++++++++++++ common/usb_kbd.c | 5 +++++ include/console.h | 8 ++++++++ include/usb.h | 12 ++++++++++++ test/test-main.c | 38 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 97 insertions(+) diff --git a/common/console.c b/common/console.c index 034942ec4a9..17dceba40b8 100644 --- a/common/console.c +++ b/common/console.c @@ -1241,3 +1241,37 @@ int console_init_r(void) } #endif /* CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV) */ + +int console_remove_by_name(const char *name) +{ + int err = 0; + +#if CONFIG_IS_ENABLED(CONSOLE_MUX) + int fnum; + + log_debug("removing console device %s\n", name); + for (fnum = 0; fnum < MAX_FILES; fnum++) { + struct stdio_dev **src, **dest; + int i; + + log_debug("file %d: %d devices: ", fnum, cd_count[fnum]); + src = console_devices[fnum]; + dest = src; + for (i = 0; i < cd_count[fnum]; i++, src++) { + struct stdio_dev *sdev = *src; + int ret = 0; + + if (!strcmp(sdev->name, name)) + ret = stdio_deregister_dev(sdev, true); + else + *dest++ = *src; + if (ret && !err) + err = ret; + } + cd_count[fnum] = dest - console_devices[fnum]; + log_debug("now %d\n", cd_count[fnum]); + } +#endif /* CONSOLE_MUX */ + + return err; +} diff --git a/common/usb_kbd.c b/common/usb_kbd.c index 1d9845b01ed..bbfee23bc26 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -137,6 +137,11 @@ extern int __maybe_unused net_busy_flag; /* The period of time between two calls of usb_kbd_testc(). */ static unsigned long kbd_testc_tms; +int usb_kbd_remove_for_test(void) +{ + return console_remove_by_name(DEVNAME); +} + /* Puts character in the queue and sets up the in and out pointer. */ static void usb_kbd_put_queue(struct usb_kbd_pdata *data, u8 c) { diff --git a/include/console.h b/include/console.h index 2617e160073..125f498facb 100644 --- a/include/console.h +++ b/include/console.h @@ -179,6 +179,14 @@ void console_puts_select_stderr(bool serial_only, const char *s); */ int console_clear(void); +/** + * console_remove_by_name() - Remove a console by its stdio name + * + * This must only be used in tests. It removes any use of the named stdio device + * from the console tables. + */ +int console_remove_by_name(const char *name); + /* * CONSOLE multiplexing. */ diff --git a/include/usb.h b/include/usb.h index e37f853482c..be37ed272e1 100644 --- a/include/usb.h +++ b/include/usb.h @@ -1092,4 +1092,16 @@ struct usb_generic_descriptor **usb_emul_find_descriptor( */ void usb_show_tree(void); +/** + * usb_kbd_remove_for_test() - Remove any USB keyboard + * + * This can only be called from test_pre_run(). It removes the USB keyboard from + * the console system so that the USB device can be dropped + */ +#if CONFIG_IS_ENABLED(USB_KEYBOARD) +int usb_kbd_remove_for_test(void); +#else +static inline int usb_kbd_remove_for_test(void) { return 0; } +#endif + #endif /*_USB_H_ */ diff --git a/test/test-main.c b/test/test-main.c index 3fa6f6e32ec..bfe9f707dc1 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -289,6 +290,43 @@ static int test_pre_run(struct unit_test_state *uts, struct unit_test *test) { ut_assertok(event_init()); + /* + * Remove any USB keyboard, so that we can add and remove USB devices + * in tests. + * + * For UT_TESTF_DM tests, the old driver model state is saved and + * restored across each test. Within in each test there is therefore a + * new driver model state, which means that any USB keyboard device in + * stdio points to the old state. + * + * This is fine in most cases. But if a non-UT_TESTF_DM test starts up + * USB (thus creating a stdio record pointing to the USB keyboard + * device) then when the test finishes, the new driver model state is + * freed, meaning that there is now a stale pointer in stdio. + * + * This means that any future UT_TESTF_DM test which uses stdin will + * cause the console system to call tstc() on the stale device pointer, + * causing a crash. + * + * We don't want to fix this by enabling UT_TESTF_DM for all tests as + * this causes other problems. For example, bootflow_efi relies on + * U-Boot going through a proper init - without that we don't have the + * TCG measurement working and get an error + * 'tcg2 measurement fails(0x8000000000000007)'. Once we tidy up how EFI + * runs tests (e.g. get rid of all the restarting of U-Boot) we could + * potentially make the bootstd tests set UT_TESTF_DM, but other tests + * might do the same thing. + * + * We could add a test flag to declare that USB is being used, but that + * seems unnecessary, at least for now. We could detect USB being used + * in a test, but there is no obvious drawback to clearing out stale + * pointers always. + * + * So just remove any USB keyboards from the console tables. This allows + * UT_TESTF_DM and non-UT_TESTF_DM tests to coexist happily. + */ + usb_kbd_remove_for_test(); + if (test->flags & UT_TESTF_DM) ut_assertok(dm_test_pre_run(uts)); From patchwork Sun Aug 11 14:51:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971322 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=EODtTiOE; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgkz4Y2yz1yXh for ; Mon, 12 Aug 2024 00:58:35 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A469888A55; Sun, 11 Aug 2024 16:52: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=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="EODtTiOE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7353588A0D; Sun, 11 Aug 2024 16:52:43 +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.2 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 mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) (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 5DE40889CB for ; Sun, 11 Aug 2024 16:52: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-il1-x12e.google.com with SMTP id e9e14a558f8ab-39b3f65b387so14949195ab.1 for ; Sun, 11 Aug 2024 07:52:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387960; x=1723992760; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qrSVzAkp7naUgUE3XYQzs/Z2IurA4XQDWXjDC7baz94=; b=EODtTiOEubxs7xUVt4ISgl0KZs4I9/SEPCiv0NnHOU4fiv6IcJ7MkUMkx2TYH2ot5i 2RiXeaY8d6Xcw9Mwc32ZHmYbgaTg+y/qMyFa46YPxBMxsOUkSpulQCf90mg8jJvd4y73 sZmmOheJhM5rAghyz1/qyGRvchKHe/+NzpDxw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387960; x=1723992760; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qrSVzAkp7naUgUE3XYQzs/Z2IurA4XQDWXjDC7baz94=; b=DfHnnJE0+hlGIXc3PE9B7/n87Num9Hto4Y6eUpm9erHaTM32DtJkfOAhpvPFfhv849 L4tKxCFOlstuLdEsina3KaXVk0WT+x4Ra99in3CuMVYOpizQVzGqPHm3o6qu2lZKIBLn kkUHrgetjAXjL8IALh2oPIRrcK4Dj0swnonNKu+MgzN0uGbphp/BL3oU/4srOBd4aRNi 5Kg4ex5CCqgXyOLdy/nbPL0lZ5meUgobMSln1/qJ2HKPtB5djWAHnbIdYXqrID0PHemm qatjQBHyepGRww0moWNo4iKV1x/toKz+xvylXi3atJWgQ35yAHW1A6LEVs7bsjFWWnwt Oeag== X-Gm-Message-State: AOJu0Yzcd6g+KciOsK1uQnHR3R0tqpTxXYcg2ZUkBCHGKq2nVzBbM6k+ fGMdV5t1yidC2bFl2QPB++t9ErU52PT3DXthCIGWvRjNOMAHX6SxpyIkxBKtbRqZbhcZcPzPVl0 = X-Google-Smtp-Source: AGHT+IFYBuyrS+NbybUsop1G+WVy/+kWg/7QXCBXTecpWtXS+gKpvZ7EKMOnD+FIf36BRwYTQZROMA== X-Received: by 2002:a05:6e02:1a65:b0:39a:ea6a:9a82 with SMTP id e9e14a558f8ab-39b7a41e62amr106532945ab.13.1723387960083; Sun, 11 Aug 2024 07:52:40 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:39 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 11/40] test: mbr: Adjust test to use lower-case hex Date: Sun, 11 Aug 2024 08:51:40 -0600 Message-Id: <20240811145209.4191404-12-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Switch to lower-case hex which is more commonly used in U-Boot. Signed-off-by: Simon Glass --- (no changes since v1) test/cmd/mbr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/cmd/mbr.c b/test/cmd/mbr.c index 235b363290e..4c884af10c7 100644 --- a/test/cmd/mbr.c +++ b/test/cmd/mbr.c @@ -50,7 +50,7 @@ static char * mbr_parts_tail = "'"; 000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| */ -static unsigned mbr_cmp_start = 0x1B8; +static unsigned int mbr_cmp_start = 0x1b8; static unsigned mbr_cmp_size = 0x48; static unsigned char mbr_parts_ref_p1[] = { 0x78, 0x56, 0x34, 0x12, 0x00, 0x00, 0x80, 0x05, @@ -257,7 +257,7 @@ static int mbr_test_run(struct unit_test_state *uts) mbr_wa = map_to_sysmem(mbr_wbuf); ebr_wa = map_to_sysmem(ebr_wbuf); ra = map_to_sysmem(rbuf); - ebr_blk = (ulong)0xB00000 / 0x200; + ebr_blk = (ulong)0xb00000 / 0x200; /* Make sure mmc6 exists */ ut_asserteq(6, blk_get_device_by_str("mmc", "6", &mmc_dev_desc)); @@ -268,7 +268,8 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Make sure mmc6 is 12+ MiB in size */ - ut_assertok(run_commandf("mmc read 0x%lx 0x%lx 1", ra, (ulong)0xBFFE00 / 0x200)); + ut_assertok(run_commandf("mmc read 0x%lx 0x%lx 1", ra, + (ulong)0xbffe00 / 0x200)); /* Test one MBR partition */ init_write_buffers(mbr_wbuf, sizeof(mbr_wbuf), ebr_wbuf, sizeof(ebr_wbuf), __LINE__); From patchwork Sun Aug 11 14:51:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971323 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=EmizTIgO; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhglB3gmHz1yXh for ; Mon, 12 Aug 2024 00:58:46 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0983788A29; Sun, 11 Aug 2024 16:52:46 +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="EmizTIgO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AB1A288A39; Sun, 11 Aug 2024 16:52: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.2 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 mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) (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 537F5889E3 for ; Sun, 11 Aug 2024 16:52: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-io1-xd2a.google.com with SMTP id ca18e2360f4ac-81f861f369aso140333239f.0 for ; Sun, 11 Aug 2024 07:52:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387961; x=1723992761; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5YVDV66ck5Lp+AyOKOisHSkjBVWjbF4qL0kXYC8tP5A=; b=EmizTIgOWKh/nTujX1DZ4vKe7ndaN+NYS+WeKYpQXo0uHlHq/b1jaJGdSlc6acXU8G gLRI0Xzaf3Q192kInso4tTVZtff3yM2Lyo81fqn6GAeBdWeHRULLzesWAbEEj7MbkVro qcvjAu3i8otx20ler2TwgTSJJ0CFdAfx63+uc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387961; x=1723992761; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5YVDV66ck5Lp+AyOKOisHSkjBVWjbF4qL0kXYC8tP5A=; b=btcLl/dpcKcVc4A6ecoQERvRwDOA4rmzlrfKXJamv1ORCJGuFFY3A6+bcs1UNP+rd4 czzQkssHiSr+Ftsmg+1JlnADrvsQtPr9nU+H7JaaRR38h18T0/4jmwjelBeWmHofxWX+ Rb3bJNKV4/ZQTOeE0WC+mxOt32cCfrDd0FwPOmaChqTX8RdqFvNm3MOGIoJjpRxzurIA LdK5UxxCBIbQwzdsot7DjG3P6NzyTN0u7fN3I8idUJh5YktFR4L3K3nVsV0yV2ZGFyxA h54SerA/p1s+upgXeBD67wDFEgOnCmKYaL3whc6wIk1qInSVKkKsf12tDG6i6q8Q1A1V Kyyw== X-Gm-Message-State: AOJu0Yyiy5SmobSE4Z3HIT74Nh1n22DwXiLy1dxRx7bM2PyBZi/R7jRp brvUo+UIwLSUgbjKZA3YAUbuzWYe7R4Z8f1NMiDHff7vgS0mVTKy9ANabUzzPuZkqgjnhLWwnPM = X-Google-Smtp-Source: AGHT+IHOkOKcP4pONsEZ30/dLoe3yh1ZRMrLVgOUyKcBrLcMlYMUFTmt1GVRBEfeD/7wombSFPeOIw== X-Received: by 2002:a05:6e02:1c05:b0:398:a9b3:d6b1 with SMTP id e9e14a558f8ab-39bd8c50832mr66421705ab.12.1723387960878; Sun, 11 Aug 2024 07:52:40 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:40 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 12/40] test: mbr: Adjust test to drop 0x Date: Sun, 11 Aug 2024 08:51:41 -0600 Message-Id: <20240811145209.4191404-13-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean U-Boot commands typically don't need 0x to specify hex, since they use hex by default. Adding 0x in this test is confusing since it suggests that it is necessary. Drop it from the file. Also use the %#x construct to get the 0x when needed. Signed-off-by: Simon Glass --- (no changes since v1) test/cmd/mbr.c | 74 +++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/test/cmd/mbr.c b/test/cmd/mbr.c index 4c884af10c7..1a35ba3351c 100644 --- a/test/cmd/mbr.c +++ b/test/cmd/mbr.c @@ -268,19 +268,19 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Make sure mmc6 is 12+ MiB in size */ - ut_assertok(run_commandf("mmc read 0x%lx 0x%lx 1", ra, + ut_assertok(run_commandf("mmc read %lx %lx 1", ra, (ulong)0xbffe00 / 0x200)); /* Test one MBR partition */ init_write_buffers(mbr_wbuf, sizeof(mbr_wbuf), ebr_wbuf, sizeof(ebr_wbuf), __LINE__); ut_assertok(build_mbr_parts(mbr_parts_buf, sizeof(mbr_parts_buf), 1)); - ut_assertok(run_commandf("write mmc 6:0 0x%lx 0 1", mbr_wa)); + ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0 1", ra)); + ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); ut_assertok(memcmp(mbr_wbuf, rbuf, 512)); - ut_assertok(run_commandf("write mmc 6:0 0x%lx 0x%lx 1", ebr_wa, ebr_blk)); + ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); + ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); ut_assertok(console_record_reset_enable()); ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); @@ -289,7 +289,7 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assertok(run_commandf("mbr verify mmc 6")); ut_assert_nextline("MBR: verify success!"); memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); + ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); ut_assertok(ut_check_console_end(uts)); /* @@ -300,23 +300,23 @@ static int mbr_test_run(struct unit_test_state *uts) 000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| */ memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0 1", ra)); + ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); for (unsigned i = 0; i < mbr_cmp_size; i++) { ut_assertf(rbuf[mbr_cmp_start + i] == mbr_parts_ref_p1[i], - "1P MBR+0x%04X: expected 0x%02X, actual: 0x%02X\n", + "1P MBR+0x%04X: expected %#02X, actual: %#02X\n", mbr_cmp_start + i, mbr_parts_ref_p1[i], rbuf[mbr_cmp_start + i]); } /* Test two MBR partitions */ init_write_buffers(mbr_wbuf, sizeof(mbr_wbuf), ebr_wbuf, sizeof(ebr_wbuf), __LINE__); ut_assertok(build_mbr_parts(mbr_parts_buf, sizeof(mbr_parts_buf), 2)); - ut_assertok(run_commandf("write mmc 6:0 0x%lx 0 1", mbr_wa)); + ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0 1", ra)); + ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); ut_assertok(memcmp(mbr_wbuf, rbuf, 512)); - ut_assertok(run_commandf("write mmc 6:0 0x%lx 0x%lx 1", ebr_wa, ebr_blk)); + ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); + ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); ut_assertok(console_record_reset_enable()); ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); @@ -325,7 +325,7 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assertok(run_commandf("mbr verify mmc 6")); ut_assert_nextline("MBR: verify success!"); memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); + ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); ut_assertok(ut_check_console_end(uts)); /* @@ -336,23 +336,23 @@ static int mbr_test_run(struct unit_test_state *uts) 000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| */ memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0 1", ra)); + ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); for (unsigned i = 0; i < mbr_cmp_size; i++) { ut_assertf(rbuf[mbr_cmp_start + i] == mbr_parts_ref_p2[i], - "2P MBR+0x%04X: expected 0x%02X, actual: 0x%02X\n", + "2P MBR+0x%04X: expected %#02X, actual: %#02X\n", mbr_cmp_start + i, mbr_parts_ref_p2[i], rbuf[mbr_cmp_start + i]); } /* Test three MBR partitions */ init_write_buffers(mbr_wbuf, sizeof(mbr_wbuf), ebr_wbuf, sizeof(ebr_wbuf), __LINE__); ut_assertok(build_mbr_parts(mbr_parts_buf, sizeof(mbr_parts_buf), 3)); - ut_assertok(run_commandf("write mmc 6:0 0x%lx 0 1", mbr_wa)); + ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0 1", ra)); + ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); ut_assertok(memcmp(mbr_wbuf, rbuf, 512)); - ut_assertok(run_commandf("write mmc 6:0 0x%lx 0x%lx 1", ebr_wa, ebr_blk)); + ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); + ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); ut_assertok(console_record_reset_enable()); ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); @@ -361,7 +361,7 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assertok(run_commandf("mbr verify mmc 6")); ut_assert_nextline("MBR: verify success!"); memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); + ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); ut_assertok(ut_check_console_end(uts)); /* @@ -372,23 +372,23 @@ static int mbr_test_run(struct unit_test_state *uts) 000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| */ memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0 1", ra)); + ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); for (unsigned i = 0; i < mbr_cmp_size; i++) { ut_assertf(rbuf[mbr_cmp_start + i] == mbr_parts_ref_p3[i], - "3P MBR+0x%04X: expected 0x%02X, actual: 0x%02X\n", + "3P MBR+0x%04X: expected %#02X, actual: %#02X\n", mbr_cmp_start + i, mbr_parts_ref_p3[i], rbuf[mbr_cmp_start + i]); } /* Test four MBR partitions */ init_write_buffers(mbr_wbuf, sizeof(mbr_wbuf), ebr_wbuf, sizeof(ebr_wbuf), __LINE__); ut_assertok(build_mbr_parts(mbr_parts_buf, sizeof(mbr_parts_buf), 4)); - ut_assertok(run_commandf("write mmc 6:0 0x%lx 0 1", mbr_wa)); + ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0 1", ra)); + ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); ut_assertok(memcmp(mbr_wbuf, rbuf, 512)); - ut_assertok(run_commandf("write mmc 6:0 0x%lx 0x%lx 1", ebr_wa, ebr_blk)); + ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); + ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); ut_assertok(console_record_reset_enable()); ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); @@ -397,7 +397,7 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assertok(run_commandf("mbr verify mmc 6")); ut_assert_nextline("MBR: verify success!"); memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); + ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); ut_assertok(ut_check_console_end(uts)); /* @@ -408,23 +408,23 @@ static int mbr_test_run(struct unit_test_state *uts) 000001f0 26 01 0e 87 06 01 00 58 00 00 00 08 00 00 55 aa |&......X......U.| */ memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0 1", ra)); + ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); for (unsigned i = 0; i < mbr_cmp_size; i++) { ut_assertf(rbuf[mbr_cmp_start + i] == mbr_parts_ref_p4[i], - "4P MBR+0x%04X: expected 0x%02X, actual: 0x%02X\n", + "4P MBR+0x%04X: expected %#02X, actual: %#02X\n", mbr_cmp_start + i, mbr_parts_ref_p4[i], rbuf[mbr_cmp_start + i]); } /* Test five MBR partitions */ init_write_buffers(mbr_wbuf, sizeof(mbr_wbuf), ebr_wbuf, sizeof(ebr_wbuf), __LINE__); ut_assertok(build_mbr_parts(mbr_parts_buf, sizeof(mbr_parts_buf), 5)); - ut_assertok(run_commandf("write mmc 6:0 0x%lx 0 1", mbr_wa)); + ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0 1", ra)); + ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); ut_assertok(memcmp(mbr_wbuf, rbuf, 512)); - ut_assertok(run_commandf("write mmc 6:0 0x%lx 0x%lx 1", ebr_wa, ebr_blk)); + ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); + ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); ut_assertok(console_record_reset_enable()); ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); @@ -441,10 +441,10 @@ static int mbr_test_run(struct unit_test_state *uts) 000001f0 26 01 05 a7 26 01 00 58 00 00 00 10 00 00 55 aa |&...&..X......U.| */ memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0 1", ra)); + ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); for (unsigned i = 0; i < mbr_cmp_size; i++) { ut_assertf(rbuf[mbr_cmp_start + i] == mbr_parts_ref_p5[i], - "5P MBR+0x%04X: expected 0x%02X, actual: 0x%02X\n", + "5P MBR+0x%04X: expected %#02X, actual: %#02X\n", mbr_cmp_start + i, mbr_parts_ref_p5[i], rbuf[mbr_cmp_start + i]); } /* @@ -455,10 +455,10 @@ static int mbr_test_run(struct unit_test_state *uts) 00b001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| */ memset(rbuf, 0, sizeof(rbuf)); - ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); + ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); for (unsigned i = 0; i < ebr_cmp_size; i++) { ut_assertf(rbuf[ebr_cmp_start + i] == ebr_parts_ref_p5[i], - "5P EBR+0x%04X: expected 0x%02X, actual: 0x%02X\n", + "5P EBR+0x%04X: expected %#02X, actual: %#02X\n", ebr_cmp_start + i, ebr_parts_ref_p5[i], rbuf[ebr_cmp_start + i]); } From patchwork Sun Aug 11 14:51:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971324 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=OlNRdebX; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhglP0NLYz1yXh for ; Mon, 12 Aug 2024 00:58:57 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 644FA88A24; Sun, 11 Aug 2024 16:52:47 +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="OlNRdebX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 38DC888A39; Sun, 11 Aug 2024 16:52:45 +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.2 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 mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) (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 19329884DB for ; Sun, 11 Aug 2024 16:52:43 +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-il1-x135.google.com with SMTP id e9e14a558f8ab-39b3e12754eso11984845ab.1 for ; Sun, 11 Aug 2024 07:52:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387962; x=1723992762; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MbRvL/gv9suH73qyXpX8t6OBHblwSrVMWu3bD+fTzdk=; b=OlNRdebXIZGjGuggVKIyQ0LmbziTwuNpT9kcVzC3kzsVQpiGTY34AO2zODIp2FVIQ2 cxZJKgdhUl2J0Ni9NpFY5YxTvQQW4SPGRW/DDybPKAivS41nMJ1uXI+zauuYsHhGTNYT cHdry9vnY4AEJtoRZiIDJJ+SyjSVDZS0rs0Lw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387962; x=1723992762; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MbRvL/gv9suH73qyXpX8t6OBHblwSrVMWu3bD+fTzdk=; b=WGDhuNC3GFtCrU1RsvGTSYf8zZSWAJD4DWrQdQmjjnEkW2WV1/rKem+tv/jjnrFAXL K93eLlIYJM1X73eq0BMjxrUdKZeejpFC+xOJyn4Eza5Ou8OhPL+9jCbAeo4Zqvbn5qv6 PAyWRL5hRfGtTVsLL8Vgba6YVBq6zp9snI77JuEOQI5ghnHjFuouVqK+YzaqEJAhQxhr GoVhzzcmTk5q57ONg5KIhiQGTqhBcrtgY3mnBL3c5Fx4JT13cU322olXFAME2y6lwaSp WhBTP8oC9fadFV/xIEpIi7Krwn/CsXWmo3AE7DCQcq6boxblx32tAckrP2VgImpvlObB GFyA== X-Gm-Message-State: AOJu0YwL7HccarYNIGWS7wjTFmyht5faeRFcqx655TS5JvB21LQAlsN2 82Idbk2xso6Exg8akvYQk9jYcqGBkAaMEXugNJfuuvDzyuNngSsmPE5grhKJE6K2c+LIqimqqiE = X-Google-Smtp-Source: AGHT+IEjgyRDz9c+U8GflToj9GlJcemXd65bmvbPVWlrgprFHuWziK1e1VMmML3rn7SDniDgpkPQ5g== X-Received: by 2002:a05:6e02:194f:b0:39a:e9c4:6baf with SMTP id e9e14a558f8ab-39b86f73f80mr83977485ab.26.1723387961746; Sun, 11 Aug 2024 07:52:41 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:41 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 13/40] sandbox: Change the range used for memory-mapping tags Date: Sun, 11 Aug 2024 08:51:42 -0600 Message-Id: <20240811145209.4191404-14-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Sandbox keeps a table of addresses which map to pointers which are outside its emulated DRAM. The current range from 10000000 conflicts with the PCI range, meaning that if PCI mapping is on, that particular address can be decoded by PCI instead of the table. Fix this by moving the range up to the top of memory. Update the docs while we are here. Signed-off-by: Simon Glass --- (no changes since v1) arch/sandbox/cpu/state.c | 9 +++++---- doc/arch/sandbox/sandbox.rst | 21 ++++++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index a9ca79e76d2..49236db99c2 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -373,12 +373,13 @@ void state_reset_for_test(struct sandbox_state *state) memset(state->spi, '\0', sizeof(state->spi)); /* - * Set up the memory tag list. Use the top of emulated SDRAM for the - * first tag number, since that address offset is outside the legal - * range, and can be assumed to be a tag. + * Set up the memory tag list. We could use the top of emulated SDRAM + * for the first tag number, since that address offset is outside the + * legal SDRAM range, but PCI can have address there. So use a very + * large address instead */ INIT_LIST_HEAD(&state->mapmem_head); - state->next_tag = state->ram_size; + state->next_tag = 0xff000000; } bool autoboot_keyed(void) diff --git a/doc/arch/sandbox/sandbox.rst b/doc/arch/sandbox/sandbox.rst index 5f8db126657..1515f93c84b 100644 --- a/doc/arch/sandbox/sandbox.rst +++ b/doc/arch/sandbox/sandbox.rst @@ -655,14 +655,17 @@ Memory Map Sandbox has its own emulated memory starting at 0. Here are some of the things that are mapped into that memory: -======= ======================== =============================== +======== ======================== =============================== Addr Config Usage -======= ======================== =============================== - 100 CONFIG_SYS_FDT_LOAD_ADDR Device tree - b000 CONFIG_BLOBLIST_ADDR Blob list - 10000 CFG_MALLOC_F_ADDR Early memory allocation - f0000 CONFIG_PRE_CON_BUF_ADDR Pre-console buffer - 100000 CONFIG_TRACE_EARLY_ADDR Early trace buffer (if enabled). Also used +======== ======================== =============================== + 100 CONFIG_SYS_FDT_LOAD_ADDR Device tree + b000 CONFIG_BLOBLIST_ADDR Blob list + 10000 CFG_MALLOC_F_ADDR Early memory allocation + f0000 CONFIG_PRE_CON_BUF_ADDR Pre-console buffer + 100000 CONFIG_TRACE_EARLY_ADDR Early trace buffer (if enabled). Also used as the SPL load buffer in spl_test_load(). - 200000 CONFIG_TEXT_BASE Load buffer for U-Boot (sandbox_spl only) -======= ======================== =============================== + 200000 CONFIG_TEXT_BASE Load buffer for U-Boot (sandbox_spl only) +10000000 PCI address space (see test.dts) + +ff000000 Memory-mapping tags start here +======== ======================== =============================== From patchwork Sun Aug 11 14:51:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971327 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=jbo3bdTJ; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgm021JNz1yXh for ; Mon, 12 Aug 2024 00:59:28 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 83CDE88A21; Sun, 11 Aug 2024 16:52:50 +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="jbo3bdTJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6679588A2F; Sun, 11 Aug 2024 16:52: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.2 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 mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) (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 B5B4488A13 for ; Sun, 11 Aug 2024 16:52:43 +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-il1-x136.google.com with SMTP id e9e14a558f8ab-39b3754468eso12825325ab.2 for ; Sun, 11 Aug 2024 07:52:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387962; x=1723992762; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3GU3G0qlXd2GDT1N3EisU4gxjskpK1YtUBWVmLnEdRo=; b=jbo3bdTJWB9bG9jXF1L3r31rK0Hast/bPUHBGNlKlw2x5oAAZtq/IHwlrc6UhLZLBW fdcv4oYALzSya9bvACM7WG2tdleHrqq2XqhgBhwDumOPxrCNbtDy4uEY0ONwv1udJMHV DDFdlX2J3otTBYywbQbiFnem+3pXyHmbRbW68= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387962; x=1723992762; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3GU3G0qlXd2GDT1N3EisU4gxjskpK1YtUBWVmLnEdRo=; b=msW+puiHRQ8VmxO2XjMfhMWObb1VRxBEnMFOARyTyb3/Qy9+5vUGEUpo64C9FxKzCq y0zmFKWdQWBgmmdyampYwDqQvga7GDIGozCp2y3Jaqdj+aggBY2bN1v67qHMFcYoqlwK tzaEc1mW+zJlv8TdFxY86BAYfcr8sW6t0d31ttcaOqqKRFvNu7AmY7SwFqDC7GYhnRyC /0sLpickCfKamnD/Eph6gEM/JXgfXyLdq8pMpTu3va/kxe8HVCGHi7R0LNm+R7gBVl4o 3vm+4xLujplDiU3n0LVqMm4b531bkZjNtPwGmw0+FLc9odI8+LRYTD8HRrcyQK/B6s4+ 9H/w== X-Gm-Message-State: AOJu0YxIsVoiqmYycOwLZ1/Y9W9IZI75t7VyDL8yICVISkWcbOHV4fSf m4KnrMeMAYcqODAkUpnVmCgOljEmQxo9zwDY8mWzXmn/+GoY0K9WS6FfQzh82m9gxOmszVnt5fU = X-Google-Smtp-Source: AGHT+IEWkBAq7aBvOD/tZl/SQkxo91/p13p3nb69Y1b/XjrIUvSWnvuEdpsyLaAz+GvoTPFk3FLlVQ== X-Received: by 2002:a05:6e02:1fc5:b0:397:6dfc:993a with SMTP id e9e14a558f8ab-39b7a449735mr81228095ab.21.1723387962446; Sun, 11 Aug 2024 07:52:42 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:42 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 14/40] sandbox: Update cpu to use logging Date: Sun, 11 Aug 2024 08:51:43 -0600 Message-Id: <20240811145209.4191404-15-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Use log_debug() instead of including the function name in the string. Add one more debug for PCI. Signed-off-by: Simon Glass --- (no changes since v1) arch/sandbox/cpu/cpu.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index 4f15a560902..8eb055d6837 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -109,8 +109,8 @@ void *phys_to_virt(phys_addr_t paddr) state = state_get_current(); list_for_each_entry(mentry, &state->mapmem_head, sibling_node) { if (mentry->tag == paddr) { - debug("%s: Used map from %lx to %p\n", __func__, - (ulong)paddr, mentry->ptr); + log_debug("Used map from %lx to %p\n", (ulong)paddr, + mentry->ptr); return mentry->ptr; } } @@ -130,11 +130,12 @@ struct sandbox_mapmem_entry *find_tag(const void *ptr) list_for_each_entry(mentry, &state->mapmem_head, sibling_node) { if (mentry->ptr == ptr) { - debug("%s: Used map from %p to %lx\n", __func__, ptr, - mentry->tag); + log_debug("Used map from %p to %lx\n", ptr, + mentry->tag); return mentry; } } + return NULL; } @@ -156,7 +157,7 @@ phys_addr_t virt_to_phys(void *ptr) __func__, ptr, (ulong)gd->ram_size); os_abort(); } - debug("%s: Used map from %p to %lx\n", __func__, ptr, mentry->tag); + log_debug("Used map from %p to %lx\n", ptr, mentry->tag); return mentry->tag; } @@ -174,6 +175,7 @@ void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) __func__, (uint)paddr, len, plen); } map_len = len; + log_debug("pci map %lx -> %p\n", (ulong)paddr, ptr); return ptr; } #endif @@ -218,8 +220,8 @@ phys_addr_t map_to_sysmem(const void *ptr) mentry->tag = state->next_tag++; mentry->ptr = (void *)ptr; list_add_tail(&mentry->sibling_node, &state->mapmem_head); - debug("%s: Added map from %p to %lx\n", __func__, ptr, - (ulong)mentry->tag); + log_debug("Added map from %p to %lx\n", ptr, + (ulong)mentry->tag); } /* From patchwork Sun Aug 11 14:51:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971325 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=EoObErIg; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whglc08PMz1yXh for ; Mon, 12 Aug 2024 00:59:08 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BCB4C88A05; Sun, 11 Aug 2024 16:52: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="EoObErIg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 86746887E8; Sun, 11 Aug 2024 16:52: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.2 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 mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) (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 8359B88A37 for ; Sun, 11 Aug 2024 16:52: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-il1-x12c.google.com with SMTP id e9e14a558f8ab-39b3a6a7941so12993265ab.0 for ; Sun, 11 Aug 2024 07:52:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387963; x=1723992763; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KempVwTGPJGo0sivKvaUCUHvMMsZ7czBFCqaB5M1H0M=; b=EoObErIgdMCLK2qQK2Ymj71l/QgYmRhxY/UOjSEPDUFtA4wyJ02xjnz6fTbRF6N5mX Y6hJsg8OAD8DGtXxwLwn3vXJvCrjVzAAaoEH+15/FtZd5tzvKzENQf64QeFtaCyQl/Ct jyb5B0DVVE3nohx6wGmeUlu27U8jmhDqiVmi0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387963; x=1723992763; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KempVwTGPJGo0sivKvaUCUHvMMsZ7czBFCqaB5M1H0M=; b=WdelGCZYyTLV8hdtAxpnv454vMgnMa1bb/mfnI468iLuCPKNaRdNHrfZ91DNVBaE9C /DE3YgQi+ehu1odrGTkLX0Dh7/+6YLO6WCaJ3+I4jAD+/x40DR7aC9+kdODhNbnYt5Xg w3qko0VD9b5yL1LG0D/RTfxJ0pkQROVomV86TiyYF8Qc5/oU3qoiKZGr+8sUG8+Ue44A i4qDrxG2Wy9ozqz7CVp8kYBlmgifF3bsg8ECx3me4/ziBnDzQqhzAPTfm7C1cWnyxTqp 5DvgUXr6ycl7PSXO2ktv5m0VscxV/XOI9avgq27jasO2Lgt9bgUf5dvJxdddELatzhCj fzaA== X-Gm-Message-State: AOJu0Yz33XVK58A2nz9dPjqh89Z3nd3g9g5lNn6g8JP5BWbc5CkZIbjA yvzxobaDPqOLyKvYNA3eU9I7236aGJHC3awOwUSmxEIISvqF2SZvUvgkq6nacla2XlgdRtAk5N4 = X-Google-Smtp-Source: AGHT+IHj2h8S+zmLuTloZxcnLO9WAz4RJi48U7NI5SiCHh06FqELYVTom6QVTr6L2ALoTH2YqFqgeQ== X-Received: by 2002:a05:6e02:1d01:b0:39a:e990:d0e with SMTP id e9e14a558f8ab-39b7484f668mr83160915ab.1.1723387963238; Sun, 11 Aug 2024 07:52:43 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:42 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 15/40] sandbox: Unmap old tags Date: Sun, 11 Aug 2024 08:51:44 -0600 Message-Id: <20240811145209.4191404-16-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean So far unmapping has not been implemented. This means that if one test maps a pointer to an address with map_sysmem(), then a second test can use that same pointer, by mapping the address back to a pointer with map_to_sysmem(). This is not really desirable, even if it doesn't cause any problems at the moment. Implement unmapping, to clean this up. Signed-off-by: Simon Glass --- (no changes since v1) arch/sandbox/cpu/cpu.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index 8eb055d6837..3e1c0dd583e 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -185,12 +185,28 @@ void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) void unmap_physmem(const void *ptr, unsigned long flags) { + struct sandbox_mapmem_entry *mentry; + #ifdef CONFIG_PCI if (map_dev) { pci_unmap_physmem(ptr, map_len, map_dev); map_dev = NULL; } #endif + + /* If it is in emulated RAM, we didn't create a tag, so nothing to do */ + if (is_in_sandbox_mem(ptr)) + return; + + mentry = find_tag(ptr); + if (mentry) { + list_del(&mentry->sibling_node); + log_debug("Removed map from %p to %lx\n", ptr, + (ulong)mentry->tag); + free(mentry); + } else { + log_warning("Address not mapped: %p\n", ptr); + } } phys_addr_t map_to_sysmem(const void *ptr) From patchwork Sun Aug 11 14:51:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971326 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=mI4KATS/; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whglp12hJz1yXh for ; Mon, 12 Aug 2024 00:59:18 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2619988A31; Sun, 11 Aug 2024 16:52:50 +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="mI4KATS/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 90EDA889CB; Sun, 11 Aug 2024 16:52: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.2 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 mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) (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 36BC888A3A for ; Sun, 11 Aug 2024 16:52: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-il1-x135.google.com with SMTP id e9e14a558f8ab-39aeccc6377so13280535ab.1 for ; Sun, 11 Aug 2024 07:52:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387964; x=1723992764; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PABb61nryISNosF9k2x01u5rY9Rbyf4Y7MSr0lJDLQk=; b=mI4KATS/gsGY7+OBQZidrqtfeLN5TPJ9OBwZwQucHyHHgNdNgcto4NcC3pSwb/VdNC 9qiZ4rQobfIkp0zmsyqCI0aVH4xrw12YMPL//Zqa2b9Eo+ok6VeTTiqoVlIfdQn/Ag5B bBuPWMCoYaJZG/LArB2dQMz9gsgnpytny0ZCY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387964; x=1723992764; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PABb61nryISNosF9k2x01u5rY9Rbyf4Y7MSr0lJDLQk=; b=rqUWBE/oyk2JYL4+7mBcY6ip8UHPMXbPr4XOVcxeFn4J4pT4hsICfjkiXC5Yz8mqYG aMgWYdrdYWLwrwAhTXtP2pQVx1N6a0v3UYhIAtmYVxFErOTKnEw/168+johbXbYNs5M6 eD6P4u6uCNy806cKzpdLQZn+sY11+eiSMkN1O13hyant5t26r4zoop0G/1oNsUJkvGsr rZzRWgIIn80n2aq3XOrGaoUePT+oNRaKRWNdtE4op8hMeUlbB5Q6G4DJIpqw/7aH0K9n unyzlN5MpxbVZoaXNA8doOfzD/JRLBTmWai/lbusnPMHXj3cJ4HCIZ/2XduTdiTpygZK Hl7w== X-Gm-Message-State: AOJu0YwB4l3hynUxLZXTHv27YdB4GxEgzuEZb95q0hqI6UCQlcCwozGB gT6jKEGy8m3rgOAAnffsqq757ol107EVexQDlNnsYRaTUbw7Q59S1CZOOEgqo2IDi1agV37vrjA = X-Google-Smtp-Source: AGHT+IFQrSW5owH3q1yk0YAbyjHGthIkGNHtHGL9EKUlGg2vmNMwaJlnsKbpanO71797Z+UyEIcIQA== X-Received: by 2002:a05:6e02:2193:b0:381:a2f9:90fe with SMTP id e9e14a558f8ab-39b74b59215mr83533215ab.12.1723387963939; Sun, 11 Aug 2024 07:52:43 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:43 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 16/40] sandbox: Add some debugging to pci_io Date: Sun, 11 Aug 2024 08:51:45 -0600 Message-Id: <20240811145209.4191404-17-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Add a little debugging to this driver. Convert the existing debugging to use logging. Signed-off-by: Simon Glass --- (no changes since v1) arch/sandbox/lib/pci_io.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/sandbox/lib/pci_io.c b/arch/sandbox/lib/pci_io.c index 6040eacb594..5eff7c7d65d 100644 --- a/arch/sandbox/lib/pci_io.c +++ b/arch/sandbox/lib/pci_io.c @@ -8,6 +8,8 @@ * IO space access commands. */ +#define LOG_CATEGORY UCLASS_PCI + #include #include #include @@ -31,10 +33,11 @@ int pci_map_physmem(phys_addr_t paddr, unsigned long *lenp, if (ret) continue; *devp = dev; + log_debug("addr=%lx, dev=%s\n", (ulong)paddr, dev->name); return 0; } - debug("%s: failed: addr=%pap\n", __func__, &paddr); + log_debug("%s: failed: addr=%pap\n", __func__, &paddr); return -ENOSYS; } @@ -66,7 +69,7 @@ static int pci_io_read(unsigned int addr, ulong *valuep, pci_size_t size) } } - debug("%s: failed: addr=%x\n", __func__, addr); + log_debug("%s: failed: addr=%x\n", __func__, addr); return -ENOSYS; } @@ -87,7 +90,7 @@ static int pci_io_write(unsigned int addr, ulong value, pci_size_t size) } } - debug("%s: failed: addr=%x, value=%lx\n", __func__, addr, value); + log_debug("%s: failed: addr=%x, value=%lx\n", __func__, addr, value); return -ENOSYS; } From patchwork Sun Aug 11 14:51:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971328 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=C4K2fIWq; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhgmB5lQ5z1yXh for ; Mon, 12 Aug 2024 00:59:38 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D97EE88A7F; Sun, 11 Aug 2024 16:52:50 +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="C4K2fIWq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6F3A588A13; Sun, 11 Aug 2024 16:52: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.2 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 mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) (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 0B2DD88A31 for ; Sun, 11 Aug 2024 16:52:46 +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-il1-x129.google.com with SMTP id e9e14a558f8ab-396cc82f6d7so12024695ab.0 for ; Sun, 11 Aug 2024 07:52:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387965; x=1723992765; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YI4bJWyLCxGwlWZWxGOuXlqr4nvTB4tkyAOeLVUpIRk=; b=C4K2fIWqpPSANZMAAKzKiK8G9phMAcSpgKsizSc9t5MQYWPFcNulj1KyNsNip42vxd X8MZ+022KCuC+/faSKj6CZYTnhrZu+e5SmY3LczdmTioluesH1jkQ5tU9VhH9vsKWnef Ivx9VpuMv1wtruaEmcHKKj6ea7fPoe5qxBo0A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387965; x=1723992765; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YI4bJWyLCxGwlWZWxGOuXlqr4nvTB4tkyAOeLVUpIRk=; b=gV3KrLeGcDNwHzHA9+mnwyFaBeOuUvNIWR2TftmpAnspKu0/cSvRkCdycqTcMdXz7A WoHg1krNqy4VJ5wDbkt2uIBzPT+9eYlcOioLxk/NYUWH/iGP+XwGICVJ8sDEfbseu98v QeY50ik85fr4ZsWK8BvR7VWHcVEg6jiyCAB5ciQqiUhT9QKro5l+hhfpnz/Ekujntanz OPkrnwTs8Gm4DQ1pML8fUNuDFZLyy8Nm+bN7jWhcwH64ytAMz7YeIed9leNabUoZDpE3 hvq28WHaldhjZ1tM1RUlTVu8ljz0W/rNhuCKybtNCzebWkiTblaEKfdx4D197bcwb3NN Opsg== X-Gm-Message-State: AOJu0YywfFkNio4hm/fgR0lAc+c+CZrJ41HBVC6j+VP0Z6I9VRv+a9PN Nl5wJvofehu8nU5wCJBLtSpse/JIptY29Ec8NKYPGDZRzxb9LH+1D5FPpNWL05c6Smdh5zoHQFM = X-Google-Smtp-Source: AGHT+IFyZtLae4vxxKJweAG/4JeXpbxVVywFlc8He5pQuzTMe6TPGfDOjVYQIFdeH2+DR6cN4AcLLQ== X-Received: by 2002:a05:6e02:216d:b0:39b:3244:a355 with SMTP id e9e14a558f8ab-39bd8c459a3mr75935215ab.11.1723387964602; Sun, 11 Aug 2024 07:52:44 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:44 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 17/40] sandbox: Implement reference counting for address mapping Date: Sun, 11 Aug 2024 08:51:46 -0600 Message-Id: <20240811145209.4191404-18-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean An address may be mapped twice and unmapped twice. Delete the mapping only when the last user unmaps it. Fix a missing comment while here. Signed-off-by: Simon Glass --- (no changes since v1) arch/sandbox/cpu/cpu.c | 14 ++++++++++---- arch/sandbox/include/asm/state.h | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index 3e1c0dd583e..51ce40e7f08 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -111,6 +111,7 @@ void *phys_to_virt(phys_addr_t paddr) if (mentry->tag == paddr) { log_debug("Used map from %lx to %p\n", (ulong)paddr, mentry->ptr); + mentry->refcnt++; return mentry->ptr; } } @@ -200,10 +201,12 @@ void unmap_physmem(const void *ptr, unsigned long flags) mentry = find_tag(ptr); if (mentry) { - list_del(&mentry->sibling_node); - log_debug("Removed map from %p to %lx\n", ptr, - (ulong)mentry->tag); - free(mentry); + if (!--mentry->refcnt) { + list_del(&mentry->sibling_node); + log_debug("Removed map from %p to %lx\n", ptr, + (ulong)mentry->tag); + free(mentry); + } } else { log_warning("Address not mapped: %p\n", ptr); } @@ -235,11 +238,14 @@ phys_addr_t map_to_sysmem(const void *ptr) } mentry->tag = state->next_tag++; mentry->ptr = (void *)ptr; + mentry->refcnt = 0; list_add_tail(&mentry->sibling_node, &state->mapmem_head); log_debug("Added map from %p to %lx\n", ptr, (ulong)mentry->tag); } + mentry->refcnt++; + /* * Return the tag as the address to use. A later call to map_sysmem() * will return ptr diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index 6b50473ed41..e7dc01759e8 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -53,10 +53,13 @@ struct sandbox_wdt_info { * be returned, just as it would for a normal sandbox address. * * @tag: Address tag (a value which U-Boot uses to refer to the address) + * @refcnt: Number of references to this tag * @ptr: Associated pointer for that tag + * @sibling_node: Next node */ struct sandbox_mapmem_entry { ulong tag; + uint refcnt; void *ptr; struct list_head sibling_node; }; From patchwork Sun Aug 11 14:51:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971329 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=hBRS95vy; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhgmP0WMTz1yXh for ; Mon, 12 Aug 2024 00:59:49 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3A9D4889E2; Sun, 11 Aug 2024 16:52: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="hBRS95vy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F303F88A13; Sun, 11 Aug 2024 16:52: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.2 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 mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) (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 DB553889E3 for ; Sun, 11 Aug 2024 16:52:46 +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-il1-x12c.google.com with SMTP id e9e14a558f8ab-39b4eadbaa7so11836835ab.2 for ; Sun, 11 Aug 2024 07:52:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387965; x=1723992765; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Kx1/WQXJunFXxjE4QfYrutj0xGpEqKwfA9DEAUPEqHw=; b=hBRS95vyVhTuX3SXiQKvxjjtkvVj4m79GZQ7gJY+09vriKsmBreHYy1HTM+aD9TdC7 dL4lwLc1quBwq9p/gV4xxGBFOAyIsW8nPb7ZI7GGvs/LNFqgRv4L6VkYEWfhKoBSaM3s JJRXhflaUdfwef7h54miVsCvW0Qd9vhWEHbUk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387965; x=1723992765; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Kx1/WQXJunFXxjE4QfYrutj0xGpEqKwfA9DEAUPEqHw=; b=gqSONjqDa5i0gHDQtkley26zpcEZdk4VEHthb4bvKCMOVViHNRSpUdXZ2WRG6pfaW8 XY+oAOuXJ3oRvTZIZqBT4LtrtyzfE7gf1MHpUqfd3NJTVjjl0rGL2AIhMN4gnvXeEgJ3 6Vw58E5EDmKRSrxK3DTAE8n9B2CXRzIvnPurmCEg4Aw90PStNnevEO61Lj8yM93OnKKv 6drH3pxtrh4100kvFQVhjq8gK0SVTPqFWio7s9+H4rnCJm9UoyBd7ulBw8gGV+HJodJy WCQ8zEozHiNu/DSdgtFivKH7mYQ4IAjxfymcGb7r4WxPg3m1v7iTPdOTuprunHuVBQWf dcFw== X-Gm-Message-State: AOJu0Ywk/W3dLvCajmb+Hn5hMZczEAjjQY5ms4+jMbgAsX6dsuDKBspo T6Gi0kRPQ842EXL5KEe2R7V0jyLMYXZTHcp/fJiBZ24yeS3nnqqOOeQaj72OxNgSydNcBcymjkE = X-Google-Smtp-Source: AGHT+IFrYT5e2nR1kgcsI1ZTmsvnoaqi0gz+GVh8nszM/LtQdjXZeYoCMz8w6fTUMoWN8gw6QP1DNA== X-Received: by 2002:a05:6e02:160f:b0:380:f340:ad66 with SMTP id e9e14a558f8ab-39b7a46a4acmr103718815ab.26.1723387965477; Sun, 11 Aug 2024 07:52:45 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:45 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass , Jaehoon Chung , Peng Fan Subject: [PATCH v3 18/40] mmc: Use map_sysmem() with buffers in the mmc command Date: Sun, 11 Aug 2024 08:51:47 -0600 Message-Id: <20240811145209.4191404-19-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean The current implementation casts an address to a pointer. Make it more sandbox-friendly by using map_sysmem(). Rename the variable to 'ptr' since it is a pointer, not an address. Signed-off-by: Simon Glass --- (no changes since v1) cmd/mmc.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cmd/mmc.c b/cmd/mmc.c index 7244a90f4dc..ff7ca3b371e 100644 --- a/cmd/mmc.c +++ b/cmd/mmc.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -349,12 +350,12 @@ static int do_mmc_read(struct cmd_tbl *cmdtp, int flag, { struct mmc *mmc; u32 blk, cnt, n; - void *addr; + void *ptr; if (argc != 4) return CMD_RET_USAGE; - addr = (void *)hextoul(argv[1], NULL); + ptr = map_sysmem(hextoul(argv[1], NULL), 0); blk = hextoul(argv[2], NULL); cnt = hextoul(argv[3], NULL); @@ -365,8 +366,9 @@ static int do_mmc_read(struct cmd_tbl *cmdtp, int flag, printf("\nMMC read: dev # %d, block # %d, count %d ... ", curr_device, blk, cnt); - n = blk_dread(mmc_get_blk_desc(mmc), blk, cnt, addr); + n = blk_dread(mmc_get_blk_desc(mmc), blk, cnt, ptr); printf("%d blocks read: %s\n", n, (n == cnt) ? "OK" : "ERROR"); + unmap_sysmem(ptr); return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE; } @@ -442,12 +444,12 @@ static int do_mmc_write(struct cmd_tbl *cmdtp, int flag, { struct mmc *mmc; u32 blk, cnt, n; - void *addr; + void *ptr; if (argc != 4) return CMD_RET_USAGE; - addr = (void *)hextoul(argv[1], NULL); + ptr = map_sysmem(hextoul(argv[1], NULL), 0); blk = hextoul(argv[2], NULL); cnt = hextoul(argv[3], NULL); @@ -462,8 +464,9 @@ static int do_mmc_write(struct cmd_tbl *cmdtp, int flag, printf("Error: card is write protected!\n"); return CMD_RET_FAILURE; } - n = blk_dwrite(mmc_get_blk_desc(mmc), blk, cnt, addr); + n = blk_dwrite(mmc_get_blk_desc(mmc), blk, cnt, ptr); printf("%d blocks written: %s\n", n, (n == cnt) ? "OK" : "ERROR"); + unmap_sysmem(ptr); return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE; } From patchwork Sun Aug 11 14:51:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971330 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=UNDHz0DO; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgmb13M9z1yXh for ; Mon, 12 Aug 2024 00:59:59 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 93A5288ABA; Sun, 11 Aug 2024 16:52:52 +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="UNDHz0DO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B17A0889E3; Sun, 11 Aug 2024 16:52:49 +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.2 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 mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) (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 9D5CA88A05 for ; Sun, 11 Aug 2024 16:52:47 +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-il1-x12a.google.com with SMTP id e9e14a558f8ab-37636c3872bso15679635ab.3 for ; Sun, 11 Aug 2024 07:52:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387966; x=1723992766; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gF4L4/LqhTmHLXLs6sfz2g4aPV4zfNGACs/y8Y8HoFs=; b=UNDHz0DOPznfYu5WG10+JMceJCdYl/g4khXX/Ql/CRGF57qEiOyWgFFvEoFWF1DFNW 9xkrK4OwPWH5bF1vYk5Hf2fLw4y6OcmKCyeApy/FBzwf1vKiv8FYspitL9lKtlB+9+Wx BSXU4kzXZ7rzH16dHbS2/f/VQDNl9CVPxH+aA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387966; x=1723992766; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gF4L4/LqhTmHLXLs6sfz2g4aPV4zfNGACs/y8Y8HoFs=; b=VWq29fmRXieNXzKIP8YTgkqTiDbmbqHhmMgvINIWU2Po7MRBDZMCWk5SHgVyyQRABa Bo7Ntvi5wdHHmLaqmal+pJ0j8+tS1iM0ONOqKcxZEcpfG37dZ6xcHm0yQamBEAQ1zP1M 9mEWkr3w0eAjpMnded3hJTvAGXUwqNObHbftaee6k+zjTQCVafdd2sYripQ9WtvGs6cG 31CDhExMNwT2Bs8YgVI8hAt+2X4PCQasgInSdnKeTiCd97Ktg4bk/BxE5lXJvkZFvhrQ WbrrUHFqXsz6Gk8O08tEU2zd49ypMxIPLW2NhSRFzyiiCkvXMbCtDwbKkezCJifKcbbm 3Gdg== X-Gm-Message-State: AOJu0YymVGr3jBoTW9jkZDzTsRTSXOI6GsILx3g5HAQG5vJjxWKmcceh INWyp2swkUa5RnJ1ErWsE8SdgHpg0jwnkFT1lafh/CLTCfzElJTSSSK3k9IxKeDA5U8cQO8zD2A = X-Google-Smtp-Source: AGHT+IGpzwntCQN/K7WrShOKo8ktyW6+rz9lpiWZ9CBZlYE1/jMaDCIgYbZfSzp5lkJ7eeZxWkW1DQ== X-Received: by 2002:a05:6e02:1a2e:b0:398:770d:1fa4 with SMTP id e9e14a558f8ab-39b7a462d12mr90316035ab.25.1723387966297; Sun, 11 Aug 2024 07:52:46 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:45 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 19/40] read: Tidy up use of map_sysmem() in the read command Date: Sun, 11 Aug 2024 08:51:48 -0600 Message-Id: <20240811145209.4191404-20-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Rename the variable to 'ptr' since it is a pointer, not an address. Make sure to unmap the pointer. Signed-off-by: Simon Glass --- Changes in v3: - Correct the commit subject and message cmd/read.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/read.c b/cmd/read.c index af54bd17654..8e21f004423 100644 --- a/cmd/read.c +++ b/cmd/read.c @@ -20,7 +20,7 @@ do_rw(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) struct disk_partition part_info; ulong offset, limit; uint blk, cnt, res; - void *addr; + void *ptr; int part; if (argc != 6) { @@ -33,7 +33,7 @@ do_rw(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) if (part < 0) return 1; - addr = map_sysmem(hextoul(argv[3], NULL), 0); + ptr = map_sysmem(hextoul(argv[3], NULL), 0); blk = hextoul(argv[4], NULL); cnt = hextoul(argv[5], NULL); @@ -48,13 +48,15 @@ do_rw(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) if (cnt + blk > limit) { printf("%s out of range\n", cmdtp->name); + unmap_sysmem(ptr); return 1; } if (IS_ENABLED(CONFIG_CMD_WRITE) && !strcmp(cmdtp->name, "write")) - res = blk_dwrite(dev_desc, offset + blk, cnt, addr); + res = blk_dwrite(dev_desc, offset + blk, cnt, ptr); else - res = blk_dread(dev_desc, offset + blk, cnt, addr); + res = blk_dread(dev_desc, offset + blk, cnt, ptr); + unmap_sysmem(ptr); if (res != cnt) { printf("%s error\n", cmdtp->name); From patchwork Sun Aug 11 14:51:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971331 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=cOMaHoDJ; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgmp1CXdz1yYl for ; Mon, 12 Aug 2024 01:00:10 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EC4B988AD2; Sun, 11 Aug 2024 16:52:52 +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="cOMaHoDJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 713EB88A5D; Sun, 11 Aug 2024 16:52:50 +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.2 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 mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) (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 5B9E588A37 for ; Sun, 11 Aug 2024 16:52:48 +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-il1-x129.google.com with SMTP id e9e14a558f8ab-39b3754468eso12825445ab.2 for ; Sun, 11 Aug 2024 07:52:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387967; x=1723992767; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qSZzhVNkWmxXYXniIKSPq/0ms8CGEbp8bOFdbuo61Sc=; b=cOMaHoDJ6tHTF5ZxENZ19qK373SfyDmRnNjhI4wwh/0cq8sDTYwXOyxAQ4k8GHd8Dd hNLPEQ6npbwgLRaTc92dB+OnzC+ZVwgv/DHauh06wI50URSSy6BNaPnCOucb4qvQIoA2 UZi2Lz68AwLKSopWfRF1a1slXC/WBl/znbJ7Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387967; x=1723992767; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qSZzhVNkWmxXYXniIKSPq/0ms8CGEbp8bOFdbuo61Sc=; b=Z6fnOQFQzvL68WhLyR/3rqhREQwfrwZjZAc0A+buBRvpQkWh20i9pHyBhfdcBsbG0y xQUOBl3y8w2aGkbX5jmizyTg5Sin8zmxGL1DiLjkFaY2oVflzhzTeNJ02M2GSc9hmbLd PKkb5bE9IvYIdhWBT/jczTTmKcvunz3IRB8wLxzXI8ARikcD0yeP8s3vSk4PQFXqsvMF bV74UBZRBfGrQxFpqR4bSDEgyQEGrrZzBBzhpEl652F7xZPiZmn8P1/cDQSq3erXO4Z0 4A4ohOqsJjYzehX7BEe8KsKrMBMnIdd63d7tJSKBSHIEMhi4eJWzw6WoZ/6dz4rm+Skh pdVg== X-Gm-Message-State: AOJu0YycS7siv+mXxS2AqHHFc8Ldd2/4pmnGdI+aW50qGwxcl4qhOaPa QOU5KNOVKHhPuyovD6+J+PiXhX+qC+ETjIARN6vNhgQo4Ut1v9zAsm1SyDRkoFJAQNwUiBLiJJE = X-Google-Smtp-Source: AGHT+IEuEtZFEJwffOjq+/bkRCisIylmyYvVxLKmWBTEymReof2f5204g8G/l7e6gyZ8cpo7bTqVxg== X-Received: by 2002:a05:6e02:1fc5:b0:397:6dfc:993a with SMTP id e9e14a558f8ab-39b7a449735mr81229375ab.21.1723387966993; Sun, 11 Aug 2024 07:52:46 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:46 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 20/40] cmd: Fix memory-mapping in cmp command Date: Sun, 11 Aug 2024 08:51:49 -0600 Message-Id: <20240811145209.4191404-21-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean This unmaps a different address from what was mapped. Fix it. Signed-off-by: Simon Glass --- (no changes since v1) cmd/mem.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/cmd/mem.c b/cmd/mem.c index 274348068c2..4d6fde28531 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -245,7 +245,7 @@ static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc, int size; int rcode = 0; const char *type; - const void *buf1, *buf2, *base; + const void *buf1, *buf2, *base, *ptr1, *ptr2; ulong word1, word2; /* 64-bit if MEM_SUPPORT_64BIT_DATA */ if (argc != 4) @@ -270,22 +270,22 @@ static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc, bytes = size * count; base = buf1 = map_sysmem(addr1, bytes); buf2 = map_sysmem(addr2, bytes); - for (ngood = 0; ngood < count; ++ngood) { + for (ngood = 0, ptr1 = buf1, ptr2 = buf2; ngood < count; ++ngood) { if (size == 4) { - word1 = *(u32 *)buf1; - word2 = *(u32 *)buf2; + word1 = *(u32 *)ptr1; + word2 = *(u32 *)ptr2; } else if (MEM_SUPPORT_64BIT_DATA && size == 8) { - word1 = *(ulong *)buf1; - word2 = *(ulong *)buf2; + word1 = *(ulong *)ptr1; + word2 = *(ulong *)ptr2; } else if (size == 2) { - word1 = *(u16 *)buf1; - word2 = *(u16 *)buf2; + word1 = *(u16 *)ptr1; + word2 = *(u16 *)ptr2; } else { - word1 = *(u8 *)buf1; - word2 = *(u8 *)buf2; + word1 = *(u8 *)ptr1; + word2 = *(u8 *)ptr2; } if (word1 != word2) { - ulong offset = buf1 - base; + ulong offset = ptr1 - base; printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n", type, (ulong)(addr1 + offset), size, word1, type, (ulong)(addr2 + offset), size, word2); @@ -293,8 +293,8 @@ static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc, break; } - buf1 += size; - buf2 += size; + ptr1 += size; + ptr2 += size; /* reset watchdog from time to time */ if ((ngood % (64 << 10)) == 0) From patchwork Sun Aug 11 14:51:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971332 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=T0yIQN9O; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgn05PV2z1yXl for ; Mon, 12 Aug 2024 01:00:20 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4F59188AE7; Sun, 11 Aug 2024 16:52: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="T0yIQN9O"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F3AF688A95; Sun, 11 Aug 2024 16:52:50 +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.2 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 mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (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 E7956889E2 for ; Sun, 11 Aug 2024 16:52:48 +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-il1-x12b.google.com with SMTP id e9e14a558f8ab-39b3cae5675so10098415ab.1 for ; Sun, 11 Aug 2024 07:52:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387967; x=1723992767; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z6bSvxh5YsAo9K1KEny+ZEyBZdSO0dvTxg/3C1drF9A=; b=T0yIQN9OKwf0MDi9f/wtWWIds+i4eSZDJPLKzi7/McwD5f6+mMZGzfjjQUEHiTcToF LNdLXN5AG21pdBXjHykr46WrodnMLKWZBgiE8IE0Vn4pxCvlbfsxmmu+MDTiFbvkydFy YA05K4rp3nQCtbwnSjNv1L8y14vmRkPX1r6wA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387967; x=1723992767; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z6bSvxh5YsAo9K1KEny+ZEyBZdSO0dvTxg/3C1drF9A=; b=KyY1qN2nY3adyq+8PNHeXwemzGQFAWNO4jHnfjnu/PEV+YmNyalox5dCITqGDU566V PVUAzA8x4sGovEMKEbG0B+U1oCGOhhuFopFfa4Jm6Lc8GrfslGROi50jRDjtkd5Nwg7P 2cNbqtnmhMgymE9+mN7d3sQeX3Z1IiaYvxyAmxHInUAmvcRhWhVu+4deR67Si+5IiXk7 cTp+2wrSPVHM/Hv+uoD5DxMt0u5/G4KvbUTKsgRmi9/Rg9J2vDQmW417plKKPlKNuZAl pn5FOcIrTOry4Nc5Zlv4e8XzndIw89eDyNQVKjj7Tb+pHog5/fibtVPYkCFKZC2WjR7I bLkw== X-Gm-Message-State: AOJu0Yyg5p7wK7XzLXodIpltLOSckx2eeWQ5sVFdKMl8cYyQHwbmzjDG B03A1yjFPPfsLNu8PBjB6017h320Ddmv4G+0WbGySOXpIogHh+eEUPGtYwedJ5yxk1CvWMrd7fw = X-Google-Smtp-Source: AGHT+IHMcyE2r4d2rchSHcIrIyCrYGKT8ONEZlmO3c8llIfPclfY+7T/MaOIJ4KhIunrtIIIa2YnBQ== X-Received: by 2002:a05:6e02:216d:b0:39b:3244:a355 with SMTP id e9e14a558f8ab-39bd8c459a3mr75935825ab.11.1723387967619; Sun, 11 Aug 2024 07:52:47 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:47 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 21/40] test: mbr: Unmap the buffers after use Date: Sun, 11 Aug 2024 08:51:50 -0600 Message-Id: <20240811145209.4191404-22-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean This tests maps some local variables into sandbox's address space. Make sure to unmap them afterwards. Note that the normal approach with sandbox is to use a fixed memory address in the RAM, to avoid needing to create a map for transient local variables. Signed-off-by: Simon Glass Fixes: 04291ee0aba ("cmd: mbr: Allow 4 MBR partitions without need...") --- Changes in v3: - Add a Fixes tag test/cmd/mbr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/cmd/mbr.c b/test/cmd/mbr.c index 1a35ba3351c..8a4d61b2928 100644 --- a/test/cmd/mbr.c +++ b/test/cmd/mbr.c @@ -461,6 +461,9 @@ static int mbr_test_run(struct unit_test_state *uts) "5P EBR+0x%04X: expected %#02X, actual: %#02X\n", ebr_cmp_start + i, ebr_parts_ref_p5[i], rbuf[ebr_cmp_start + i]); } + unmap_sysmem(mbr_wbuf); + unmap_sysmem(ebr_wbuf); + unmap_sysmem(rbuf); return 0; } From patchwork Sun Aug 11 14:51:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971333 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=cFT7HAcv; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhgnC6Y2mz1yXl for ; Mon, 12 Aug 2024 01:00:31 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B0BB688AB6; Sun, 11 Aug 2024 16:52: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="cFT7HAcv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CC91D88ABA; Sun, 11 Aug 2024 16:52:51 +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.2 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 mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (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 8790D8889C for ; Sun, 11 Aug 2024 16:52: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=sjg@chromium.org Received: by mail-io1-xd32.google.com with SMTP id ca18e2360f4ac-81fd520fe0dso139977739f.3 for ; Sun, 11 Aug 2024 07:52:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387968; x=1723992768; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Hv5CQZtvqIcRAzXF4f4WtoI+4p46tzX/HHM7gwIf1Y8=; b=cFT7HAcvG7lKGSr8EkgpzSQQiYthknM4sECvhdByiuZ5Nm3el1TH7M5TGVobMkCTEl y5s0+aJ2SCDGmo9VsLMZ3HOFmlzBM0lZBeUZ6m/j4Sr9YYaB0iWkZrUQp10qvZ6Sz/+T EuZgBaiewvjMO9DptgG3ThrzfK2fh1f2/2lLI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387968; x=1723992768; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Hv5CQZtvqIcRAzXF4f4WtoI+4p46tzX/HHM7gwIf1Y8=; b=RUcQRXmN6ZujVl0vbIqIA8P65AU1xHHSTxJAYo7qQ6XXp+JoCtgaxV2ev8zZvtHdlN LZzqEiKDGXUsrBB8jBd1nZ0dpVLuBnel37YSkSc5lIztUCAZy60Dq/3WGFktxLFGScyK p5DQZ9Z24gzEilQef60nPK0cofA1An97xX7dkRTq71P3AYQniXR9+eKjxIpo/lnRE+vA AZ0fYGDV5jHoKK2xGXvwzxYJ+Z1jb2KWIY/giUo1eH+uj0lIGWJnxI8oa0tez1UKmVVI kYeELQefCFRGJs+q2roCxsJ3cmI4aDUbS9QjUkkOMoisXO2RsQrVBKAC1bWVY+LC3Sna qUNw== X-Gm-Message-State: AOJu0YyMu4VUkH/Cd/DN2xNxHBwsnOBMOtjqpGOxiYsuULZNhiKcx1rx xwNAUodaFbmIVwUv5ZEmMXEhtzVUbKbmo/CJXk3655hKe7wiUlcVtKnR/wQ8OLivnsT4vKe44M0 = X-Google-Smtp-Source: AGHT+IGRyrTFC12zbJKJo8K1HPxiv94RhfQb/Nmt0JJnvKUGbUNcchuqYJSW2ngRVUAk8w5fN/YbfA== X-Received: by 2002:a92:cd8d:0:b0:398:16d1:610b with SMTP id e9e14a558f8ab-39b6c11b903mr107661565ab.0.1723387968291; Sun, 11 Aug 2024 07:52:48 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:48 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 22/40] test: mbr: Use a constant for the block size Date: Sun, 11 Aug 2024 08:51:51 -0600 Message-Id: <20240811145209.4191404-23-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean It isn't that important to factor out constants in tests, but in this case we have 0x200 and 512 used. The commands don't use the constant as they use a block count ('1'). It doesn't create more code to use a constant, so create one. Signed-off-by: Simon Glass --- Changes in v3: - use SZ_512 instead of 0x200 test/cmd/mbr.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/test/cmd/mbr.c b/test/cmd/mbr.c index 8a4d61b2928..e2a7cc35500 100644 --- a/test/cmd/mbr.c +++ b/test/cmd/mbr.c @@ -14,10 +14,14 @@ #include #include #include +#include #include #include DECLARE_GLOBAL_DATA_PTR; + +#define BLKSZ SZ_512 /* block size */ + /* * Requirements for running test manually: * mmc6.img - File size needs to be at least 12 MiB @@ -228,7 +232,7 @@ static unsigned build_mbr_parts(char *buf, size_t buf_size, unsigned num_parts) static int mbr_test_run(struct unit_test_state *uts) { struct blk_desc *mmc_dev_desc; - unsigned char mbr_wbuf[512], ebr_wbuf[512], rbuf[512]; + unsigned char mbr_wbuf[BLKSZ], ebr_wbuf[BLKSZ], rbuf[BLKSZ]; char mbr_parts_buf[256]; ulong mbr_wa, ebr_wa, ra, ebr_blk, mbr_parts_max; struct udevice *dev; @@ -257,7 +261,7 @@ static int mbr_test_run(struct unit_test_state *uts) mbr_wa = map_to_sysmem(mbr_wbuf); ebr_wa = map_to_sysmem(ebr_wbuf); ra = map_to_sysmem(rbuf); - ebr_blk = (ulong)0xb00000 / 0x200; + ebr_blk = (ulong)0xb00000 / BLKSZ; /* Make sure mmc6 exists */ ut_asserteq(6, blk_get_device_by_str("mmc", "6", &mmc_dev_desc)); @@ -269,7 +273,7 @@ static int mbr_test_run(struct unit_test_state *uts) /* Make sure mmc6 is 12+ MiB in size */ ut_assertok(run_commandf("mmc read %lx %lx 1", ra, - (ulong)0xbffe00 / 0x200)); + (ulong)0xbffe00 / BLKSZ)); /* Test one MBR partition */ init_write_buffers(mbr_wbuf, sizeof(mbr_wbuf), ebr_wbuf, sizeof(ebr_wbuf), __LINE__); @@ -277,11 +281,11 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); - ut_assertok(memcmp(mbr_wbuf, rbuf, 512)); + ut_assertok(memcmp(mbr_wbuf, rbuf, BLKSZ)); ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); - ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); + ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(console_record_reset_enable()); ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); ut_assertok(run_commandf("mbr write mmc 6")); @@ -290,7 +294,7 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assert_nextline("MBR: verify success!"); memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); - ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); + ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(ut_check_console_end(uts)); /* 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| @@ -313,11 +317,11 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); - ut_assertok(memcmp(mbr_wbuf, rbuf, 512)); + ut_assertok(memcmp(mbr_wbuf, rbuf, BLKSZ)); ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); - ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); + ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(console_record_reset_enable()); ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); ut_assertok(run_commandf("mbr write mmc 6")); @@ -326,7 +330,7 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assert_nextline("MBR: verify success!"); memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); - ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); + ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(ut_check_console_end(uts)); /* 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| @@ -349,11 +353,11 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); - ut_assertok(memcmp(mbr_wbuf, rbuf, 512)); + ut_assertok(memcmp(mbr_wbuf, rbuf, BLKSZ)); ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); - ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); + ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(console_record_reset_enable()); ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); ut_assertok(run_commandf("mbr write mmc 6")); @@ -362,7 +366,7 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assert_nextline("MBR: verify success!"); memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); - ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); + ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(ut_check_console_end(uts)); /* 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| @@ -385,11 +389,11 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); - ut_assertok(memcmp(mbr_wbuf, rbuf, 512)); + ut_assertok(memcmp(mbr_wbuf, rbuf, BLKSZ)); ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); - ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); + ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(console_record_reset_enable()); ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); ut_assertok(run_commandf("mbr write mmc 6")); @@ -398,7 +402,7 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assert_nextline("MBR: verify success!"); memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); - ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); + ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(ut_check_console_end(uts)); /* 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| @@ -421,11 +425,11 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); - ut_assertok(memcmp(mbr_wbuf, rbuf, 512)); + ut_assertok(memcmp(mbr_wbuf, rbuf, BLKSZ)); ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); - ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); + ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(console_record_reset_enable()); ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); ut_assertf(0 == run_commandf("mbr write mmc 6"), "Invalid partitions string: %s\n", mbr_parts_buf); From patchwork Sun Aug 11 14:51:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971334 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=dwUQaFOV; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhgnP6l4gz1yXl for ; Mon, 12 Aug 2024 01:00:41 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1141B88B2A; Sun, 11 Aug 2024 16:52: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="dwUQaFOV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AE15688AC0; Sun, 11 Aug 2024 16:52:52 +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.2 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 mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) (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 5C0BC88A4B for ; Sun, 11 Aug 2024 16:52:50 +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-il1-x129.google.com with SMTP id e9e14a558f8ab-39b32f258c8so15336105ab.1 for ; Sun, 11 Aug 2024 07:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387969; x=1723992769; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0vcNh4A/0Y2cDSZmNL1fx6L/Fv+ZKklzesoZR46WLOc=; b=dwUQaFOV7FGVvS/8GG6tEnseNB65r00B4CIQYMcgwrD2qZurzTxtPEQamZH4MRvlhs H+NWmevGpyfbxkzRDfsbINMtobvzLRV3a36Mu5PwrJN6L6C+9cCUb1w3qfT283pyhaYo R/mTuzKO7/bUm1rWFx1pE4Wl+lhnOpwTSOw2I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387969; x=1723992769; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0vcNh4A/0Y2cDSZmNL1fx6L/Fv+ZKklzesoZR46WLOc=; b=Kjs7++Z1xqJPdSjI4KmDnp9gRMTtb9W5hXuv0X1BP/3Hzuns7mKaMjF1pb1T0U1Q7u IOClKTZkk5NeRwUCBmyF5emj4szt9kYIJ42GxvOhNPx/51j/NfiZHfNmHBIeDbP+cU13 +BWUroFjxQ4Bgmg40+m9Iw+kcLI6ILZOVJKA0sCqwiji6A6YqejNuSNgyoSuL5rfMgf+ W2Qeauabk2hvx6NjWqnuFGsHyo8qFuopywS8C/lUAnujGbOLkD3do3uzBp38D9VQkvZ4 rudWe/C6SX1Olg3uuIrG2BU2OMME5tZbgUQ7ey4Ohn6YXmxrlGTcvUehVBqjQT85Dn+x VhPA== X-Gm-Message-State: AOJu0YysrZ47j7pLY9ijf71PkMiAWjymbCIyQoQ2vmcY4hzOo7nFr8bM qTlfBMRQSk5kfx/lZqK0Uwl/yNHqm5ASfonQV66YNzYmwZ45cSuQ2YjbcONLFADE426sgsOP6WQ = X-Google-Smtp-Source: AGHT+IHelvCfJe2Zhr9CtLja0TzUd4sQVtie4NzdnYDtFakHKEouX8eDRny2KO3O7flW9SRa3blKPA== X-Received: by 2002:a05:6e02:1c05:b0:398:a9b3:d6b1 with SMTP id e9e14a558f8ab-39bd8c50832mr66423365ab.12.1723387968929; Sun, 11 Aug 2024 07:52:48 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:48 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 23/40] test: mbr: Use RAM for the buffers Date: Sun, 11 Aug 2024 08:51:52 -0600 Message-Id: <20240811145209.4191404-24-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean The normal approach with sandbox is to use a fixed memory address in the RAM, to avoid needing to create a map for transient local variables. Update this test to use this approach. Signed-off-by: Simon Glass --- (no changes since v1) test/cmd/mbr.c | 52 ++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/test/cmd/mbr.c b/test/cmd/mbr.c index e2a7cc35500..ec19cf3793c 100644 --- a/test/cmd/mbr.c +++ b/test/cmd/mbr.c @@ -232,9 +232,11 @@ static unsigned build_mbr_parts(char *buf, size_t buf_size, unsigned num_parts) static int mbr_test_run(struct unit_test_state *uts) { struct blk_desc *mmc_dev_desc; - unsigned char mbr_wbuf[BLKSZ], ebr_wbuf[BLKSZ], rbuf[BLKSZ]; + unsigned char *mbr_wbuf, *ebr_wbuf, *rbuf; char mbr_parts_buf[256]; - ulong mbr_wa, ebr_wa, ra, ebr_blk, mbr_parts_max; + ulong addr = 0x1000; /* start address for buffers */ + ulong mbr_wa = addr, ebr_wa = addr + BLKSZ, ra = addr + BLKSZ * 2; + ulong ebr_blk, mbr_parts_max; struct udevice *dev; ofnode root, node; @@ -258,9 +260,9 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assertf(sizeof(mbr_parts_buf) >= mbr_parts_max, "Buffer avail: %ld; buffer req: %ld\n", sizeof(mbr_parts_buf), mbr_parts_max); - mbr_wa = map_to_sysmem(mbr_wbuf); - ebr_wa = map_to_sysmem(ebr_wbuf); - ra = map_to_sysmem(rbuf); + mbr_wbuf = map_sysmem(mbr_wa, BLKSZ); + ebr_wbuf = map_sysmem(ebr_wa, BLKSZ); + rbuf = map_sysmem(ra, BLKSZ); ebr_blk = (ulong)0xb00000 / BLKSZ; /* Make sure mmc6 exists */ @@ -279,11 +281,11 @@ static int mbr_test_run(struct unit_test_state *uts) init_write_buffers(mbr_wbuf, sizeof(mbr_wbuf), ebr_wbuf, sizeof(ebr_wbuf), __LINE__); ut_assertok(build_mbr_parts(mbr_parts_buf, sizeof(mbr_parts_buf), 1)); ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); ut_assertok(memcmp(mbr_wbuf, rbuf, BLKSZ)); ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(console_record_reset_enable()); @@ -292,7 +294,7 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assert_nextline("MBR: write success!"); ut_assertok(run_commandf("mbr verify mmc 6")); ut_assert_nextline("MBR: verify success!"); - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(ut_check_console_end(uts)); @@ -303,7 +305,7 @@ static int mbr_test_run(struct unit_test_state *uts) 000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| */ - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); for (unsigned i = 0; i < mbr_cmp_size; i++) { ut_assertf(rbuf[mbr_cmp_start + i] == mbr_parts_ref_p1[i], @@ -315,11 +317,11 @@ static int mbr_test_run(struct unit_test_state *uts) init_write_buffers(mbr_wbuf, sizeof(mbr_wbuf), ebr_wbuf, sizeof(ebr_wbuf), __LINE__); ut_assertok(build_mbr_parts(mbr_parts_buf, sizeof(mbr_parts_buf), 2)); ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); ut_assertok(memcmp(mbr_wbuf, rbuf, BLKSZ)); ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(console_record_reset_enable()); @@ -328,7 +330,7 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assert_nextline("MBR: write success!"); ut_assertok(run_commandf("mbr verify mmc 6")); ut_assert_nextline("MBR: verify success!"); - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(ut_check_console_end(uts)); @@ -339,7 +341,7 @@ static int mbr_test_run(struct unit_test_state *uts) 000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| */ - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); for (unsigned i = 0; i < mbr_cmp_size; i++) { ut_assertf(rbuf[mbr_cmp_start + i] == mbr_parts_ref_p2[i], @@ -351,11 +353,11 @@ static int mbr_test_run(struct unit_test_state *uts) init_write_buffers(mbr_wbuf, sizeof(mbr_wbuf), ebr_wbuf, sizeof(ebr_wbuf), __LINE__); ut_assertok(build_mbr_parts(mbr_parts_buf, sizeof(mbr_parts_buf), 3)); ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); ut_assertok(memcmp(mbr_wbuf, rbuf, BLKSZ)); ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(console_record_reset_enable()); @@ -364,7 +366,7 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assert_nextline("MBR: write success!"); ut_assertok(run_commandf("mbr verify mmc 6")); ut_assert_nextline("MBR: verify success!"); - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(ut_check_console_end(uts)); @@ -375,7 +377,7 @@ static int mbr_test_run(struct unit_test_state *uts) 000001e0 06 01 0e 66 25 01 00 50 00 00 00 08 00 00 00 00 |...f%..P........| 000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| */ - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); for (unsigned i = 0; i < mbr_cmp_size; i++) { ut_assertf(rbuf[mbr_cmp_start + i] == mbr_parts_ref_p3[i], @@ -387,11 +389,11 @@ static int mbr_test_run(struct unit_test_state *uts) init_write_buffers(mbr_wbuf, sizeof(mbr_wbuf), ebr_wbuf, sizeof(ebr_wbuf), __LINE__); ut_assertok(build_mbr_parts(mbr_parts_buf, sizeof(mbr_parts_buf), 4)); ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); ut_assertok(memcmp(mbr_wbuf, rbuf, BLKSZ)); ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(console_record_reset_enable()); @@ -400,7 +402,7 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assert_nextline("MBR: write success!"); ut_assertok(run_commandf("mbr verify mmc 6")); ut_assert_nextline("MBR: verify success!"); - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(ut_check_console_end(uts)); @@ -411,7 +413,7 @@ static int mbr_test_run(struct unit_test_state *uts) 000001e0 06 01 0e 66 25 01 00 50 00 00 00 08 00 00 00 66 |...f%..P.......f| 000001f0 26 01 0e 87 06 01 00 58 00 00 00 08 00 00 55 aa |&......X......U.| */ - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); for (unsigned i = 0; i < mbr_cmp_size; i++) { ut_assertf(rbuf[mbr_cmp_start + i] == mbr_parts_ref_p4[i], @@ -423,11 +425,11 @@ static int mbr_test_run(struct unit_test_state *uts) init_write_buffers(mbr_wbuf, sizeof(mbr_wbuf), ebr_wbuf, sizeof(ebr_wbuf), __LINE__); ut_assertok(build_mbr_parts(mbr_parts_buf, sizeof(mbr_parts_buf), 5)); ut_assertok(run_commandf("write mmc 6:0 %lx 0 1", mbr_wa)); - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); ut_assertok(memcmp(mbr_wbuf, rbuf, BLKSZ)); ut_assertok(run_commandf("write mmc 6:0 %lx %lx 1", ebr_wa, ebr_blk)); - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, BLKSZ)); ut_assertok(console_record_reset_enable()); @@ -444,7 +446,7 @@ static int mbr_test_run(struct unit_test_state *uts) 000001e0 06 01 0e 66 25 01 00 50 00 00 00 08 00 00 00 66 |...f%..P.......f| 000001f0 26 01 05 a7 26 01 00 58 00 00 00 10 00 00 55 aa |&...&..X......U.| */ - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx 0 1", ra)); for (unsigned i = 0; i < mbr_cmp_size; i++) { ut_assertf(rbuf[mbr_cmp_start + i] == mbr_parts_ref_p5[i], @@ -458,7 +460,7 @@ static int mbr_test_run(struct unit_test_state *uts) 00b001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00b001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| */ - memset(rbuf, 0, sizeof(rbuf)); + memset(rbuf, '\0', BLKSZ); ut_assertok(run_commandf("read mmc 6:0 %lx %lx 1", ra, ebr_blk)); for (unsigned i = 0; i < ebr_cmp_size; i++) { ut_assertf(rbuf[ebr_cmp_start + i] == ebr_parts_ref_p5[i], From patchwork Sun Aug 11 14:51:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971335 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=GWgsxVDS; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgnc5MjGz1yXl for ; Mon, 12 Aug 2024 01:00:52 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6830788BC4; Sun, 11 Aug 2024 16:52: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="GWgsxVDS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0C36888AD7; Sun, 11 Aug 2024 16:52: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.2 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 mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) (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 EFD2388A8B for ; Sun, 11 Aug 2024 16:52:50 +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-il1-x130.google.com with SMTP id e9e14a558f8ab-39b3c36d247so14452915ab.3 for ; Sun, 11 Aug 2024 07:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387969; x=1723992769; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ahAvCaLmjp2sdMvw31TMHsvRc8Q9a30fpGnHuGXBB3A=; b=GWgsxVDScj/IM2UWiOke+rGKmSi83dtEOllnw083d4ZwpO0Cj4yP8+zYsfdHwzXWc8 02p7+XIfAi2pO22cE6jTAC6pg2ww74cF1WtaWox+nH/z4gslSwPx+hsXUiDx/ib3SGfR r2w/+4W5HlainlFn/cB0MSMdaq0IfkQy7qYBk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387969; x=1723992769; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ahAvCaLmjp2sdMvw31TMHsvRc8Q9a30fpGnHuGXBB3A=; b=KLmE6obpM4wsJo4Kdw5bwHBoR5YxOJ8hY11PuUjAoWQGdYXa/trKMu4TqeNQ5l4nuL 3Ellr7/FWT5pA7KTl0B/g/4jtXMsFWOlYqw/FHYE0tYLrcD2dC6l6aUjloE/tQlYWuJ4 bO5PRiEyWwJQNKmruEjSSInCKO3RyPeDbz0VnuOCKTcMjrScZScWqxXSecpC76UFfmkL kLw/7PtM2uWdMDaFXVe3k7ElmzxE/aZl3YH1miQfExir+MnBKxowzq7pnlpuTyySIRmJ fdxUWsrOyx7gsQ+rhurn/5J+xOStl5miXEnVQHc14XNyJ/AmOvJ0F6OQ4JUD/5XCePGg DDpQ== X-Gm-Message-State: AOJu0YxF+pmHkP/sa5ntW5Zzk7sZ5ZNYMaWc+7Jt3h82Nl1X1CIbbwIE ztk2NoLCAMikXHfCxR6qHWNm/uAo22YAkDK9o/SXTolr3vQUTOCKpsPM709uOnAhbkagMntupPc = X-Google-Smtp-Source: AGHT+IHPalbMQCQlP4hJbpmJN4RCJwrVdIHJ6ElmA0l4woBuGmxTTrSZ0vmw6C9Xp5y7MWoYJaa6Ww== X-Received: by 2002:a05:6e02:1a6a:b0:383:8ec6:6d17 with SMTP id e9e14a558f8ab-39b74840d5bmr92023775ab.0.1723387969666; Sun, 11 Aug 2024 07:52:49 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:49 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 24/40] test: mbr: Drop a duplicate test Date: Sun, 11 Aug 2024 08:51:53 -0600 Message-Id: <20240811145209.4191404-25-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean The test currently runs twice as it is declared twice. Unwind this. Signed-off-by: Simon Glass --- (no changes since v1) test/cmd/mbr.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/cmd/mbr.c b/test/cmd/mbr.c index ec19cf3793c..2beaf9a75c5 100644 --- a/test/cmd/mbr.c +++ b/test/cmd/mbr.c @@ -484,10 +484,3 @@ int do_ut_mbr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) return cmd_ut_category("mbr", "mbr_test_", tests, n_ents, argc, argv); } - -static int dm_test_cmd_mbr(struct unit_test_state *uts) -{ - return mbr_test_run(uts); -} - -DM_TEST(dm_test_cmd_mbr, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); From patchwork Sun Aug 11 14:51:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971336 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=SiHfw1YB; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgnq0D7Kz1yXl for ; Mon, 12 Aug 2024 01:01:03 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C61A388BE6; Sun, 11 Aug 2024 16:52: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="SiHfw1YB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AB19B88B1C; Sun, 11 Aug 2024 16:52: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.2 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 mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) (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 9314D88AB6 for ; Sun, 11 Aug 2024 16:52: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=sjg@chromium.org Received: by mail-il1-x136.google.com with SMTP id e9e14a558f8ab-39b3a4d2577so12271985ab.3 for ; Sun, 11 Aug 2024 07:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387970; x=1723992770; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1EOgF0fi9K6gWAGi3Z+7iUXQy0Hk2b0EbHWQDBsqJCM=; b=SiHfw1YBvhzxEzwyqSJNdqUhWmmKpq1HalV3L25KnTqqg6rRz1St4JVAOCJPN/iqBP GQCVZHkgpkyffdNse1zOcicHNTgBfp4tkcmYNYhsP3bgZZqJnbw3ebRBGFOsLp0YBT0Y ET8UgnISYo6Uuluh32vNwtV5fRQLorHug5U40= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387970; x=1723992770; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1EOgF0fi9K6gWAGi3Z+7iUXQy0Hk2b0EbHWQDBsqJCM=; b=cgjbd9vF0LZWNOC76H/C3PZl+pILvuh06G7QVZBzJafOGNH9DdO7VnA3mfyl07JVs+ D/RDqRMfbGV3FhjIse7T3ZKM+ansVxn/1yMK7bUusq84K9nm8qxt5MOzXQuKMq5g+Evp Bxlg5/Cig70kiMyf6Og+T0v6/2Lr9x1xiKOhbNYXOfbCOqps2butPOWGjDzINp1q2Uzz GnJiNxThHSrvDr3d7w8/TJP2fA2pFg78Rj7bqsP8oQCB9w5rBPYNJt8SG+C2X4uqrGAv Aa8ue+/cemQrY1YZfYEWOfJr7rz4dNk+H+UUXFwtRN/Fu5lyUt64GyJejom6MGLFSiUh E+wg== X-Gm-Message-State: AOJu0Yy5wi3S7Gn5jSwWUk/AEZBEovMHSsRfVj0XkDW8A+yBVZHWgmus oQJtz5/WMLDeHxl3unsGE2u7UIEPYqaJZ6vq0I75Yw1kYX3vuJEyQqakJWEor8AaIZ04cq25kGM = X-Google-Smtp-Source: AGHT+IFKkdGHujZW7Ez6bPE4r/k65TfZXLJ2nkIFomUQvW1fdOKAUm9KEq/OyBrOG17vX+7DLezcqA== X-Received: by 2002:a05:6e02:b26:b0:383:4a12:b77c with SMTP id e9e14a558f8ab-39b74968608mr97263335ab.8.1723387970289; Sun, 11 Aug 2024 07:52:50 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:50 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 25/40] efi: Use puts() in cout so that console recording works Date: Sun, 11 Aug 2024 08:51:54 -0600 Message-Id: <20240811145209.4191404-26-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean At present EFI output to the console uses fputs() which bypasses the console-recording feature. This makes it impossible for tests to check the output of an EFI app. There doesn't seem to be any need to do this bypass, so adjust it to simply use the puts() function. Signed-off-by: Simon Glass Reviewed-by: Ilias Apalodimas Reviewed-by: Heinrich Schuchardt --- (no changes since v2) Changes in v2: - Fix 'use' typo lib/efi_loader/efi_console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index c944c10b216..cea50c748aa 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -181,7 +181,7 @@ static efi_status_t EFIAPI efi_cout_output_string( } pos = buf; utf16_utf8_strcpy(&pos, string); - fputs(stdout, buf); + puts(buf); free(buf); /* From patchwork Sun Aug 11 14:51:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971337 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=BUYpYmnk; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgp15724z1yXl for ; Mon, 12 Aug 2024 01:01:13 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 250DB88C19; Sun, 11 Aug 2024 16:52:57 +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="BUYpYmnk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5887F88A7E; Sun, 11 Aug 2024 16:52:54 +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.2 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 mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) (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 4E40E889CB for ; Sun, 11 Aug 2024 16:52:52 +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-il1-x12e.google.com with SMTP id e9e14a558f8ab-39641271f2aso11320875ab.3 for ; Sun, 11 Aug 2024 07:52:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387971; x=1723992771; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CnoJRYiA0jpgdtUTiaY1SSzDLCyCKyPzj2aCRxRQE1s=; b=BUYpYmnkmzARRk1PQEfWK+OSGq1Q+uoA0Qug409WlX78G9x4ydEnSPaE7Q8V8rrnmE eAqXVY/7HH1aWuyEK8EjSfA5K2hrAgr2UHrzw1oGlZoDijp3UgthwLpmf54N6rO5SjIi tm9KphPgdMar1wr/rXf134n2aT0H0sFdNBao8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387971; x=1723992771; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CnoJRYiA0jpgdtUTiaY1SSzDLCyCKyPzj2aCRxRQE1s=; b=pAarO2cmIYokBKmdNYDxT1FgumP6THlVZd0bDbZUakJ2tiLtIxOM78iu5apNOcppGN 3TV82L/coAmnSCuE2FTxVKIA4wg70VNNYkuw5Fxr/5Nt7NLyxmHMA5iVZFfOSWwxRXzr csoXEsRzb8QdfwmXtTFMNVztM1geXZCxIuHyQ0RLfMiTBygdCfQn4mprXXT5s9hL/lak gWwlwz5eg0SCHHU0Vb1onWibG0MGo9CO+mGSqD2jvqSt09urzNHP1RB1rpN8BdyrnLCZ yLZdKQZ9+aDILfT8lMwMFPDityaff10qef0uZ+1wZzEE/FnG5aYS8ttHOlsTZgfCWTs1 rtxg== X-Gm-Message-State: AOJu0Yzs+ogHa8susM5RbOtLgMBZKioDDqIYFsDfgkCpMT8+RI7VqY4V GntU7GthFICD105vPiGflGu3KRjEBeETX/REPgfTtA3idS8sh8jnbvdCytjCytoc6AFHmU+JnY8 = X-Google-Smtp-Source: AGHT+IEhkqUpPlhpCrdojzsdbM7ZrI9/f/dA/cAlcD2u0d3MjO3aIYjVAkEB8Su0+7phKo5c/88weQ== X-Received: by 2002:a05:6e02:b43:b0:376:1cf6:6be4 with SMTP id e9e14a558f8ab-39b7a41702fmr78378385ab.14.1723387970934; Sun, 11 Aug 2024 07:52:50 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:50 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 26/40] efi_loader: Put back copyright message Date: Sun, 11 Aug 2024 08:51:55 -0600 Message-Id: <20240811145209.4191404-27-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean This was lost in a later commit, so add it back. Signed-off-by: Simon Glass Fixes: dd860b90ff4 ("efi_loader: print boot device and file path in") --- (no changes since v1) lib/efi_loader/helloworld.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/efi_loader/helloworld.c b/lib/efi_loader/helloworld.c index bd72822c0b7..586177de0c8 100644 --- a/lib/efi_loader/helloworld.c +++ b/lib/efi_loader/helloworld.c @@ -2,6 +2,9 @@ /* * Hello world EFI application * + * Copyright (c) 2016 Google, Inc + * Written by Simon Glass + * * Copyright 2020, Heinrich Schuchardt * * This test program is used to test the invocation of an EFI application. From patchwork Sun Aug 11 14:51:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971338 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=BUxK+pvU; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhgpC4Jyfz1yXl for ; Mon, 12 Aug 2024 01:01:23 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 80C4888C26; Sun, 11 Aug 2024 16:52:57 +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="BUxK+pvU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3651488B9B; Sun, 11 Aug 2024 16:52:55 +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.2 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 mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (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 E2A3E88AC0 for ; Sun, 11 Aug 2024 16:52:52 +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-il1-x12b.google.com with SMTP id e9e14a558f8ab-39b27935379so13823875ab.1 for ; Sun, 11 Aug 2024 07:52:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387971; x=1723992771; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+KBkjhxsqksQnxYqtk5cezP+tRjhShWLlVARiDbfwuI=; b=BUxK+pvUbf/opUPpY3qiYXPwFsetwuVRF/d3iae6finLC3vReT6DA2dSP54cJcUuEA c2JdcJpIgCuGRtL1mPeyhjUV4J22i5RV03sMkHlvhMtY2BSCPVVcPxWYgTa83VJ7ETJ2 NqLNJlttfdJWp+YNcNPiM7bv8dG9PXnwIo/0s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387971; x=1723992771; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+KBkjhxsqksQnxYqtk5cezP+tRjhShWLlVARiDbfwuI=; b=YK0fyVy/ihxZ3CUdxwAaHtcTwvJghv2KGbfPzIY+6/Srahs9L9dXBTIHiBsqkqlVIV Aby9szMHxw0eLDxGcHNyQh4g/pxPgkxrKd1efIWaKcrnFXeIpprq5Ac4RuhyvO1SacoT 38YlWZ0CtfCQawTGjTQGblnNtcc7s6CXg6wCpKH6s8OTZjhvl5/G3zLOWLoQG9vCZnAg w51n56Bbzq4sXVeCx3XrGmq5qd4w450DcER+DzoRkyxUXXoY3f+5yEtrG4okupD1fnWF +J5orvPF9yPSXCEqwbzBkqvucRFzjM1cYMf2O6mYnAnNgRT51LsxX+St/+lC8yqLO9mE LjFA== X-Gm-Message-State: AOJu0Yx8wpmBWwhJXfbsYHuKQNfSkotzWq3w7nSMi0K1k/i+3l4Bal2/ F0A39jP8/2m48SHg62CoSAj/q4ZHajoDiJoA/62K0sEWbUNJ/68QXE8z9zAm4daxacEAAl/yQ7g = X-Google-Smtp-Source: AGHT+IHOWys2ofUsbXpIeq1Cg0nLAWcpKE+1vIdZiRwy6gCQivHWBv7q5PAzhyb44a8S1n0AFu2DkA== X-Received: by 2002:a05:6e02:1a4e:b0:397:2918:6f52 with SMTP id e9e14a558f8ab-39b86f73f8bmr89967295ab.25.1723387971586; Sun, 11 Aug 2024 07:52:51 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:51 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 27/40] efi_loader: Rename and move CMD_BOOTEFI_HELLO_COMPILE Date: Sun, 11 Aug 2024 08:51:56 -0600 Message-Id: <20240811145209.4191404-28-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean This is not actually a command so the name is confusing. Use BOOTEFI_HELLO_COMPILE instead. Put it in the efi_loader directory with the other such config options. The link rule (for $(obj)/%_efi.so) in scripts/Makefile.lib handles pulling in efi_crt0.o and efi_reloc.o so drop the 'extra' rules. Signed-off-by: Simon Glass --- Changes in v3: - Drop the extra- rules since scripts/Makefile.lib takes care of it arch/arm/lib/Makefile | 1 - arch/riscv/lib/Makefile | 1 - arch/x86/lib/Makefile | 2 +- cmd/Kconfig | 14 +------------- configs/octeontx2_95xx_defconfig | 2 +- configs/octeontx2_96xx_defconfig | 2 +- configs/octeontx_81xx_defconfig | 2 +- configs/octeontx_83xx_defconfig | 2 +- doc/develop/uefi/uefi.rst | 2 +- lib/efi_loader/Kconfig | 12 ++++++++++++ lib/efi_loader/Makefile | 2 +- test/py/tests/test_efi_fit.py | 2 +- test/py/tests/test_efi_loader.py | 2 +- 13 files changed, 22 insertions(+), 24 deletions(-) diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 67275fba616..4e54c577cc3 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -130,7 +130,6 @@ CFLAGS_REMOVE_$(EFI_CRT0) := $(CFLAGS_NON_EFI) CFLAGS_$(EFI_RELOC) := $(CFLAGS_EFI) CFLAGS_REMOVE_$(EFI_RELOC) := $(CFLAGS_NON_EFI) -extra-$(CONFIG_CMD_BOOTEFI_HELLO_COMPILE) += $(EFI_CRT0) $(EFI_RELOC) # TODO: As of v2019.01 the relocation code for the EFI application cannot # be built on ARMv7-M. ifndef CONFIG_CPU_V7M diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile index 65dc49f6fa5..4f6272aab6e 100644 --- a/arch/riscv/lib/Makefile +++ b/arch/riscv/lib/Makefile @@ -36,7 +36,6 @@ CFLAGS_REMOVE_$(EFI_CRT0) := $(CFLAGS_NON_EFI) CFLAGS_$(EFI_RELOC) := $(CFLAGS_EFI) CFLAGS_REMOVE_$(EFI_RELOC) := $(CFLAGS_NON_EFI) -extra-$(CONFIG_CMD_BOOTEFI_HELLO_COMPILE) += $(EFI_CRT0) $(EFI_RELOC) extra-$(CONFIG_CMD_BOOTEFI_SELFTEST) += $(EFI_CRT0) $(EFI_RELOC) extra-$(CONFIG_EFI) += $(EFI_CRT0) $(EFI_RELOC) diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index 8fc35e1b51e..8bc8d92172b 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -97,7 +97,7 @@ endif else ifndef CONFIG_SPL_BUILD -ifneq ($(CONFIG_CMD_BOOTEFI_SELFTEST)$(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),) +ifneq ($(CONFIG_CMD_BOOTEFI_SELFTEST),) extra-y += $(EFI_CRT0) $(EFI_RELOC) endif endif diff --git a/cmd/Kconfig b/cmd/Kconfig index 8af136d2bd4..f8a7e03400a 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -438,21 +438,9 @@ config CMD_BOOTEFI_BOOTMGR This subcommand will allow you to select the UEFI binary to be booted via UEFI variables Boot####, BootOrder, and BootNext. -config CMD_BOOTEFI_HELLO_COMPILE - bool "Compile a standard EFI hello world binary for testing" - default y - help - This compiles a standard EFI hello world application with U-Boot so - that it can be used with the test/py testing framework. This is useful - for testing that EFI is working at a basic level, and for bringing - up EFI support on a new architecture. - - No additional space will be required in the resulting U-Boot binary - when this option is enabled. - config CMD_BOOTEFI_HELLO bool "Allow booting a standard EFI hello world for testing" - depends on CMD_BOOTEFI_BINARY && CMD_BOOTEFI_HELLO_COMPILE + depends on CMD_BOOTEFI_BINARY && BOOTEFI_HELLO_COMPILE default y if CMD_BOOTEFI_SELFTEST help This adds a standard EFI hello world application to U-Boot so that diff --git a/configs/octeontx2_95xx_defconfig b/configs/octeontx2_95xx_defconfig index c5dc4f4dfa6..23c313375ac 100644 --- a/configs/octeontx2_95xx_defconfig +++ b/configs/octeontx2_95xx_defconfig @@ -38,7 +38,7 @@ CONFIG_SYS_PBSIZE=1050 CONFIG_BOARD_EARLY_INIT_R=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="Marvell> " -# CONFIG_CMD_BOOTEFI_HELLO_COMPILE is not set +# CONFIG_BOOTEFI_HELLO_COMPILE is not set CONFIG_CMD_MD5SUM=y CONFIG_MD5SUM_VERIFY=y CONFIG_CMD_MX_CYCLIC=y diff --git a/configs/octeontx2_96xx_defconfig b/configs/octeontx2_96xx_defconfig index ad61b80300f..197e72acd1f 100644 --- a/configs/octeontx2_96xx_defconfig +++ b/configs/octeontx2_96xx_defconfig @@ -38,7 +38,7 @@ CONFIG_SYS_PBSIZE=1050 CONFIG_BOARD_EARLY_INIT_R=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="Marvell> " -# CONFIG_CMD_BOOTEFI_HELLO_COMPILE is not set +# CONFIG_BOOTEFI_HELLO_COMPILE is not set CONFIG_CMD_MD5SUM=y CONFIG_MD5SUM_VERIFY=y CONFIG_CMD_MX_CYCLIC=y diff --git a/configs/octeontx_81xx_defconfig b/configs/octeontx_81xx_defconfig index 1d39bce6abd..b501d653c27 100644 --- a/configs/octeontx_81xx_defconfig +++ b/configs/octeontx_81xx_defconfig @@ -39,7 +39,7 @@ CONFIG_SYS_PBSIZE=1050 CONFIG_BOARD_EARLY_INIT_R=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="Marvell> " -# CONFIG_CMD_BOOTEFI_HELLO_COMPILE is not set +# CONFIG_BOOTEFI_HELLO_COMPILE is not set CONFIG_CMD_MD5SUM=y CONFIG_MD5SUM_VERIFY=y CONFIG_CMD_MX_CYCLIC=y diff --git a/configs/octeontx_83xx_defconfig b/configs/octeontx_83xx_defconfig index ba9fc5f9553..4a537f5cbbe 100644 --- a/configs/octeontx_83xx_defconfig +++ b/configs/octeontx_83xx_defconfig @@ -37,7 +37,7 @@ CONFIG_SYS_PBSIZE=1050 CONFIG_BOARD_EARLY_INIT_R=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="Marvell> " -# CONFIG_CMD_BOOTEFI_HELLO_COMPILE is not set +# CONFIG_BOOTEFI_HELLO_COMPILE is not set CONFIG_CMD_MD5SUM=y CONFIG_MD5SUM_VERIFY=y CONFIG_CMD_MX_CYCLIC=y diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst index d450b12bf80..9aeee23a32e 100644 --- a/doc/develop/uefi/uefi.rst +++ b/doc/develop/uefi/uefi.rst @@ -693,7 +693,7 @@ Executing the built in hello world application A hello world UEFI application can be built with:: - CONFIG_CMD_BOOTEFI_HELLO_COMPILE=y + CONFIG_BOOTEFI_HELLO_COMPILE=y It can be embedded into the U-Boot binary with:: diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 1179c31bb13..ab2c1c44364 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -516,4 +516,16 @@ config EFI_HTTP_BOOT Enabling this option adds EFI HTTP Boot support. It allows to directly boot from network. +config BOOTEFI_HELLO_COMPILE + bool "Compile a standard EFI hello world binary for testing" + default y + help + This compiles a standard EFI hello world application with U-Boot so + that it can be used with the test/py testing framework. This is useful + for testing that EFI is working at a basic level, and for bringing + up EFI support on a new architecture. + + No additional space will be required in the resulting U-Boot binary + when this option is enabled. + endif diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index 2af6f2066b5..27dbd9e760d 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -27,7 +27,7 @@ always += boothart.efi targets += boothart.o endif -ifneq ($(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),) +ifneq ($(CONFIG_BOOTEFI_HELLO_COMPILE),) always += helloworld.efi targets += helloworld.o endif diff --git a/test/py/tests/test_efi_fit.py b/test/py/tests/test_efi_fit.py index 0ad483500f8..550058a30fd 100644 --- a/test/py/tests/test_efi_fit.py +++ b/test/py/tests/test_efi_fit.py @@ -119,7 +119,7 @@ FDT_DATA = ''' ''' @pytest.mark.buildconfigspec('bootm_efi') -@pytest.mark.buildconfigspec('cmd_bootefi_hello_compile') +@pytest.mark.buildconfigspec('BOOTEFI_HELLO_COMPILE') @pytest.mark.buildconfigspec('fit') @pytest.mark.notbuildconfigspec('generate_acpi_table') @pytest.mark.requiredtool('dtc') diff --git a/test/py/tests/test_efi_loader.py b/test/py/tests/test_efi_loader.py index 85473a9049b..ef1f1f1afb3 100644 --- a/test/py/tests/test_efi_loader.py +++ b/test/py/tests/test_efi_loader.py @@ -148,7 +148,7 @@ def fetch_tftp_file(u_boot_console, env_conf): return addr @pytest.mark.buildconfigspec('of_control') -@pytest.mark.buildconfigspec('cmd_bootefi_hello_compile') +@pytest.mark.buildconfigspec('BOOTEFI_HELLO_COMPILE') def test_efi_helloworld_net(u_boot_console): """Run the helloworld.efi binary via TFTP. From patchwork Sun Aug 11 14:51:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971339 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=TAxOoQ9t; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhgpQ6G91z1yXl for ; Mon, 12 Aug 2024 01:01:34 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DDF6688A75; Sun, 11 Aug 2024 16:52:59 +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="TAxOoQ9t"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D036388A95; Sun, 11 Aug 2024 16:52:55 +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.2 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 mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) (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 A84A788B2A for ; Sun, 11 Aug 2024 16:52: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=sjg@chromium.org Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-81fe38c7255so201735139f.1 for ; Sun, 11 Aug 2024 07:52:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387972; x=1723992772; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bMiCbuMttxcqPPlARM4XLKVYwCWIZE5EuK9sImcrxM8=; b=TAxOoQ9tt6OYuKxGPfnwiz4/ghxDRLaXdt/asZEyBT6XMOnxuelI7Gb7muEZVAoW56 of3eJLhpzT9+FclpAynEuQQI46du/+AD4RjQoW1W1x4Aq+Phase40hTvxF0hhLysaHl8 WRchawgyCY9hZ6pipxpQ104X63WgBoUwKAyto= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387972; x=1723992772; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bMiCbuMttxcqPPlARM4XLKVYwCWIZE5EuK9sImcrxM8=; b=G1ArchPApzZbSCe0zOnib5nzkQ08fVt2cCp5LJBanL+p7rUEAqJEd/F4xx2YQBDrrJ 37Lp5wY36NGnHWn3RUBNdDX4ZaU8nJX700EtOmAqfvKiSWboGdTnDKEwKCkoFf/atOhg MXPbwo80e3v4lV/K6rpuc/ohMtypSpuk8yi+B+tNJVQm6wfF8eDVYFB3kHmm8QfS2W0Y 4cahD+OsIps09uJjU/gDvKXctTvQByY2p/JNgZk912aYPYGR3Ce3P5ojBI4+duJnQsLX 50/a3fdOIYTOPthFSIzMSqjAH01HqGraEcpDtUMgFgRjzsOQ7BPXCMweIM0BZGHGkIeJ 0oKw== X-Gm-Message-State: AOJu0Yz8Wdbvn593P/k0HwD+SL6lAbPRPEGMiRoWdKBA4dLnm9YAcw/v I1CxEfAAWOsDMsiS1YAWAYlXyKAiItvEUowjo73ybTT870KejJpTJIMUGs4/S5HOQXKVzrghX/U = X-Google-Smtp-Source: AGHT+IH/Pkw1QWP5FTjyNOaWQYbszvk1oV2RLi6mVex1BLQRyzBEEhu3UnolHK+5ioWJrAezOWk00Q== X-Received: by 2002:a05:6e02:1a86:b0:39b:2d7d:7289 with SMTP id e9e14a558f8ab-39b8122a0d6mr86894925ab.23.1723387972309; Sun, 11 Aug 2024 07:52:52 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:52 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass , Albert Aribaud , Bin Meng Subject: [PATCH v3 28/40] efi: arm: x86: riscv: Drop crt0/relocal extra- rules Date: Sun, 11 Aug 2024 08:51:57 -0600 Message-Id: <20240811145209.4191404-29-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean The link rule (for $(obj)/%_efi.so) in scripts/Makefile.lib handles pulling in efi_crt0.o and efi_reloc.o so drop the 'extra' rules. Signed-off-by: Simon Glass Suggested-by: Heinrich Schuchardt --- Changes in v3: - Add new patch to drop crt0/relocal extra- rules arch/arm/lib/Makefile | 7 ------- arch/riscv/lib/Makefile | 3 --- arch/x86/lib/Makefile | 16 ---------------- 3 files changed, 26 deletions(-) diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 4e54c577cc3..87000d1609b 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -129,10 +129,3 @@ CFLAGS_REMOVE_$(EFI_CRT0) := $(CFLAGS_NON_EFI) CFLAGS_$(EFI_RELOC) := $(CFLAGS_EFI) CFLAGS_REMOVE_$(EFI_RELOC) := $(CFLAGS_NON_EFI) - -# TODO: As of v2019.01 the relocation code for the EFI application cannot -# be built on ARMv7-M. -ifndef CONFIG_CPU_V7M -#extra-$(CONFIG_CMD_BOOTEFI_SELFTEST) += $(EFI_CRT0) $(EFI_RELOC) -endif -extra-$(CONFIG_EFI) += $(EFI_CRT0) $(EFI_RELOC) diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile index 4f6272aab6e..bcfdb516b76 100644 --- a/arch/riscv/lib/Makefile +++ b/arch/riscv/lib/Makefile @@ -36,9 +36,6 @@ CFLAGS_REMOVE_$(EFI_CRT0) := $(CFLAGS_NON_EFI) CFLAGS_$(EFI_RELOC) := $(CFLAGS_EFI) CFLAGS_REMOVE_$(EFI_RELOC) := $(CFLAGS_NON_EFI) -extra-$(CONFIG_CMD_BOOTEFI_SELFTEST) += $(EFI_CRT0) $(EFI_RELOC) -extra-$(CONFIG_EFI) += $(EFI_CRT0) $(EFI_RELOC) - obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMSET) += memset.o obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMMOVE) += memmove.o obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMCPY) += memcpy.o diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index 8bc8d92172b..d6ea9c955f8 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -87,19 +87,3 @@ extra-$(CONFIG_EFI_STUB_32BIT) += crt0_ia32_efi.o reloc_ia32_efi.o extra-$(CONFIG_EFI_STUB_64BIT) += crt0_x86_64_efi.o reloc_x86_64_efi.o endif - -ifdef CONFIG_EFI_STUB - -ifeq ($(CONFIG_$(SPL_)X86_64),) -extra-y += $(EFI_CRT0) $(EFI_RELOC) -endif - -else - -ifndef CONFIG_SPL_BUILD -ifneq ($(CONFIG_CMD_BOOTEFI_SELFTEST),) -extra-y += $(EFI_CRT0) $(EFI_RELOC) -endif -endif - -endif From patchwork Sun Aug 11 14:51:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971340 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=mTDU1bjm; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgpd5xmCz1yXl for ; Mon, 12 Aug 2024 01:01:45 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4D17788BB5; Sun, 11 Aug 2024 16:53:00 +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="mTDU1bjm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 71BAC88BCB; Sun, 11 Aug 2024 16:52:56 +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.2 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 mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) (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 5D18F889CB for ; Sun, 11 Aug 2024 16:52:54 +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-il1-x12d.google.com with SMTP id e9e14a558f8ab-37636c3872bso15679825ab.3 for ; Sun, 11 Aug 2024 07:52:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387973; x=1723992773; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VDi34zh5iUF/lazft3RFzZ6HaolClJOkEgnwinZkr2E=; b=mTDU1bjm40znMQLf6sMC0sFe6go4+PAz0RzK/vmOBh6+NhaxV5f3jPi32HoJl8yWxA qh4IhLCp/ZhBKj/AxU5EM0257fEInJEJWmU1ofOAL1Lem7DIavOCsJLOLABR8DhY0TwO dHo/dcpY+n8fBjUvnMh0IlKmqjUj+aPrMdEAo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387973; x=1723992773; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VDi34zh5iUF/lazft3RFzZ6HaolClJOkEgnwinZkr2E=; b=mMnpnmGhIl2BsZEvbej1fcJ9RFWPCGWtk5Zn9Gi1rr5lPy1PSpXaLScfg/zlik0FHn +3fsqNYauSDChcqQZmb8Q8seh72222mv2c6msjPC+JzoPeVAnbgQrU0o+sw34pM5PL7u jBKnIfXsJNHfPuEFSZVC1UA2v4avj7BbLXStb/ClGdMrTgJzpX2UaGhGjPGFgdCrDBej gCDyFK1GUvz85KYyGjtELjYZWuM3JIC+CodKwbtyKyafggLAOCgj7HCcnTZWXi6Cn4mR jwpvb9haDMhcXb2C299GxQxNeAu4S35lHMqvAhbgeU8XCLmhgaw3D4HxoTquzW+DgrMo kkJA== X-Gm-Message-State: AOJu0YzfRkcVWBA10FmbqrXuW10BkUnNnrgxz4nehvF/MusWnRoKg7ac X2gF7bhfnD70auBJ7AStHE4ordRP+Bn9crn2WlzcUoFbaLBAkptLUmYVsuNTME1teo2/ZHOvFlo = X-Google-Smtp-Source: AGHT+IETZ5LLPYO6Bo4Vrjnt3WK5QANA5aYgZhcz7uv0ys+4FqLC3IwtdaRnty3HzjgsL+XWuFNc+w== X-Received: by 2002:a05:6e02:138c:b0:39a:e9ec:9462 with SMTP id e9e14a558f8ab-39b748522fdmr95338715ab.5.1723387973042; Sun, 11 Aug 2024 07:52:53 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:52 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 29/40] efi_loader: Shorten the app rules Date: Sun, 11 Aug 2024 08:51:58 -0600 Message-Id: <20240811145209.4191404-30-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean We have quite a few apps now, so create a way to specify them as a list rather than repeating the same rules again and again. Signed-off-by: Simon Glass Reviewed-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- (no changes since v1) lib/efi_loader/Makefile | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index 27dbd9e760d..660368b9d8f 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -22,29 +22,13 @@ CFLAGS_REMOVE_dtbdump.o := $(CFLAGS_NON_EFI) CFLAGS_initrddump.o := $(CFLAGS_EFI) -Os -ffreestanding CFLAGS_REMOVE_initrddump.o := $(CFLAGS_NON_EFI) -ifdef CONFIG_RISCV -always += boothart.efi -targets += boothart.o -endif - -ifneq ($(CONFIG_BOOTEFI_HELLO_COMPILE),) -always += helloworld.efi -targets += helloworld.o -endif - -ifneq ($(CONFIG_GENERATE_SMBIOS_TABLE),) -always += smbiosdump.efi -targets += smbiosdump.o -endif - +# These are the apps that are built +apps-$(CONFIG_RISCV) += boothart +apps-$(CONFIG_BOOTEFI_HELLO_COMPILE) += helloworld +apps-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbiosdump +apps-$(CONFIG_EFI_LOAD_FILE2_INITRD) += initrddump ifeq ($(CONFIG_GENERATE_ACPI_TABLE),) -always += dtbdump.efi -targets += dtbdump.o -endif - -ifdef CONFIG_EFI_LOAD_FILE2_INITRD -always += initrddump.efi -targets += initrddump.o +apps-y += dtbdump endif obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o @@ -95,3 +79,6 @@ obj-$(CONFIG_EFI_ECPT) += efi_conformance.o EFI_VAR_SEED_FILE := $(subst $\",,$(CONFIG_EFI_VAR_SEED_FILE)) $(obj)/efi_var_seed.o: $(srctree)/$(EFI_VAR_SEED_FILE) + +always += $(foreach f,$(apps-y),$(f).efi) +targets += $(foreach f,$(apps-y),$(f).o) From patchwork Sun Aug 11 14:51:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971341 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=lHjd7fac; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgpt1zzVz1yXl for ; Mon, 12 Aug 2024 01:01:58 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A34E688BC7; Sun, 11 Aug 2024 16:53:00 +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="lHjd7fac"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 39D5088C1F; Sun, 11 Aug 2024 16:52:57 +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.2 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 mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) (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 1F87688A7E for ; Sun, 11 Aug 2024 16:52:55 +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-il1-x12a.google.com with SMTP id e9e14a558f8ab-39b06af1974so12699065ab.2 for ; Sun, 11 Aug 2024 07:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387974; x=1723992774; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6J+3K1D32XFzIlqKv8IxwxtO9z9dD+tWb033XYnecns=; b=lHjd7facEJhBqtZL3iM5dHXHfsDxLh131tja2xB9ZRmL/eQpyqqmN6pIA1IGao8pw5 tCGDmC3MVsiISb65nkjxWgNlINuOa+U2j9H2xvBSocZxhTC3ZKBca+1+4ZXFs+4nj81E D95t5UEpWLTvY/DXhRiaSY6vfSQU//4AekGJ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387974; x=1723992774; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6J+3K1D32XFzIlqKv8IxwxtO9z9dD+tWb033XYnecns=; b=iBi46rmaoNlr49xCPbvbQTLCYItrCqd5rWBvCHCUAoyn2YNgCWUuDyrWmiIi7cG2aF Y4UXTIjfiGp58pMGiI5MVHhVL2ze+D+PekSagq26F1jCWUBAdAazhc8xeYlF0bo53Zpk SCyXjJb4QSUE+8EqT9f0he/K9PsLUEDmdJs8PtomrXSHEdP7YssHVDtOPCcUx2Xm/HTU bKAJpFilPu3sZzZoJGjNKqL2rwsaXYgeFc3ZydHayDJUpUwNzXbrgaBl+TgFF0wpep7N yfITrjotng2Raou7CAe+My/wdDuY/SYI2TGgcm9nqi89jht2+Nuts56pQror6elQRHyz Lpeg== X-Gm-Message-State: AOJu0YxKftL+a9dJKuavMBb4yU6JIIxd0oDUvk7M1dfVsBSROJ2VMEwE O+VdpOi9leyBn29TbH3MnPoag1gTEA0fz2y7BBcuF+vV7ZjfTunzR+HQM6h2VL3tOnbWtmz5G8s = X-Google-Smtp-Source: AGHT+IHp0ABd9SEp2+fzQcFF0Mrnk6pgRVn0IilJttWA5LpPKjdVZD4DtLflXlV6CON7L8qgDktpTA== X-Received: by 2002:a92:c54b:0:b0:397:95c7:6f5d with SMTP id e9e14a558f8ab-39b7a410945mr78507035ab.11.1723387973803; Sun, 11 Aug 2024 07:52:53 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:53 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 30/40] efi_loader: Shorten the app rules further Date: Sun, 11 Aug 2024 08:51:59 -0600 Message-Id: <20240811145209.4191404-31-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Add a way to factor out the CFLAGS changes for each app, since they are all the same. Signed-off-by: Simon Glass Reviewed-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- (no changes since v1) lib/efi_loader/Makefile | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index 660368b9d8f..00d18966f9e 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -11,16 +11,6 @@ asflags-y += -I. CFLAGS_efi_boottime.o += \ -DFW_VERSION="0x$(VERSION)" \ -DFW_PATCHLEVEL="0x$(PATCHLEVEL)" -CFLAGS_boothart.o := $(CFLAGS_EFI) -Os -ffreestanding -CFLAGS_REMOVE_boothart.o := $(CFLAGS_NON_EFI) -CFLAGS_helloworld.o := $(CFLAGS_EFI) -Os -ffreestanding -CFLAGS_REMOVE_helloworld.o := $(CFLAGS_NON_EFI) -CFLAGS_smbiosdump.o := $(CFLAGS_EFI) -Os -ffreestanding -CFLAGS_REMOVE_smbiosdump.o := $(CFLAGS_NON_EFI) -CFLAGS_dtbdump.o := $(CFLAGS_EFI) -Os -ffreestanding -CFLAGS_REMOVE_dtbdump.o := $(CFLAGS_NON_EFI) -CFLAGS_initrddump.o := $(CFLAGS_EFI) -Os -ffreestanding -CFLAGS_REMOVE_initrddump.o := $(CFLAGS_NON_EFI) # These are the apps that are built apps-$(CONFIG_RISCV) += boothart @@ -80,5 +70,10 @@ obj-$(CONFIG_EFI_ECPT) += efi_conformance.o EFI_VAR_SEED_FILE := $(subst $\",,$(CONFIG_EFI_VAR_SEED_FILE)) $(obj)/efi_var_seed.o: $(srctree)/$(EFI_VAR_SEED_FILE) +# Set the C flags to add and remove for each app +$(foreach f,$(apps-y),\ + $(eval CFLAGS_$(f).o := $(CFLAGS_EFI) -Os -ffreestanding)\ + $(eval CFLAGS_REMOVE_$(f).o := $(CFLAGS_NON_EFI))) + always += $(foreach f,$(apps-y),$(f).efi) targets += $(foreach f,$(apps-y),$(f).o) From patchwork Sun Aug 11 14:52:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971342 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=m9O3cezk; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgq75BJMz1yXl for ; Mon, 12 Aug 2024 01:02:11 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 29D6288C01; Sun, 11 Aug 2024 16:53:01 +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="m9O3cezk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E006E88C30; Sun, 11 Aug 2024 16:52:57 +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.2 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 mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) (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 CD32388AD7 for ; Sun, 11 Aug 2024 16:52:55 +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-io1-xd36.google.com with SMTP id ca18e2360f4ac-81f8f0197abso176469339f.2 for ; Sun, 11 Aug 2024 07:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387974; x=1723992774; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bcP6BtqafScc0NdTztSLCjfNhuuO7jN51LuoNSQ0VeE=; b=m9O3cezk6vmBRoSIoVa2Ouq/SI8F3VpfcvlkxqhJIMDsKPmKKbiYbM3pNZG5hMb/jN XDdeGi1QwUcF7rU5MfR9K+Lru5EMvqd+Rev42jkzey6VoDNuBm/Tp2jxDgw/sWJQK+03 +KVzUsK0waYPeWkOHeKHmS3RtDxKpdNbmNBSI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387974; x=1723992774; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bcP6BtqafScc0NdTztSLCjfNhuuO7jN51LuoNSQ0VeE=; b=KgIBQC1ZsGnTGQC0uX8Bq7KN8RTrYMDmBH86q5WgWF4kvcqwZ6tXTuAgyOkkW9lwW5 AlNNpGw+TD701bN7kErl4NJpyfMflPjSFpAocAp/fbvFAW0wN80JmUZhusdFhFzT7MK1 NZwJ8GcRo6fQ3y/3uVv3j7RF87D/qxpgA4UlXt+/rLF3p4VSH/xn2P9lbmFYGXVBXIRT nDpIixXmCkDHHCq4zTSQmvu7mqaO8t7gc4fOzYubw+mvGx9An6RkLsF57olDCYHimgPK j0WW9u3QGIQTFsk/TjgD0MxgcMJU1nEnpIJwl4S7vnKfpQ59u58vmD+Ug27x059P766a L59A== X-Gm-Message-State: AOJu0YyohVCVvFyXlUiNl59McI9R1OfbZa5YQmZg8sVjhSS2+0Vnytr0 BmZXkQ6m0Dcc/keTcImepPbnMcvPDwaLaCyuCdFr9JNJBsI5rQ/dB+XLTRl0tWO50mcJbdVewKE = X-Google-Smtp-Source: AGHT+IE6C4tf/fDXZakM1hmi76V4nQxPohnyNNmxMG3RrByn/JvbdSzg06TtMx98/yxX6XAyW0mnpw== X-Received: by 2002:a05:6e02:1fe1:b0:39a:14f7:1c1c with SMTP id e9e14a558f8ab-39b813286b9mr84260825ab.25.1723387974446; Sun, 11 Aug 2024 07:52:54 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:54 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 31/40] efi: Show the vendor in helloworld Date: Sun, 11 Aug 2024 08:52:00 -0600 Message-Id: <20240811145209.4191404-32-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Show the vendor name so it is clear which firmware is being used, e.g. whether U-Boot is providing the boot services. Signed-off-by: Simon Glass Reviewed-by: Ilias Apalodimas --- (no changes since v2) Changes in v2: - Reword commit message - Use 'Firmware vendor' instead of just 'Vendor' lib/efi_loader/helloworld.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/efi_loader/helloworld.c b/lib/efi_loader/helloworld.c index 586177de0c8..c4d2afcb40a 100644 --- a/lib/efi_loader/helloworld.c +++ b/lib/efi_loader/helloworld.c @@ -237,6 +237,9 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, (con_out, u"Missing device path for device handle\r\n"); goto out; } + con_out->output_string(con_out, u"Firmware vendor: "); + con_out->output_string(con_out, systab->fw_vendor); + con_out->output_string(con_out, u"\n"); con_out->output_string(con_out, u"Boot device: "); ret = print_device_path(device_path, device_path_to_text); if (ret != EFI_SUCCESS) From patchwork Sun Aug 11 14:52:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971343 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=MMTPS6Fh; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhgqL1L0Hz1yXl for ; Mon, 12 Aug 2024 01:02:22 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8843688C25; Sun, 11 Aug 2024 16:53:03 +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="MMTPS6Fh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1C34288B9F; Sun, 11 Aug 2024 16:53:00 +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.2 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 mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (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 888A588BCB for ; Sun, 11 Aug 2024 16:52: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=sjg@chromium.org Received: by mail-il1-x12b.google.com with SMTP id e9e14a558f8ab-39b3a4d2577so12272165ab.3 for ; Sun, 11 Aug 2024 07:52:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387975; x=1723992775; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Og7RzCRZ6P7JZ73xgqQ33OT1hycWQPRTf3lWUqFTQ7k=; b=MMTPS6FhVD2AyFV0k4fKM8hSOHhO2eRCO/F/r82PXZeCgR8zbjoTp8bzLCp4W1YB0/ 1g9u08eCotD9fq62f6l2WMxm8Zhd6/kyKml77PBXOE0NlP58+KJ/81aM6HydtKtldq+L efDVYhCce4exhTkrO9mz20ENKJ3e0FnW3CtbQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387975; x=1723992775; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Og7RzCRZ6P7JZ73xgqQ33OT1hycWQPRTf3lWUqFTQ7k=; b=wNQPVMy6xHKww81D2miXxVoNgVVW5LsZoW68ELfwDkPdrWhNCIwlIoUx/kQQvQ5vor m0uAX6ZLBzlkbb7QCNx5oeyFR0cvqC03cVFFkjOBrkPAJQN9hvQ+UAJ3PqQsOzZyTLG4 zlMQG2KQqhJkTc2k14xRac9N6y5OMnVeAZ8oulNweceoJnEaR4cznTlOZi5/EzVSPAyf +zmVIBZsSBRLljm+DF5wnAuXx4IdZLZcHyI8W6ME9dLLmy4yf7ORzK/YABRavyzGidQQ V9ZtTs8wXLlHE2ALCl82LQlkgc+4z89nmHBVvxpgh+Qqs/IGRBeaoIzjuYa9Qjv86tBK hUtg== X-Gm-Message-State: AOJu0YytFENrFs9BWLwzOMifO/EvUvq4rA4vSLuMRUs1ldRZJLpVjPM3 f23b8qEIGUHz9d/nG2FEfle0xYO1K43dLsdzvXqg1rI0puCH5NbUf6nyVAnqGPeZRWf6aP8n5KQ = X-Google-Smtp-Source: AGHT+IEtVIIj7Rqi/nbk4pCBr+eulC3Ft76BFYjJYjeZ9CTfT9wm+WJbsj0CNhPsoHyyLzUHypRfLA== X-Received: by 2002:a05:6e02:2194:b0:376:410b:ae67 with SMTP id e9e14a558f8ab-39b7a4205demr109709135ab.16.1723387975161; Sun, 11 Aug 2024 07:52:55 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:54 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 32/40] Revert "bootdev: avoid infinite probe loop" Date: Sun, 11 Aug 2024 08:52:01 -0600 Message-Id: <20240811145209.4191404-33-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean This turns out to be insufficient to fix the problem, since when bootdev_next_prio() exits, the caller has no idea that this really is the end. Nor is it, since there may be other devices which should be checked. The caller iterates which calls iter_incr() which calls bootdev_next_prio() again, which finds the same device and the loop continues. We never did create a test for this[1], which makes it hard to be sure which problem was fixed. The original code had the virtue of staying in the loop looking for a bootdev, so let's go back to that and try to fix this another way. A future patch will make bootdev_next_prio() continue after failure which should provide same effect. This reverts commit 9d92c418acfb7576e12e2bd53fed294bb9543724. Signed-off-by: Simon Glass --- Changes in v3: - Update commit message to describe how the problem will be addressed - Fix 'virtual' typo boot/bootdev-uclass.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index 7c7bba088c9..15a8a3555c6 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -632,7 +632,7 @@ int bootdev_next_label(struct bootflow_iter *iter, struct udevice **devp, int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp) { - struct udevice *dev = *devp, *last_dev = NULL; + struct udevice *dev = *devp; bool found; int ret; @@ -682,19 +682,9 @@ int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp) } } else { ret = device_probe(dev); - if (!ret) - last_dev = dev; if (ret) { - log_warning("Device '%s' failed to probe\n", + log_debug("Device '%s' failed to probe\n", dev->name); - if (last_dev == dev) { - /* - * We have already tried this device - * and it failed to probe. Give up. - */ - return log_msg_ret("probe", ret); - } - last_dev = dev; dev = NULL; } } From patchwork Sun Aug 11 14:52:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971348 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=Oh1sVEJC; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhgrL02TYz1yXl for ; Mon, 12 Aug 2024 01:03:14 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 60AFA888AB; Sun, 11 Aug 2024 16:53:08 +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="Oh1sVEJC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B8B8388898; Sun, 11 Aug 2024 16:53:04 +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.2 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 mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) (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 24DF088C16 for ; Sun, 11 Aug 2024 16:52:57 +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-il1-x132.google.com with SMTP id e9e14a558f8ab-39b38295008so10986245ab.2 for ; Sun, 11 Aug 2024 07:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387976; x=1723992776; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yzZSEdq27xsTACKG9U6R1IRZchzVcWl4fQRrNpNdfyQ=; b=Oh1sVEJCA9Yb5ou6aoeiY72oGbYevQpkKqx/Jgxs5YgDJB3LhC1R8BtJbXBGLBe/OW Ew1+3BUmkGP3GJ/OrOxOvvjWOGm7sa30VU3yaTUQAuGTAcN5crl8KQscUjcEIaDn4Hun lR+co6hA72q2M+KUGkOX3q6r9nHqysncMEKTc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387976; x=1723992776; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yzZSEdq27xsTACKG9U6R1IRZchzVcWl4fQRrNpNdfyQ=; b=vQeFFkZZWzgB/MdiQ3RZp9PHcu+isFsLu3vXuqtJ5gS3PUn0YNqw23ZE0oQvjVaPBY TB7cjryyFHHrJqOUCzyKPxwNWnSX8SURzbFBWcW6emb0CLlMBZtATxDmcjrJT1OwxG3r h5hPnq2NqXDcul27gnGB0LSidRpiOm7TgTc0Z/rC0n1kcugXbqhsMh9v39RXfAIwq8AI K3IK/JrpogCNsfLOHbpjmnmQiIN+TP6w+npA9kQcdInOTWBp2EGsTtiBcrIxx0CR9RDS KDD0C6jT6oi4StP8t4jy6Noy/ffkbr3VstCdraiu8t5yy93bZfSQAjj/JDma5h30vzjb wySA== X-Gm-Message-State: AOJu0YwMIBmbvg+os/7qPv5pAieab4PNVPQqw1TdPN8ZkJdSZeVWsIDF GlwUx7WGpyRXJe8YRwZmFwVw8156cH5/5MzegpQlMORKIXyapKn4/5dGLlt19R/PC9Y+kyZhl2I = X-Google-Smtp-Source: AGHT+IEM4+BQJoxsZYBF2cIs6xsBdqDD1d+BaV5dGPCUHR3Im7EwI0dg73V3kYvdcRrFM3J2L4sisA== X-Received: by 2002:a05:6e02:1525:b0:374:ac3a:e32c with SMTP id e9e14a558f8ab-39b78492e8emr86299605ab.16.1723387975815; Sun, 11 Aug 2024 07:52:55 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:55 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 33/40] bootstd: Make bootdev_next_prio() continue after failure Date: Sun, 11 Aug 2024 08:52:02 -0600 Message-Id: <20240811145209.4191404-34-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean When a device fails to probe, the next device should be tried, until either we find a suitable device or run out of devices. A device should never be tried twice. When we run out of devices of a particular priority, the hunter should be used to generate devices of the next priority. Only if all attempts fail should this function return an error. Update the function to use the latent 'found' boolean to determine whether another loop iteration is warranted, rather than setting 'dev' to NULL, which creates confusion, suggesting that no devices have been scanned and the whole process is starting from the beginning. Note that the upcoming bootflow_efi() test is used to test this behaviour. Signed-off-by: Simon Glass Fixes: https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/17 --- (no changes since v1) boot/bootdev-uclass.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index 15a8a3555c6..807f8dfb064 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -640,6 +640,7 @@ int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp) *devp = NULL; log_debug("next prio %d: dev=%p/%s\n", iter->cur_prio, dev, dev ? dev->name : "none"); + found = false; do { /* * Don't probe devices here since they may not be of the @@ -682,13 +683,13 @@ int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp) } } else { ret = device_probe(dev); - if (ret) { + if (ret) log_debug("Device '%s' failed to probe\n", dev->name); - dev = NULL; - } + else + found = true; } - } while (!dev); + } while (!found); *devp = dev; From patchwork Sun Aug 11 14:52:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971344 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=TAsLKdvk; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhgqW4SM4z1yXl for ; Mon, 12 Aug 2024 01:02:31 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E264B88C3C; Sun, 11 Aug 2024 16:53:03 +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="TAsLKdvk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 254F388BA5; Sun, 11 Aug 2024 16:53:00 +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.2 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 mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) (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 BC07388C2A for ; Sun, 11 Aug 2024 16:52:57 +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-io1-xd33.google.com with SMTP id ca18e2360f4ac-81f85130660so143489639f.1 for ; Sun, 11 Aug 2024 07:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387976; x=1723992776; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XwxAiFESs65vbo6QNOU8SXLS8pkdRiY6L9eOgLqhNdc=; b=TAsLKdvkRHxNFGvJs+vR8EN0TbY0L4IFRU3E6jTYZhDocR47/D2qwJMrsFwKmFh8jf gHHlIKmT0pUG+UnqVPmYV48D+gf7lIVqJ0/MLp3WsjPKvx4nOGy266nasQeNprnV2wcu yktjMqj+aNYQzLcEUZWh1BZ73cCCZpkE55hiM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387976; x=1723992776; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XwxAiFESs65vbo6QNOU8SXLS8pkdRiY6L9eOgLqhNdc=; b=SMfdLvwi3X2pZ8JMY9fG0HqcjuEcr1n6WKRTNcEi4OmBZjxmzjLVVIoHCYXDM+CLXf uYctBpNN19MjMJQlLgqMciBRrpXFD+GdgeucjW+LRvshSN0ITTWdu2WkrbcNe+7zFWKW ruGQVAz/Yyr02D8dIXsyZCEf+WoFaFkXZIyh/j1Egoe+20DeciKDv3obfxzrm8j8wwY/ QLU9lTPYSW2FyHVVpSwAbyxr8HWuh6GonEHlGSo21WkY8C9fSWWVna5G6l7rJodaUTPo YWPGkotGuwjSEWj8aedbVTHAWDiMO0oiUSd5w0zcXuArmCjTg9jMORZW6cz0uRnZqdH1 ZwIg== X-Gm-Message-State: AOJu0YxqMwjmiRz36SmCN+rGGhtoau7adHAVWFd5FExO8+6eeKBDGQtH 3eTrPGYSGTCUycCN7V9AVjiwx41NhfO/SsToICtXenLtWISGdipHyRRUUZ3XJRjY5ntp9ecowjM = X-Google-Smtp-Source: AGHT+IHtXje9OyFNqb9tbpa0zW37Dp0GTmky/6EkK+4nDEqBzRhhFiYvCjpCWBjdccGYq0BwBflsZQ== X-Received: by 2002:a92:c56a:0:b0:375:acd3:31b3 with SMTP id e9e14a558f8ab-39bd419bcbbmr80004615ab.5.1723387976495; Sun, 11 Aug 2024 07:52:56 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:56 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 34/40] efi: Use the same filename for all sandbox builds Date: Sun, 11 Aug 2024 08:52:03 -0600 Message-Id: <20240811145209.4191404-35-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Sandbox is not a real architecture, but within U-Boot it is real enough. We should not need to pretend it is x86 or ARM anywhere in the code. Also we want to be able to locate the sandbox app using a single filename, 'bootsbox.efi', to avoid needing tests to produce different files on each host architecture. Drop the confusing use of host architecture and just let sandbox be sandbox. Signed-off-by: Simon Glass Fixes: 3a0654ecd0d ("efi_loader: correctly identify binary name") --- Changes in v3: - Put back the Linaro copyright accidentally removed include/efi_default_filename.h | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/include/efi_default_filename.h b/include/efi_default_filename.h index 77932984b55..06ca8735002 100644 --- a/include/efi_default_filename.h +++ b/include/efi_default_filename.h @@ -16,26 +16,8 @@ #undef BOOTEFI_NAME #ifdef CONFIG_SANDBOX - -#if HOST_ARCH == HOST_ARCH_X86_64 -#define BOOTEFI_NAME "BOOTX64.EFI" -#elif HOST_ARCH == HOST_ARCH_X86 -#define BOOTEFI_NAME "BOOTIA32.EFI" -#elif HOST_ARCH == HOST_ARCH_AARCH64 -#define BOOTEFI_NAME "BOOTAA64.EFI" -#elif HOST_ARCH == HOST_ARCH_ARM -#define BOOTEFI_NAME "BOOTARM.EFI" -#elif HOST_ARCH == HOST_ARCH_RISCV32 -#define BOOTEFI_NAME "BOOTRISCV32.EFI" -#elif HOST_ARCH == HOST_ARCH_RISCV64 -#define BOOTEFI_NAME "BOOTRISCV64.EFI" -#else -#error Unsupported UEFI architecture -#endif - -#else - -#if defined(CONFIG_ARM64) +#define BOOTEFI_NAME "BOOTSBOX.EFI" +#elif defined(CONFIG_ARM64) #define BOOTEFI_NAME "BOOTAA64.EFI" #elif defined(CONFIG_ARM) #define BOOTEFI_NAME "BOOTARM.EFI" @@ -52,5 +34,3 @@ #endif #endif - -#endif From patchwork Sun Aug 11 14:52:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971349 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=RahY2NM/; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WhgrX5lnkz1yXl for ; Mon, 12 Aug 2024 01:03:24 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B9DF688C4D; Sun, 11 Aug 2024 16:53:08 +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="RahY2NM/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BCF548889C; Sun, 11 Aug 2024 16:53:04 +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.2 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 mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) (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 6388888A25 for ; Sun, 11 Aug 2024 16:52:58 +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-il1-x12c.google.com with SMTP id e9e14a558f8ab-39c2f653efcso5890865ab.2 for ; Sun, 11 Aug 2024 07:52:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387977; x=1723992777; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AZPs5LxcNNfqWmMn1am7y0YE8qmewycHIxMGVk0UTcc=; b=RahY2NM/OYCDifSK1+FVIdWsDlEDipghQGMxqNopb0Vh/BFtkwzqkO6jiNTqm94Cc8 h8Sf4k9qAKwrh1Eg/z+5E59E2vII1XWpHum6Ff9gqXnrtpWcUTQO4exfA18SW0kVfVpg 5N5vFmKPg0SaIZFCUQXeov05DirDPuy6RXvbc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387977; x=1723992777; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AZPs5LxcNNfqWmMn1am7y0YE8qmewycHIxMGVk0UTcc=; b=n4UJBeVeAormj5u8ZCAOVmFfSmMpw2GppwDYxDCHS+fU3ISIgwq+5qA7h0EC4cUQYx YR5vcbsYXJYgsWAJ820obKQ0yoiljESM7hZIv3w/WD1oaPrbptOxBTrL4FllqRo/VHv9 r/XBEC43WyLFaKBtvCGQ+IaFVsfFBKHsErUpSrm4gCuz7ZyagAn9fPjYUWXRc838HRwJ jBdW1trh+t0ne/MsMf5aA+xDhm7OO9CGumBepiBwkHGA13FxwyYVSj2W6dC13pRQ/RwG ZBf900oBOPIjftW6aPs6SLptQi/T4L38qUP178/S5wtNcMj8rTzVp802mAb2izxXY9aR ycfA== X-Gm-Message-State: AOJu0Yya7/aS/KzuHWYb2KdQL3kFf5B+TZa0g/gfJRfFXCy1DcNxE46W lgtsKQLV3wV2+Xp2z7XmIy5EkAG5UH/rjz57cPXyzIkv5odRdn97sp4/OrWeesOgpq9KFVz0cTk = X-Google-Smtp-Source: AGHT+IHw6qwgyWh7odjaszTbr1OC8RrfIAtvKNAvPNYurxihEtx8HiDNzMDmlvXc9LnmUCYk+XOrtw== X-Received: by 2002:a05:6e02:b49:b0:382:64d9:1cba with SMTP id e9e14a558f8ab-39b815a4dcfmr91263875ab.19.1723387977123; Sun, 11 Aug 2024 07:52:57 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:56 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 35/40] bootstd: Add debugging for efi bootmeth Date: Sun, 11 Aug 2024 08:52:04 -0600 Message-Id: <20240811145209.4191404-36-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Add a little debugging so we can see what is happening. Signed-off-by: Simon Glass --- (no changes since v1) boot/bootmeth_efi.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c index 39232eb2e25..99887a89f02 100644 --- a/boot/bootmeth_efi.c +++ b/boot/bootmeth_efi.c @@ -163,8 +163,10 @@ static int distro_efi_try_bootflow_files(struct udevice *dev, int ret, seq; /* We require a partition table */ - if (!bflow->part) + if (!bflow->part) { + log_debug("no partitions\n"); return -ENOENT; + } strcpy(fname, EFI_DIRNAME); strcat(fname, BOOTEFI_NAME); @@ -172,8 +174,10 @@ static int distro_efi_try_bootflow_files(struct udevice *dev, if (bflow->blk) desc = dev_get_uclass_plat(bflow->blk); ret = bootmeth_try_file(bflow, desc, NULL, fname); - if (ret) + if (ret) { + log_debug("no file\n"); return log_msg_ret("try", ret); + } /* Since we can access the file, let's call it ready */ bflow->state = BOOTFLOWST_READY; @@ -308,6 +312,8 @@ static int distro_efi_read_bootflow(struct udevice *dev, struct bootflow *bflow) { int ret; + log_debug("dev='%s', part=%d\n", bflow->dev->name, bflow->part); + /* * bootmeth_efi doesn't allocate any buffer neither for blk nor net device * set flag to avoid freeing static buffer. @@ -333,6 +339,7 @@ static int distro_efi_boot(struct udevice *dev, struct bootflow *bflow) ulong kernel, fdt; int ret; + log_debug("boot\n"); kernel = env_get_hex("kernel_addr_r", 0); if (!bootmeth_uses_network(bflow)) { ret = efiload_read_file(bflow, kernel); From patchwork Sun Aug 11 14:52:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971347 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=cCqJgkrX; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgr73xNcz1yXl for ; Mon, 12 Aug 2024 01:03:03 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0C44988C4A; Sun, 11 Aug 2024 16:53:06 +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="cCqJgkrX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 94A2F88898; Sun, 11 Aug 2024 16:53:04 +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.2 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 mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) (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 251F0889E3 for ; Sun, 11 Aug 2024 16:52:59 +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-il1-x12e.google.com with SMTP id e9e14a558f8ab-396675b83afso16623325ab.0 for ; Sun, 11 Aug 2024 07:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387978; x=1723992778; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9fHFqiEb/an93PtFX+BLCkE6/YVYMa2Q9B8rwdB3tC4=; b=cCqJgkrXCiVDk2K3uSd35N4vT85tV+EGNJP0fYN+W7+1VYK1riSR5W9RxoVCqdz9Vm ze/y0/AX9oc75q/GsjYWOtn92IDpbjNnWHuwqr1App/JkrmJ7WesdkV2TyfYQIWMsisa nhtAp83/PvoZf4Jj6rFlqwAbxmhkxdcwbEfc8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387978; x=1723992778; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9fHFqiEb/an93PtFX+BLCkE6/YVYMa2Q9B8rwdB3tC4=; b=fQ5bCuCiWfPyrQm7RETHhd4wOeixe1a0o5py0G6tMv+U+ILpjGgm8Zm7s+6KBI/5Ut yvNx2Q3fQhOQVwxiQ45OxSurfVbSfloKd7JHPqEY4Sh3uAcNEuAZs/80iSnSuTlKx+qT s2SI4ySnUw56yTsh+dU69mFws+WNHj0/UMYORbAxHNJHKC00asZdpohw6X7q7G/RK929 Wd5E/a3/CnUEqipAoUA6oxTC0TVQLWY1q/d3LZfzrf6wmuGh9IK2y8VJ7+nzp+G2IQIt o7tVjoTdT4/KQpwcV5ofrRp6atIDxydp3f3sb/wtku/hCUCZwP5tnHoEHfzJKX218TTT v1UQ== X-Gm-Message-State: AOJu0YznOtxvmRLR9yRRCC3XG18HuZ+oWWM9NJFTvt/gxEcvBI3s/Yye Ycp540nhRCt90DU4HL9oX+ghjtQus4zlXgvPa3ySxtI6ZA8fU0Ercuv0szmZ88mwuShBAnhg6RA = X-Google-Smtp-Source: AGHT+IHpz09dKxPWXW3kDi/XuIB4k/3XldBle2JrGQYR7Q4UeGUVbO/W9izLQA409IfsiSw8SPl5XQ== X-Received: by 2002:a05:6e02:13a2:b0:39b:20d8:601e with SMTP id e9e14a558f8ab-39b7a4757aemr95218785ab.3.1723387977840; Sun, 11 Aug 2024 07:52:57 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:57 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 36/40] efi: Disable ANSI output for tests Date: Sun, 11 Aug 2024 08:52:05 -0600 Message-Id: <20240811145209.4191404-37-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean We don't want ANSI characters written in tests since it is a pain to check the output with ut_assert_nextline() et al. Provide a way to tests to request that ANSI characters not be sent. Add a proper function comment while we are here, to encourage others. Signed-off-by: Simon Glass --- (no changes since v1) include/efi_loader.h | 21 ++++++++++++++++++++- lib/efi_loader/efi_console.c | 26 +++++++++++++++++--------- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index f84852e384f..82b90ee0f1d 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -531,8 +531,27 @@ efi_status_t efi_bootmgr_delete_boot_option(u16 boot_index); efi_status_t efi_bootmgr_run(void *fdt); /* search the boot option index in BootOrder */ bool efi_search_bootorder(u16 *bootorder, efi_uintn_t num, u32 target, u32 *index); -/* Set up console modes */ + +/** + * efi_setup_console_size() - update the mode table. + * + * By default the only mode available is 80x25. If the console has at least 50 + * lines, enable mode 80x50. If we can query the console size and it is neither + * 80x25 nor 80x50, set it as an additional mode. + */ void efi_setup_console_size(void); + +/** + * efi_console_set_ansi() - Set whether ANSI characters should be emitted + * + * These characters mess up tests which use ut_assert_nextline(). Call this + * function to tell efi_loader not to emit these characters when starting up the + * terminal + * + * @allow_ansi: Allow emitting ANSI characters + */ +void efi_console_set_ansi(bool allow_ansi); + /* Set up load options from environment variable */ efi_status_t efi_env_set_load_options(efi_handle_t handle, const char *env_var, u16 **load_options); diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index cea50c748aa..569fc9199bc 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -30,6 +30,17 @@ struct cout_mode { __maybe_unused static struct efi_object uart_obj; +/* + * suppress emission of ANSI codes for use by unit tests. Leave it as 0 for the + * default behaviour + */ +static bool no_ansi; + +void efi_console_set_ansi(bool allow_ansi) +{ + no_ansi = !allow_ansi; +} + static struct cout_mode efi_cout_modes[] = { /* EFI Mode 0 is 80x25 and always present */ { @@ -348,13 +359,6 @@ static int __maybe_unused query_vidconsole(int *rows, int *cols) return 0; } -/** - * efi_setup_console_size() - update the mode table. - * - * By default the only mode available is 80x25. If the console has at least 50 - * lines, enable mode 80x50. If we can query the console size and it is neither - * 80x25 nor 80x50, set it as an additional mode. - */ void efi_setup_console_size(void) { int rows = 25, cols = 80; @@ -362,8 +366,12 @@ void efi_setup_console_size(void) if (IS_ENABLED(CONFIG_VIDEO)) ret = query_vidconsole(&rows, &cols); - if (ret) - ret = query_console_serial(&rows, &cols); + if (ret) { + if (no_ansi) + ret = 0; + else + ret = query_console_serial(&rows, &cols); + } if (ret) return; From patchwork Sun Aug 11 14:52:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971350 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=gBNuPSa8; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgrk3RjHz1yXl for ; Mon, 12 Aug 2024 01:03:34 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1A2E288C51; Sun, 11 Aug 2024 16:53:09 +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="gBNuPSa8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 021B388C4D; Sun, 11 Aug 2024 16:53:07 +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.2 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 mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) (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 CD126889E3 for ; Sun, 11 Aug 2024 16:52:59 +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-il1-x12f.google.com with SMTP id e9e14a558f8ab-39b40ab3210so13413755ab.3 for ; Sun, 11 Aug 2024 07:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387978; x=1723992778; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zlZkCax0JTI7O6Xx7eXrCZ1Ss/UmtibuO9+isV4O2ng=; b=gBNuPSa8o1Od/u03tktn3v6S1T0QW3snHtofTVPQfqQUe7s6la+PfOWvMqfviA6P5A +4ozjbIiCnBm9HSm+lmVYMoHe9FWRbRo2x11a2ju5f8dqIfLMNNlicIK2BeH85B/pQlk TS760Qw7s+HYrJKMFOII+SjUXpOWNrc+ckyxs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387978; x=1723992778; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zlZkCax0JTI7O6Xx7eXrCZ1Ss/UmtibuO9+isV4O2ng=; b=mX0gyXDJSvLkCAOxuu4xzuWCTc8jCiuv7JrvR0QJfkXvRgVVxzFrVqHpc1fc0YjFkO FBYGO9dFjIimPnE/IFMgsB6VIS0KYHgwRpPm8IQFVhNsWV6OlWklU2zUvHiIG85CVy/q hy/68uRl1ph1dRxT2yBePk7dZSUIywwqfb2LyioULFnGc7X+7uOIJlGQmcHGg1MAG9gQ ODeRPtd/qv+Kn5Qo0gVgbGO148c9JTR9s8xsVJoded4SyBirUOIYW54HsgRKQ7xpZqZL 3+KI2BbvRHh8zacXYtOYCT1adyIC/zKTsMXrkwH/UoSTDiSlHTAr9jsrJjRw9EQGjF9u FZcQ== X-Gm-Message-State: AOJu0YwpmfDondCBCGHWx/q1KbINYCh0DXH5ulsMyoRb4lHOAbyg5ZxG 7svsxBr9s+ATGgXCwCNoKObXODbIu+q80o+yt7r6NEGaPMaHxMMm34cJ5dRmNyveOBjR2LSrw2U = X-Google-Smtp-Source: AGHT+IHtzC3GnsRLqfO6KDTrb6XIotYDEKifKL4hFP0aPQX+ClYcWMXeb7qcWruJNOL0IvVU0aZGxA== X-Received: by 2002:a92:cd8d:0:b0:398:16d1:610b with SMTP id e9e14a558f8ab-39b6c11b903mr107666255ab.0.1723387978497; Sun, 11 Aug 2024 07:52:58 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:58 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 37/40] efi: Add a test app Date: Sun, 11 Aug 2024 08:52:06 -0600 Message-Id: <20240811145209.4191404-38-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Add a simple app to use for testing. This is intended to do whatever it needs to for testing purposes. For now it just prints a message and exits boot services. Signed-off-by: Simon Glass --- (no changes since v1) lib/efi_loader/Kconfig | 10 ++++++ lib/efi_loader/Makefile | 1 + lib/efi_loader/testapp.c | 68 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 lib/efi_loader/testapp.c diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index ab2c1c44364..4de05c6f2d6 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -528,4 +528,14 @@ config BOOTEFI_HELLO_COMPILE No additional space will be required in the resulting U-Boot binary when this option is enabled. +config BOOTEFI_TESTAPP_COMPILE + bool "Compile an EFI test app for testing" + default y + help + This compiles an app designed for testing. It is packed into an image + by the test.py testing frame in the setup_efi_image() function. + + No additional space will be required in the resulting U-Boot binary + when this option is enabled. + endif diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index 00d18966f9e..87131ab911d 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -20,6 +20,7 @@ apps-$(CONFIG_EFI_LOAD_FILE2_INITRD) += initrddump ifeq ($(CONFIG_GENERATE_ACPI_TABLE),) apps-y += dtbdump endif +apps-$(CONFIG_BOOTEFI_TESTAPP_COMPILE) += testapp obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o obj-$(CONFIG_EFI_BOOTMGR) += efi_bootmgr.o diff --git a/lib/efi_loader/testapp.c b/lib/efi_loader/testapp.c new file mode 100644 index 00000000000..feb444c92e9 --- /dev/null +++ b/lib/efi_loader/testapp.c @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Hello world EFI application + * + * Copyright 2024 Google LLC + * Written by Simon Glass + * + * This test program is used to test the invocation of an EFI application. + * It writes a few messages to the console and then exits boot services + */ + +#include + +static const efi_guid_t loaded_image_guid = EFI_LOADED_IMAGE_PROTOCOL_GUID; + +static struct efi_system_table *systable; +static struct efi_boot_services *boottime; +static struct efi_simple_text_output_protocol *con_out; + +/** + * efi_main() - entry point of the EFI application. + * + * @handle: handle of the loaded image + * @systab: system table + * Return: status code + */ +efi_status_t EFIAPI efi_main(efi_handle_t handle, + struct efi_system_table *systab) +{ + struct efi_loaded_image *loaded_image; + efi_status_t ret; + efi_uintn_t map_size; + efi_uintn_t map_key; + efi_uintn_t desc_size; + u32 desc_version; + + systable = systab; + boottime = systable->boottime; + con_out = systable->con_out; + + /* Get the loaded image protocol */ + ret = boottime->open_protocol(handle, &loaded_image_guid, + (void **)&loaded_image, NULL, NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL); + if (ret != EFI_SUCCESS) { + con_out->output_string + (con_out, u"Cannot open loaded image protocol\r\n"); + goto out; + } + + /* UEFI requires CR LF */ + con_out->output_string(con_out, u"U-Boot test app for EFI_LOADER\r\n"); + +out: + map_size = 0; + ret = boottime->get_memory_map(&map_size, NULL, &map_key, &desc_size, + &desc_version); + con_out->output_string(con_out, u"Exiting boot sevices\n"); + + /* exit boot services so that this part of U-Boot can be tested */ + boottime->exit_boot_services(handle, map_key); + + /* now exit for real */ + ret = boottime->exit(handle, ret, 0, NULL); + + /* We should never arrive here */ + return ret; +} From patchwork Sun Aug 11 14:52:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971351 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=YwSWbPCH; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgrw6dCFz1yXl for ; Mon, 12 Aug 2024 01:03:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C5E27888AA; Sun, 11 Aug 2024 16:53:11 +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="YwSWbPCH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C8CFA88898; Sun, 11 Aug 2024 16:53:07 +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.2 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 mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) (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 7061088C16 for ; Sun, 11 Aug 2024 16:53:05 +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-il1-x135.google.com with SMTP id e9e14a558f8ab-39834949e42so13585535ab.1 for ; Sun, 11 Aug 2024 07:53:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387979; x=1723992779; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=In7yWFGRG7By2lbqiAb68SxAW7P6Ev/u7xa2rSM6srk=; b=YwSWbPCHtM+ZdxwHDs5zFxUFU4OjNrxhnDzNxfwHF5BfNR/JA7AqExvBEpDyJ1uSj4 9JAZlsS6547DPd53n3/kXBc4XqQYtqBrxnHQpELeFdw1jwgfDHEKXrAJi6Uh8zSY7ww5 RYLuj4+5X/OPGpFUTVoT/TKi9s7c6fzBIBKz4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387979; x=1723992779; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=In7yWFGRG7By2lbqiAb68SxAW7P6Ev/u7xa2rSM6srk=; b=MYTWhsXD1Obm8GjHfyp97XUrr1ru0sObOhksRgaZjLGulxzAJ7pvSXrTtlXKVd8fYT mqA34j3+C2HxNVtagYSB+wVZ+V5aVyZLuKVadYf2iXyym4it/ucgN1dlpayEexNV1W22 aLRi3aiQoW2RdXs75DWVC4Qykn2AcMN1SX8pASWEQi7dAXvka1X9NgqRCYzvly79YH8v 4PKnZgX+dpvd5vu+/YNeKIHxU2arQN3juaA8/VfT59dQZ0Gt6kSXBXFfEO0rp51jkAYz IOgFCHrmRIYDvitPEPDXm7CJ+icnl9TYscocyaUxA8/jC3Ggg7J5BYBM6AazBD1kdqpP eb8A== X-Gm-Message-State: AOJu0YwoLD7BCsgQ0U2ARnQa/thZBcq27JZQJxEDPpEQAe60OAPG63S6 +7EGP4zb2m0snckb+nRoPDFBenYh44QqgdWuNotP8WzRK4ElKWe0ob8lHTmYB7rd7iA3DnKxBYw = X-Google-Smtp-Source: AGHT+IG7J96BJns6JlSR9pDrbGV1rvQogz5s2FicFxK3N55X4sHTpFP8maZQMXcs9brTor83cQlEow== X-Received: by 2002:a05:6e02:1a6d:b0:39b:64b9:a4b6 with SMTP id e9e14a558f8ab-39b7a467abbmr91498275ab.18.1723387979149; Sun, 11 Aug 2024 07:52:59 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:58 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 38/40] efi: Avoid using sandbox virtio devices Date: Sun, 11 Aug 2024 08:52:07 -0600 Message-Id: <20240811145209.4191404-39-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean While sandbox supports virtio it cannot support actually using the block devices to read files, since there is nothing on the other end of the 'virtqueue'. A recent change makes EFI probe all block devices, whether used or not. This is apparently required by EFI, although it violates U-Boot's lazy-init principle. We cannot just drop the virtio devices as they are used in sandbox tests. So for now just add a special case to work around this. The eventual fix is likely adding an implementation of virtio_sandbox_notify() to actually do the block read. That is tracked in [1]. Signed-off-by: Simon Glass Fixes: d5391bf02b9 ("efi_loader: ensure all block devices are probed") [1] https://source.denx.de/u-boot/u-boot/-/issues/37 --- Changes in v3: - Add a Fixes tag - Mention the issue created for this problem lib/efi_loader/efi_disk.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index 93a9a5ac025..2e1d37848fc 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -838,8 +838,20 @@ efi_status_t efi_disk_get_device_name(const efi_handle_t handle, char *buf, int efi_status_t efi_disks_register(void) { struct udevice *dev; + struct uclass *uc; - uclass_foreach_dev_probe(UCLASS_BLK, dev) { + uclass_id_foreach_dev(UCLASS_BLK, dev, uc) { + /* + * The virtio block-device hangs on sandbox when accessed since + * there is nothing listening to the mailbox + */ + if (IS_ENABLED(CONFIG_SANDBOX)) { + struct blk_desc *desc = dev_get_uclass_plat(dev); + + if (desc->uclass_id == UCLASS_VIRTIO) + continue; + } + device_probe(dev); } return EFI_SUCCESS; From patchwork Sun Aug 11 14:52:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971345 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=W/JnC/ol; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgqj6DXNz1yXl for ; Mon, 12 Aug 2024 01:02:41 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 429C088A25; Sun, 11 Aug 2024 16:53:05 +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="W/JnC/ol"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AA8A888C3C; Sun, 11 Aug 2024 16:53:03 +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.2 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 mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) (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 4572188C35 for ; Sun, 11 Aug 2024 16:53:01 +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-il1-x135.google.com with SMTP id e9e14a558f8ab-39b37b63834so14084045ab.0 for ; Sun, 11 Aug 2024 07:53:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387980; x=1723992780; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z8eq2a/yMA0WiQtlN7pApVkbRROrcKprszM11T3YVUE=; b=W/JnC/ol8gWPjlqXdUHiy5ift8/3biQOk4pkH4ktwkkPIDopaMZSQz3gI3weyqliR+ zcDV1OmlLTglgMZuCspUBz18vuK4qGvcG6AF8rq/qCgjJ+xQI63UtG6nmn2tyjXKMKkp Ix5GyO1jRiwKDbiuWUv2O0ANMvSPXHNIqhn3Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387980; x=1723992780; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z8eq2a/yMA0WiQtlN7pApVkbRROrcKprszM11T3YVUE=; b=QJ7Vpqm5q8ZKv8vO26/4tLvYo1LVo1kMOvCCXDxPA+3r7qmfbMcKYCstphQEJnrCCE Jxgrqg3HmAms2x6CEZ4db0L76vwBsm+ALdZTo/iSK2wssFChC582JZZXbkLlfgBzuGAb Wi4LmrdujWeJATZqxG27WYcoxAKy1Y0c2/+HkgDWJ+HyWvnqAzBnuha5wh3riW+CFran YCkN/VgSi7a1C8eUTMR0fC25o6aAC3Srex16cz3enkGLZEib/k0HVphZ9FF2kHY+YAPn +IrN4JowuFVVUTWgZFZV8q3PGWlcmWLxCdaNqnkB3SxcD0PhLOA0mq9rQG0+XKYIRZ/5 72dQ== X-Gm-Message-State: AOJu0Yy1OQc0KURBRiRpWb1jPW4Zhcs/mecBsvRBDA+oq/gCNzH0M8FM pg42gWKPUUm8u41jVscp0TENI+vz8+DqG9RC5++WRqXVFKxN84DFpFQ1cSIBj/zSWOCewNrO+M8 = X-Google-Smtp-Source: AGHT+IGkSMBd/pUdb1eKE+wKrODm87WDxmVVIRs7GzAQ8t3WQApFVAh1zOaLREn5ACqUL+KJwzV2Bw== X-Received: by 2002:a92:cd8d:0:b0:383:6af0:eb0d with SMTP id e9e14a558f8ab-39b86f75ecbmr98640175ab.26.1723387979878; Sun, 11 Aug 2024 07:52:59 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.52.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:52:59 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 39/40] test: Set up an image suitable for EFI testing Date: Sun, 11 Aug 2024 08:52:08 -0600 Message-Id: <20240811145209.4191404-40-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Create a new disk for use with tests, which contains the new 'testapp' EFI app specifically intended for testing the EFI loader. Attach it to the USB device, since most testing is currently done with mmc. Initially this image will be used to test the EFI bootmeth. Fix a stale comment in prep_mmc_bootdev() while we are here. Signed-off-by: Simon Glass --- (no changes since v1) arch/sandbox/dts/test.dts | 2 +- test/boot/bootdev.c | 18 +++++++++- test/boot/bootflow.c | 2 +- test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 5016 bytes test/py/tests/test_ut.py | 52 ++++++++++++++++++++++++---- 5 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 test/py/tests/bootstd/flash1.img.xz diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 5fb5eac862e..a99de6e62ce 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -1507,7 +1507,7 @@ flash-stick@1 { reg = <1>; compatible = "sandbox,usb-flash"; - sandbox,filepath = "testflash1.bin"; + sandbox,filepath = "flash1.img"; }; flash-stick@2 { diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c index de16a51956d..254fcd26a5c 100644 --- a/test/boot/bootdev.c +++ b/test/boot/bootdev.c @@ -216,6 +216,10 @@ static int bootdev_test_order(struct unit_test_state *uts) /* Use the environment variable to override it */ ut_assertok(env_set("boot_targets", "mmc1 mmc2 usb")); ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); + + /* get the usb device which has a backing file (flash1.img) */ + ut_asserteq(0, bootflow_scan_next(&iter, &bflow)); + ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); ut_asserteq(5, iter.num_devs); ut_asserteq_str("mmc1.bootdev", iter.dev_used[0]->name); @@ -255,7 +259,11 @@ static int bootdev_test_order(struct unit_test_state *uts) ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); ut_asserteq(2, iter.num_devs); - /* Now scan past mmc1 and make sure that the 3 USB devices show up */ + /* + * Now scan past mmc1 and make sure that the 3 USB devices show up. The + * first one has a backing file so returns success + */ + ut_asserteq(0, bootflow_scan_next(&iter, &bflow)); ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); ut_asserteq(6, iter.num_devs); ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); @@ -318,6 +326,10 @@ static int bootdev_test_prio(struct unit_test_state *uts) /* 3 MMC and 3 USB bootdevs: MMC should come before USB */ console_record_reset_enable(); ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); + + /* get the usb device which has a backing file (flash1.img) */ + ut_asserteq(0, bootflow_scan_next(&iter, &bflow)); + ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); ut_asserteq(6, iter.num_devs); ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); @@ -335,6 +347,10 @@ static int bootdev_test_prio(struct unit_test_state *uts) bootflow_iter_uninit(&iter); ut_assertok(bootflow_scan_first(NULL, NULL, &iter, BOOTFLOWIF_HUNT, &bflow)); + + /* get the usb device which has a backing file (flash1.img) */ + ut_asserteq(0, bootflow_scan_next(&iter, &bflow)); + ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); ut_asserteq(7, iter.num_devs); ut_asserteq_str("usb_mass_storage.lun0.bootdev", diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 8ea091a36af..6d85cf20dd5 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -537,7 +537,7 @@ static int prep_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev, order[2] = mmc_dev; - /* Enable the mmc4 node since we need a second bootflow */ + /* Enable the requested mmc node since we need a second bootflow */ root = oftree_root(oftree_default()); node = ofnode_find_subnode(root, mmc_dev); ut_assert(ofnode_valid(node)); diff --git a/test/py/tests/bootstd/flash1.img.xz b/test/py/tests/bootstd/flash1.img.xz new file mode 100644 index 0000000000000000000000000000000000000000..9148b91a20c1f0acb54449b124d1408961e92507 GIT binary patch literal 5016 zcmeI0cTf{r8pRVz9+4n5AV?_EgQ1BO;n5K(kx-;pUwkwL0tBUqlz==yF+ikBDAExL zQWT{~2Sq?y06~gW5eP+U$nMPkwKMCEzInSlv*Z7F=Fa`i`OZ1tr78#8*Z}|x3nSGR z=>Wn&ZU6ufAUmH=qlqxW9033y>XG5m*pL}cy$rvQVYbMeTPGAi$9qqfMnd47Jp+b8@aTLW9^ZgBe#gV-u~nri0|VMr5lA6KhSV}ds3x_d!R zK70s*W-GN^=;}ze2DKy`8Bp8a3s-y^i!J>$OdpXOt?{Uc-H+4p?jUP+#@pmNRUwJ*{D zGJt0cjopJaH2B8t_BV*T|(V? zQE{)kaF4zAwh?({NItl!v80%xP5j+-km~m0FjHOI&3eSrr0=y}ILxn&A^gJ={@ zcWW%yKY}Nl1tu^^*#UCxf;bJ&NSo@TX5>5e+pT?chViS8Qddj*v2(zyvvS5|tWhS65&b1s# ztq%uj(ECDcNKU@WQlPgiVOeS{T^}+v^G!^rLMD_i2e;x1$aOEia;LV&Z930_1Thek8ad0!1k*%M3 z_Q0A`8vzaWYYX7vQ=^y;COH>9zmbcNam0;YlMB3IVMi>ftHk8xY%(%}{iymL<`3XMZW+f8a2?SETgT0;aAgL=a#3!1KX z^cLebMqp!W-R{zh?QA#i^JTju!o5tn8#754Z(}^I`q<{*5Rey^jYGXyHJRh;{p1ikj zc9Dqls^pvK0YX|_7#zPTf!*b82Bk?#z3fQBiu4q*qMiE6{UF>)MUAS7qBGw*k4&SI zpAJ7@{r3j-*FNfpyz$Rntz!RCiAZAuN`Ei6|5Fa%9ZzPgnpH&FE1=r9f!*ynU>LRk zs^i2fv8m7Ts$<41M5$$$O!aU5TsIe9FH*b*iXYp#Gs1FO^Y+cMC@x{|f&W>e{yEir zH?4mW<^(Pg@=wM6Kq2~v;(m_kcZ=>Pupg}4KY{%zU`U3zZ->A?w~ha5Y7#LChpCq# zjLs}(gwV(qHKH0PIq==G%UE&4)cV#zQp!hu3P)N#5~J*rP#)Mrnf2FEJB=>p2`NB0 zxrbCGW-cOk>(@E=<>XoI^r+-qsU_Hbj=2C;jaT42`)4Nl?$A9Ao502gVwPUdyH zk|c8N(S#6;Vbf5B1-#i5rvvuH#*!j4W%J!DHrzLL7Y}2FiA;&kE{gOSUX)eQM58e% zxzCf&=qNe#7eNq+P!z(uHeIWDRQiY=vVq^N5#m=JF!q>=l3~T}x`dQCQkTnB7Jyp9 z9!$S*si%Y z#K@3yE)2HKtuQf<(p%-MP;{u#ln=wpQ1YA#gF=REU4Ysw)eE4nJR61Dj5RfBZ~dM* zSMp96hovw!v!`3u@q#5n+3D*c)52Q{z19NhVU|dnO=-{cW*eIX_2Q97jaK23vWBG7 z@m-4+V3|8nS|8n5(7fuqxU~m1hiT=)sP4+=FIXUT1|kn%EzpMCxRuaG>(_h94n9E@ z^-0~gvKr&93iu$m=JxNvH`Z>5eVq0gWqPV|6Dd^9zrpc%XLqFfRKYs#OhX;3>Jm;b zh)!B^-RF<)Tr}SWQrPsyLGNqxRRqOIG#PiTgwEoM7^!y@5qBOR-Cf%U)jHUm7=x1n zabX0NS!nxd?gq)JryA$B@Ibw^qlg)E=DN@e$6aC^s8+O_{x@AiR~<_W*A_j#gJdl-^e|Hn)_#5WHWmA z*>1210plk_~Sa)Oa|ASTX<>*J$=fQh1r%Sk4yV+%E8c2*ol{zZAGEORz}_=pJYbILT?~9 zx@Ww_ZY!Phs9}DZ;|(-K7u0?|tedsc3u1!ajplM14D z?)FvVYF1EAD}VwEmh!>y)l!pF literal 0 HcmV?d00001 diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py index 39aa1035e34..f647e2f0af2 100644 --- a/test/py/tests/test_ut.py +++ b/test/py/tests/test_ut.py @@ -28,21 +28,22 @@ def mkdir_cond(dirname): if not os.path.exists(dirname): os.mkdir(dirname) -def setup_image(cons, mmc_dev, part_type, second_part=False): +def setup_image(cons, devnum, part_type, second_part=False, basename='mmc'): """Create a 20MB disk image with a single partition Args: cons (ConsoleBase): Console to use - mmc_dev (int): MMC device number to use, e.g. 1 + devnum (int): Device number to use, e.g. 1 part_type (int): Partition type, e.g. 0xc for FAT32 second_part (bool): True to contain a small second partition + basename (str): Base name to use in the filename, e.g. 'mmc' Returns: tuple: str: Filename of MMC image str: Directory name of 'mnt' directory """ - fname = os.path.join(cons.config.source_dir, f'mmc{mmc_dev}.img') + fname = os.path.join(cons.config.source_dir, f'{basename}{devnum}.img') mnt = os.path.join(cons.config.persistent_data_dir, 'mnt') mkdir_cond(mnt) @@ -78,16 +79,17 @@ def mount_image(cons, fname, mnt, fstype): u_boot_utils.run_and_log(cons, f'sudo chown {getpass.getuser()} {mnt}') return loop -def copy_prepared_image(cons, mmc_dev, fname): +def copy_prepared_image(cons, devnum, fname, basename='mmc'): """Use a prepared image since we cannot create one Args: cons (ConsoleBase): Console touse - mmc_dev (int): MMC device number + devnum (int): device number fname (str): Filename of MMC image + basename (str): Base name to use in the filename, e.g. 'mmc' """ infname = os.path.join(cons.config.source_dir, - f'test/py/tests/bootstd/mmc{mmc_dev}.img.xz') + f'test/py/tests/bootstd/{basename}{devnum}.img.xz') u_boot_utils.run_and_log(cons, ['sh', '-c', f'xz -dc {infname} >{fname}']) def setup_bootmenu_image(cons): @@ -549,6 +551,43 @@ def test_ut_dm_init(u_boot_console): with open(fn, 'wb') as fh: fh.write(data) + +def setup_efi_image(cons): + """Create a 20MB disk image with an EFI app on it""" + devnum = 1 + basename = 'flash' + fname, mnt = setup_image(cons, devnum, 0xc, second_part=True, + basename=basename) + + loop = None + mounted = False + complete = False + try: + loop = mount_image(cons, fname, mnt, 'ext4') + mounted = True + efi_dir = os.path.join(mnt, 'EFI') + mkdir_cond(efi_dir) + bootdir = os.path.join(efi_dir, 'BOOT') + mkdir_cond(bootdir) + efi_src = os.path.join(cons.config.build_dir, + f'lib/efi_loader/testapp.efi') + efi_dst = os.path.join(bootdir, 'BOOTSBOX.EFI') + with open(efi_src, 'rb') as inf: + with open(efi_dst, 'wb') as outf: + outf.write(inf.read()) + except ValueError as exc: + print(f'Falled to create image, failing back to prepared copy: {exc}') + + finally: + if mounted: + u_boot_utils.run_and_log(cons, 'sudo umount --lazy %s' % mnt) + if loop: + u_boot_utils.run_and_log(cons, 'sudo losetup -d %s' % loop) + + if not complete: + copy_prepared_image(cons, devnum, fname, basename) + + @pytest.mark.buildconfigspec('cmd_bootflow') @pytest.mark.buildconfigspec('sandbox') def test_ut_dm_init_bootstd(u_boot_console): @@ -559,6 +598,7 @@ def test_ut_dm_init_bootstd(u_boot_console): setup_cedit_file(u_boot_console) setup_cros_image(u_boot_console) setup_android_image(u_boot_console) + setup_efi_image(u_boot_console) # Restart so that the new mmc1.img is picked up u_boot_console.restart_uboot() From patchwork Sun Aug 11 14:52:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1971346 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=OSn0VeVS; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Whgqx1kKNz1yXl for ; Mon, 12 Aug 2024 01:02:53 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A0EAF88C40; Sun, 11 Aug 2024 16:53:05 +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="OSn0VeVS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1B4E988C3F; Sun, 11 Aug 2024 16:53:04 +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.2 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 mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) (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 EB4D688BE1 for ; Sun, 11 Aug 2024 16:53:01 +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-il1-x136.google.com with SMTP id e9e14a558f8ab-39b37b63834so14084055ab.0 for ; Sun, 11 Aug 2024 07:53:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1723387980; x=1723992780; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MLB/rlCl2CQkjdoVqrRBTFn6YNhlaDFKNnr8F1hsgag=; b=OSn0VeVS75o8HZ7kF6pI6RWlqQXxsh72Q5xvSpR94eceYhiY8wK/3ApcFLZVgy2M98 SIi1VE3UOlbzEAJqkjjZfMu3vfGq8Q0Ztq/PtMTWZjTBGfz6C7Ztn7Ca6t+DdiLiMC/x LyjiGy6DMW0BBsA9cnZTUyjF3sUzVpVkIGSjc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723387980; x=1723992780; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MLB/rlCl2CQkjdoVqrRBTFn6YNhlaDFKNnr8F1hsgag=; b=wqNCxiLmPyLhXIpnIKl6WL8T9NU3Cdjemst8othEyPD9M/ipWj/flP3RlGN6J4sn/Y XmpccvsbhjFerv/3s60ypVqLo84UFc9Rxbk+PL8v7AgtQ4me9kj6Xl9qAWKCfisSQwqd eCaNS1XVuTyakSUyPjh5kt2W5LyilDQ+Ec3pyLoGtK2a6eAgBkA4MpRG41r1U9ksPu2U 1VKCA2a+cLcKFT1DqgbxMP5A3BNT6U+90COmA37cxsDof6c2ljB/ivbAQ194/L0c/tQS 9v3adt6TwOEwAvCg8Rcklc8KExzCnL/YmOxlWwj/7ruj6Kl8mppWIicA6qGfc6cM/jUi vvGA== X-Gm-Message-State: AOJu0YxBjTD3+fz0x5I4bdVdTb6s2F7QDmiQ8XRAUzcU9S5AP/L5Lf8T VtLPt3AWUbVzljIySZuvxS+lQpTqOobo1c1Ks3hp2XD5wqc118dYhmS/CeDwURtqUfGUCPZM3xI = X-Google-Smtp-Source: AGHT+IFXXkf/vwlqMKbL0YcSR3XCZolqhQ2c9Z3UPD9A0Qu7N3N3InNrBfCxPVuUmI9YEJfQDFT96g== X-Received: by 2002:a05:6e02:20eb:b0:398:4bda:cf66 with SMTP id e9e14a558f8ab-39b8159e1ccmr80249435ab.18.1723387980571; Sun, 11 Aug 2024 07:53:00 -0700 (PDT) Received: from chromium.org (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39c30a9a2c8sm11195855ab.43.2024.08.11.07.53.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 07:53:00 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Caleb Connolly , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 40/40] efi: Add a test for the efi bootmeth Date: Sun, 11 Aug 2024 08:52:09 -0600 Message-Id: <20240811145209.4191404-41-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240811145209.4191404-1-sjg@chromium.org> References: <20240811145209.4191404-1-sjg@chromium.org> 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.8 at phobos.denx.de X-Virus-Status: Clean Add a simple test of booting with the EFI bootmeth, which runs the app and checks that it can call 'exit boot-services' (to check that all the device-removal code doesn't break anything) and then exit back to U-Boot. This uses a disk image containing the testapp, ready for execution by sandbox when needed. Signed-off-by: Simon Glass --- (no changes since v2) Changes in v2: - Add many new patches to resolve all the outstanding test issues test/boot/bootflow.c | 58 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 6d85cf20dd5..8822dac8503 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #ifdef CONFIG_SANDBOX #include @@ -31,6 +32,9 @@ extern U_BOOT_DRIVER(bootmeth_android); extern U_BOOT_DRIVER(bootmeth_cros); extern U_BOOT_DRIVER(bootmeth_2script); +/* Use this as the vendor for EFI to tell the app to exit boot services */ +static u16 __efi_runtime_data test_vendor[] = u"U-Boot testing"; + static int inject_response(struct unit_test_state *uts) { /* @@ -1225,3 +1229,57 @@ static int bootflow_android(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(bootflow_android, UT_TESTF_CONSOLE_REC); + +/* Test EFI bootmeth */ +static int bootflow_efi(struct unit_test_state *uts) +{ + /* disable ethernet since the hunter will run dhcp */ + test_set_eth_enable(false); + + /* make USB scan without delays */ + test_set_skip_delays(true); + + bootstd_reset_usb(); + + /* Avoid outputting ANSI characters which mess with our asserts */ + efi_console_set_ansi(false); + + ut_assertok(bootstd_test_drop_bootdev_order(uts)); + ut_assertok(run_command("bootflow scan", 0)); + ut_assert_skip_to_line( + "Bus usb@1: scanning bus usb@1 for devices... 5 USB Device(s) found"); + + ut_assertok(run_command("bootflow list", 0)); + + ut_assert_nextlinen("Showing all"); + ut_assert_nextlinen("Seq"); + ut_assert_nextlinen("---"); + ut_assert_nextlinen(" 0 extlinux"); + ut_assert_nextlinen( + " 1 efi ready usb_mass_ 1 usb_mass_storage.lun0.boo /EFI/BOOT/BOOTSBOX.EFI"); + ut_assert_nextlinen("---"); + ut_assert_skip_to_line("(2 bootflows, 2 valid)"); + ut_assert_console_end(); + + ut_assertok(run_command("bootflow select 1", 0)); + ut_assert_console_end(); + + /* signal to helloworld to exit boot services */ + systab.fw_vendor = test_vendor; + + ut_asserteq(1, run_command("bootflow boot", 0)); + ut_assert_nextline( + "** Booting bootflow 'usb_mass_storage.lun0.bootdev.part_1' with efi"); + ut_assert_skip_to_line("Booting /\\EFI\\BOOT\\BOOTSBOX.EFI"); + + /* TODO: Why the \r ? */ + ut_assert_nextline("U-Boot test app for EFI_LOADER\r"); + ut_assert_nextline("Exiting boot sevices"); + ut_assert_nextline("## Application failed, r = 5"); + ut_assert_nextline("Boot failed (err=-22)"); + + ut_assert_console_end(); + + return 0; +} +BOOTSTD_TEST(bootflow_efi, UT_TESTF_CONSOLE_REC);