From patchwork Tue Sep 30 00:51:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 437 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759193519; bh=fcFtDHJfe3ScVjJZ1zCf4jEe6oVyd4al2w33W6vtauY=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=K+M2/bX7iy5h1Co2j+we5gWAzi8cHWWn2Uxj9ACbtN0kxifxQDghFgr1hBa+vMQSV jKsYYNAZ350twgfaUpDz2+PpWt0WL6pQvAPE9FfSqLPo2nN18llActfrCC4vevTSsp 2K9WEBFj54UT7jIWV81kje3WQNyblTpM47MZ82FdIMQ8cwfkRHzQL5h6kq+9ZF30bZ e8e+Z42WRvJzPw2Bczc8h4NHU0PKPn1Chg7Pn3py09JfJyF1kXxpkl31rGkX/ePQ/n EBBIEaib1tPUyqHKBT/b75tbCN1RB5oDfp56CAA/+iJnXq42vb2Z2tvVZHvQnpRwTK Et3p/HZq2PZLg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E0AFF67E59 for ; Mon, 29 Sep 2025 18:51:59 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id kQrv4q7_GXND for ; Mon, 29 Sep 2025 18:51:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759193519; bh=fcFtDHJfe3ScVjJZ1zCf4jEe6oVyd4al2w33W6vtauY=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=K+M2/bX7iy5h1Co2j+we5gWAzi8cHWWn2Uxj9ACbtN0kxifxQDghFgr1hBa+vMQSV jKsYYNAZ350twgfaUpDz2+PpWt0WL6pQvAPE9FfSqLPo2nN18llActfrCC4vevTSsp 2K9WEBFj54UT7jIWV81kje3WQNyblTpM47MZ82FdIMQ8cwfkRHzQL5h6kq+9ZF30bZ e8e+Z42WRvJzPw2Bczc8h4NHU0PKPn1Chg7Pn3py09JfJyF1kXxpkl31rGkX/ePQ/n EBBIEaib1tPUyqHKBT/b75tbCN1RB5oDfp56CAA/+iJnXq42vb2Z2tvVZHvQnpRwTK Et3p/HZq2PZLg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CDB9967E31 for ; Mon, 29 Sep 2025 18:51:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759193517; bh=cJr9l31rZth5Wrxy/sQERz7LpqR45zrNllcoxcP4N+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WEh9/UJjAnLNX+2DWMalyzPkH+haJJwFgA18Ut7Wv3bO+ci9eBPkdNgDzwU1oTpbc x/NpWbXBganEcFEM+wUfc7iTEljj48hAvIgTrj5pd9W+Qk91kBW+XLN7PGSzTNQpNU R6k1UkNt8woAUpWdcw57ppR59Bw3l9C3Lh+8Uk0YHdPCY6ZH+UvmdEklg3+YSNSsqA lS25Mw5qKLjfDz9kkqWrzz2fBVTR5swtoGuJgiuFK22bE1NwjPxD4KYOldqzhIvb9a 9GUxLfE+RRRLqCTKVH3HUUGmKR8NG8IRUFp6S1khvZ3Aco3eiUn4cSXU/wfjNVeXVi +Uql7CvGq5ICg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 950AF67E31; Mon, 29 Sep 2025 18:51:57 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id Y799treW4bKo; Mon, 29 Sep 2025 18:51:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759193511; bh=L62AoTGO/sOCrND7Vn2KpckP153LhSDirWlSIrIHfDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oLWcr3EtjKzDF84Riv5DzVEdWwj5ygSjCh4bk3m1ItmjpqJo380juHUGNFPzmZsVJ yzgJQ8u6jhZf6IVEOpq2PDxHjtcpDjzqTYwdt2pFrjjENVSyQyLRlek+pvzR5/rHUo wJ4EkYh2B/U57sPk5qv3J5eyBDZhZx7/PdDii3jb1QdUTE0hjsHFafJBU9EbOk7FWO 63C6npeqJzrVq9Bw17sErGXEwo2X/QWgH2LVeSiXPk8yhcB5GelhGtVMhHCMRjqfnt ikFH25MFQZTHauScsOvWa1SYlFyHyn3YaNMxsTX8AEhqYn6fUlJj6If2uTpljLFOIu 3tyyolgMdeUDw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7B62B67B49; Mon, 29 Sep 2025 18:51:51 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 29 Sep 2025 18:51:17 -0600 Message-ID: <20250930005137.3650600-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250930005137.3650600-1-sjg@u-boot.org> References: <20250930005137.3650600-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: BCXGPPD5NZUIXNT45KEQZRYR4HUDNZPP X-Message-ID-Hash: BCXGPPD5NZUIXNT45KEQZRYR4HUDNZPP X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 01/15] boot: Improve comments related to global bootmeths List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a few comments about global bootmeths and first_glob_method Fix a broken line in bootmeth_setup_iter_order() while we are here. Signed-off-by: Simon Glass Reviewed-by: Heinrich Schuchardt --- boot/bootflow.c | 3 ++- boot/bootmeth-uclass.c | 4 ++-- include/bootflow.h | 3 ++- test/boot/bootflow.c | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/boot/bootflow.c b/boot/bootflow.c index c8391641001..de1f0c99916 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -150,7 +150,7 @@ static void bootflow_iter_set_dev(struct bootflow_iter *iter, if (dev) printf("Scanning bootdev '%s':\n", dev->name); else if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) && - ucp->flags & BOOTMETHF_GLOBAL) + ucp->flags & BOOTMETHF_GLOBAL) printf("Scanning global bootmeth '%s':\n", iter->method->name); else @@ -347,6 +347,7 @@ static int bootflow_check(struct bootflow_iter *iter, struct bootflow *bflow) struct udevice *dev; int ret; + /* handle global bootmeths if needed */ if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) && iter->doing_global) { bootflow_iter_set_dev(iter, NULL, 0); ret = bootmeth_get_bootflow(iter->method, bflow); diff --git a/boot/bootmeth-uclass.c b/boot/bootmeth-uclass.c index 8c191082cf3..152c334f205 100644 --- a/boot/bootmeth-uclass.c +++ b/boot/bootmeth-uclass.c @@ -147,8 +147,7 @@ int bootmeth_setup_iter_order(struct bootflow_iter *iter, bool include_global) bool is_global; ucp = dev_get_uclass_plat(dev); - is_global = ucp->flags & - BOOTMETHF_GLOBAL; + is_global = ucp->flags & BOOTMETHF_GLOBAL; if (is_global) { iter->first_glob_method = i; break; @@ -193,6 +192,7 @@ int bootmeth_setup_iter_order(struct bootflow_iter *iter, bool include_global) if (!count) return log_msg_ret("count2", -ENOENT); + /* start with the global bootmeths */ if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) && include_global && iter->first_glob_method != -1 && iter->first_glob_method != count) { iter->cur_method = iter->first_glob_method; diff --git a/include/bootflow.h b/include/bootflow.h index 284c23c59dd..4d1f888a5a8 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -263,7 +263,8 @@ enum bootflow_meth_flags_t { * @cur_label: Current label being processed * @num_methods: Number of bootmeth devices in @method_order * @cur_method: Current method number, an index into @method_order - * @first_glob_method: First global method, if any, else -1 + * @first_glob_method: Index of first global method within @method_order[], if + * any, else -1 * @cur_prio: Current priority being scanned * @method_order: List of bootmeth devices to use, in order. The normal methods * appear first, then the global ones, if any diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 14e3326a08f..be85032985d 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -439,7 +439,7 @@ static int bootflow_system(struct unit_test_state *uts) ut_assertok(device_probe(dev)); sandbox_set_fake_efi_mgr_dev(dev, true); - /* We should get a single 'bootmgr' method right at the end */ + /* We should get a single 'bootmgr' method at the start */ bootstd_clear_glob(); ut_assertok(run_command("bootflow scan -lH", 0)); ut_assert_skip_to_line(