From patchwork Tue Sep 30 23:25:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 453 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=1759274794; bh=jxvMI5jcnpU0T32fMv/3W2giO84K8FxwtDjl7dNtrFQ=; 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=qn06F4ABpqlc94L7RP4Wm9+5KcibPUiob+SrTtJlEmXLyTI/M9a+UanHqyHYntCHh BTYcCMXejHl8G8VHGLKx9GP9Z0evQTOzJFKBxWH560prXlfyBIOXO4g9kPxo/I8D/q FHL02Tg4ZRfdf0/+q2kUvfI+d94snxjvcFrHoKQaHjH19HLjcEiGMHpLH/j22aBZXf DuA+RzCNnxdXx7QcrX27mMxbCZ71j2IlUye19X7EdmBJxo8z/ahmiU/f49MoeF9cJS 7Hv4W5G/aokLpHuEJ+iVWgwXCRdXqlyaNCho6HvZhyP4n4fMHBzmVKQGqsoFkiRN4Y YSPakcq9laerQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8571067B5E for ; Tue, 30 Sep 2025 17:26:34 -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 m9wFSNDwGZ2U for ; Tue, 30 Sep 2025 17:26:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759274794; bh=jxvMI5jcnpU0T32fMv/3W2giO84K8FxwtDjl7dNtrFQ=; 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=qn06F4ABpqlc94L7RP4Wm9+5KcibPUiob+SrTtJlEmXLyTI/M9a+UanHqyHYntCHh BTYcCMXejHl8G8VHGLKx9GP9Z0evQTOzJFKBxWH560prXlfyBIOXO4g9kPxo/I8D/q FHL02Tg4ZRfdf0/+q2kUvfI+d94snxjvcFrHoKQaHjH19HLjcEiGMHpLH/j22aBZXf DuA+RzCNnxdXx7QcrX27mMxbCZ71j2IlUye19X7EdmBJxo8z/ahmiU/f49MoeF9cJS 7Hv4W5G/aokLpHuEJ+iVWgwXCRdXqlyaNCho6HvZhyP4n4fMHBzmVKQGqsoFkiRN4Y YSPakcq9laerQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 755CD67E2F for ; Tue, 30 Sep 2025 17:26:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759274792; bh=N+xRwU1dicncZ1noJI6qJSeKvjquE3Cs6bj7dQev2W4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LQ7ea0/f67LBgpQ9p+hlazpeQYPYEWVyyzSIXsehq/m5hS+HnMDtztElZUoBfBmmI /Q+CHQDjTPPjcL7o1+D5S0sUMkWmOuNUEyUo4j04AzB4fHj7pDZcLkHJ57SpsdmJse Qdx3Oq3s8y8wXnFEwvy0LAg+TAARMSTfPI6bnEIVOkblGINqioNJC7JwfN3WLJfSg8 XQhOLdnfQGuHL/4k2PDQ0sNZWKRYg1vUrin7EapkCmgCwQWPON5q/5vMqIAU+V9kLs 27UnDZpG9fkWpuhI5B0813V+YjFaeEh4ZZMqJUh9Zn7XTyU+uQXyIxfXpYLg9LE4qD a4BuB7rll6ZXw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3448367E7C; 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 10026) with ESMTP id 4n44AKiy38m0; 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=dVlZMLrIzutOX8S/RIDUbSBzIO4+ErFOZxSYRtH3ras=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bAkwgDGDgZldWiGg7mtMrEDU6XJcaXm4rbFzWQUNBfxllRI7U/hS3Zy7FaJ/hbg18 PqGIJVgj8+j7dJSPTg81pTuvSVk4vxCxljHRDqGMdzVMBenfLC2jRqVj4ZchLttEBT RLNs8lETLDWT5hc3d06mYF8set/vdsRVBeAxNcO9HiIYiZJEAphjr4qi+CRRPntTzu AUnKL/qqazaCYme7SlJyk1ghTMgdBA9c9djwJOusQJ61h2T4nAGGYKUccSgxpKn+d+ FTLOHzaTwFVSfi2RHOqmxqr8dRqC21t2KuH/cvc/8fBLb/VVpjbux9VBmCKnxqgobe TH6OJHPoOMoUQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7AE9667B5E; Tue, 30 Sep 2025 17:26:30 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Tue, 30 Sep 2025 17:25:39 -0600 Message-ID: <20250930232611.1564850-3-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: PBIR4ADAKHKTL3Q3CPBH2PZAOSX523DN X-Message-ID-Hash: PBIR4ADAKHKTL3Q3CPBH2PZAOSX523DN 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 02/15] boot: Add more debugging to iter_incr() 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 This function is the core of the bootstd iteration. Add some debugging for the decisions it makes along the way, to make it easier to track what is going on. Signed-off-by: Simon Glass --- (no changes since v1) boot/bootflow.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/boot/bootflow.c b/boot/bootflow.c index de1f0c99916..79be94960e7 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -195,14 +195,19 @@ static int iter_incr(struct bootflow_iter *iter) log_debug("entry: err=%d\n", iter->err); global = iter->doing_global; - if (iter->err == BF_NO_MORE_DEVICES) + if (iter->err == BF_NO_MORE_DEVICES) { + log_debug("-> err: no more devices1\n"); return BF_NO_MORE_DEVICES; + } /* Get the next boothmethod */ if (++iter->cur_method < iter->num_methods) { iter->method = iter->method_order[iter->cur_method]; + log_debug("-> next method '%s'\n", iter->method->name); return 0; } + log_debug("! no more methods: cur_method %d num_methods %d\n", + iter->cur_method, iter->num_methods); /* * If we have finished scanning the global bootmeths, start the @@ -219,8 +224,10 @@ static int iter_incr(struct bootflow_iter *iter) inc_dev = false; } - if (iter->flags & BOOTFLOWIF_SINGLE_PARTITION) + if (iter->flags & BOOTFLOWIF_SINGLE_PARTITION) { + log_debug("-> single partition: no more devices\n"); return BF_NO_MORE_DEVICES; + } /* No more bootmeths; start at the first one, and... */ iter->cur_method = 0; @@ -228,11 +235,15 @@ static int iter_incr(struct bootflow_iter *iter) if (iter->err != BF_NO_MORE_PARTS) { /* ...select next partition */ - if (++iter->part <= iter->max_part) + if (++iter->part <= iter->max_part) { + log_debug("-> next partition %d max %d\n", iter->part, + iter->max_part); return 0; + } } /* No more partitions; start at the first one and... */ + log_debug("! no more partitions\n"); iter->part = 0; /* @@ -328,8 +339,13 @@ static int iter_incr(struct bootflow_iter *iter) } /* if there are no more bootdevs, give up */ - if (ret) + if (ret) { + log_debug("-> no more bootdevs\n"); return log_msg_ret("incr", BF_NO_MORE_DEVICES); + } + + log_debug("-> bootdev '%s' method '%s'\n", dev->name, + iter->method->name); return 0; }