From patchwork Tue Sep 30 23:25:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 452 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=1759274792; bh=gVseYYyhukKhoBDHcrOt2Rb/+mT15yA7eIAjSHyO98g=; 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=rO8t1vHpwWcCh77AnbGaBjCz8LWQlKQiW3pE4UXAvksYGirGJwgkrUabQdx92TVBV q+wOrBr6N+a3Uiw2GCvMhpSS1y7+LeR0RPq1UzB8wG6u0PpOE6ei+YNAAcqcyzI00l +SmcxuosT333tWfUNkYbjbeity2IbCIDBXrGQgPoqiVzp4m/93o5LbyBPNloshx7oF cJeV7n98DBwax7p52b9/5UEF0gSPIXlKd8G6SgudsMZBLwkFPjIWmblicux8e2Y/eQ wadFZlEABdA9u6jz/VWpvKiGDEivl2HiI4nYPpwRvEy3n8gdg6buZMx3gpIwS/wnKa rumoYCg5VdtYQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1B1DB67E95 for ; Tue, 30 Sep 2025 17:26:32 -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 HoHTRCHY7tuX for ; Tue, 30 Sep 2025 17:26:32 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759274792; bh=gVseYYyhukKhoBDHcrOt2Rb/+mT15yA7eIAjSHyO98g=; 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=rO8t1vHpwWcCh77AnbGaBjCz8LWQlKQiW3pE4UXAvksYGirGJwgkrUabQdx92TVBV q+wOrBr6N+a3Uiw2GCvMhpSS1y7+LeR0RPq1UzB8wG6u0PpOE6ei+YNAAcqcyzI00l +SmcxuosT333tWfUNkYbjbeity2IbCIDBXrGQgPoqiVzp4m/93o5LbyBPNloshx7oF cJeV7n98DBwax7p52b9/5UEF0gSPIXlKd8G6SgudsMZBLwkFPjIWmblicux8e2Y/eQ wadFZlEABdA9u6jz/VWpvKiGDEivl2HiI4nYPpwRvEy3n8gdg6buZMx3gpIwS/wnKa rumoYCg5VdtYQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0B3EF67E7F for ; Tue, 30 Sep 2025 17:26:32 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759274790; bh=YKzabuh6R8pt1jUWr6+VLx2hT0vGmkxY2whFm9q0Ghc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hzwoP2bwwMTq1+oCotetMaFBDspqKaRDm5WbuwVjW+xYwb3z0Ko8mJ4nqw6lVkHGn 4l8GRgrXvXxhj/64jKdbmPQ5kLWqt7JuUWI2xoaL2lgDKR6Zp8TzItEFTf+Vv1luWs CKQZu5pGQzT2zyH865Lmz1fLXikKrOGFPtZ+/CWvZKLgRU+Ohne8piWB5UGqInCtNO nGiH1LVEg3g0d8ULm2KpV9CXnbvi/tIJlbWcW4Bps6xh9ZpeVAst8MrcU8kCtNTI+5 8njyhQMmgH4+GvsX/j4Lz/CLrlGaeVU4EKAP4eGMc3paWqVr17xO15jC+QxgPfuEXb 36I2TwJG+6zRQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 31DE267E2E; Tue, 30 Sep 2025 17:26:30 -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 Sorh5wpDaAX8; Tue, 30 Sep 2025 17:26:30 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759274786; bh=0hExmZgs+eL/+yGSsNrUaprleGgYIIwpjJifGyZx6lk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VHRtf9oKNpuZn1vYYJDaT2XU6J+XiCwJ9dvhE+1ReZOo/c1ZqdV/K0bsaLD9+J8Pc fUMhbl6lPQWAL8lkrHOQn9mXV6O89jAFU8nzRnJqWUEju6Y82g2bqTsn3QZPe3Hiqf KnnI9Z7tcq/VvGbjKIvK6UqzkpuwIMxcAe7xDiEkh7XHqo4Lhech76rlJnqwt1HkI5 RUabYI8xQJVa6H/LYFfzlk4mVSn7Gd9D5U5R4s3KY+YrFfg6ItpUCCK6ZSkXjHf3wp F/KPS3AxmbWh6mP053v1OjgXuo7PqhwsLdIyA+lJpQwU3gzxrQvlxQchBACUF96d51 +hL0cPxdvUYnQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id DC3C367B5E; Tue, 30 Sep 2025 17:26:25 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Sep 2025 17:25:38 -0600 Message-ID: <20250930232611.1564850-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250930232611.1564850-1-sjg@u-boot.org> References: <20250930232611.1564850-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ZFUFDCPOAQIGUXPNIDSIIG4ZCQJN3BH6 X-Message-ID-Hash: ZFUFDCPOAQIGUXPNIDSIIG4ZCQJN3BH6 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 v2 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 --- (no changes since v1) 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(