From patchwork Tue Sep 30 00:51:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 438 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=1759193522; bh=00RsA9gGB21v1zKsKm+0lAwbX3nFBDtcG9LQM6D4hy8=; 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=pu03bSAurRw2o6e6O3NR6lCK1yHGDwjNwDijJVTCPxcRZz8wIHqzyx9PvlM1lAm9P wIg5PpjbNl1ceRsoAcjeYtfoHw0frU+iDIhVTRKXq63a4JKj/JZs2vBfx1SHGi1o5e ideMeMDW9WfaNDMUGr/DwZ3JbeO5fSFWiHRyxjvBANDKNQczOL7A2rlHwEYzKOnWfT eMH3Re/07vDDXLCFdbgFuUIazQ3xSIYQTWBU3zm80KAiBx/V0bd2QngUMWxr11+06h DcOBwDwmIo5ptE55UQQlqwwQWePzQ5hmy3Id57BgVgShtqhjttcRIGxF/0XSBqCsgH /TRstm0b/Ma6A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5948B67E31 for ; Mon, 29 Sep 2025 18:52:02 -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 pwj3uCVqNF7D for ; Mon, 29 Sep 2025 18:52:02 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759193520; bh=00RsA9gGB21v1zKsKm+0lAwbX3nFBDtcG9LQM6D4hy8=; 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=WPwFUSA1gIt9rw/rIvs/v9otsI/N8cc5ZP3+s/2KVPv11t9nXNtzxKbJ2iySu4vk8 JcYAoUcPVQkslUTPOIY6egKBcul1Rq2MbQJsxNRY8JE5B7oJTArqq426CQ/TPP62zE SRjPcEWoOVjyZ70aTul07K5rI5QvdYzt/SDAOtknMWJvJATP5Jb43sg81y9zGdZVIU CIlJA8WdvJXbX9+mMWDbNpQyDwny4mVkc1+ZeB+a6pIcput/wyaeuw/cMh3nbjjgEG OjsrzErYOIcmLRzVNRFOowaBm5dInXgrrxz/g0JRI3LuEozCNUIE+EPt2Sb4UmYFtl zidD6+skrUS8g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 53CA067B49 for ; Mon, 29 Sep 2025 18:52:00 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759193517; bh=bzoXOM9TN+Gh3wkMy5BjvzyEri2lEYdKuATB4fS0JHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wKUDTnJVH3+URSMOWj2t38dKvRwdiEpxLoWr0xo0JIOfIrDfMeezG/4/WLgbGQGOC aCmTr9OimfimjpHrOeqENM4mdsz4Vr6uDmJZVrypxwOdQkSn4mzK4en0NG+9iGBqe3 ecfIgUooU39/+Kcx1HUAKHlsNt81pOTYr2rjwBxz87sRraSSfrB8zlDDXd2/IUVPk7 BpeTlGEKP+XASYK6HjNjgO7W4OuB5dAMoXvUn4IX/A0mydf3TG9Zsr9HQi8RtHj3pP J0/gTCFe/G8493Ju2yrMJ2+86MZhjmYazXtvNK2YgBrApeQzhn8TRe2EKOzFM/KNmf bP7YdRBgHFaPA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D48ED67B49; 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 UAPKUhuHQp3A; 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=1759193516; bh=fwtFAU+w970g4ZTpqcrmeJA6RhlHKlCzOn1n8cUGJ/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r6sRf0cBduZK8WNbDdCQBoCXrOxz8rD9N6sIn1c0bkRCJ67u6c9XLmpHM2GJ7e4vq yk4uXbs6QZVGNQUXjYXLE6EKsaM+5C0chY0BanTnSu/viRC4OjGz87t0KpTw2vcSTI ehP25i0ha2x+UOKO7gxgM4zm28txOtky3qDpi4n/rdHy3Gpqw8XrvvKqbo8+5WwQ6L s2Buu+rgLnAivHgyawXmm+nGFjbdiCHt3QUQ8ZV8GWGVLSi5TWTJkqaVHEyGK08Xen uleEw4cmUR63HlvBzda9h27gyye0u2xrLTdshmcWtovOgIx6nN+ymQDq4PaW8G4U6E FiOD8ovIju+rw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1943367E03; Mon, 29 Sep 2025 18:51:56 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 29 Sep 2025 18:51:18 -0600 Message-ID: <20250930005137.3650600-3-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: 2ULCGRDZHDK6D5FINXUL7SWOB2X5NU5C X-Message-ID-Hash: 2ULCGRDZHDK6D5FINXUL7SWOB2X5NU5C 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 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 --- 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; }