From patchwork Tue Sep 30 23:25:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 464 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=1759274835; bh=R+J0vG1KIVNIdWkhAP0/QW8IwsiyqjF+iEhq+VVQUzc=; 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=OwnFQRNSGjcHdf699JqdHDrG5ICLdIfuqsf3UPFQdAMgdCYh4OXhAne+l3E+T/rJZ 9LFm6VLEsy3mJ2Zuwl6P/eBmtYclLb9SQq9nUFwyWWh/tUBCLrZPYea2WuOnJnUszs qxmMrXZ51NM92tRDdqpkV2JyaouFji8prSI4h6o1JLah0vmsUvHBNX/OuuRx4ELUyA am0NAd/cqPHTfyPPb2Naf8oLCcTxr72GKxTC9s3po0+7wPFjul8HOzpEmyphe9nAcQ qZBBlwk5CNW22iXUA4FRUJuCepLQfz/LgdhoV+QgEMZMooyBAIeCh3YC/SZR6JySpY WXs9uHssN3W1g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 43D4C67EA9 for ; Tue, 30 Sep 2025 17:27:15 -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 Ud5oqZykv6Aj for ; Tue, 30 Sep 2025 17:27:15 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759274833; bh=R+J0vG1KIVNIdWkhAP0/QW8IwsiyqjF+iEhq+VVQUzc=; 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=hVT0ilrBGQYstfzBoY7Urx1nqb1WkWKz1vlGR27+TrSu+cyJJ4CCn8rDX84DG2kY9 Cem1w/YpPKSf1LPcRXht3SIJTVlKFRvOPF3YO6VzW0nA3uqzofrWyU4QKZ+dXvSFcg RSrgqiAeiLFHOd3W3Vluc8bWDZIFrpyg40e4qWUTAHcx9+jdFpSlB253I8xsRF/S2Z CuOrNlnFq7R6B9ViQSV17t8bYpxBMroerJiCiRCIjQaQXOazPadQz5fKgBtsxbT1q5 4tyBXZLG8mKAf8vIIb9GRokQnfJ6HdHq1v21YhaZvcJ6RBXizrF/PnY2qmbM8fcu/e 5gud+rxTJQJHg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 779C267B7A for ; Tue, 30 Sep 2025 17:27:13 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759274832; bh=yIZb12M0jUvo+l6cVFyKJRJFK8nVXiOmP2Ov03FqHGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L1S3kwr5BnxZFjDG/xNkfn7yE8hB+VZdBfXmxqH9N8aFqpjBgQ1wSZzvrp35VYzaK yrVY5ukKqMFHcp1infEUqJWaD48cnjM837lIsn1tNJOmFXktzmN3NxKwehDxs+vUFB 37dpKCL0jT62w2NzMvff1Yx2hznkcRBGy44ZR/FblM/ckZ2x7eeq+XPxUdZ3LkIhbW 9Bom5kGG8dVGDjnJf8pAObrRcu5XykWrRtdIr7qKQs1mL/0TU/GGgjXBjou3zMLOC9 7opMqItXQtF5iTHNY3YfHHvYSERfMZditTopm2nYRO7ZE9yis7NC+lwnpbolgzKFPc +JSDQG9YSjf3g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6462667E2C; Tue, 30 Sep 2025 17:27:12 -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 T0zNSuiolsYH; Tue, 30 Sep 2025 17:27:12 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759274826; bh=scFlZwUmsjCrSQziZ+PM053KQ1+fFCVdM93rf1DqIcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A9r9uw082xXqH8FQKkCFmMXcatgOWbmjXkx3lXhMt2yiC2UbaGm2qiyxIRZ4HA7z/ e0sBJoZC+Z8NTB6mJVvbZy5xAsfGIKU+aDJYFp0J/RJsE/O5gxnQG+O1i/sPqYP7jt Muadac375Zc+uk/Y27i1WdCtDite3YUNz9yHMl4Ul0VEXkNTZZ7c3/lx8DuldcIvVc qLq5d/MKngP6TPtzUpkjITKWAH10DCsoeLhZJMH7kFM7XUpeCOZRkkddiJhSO9Aen9 sDQhUgeARHDIiG7GRYwAiYtej7C1b/4VqUmqH51rXcj60nnmapeRPIDVdQhAG0NwE2 SKtbq4Hiqn7bw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id ED97267E7F; Tue, 30 Sep 2025 17:27:05 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Sep 2025 17:25:50 -0600 Message-ID: <20250930232611.1564850-14-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: 7S5SFJLWA54TVUFZFQLUX3ICX4LQSIH2 X-Message-ID-Hash: 7S5SFJLWA54TVUFZFQLUX3ICX4LQSIH2 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 13/15] boot: Run global bootmeths after all bootdevs are exhausted 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 When there are no more bootdevs we should still go through the global bootmeths, since some may not have yet been used, if their priority has not yet come up. Add a final check for this at the end of the iterator. Signed-off-by: Simon Glass --- (no changes since v1) boot/bootflow.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/boot/bootflow.c b/boot/bootflow.c index 98d57ef017e..30e0644a09e 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -419,6 +419,18 @@ static int iter_incr(struct bootflow_iter *iter) return 0; } + /* if this was the final global bootmeth check, we are done */ + if (iter->cur_prio == BOOTDEVP_COUNT) { + log_debug("-> done global bootmeths\n"); + + /* print the same message as bootflow_iter_set_dev() */ + if ((iter->flags & (BOOTFLOWIF_SHOW | + BOOTFLOWIF_SINGLE_DEV)) == + BOOTFLOWIF_SHOW) + printf("No more bootdevs\n"); + return BF_NO_MORE_DEVICES; + } + /* * Don't move to the next dev as we haven't tried this * one yet! @@ -532,6 +544,17 @@ static int iter_incr(struct bootflow_iter *iter) ret = prepare_bootdev(iter, dev, method_flags, true); } + if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) && ret) { + log_debug("no more bootdevs, trying global\n"); + + /* allow global bootmeths with any priority */ + iter->cur_prio = BOOTDEVP_COUNT; + if (!next_glob_bootmeth(iter)) { + log_debug("-> next method '%s'\n", iter->method->name); + return 0; + } + } + /* if there are no more bootdevs, give up */ if (ret) { log_debug("-> no more bootdevs\n");