From patchwork Mon Aug 25 16:27:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 122 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=1756139263; bh=4Zx3ZmI4J3OWV69jvQpAJuyPwoVA/nVrc3cWjFPeJvo=; 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=XnkDbOuqsckd1YXHlHgE7OzA/fXc9V4uV26xSWDJU9rZ4WtURuIdCzqcFBE7Lg0qk T/y62PyEqpI8yyr+nHugb4AJfj8tlDf5L270rXiyGuYzIfy8JcdrmQVxMchJYDhgpw QSaudgMO5NXP8nEQRnMiTiVRjZM43x4y3EWDSRUZAbsDjUrlt85GDdHgYg2R21+jrJ qa0fYfwGAiTq2MUEszv5t95fjIbMJn3AsLYaSMSNM75BNA4oV0DNDujpmNaY3Jyyzg nv4ENfvpTJM+wLEcxez1p0hwvHwGL0FXUb4OhoxZ3XMKL6yuEDtSsmW5c1sJAnvfB1 nBMS5GKHWWQKw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 336CE677A5 for ; Mon, 25 Aug 2025 10:27:43 -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 hfQ-A8RCHFnP for ; Mon, 25 Aug 2025 10:27:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139262; bh=4Zx3ZmI4J3OWV69jvQpAJuyPwoVA/nVrc3cWjFPeJvo=; 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=e4P9cPUhdKmHYoahTiwjspyxtKAFcCxjNQ9wIeK6M+Q8jSYb8BI3L3njQ/l7huqxc AXydkijOkBBLoGU8Q9d0X+30hKYtYPgcO9rKLYhrVoY+u9CEEr1lYduttuCo0pWK+M uQ71fVp4C6xLjkyUMANZ+eIoRRyINDbxPsno1kEfeoxTtIQOhkO4R9jcUAviIDZ0ym KW2wmfQbqMW+wPlTWTomWcujQnlPolsORQJQ+twwGgF6ZrGqsUdLXjT2TkbYGoWzCk fzQzyzSxIG0sQTJAWT5GIqHCo7pLKMthTHugkP4JyClt7U0eVp1nSNgvqiEkf0cNf+ NltEFEeWxjnIA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 276C567795 for ; Mon, 25 Aug 2025 10:27:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139258; bh=W+bflmlpsd9xkYmKgAi4yfO+Z2QNbEb7nE1ZFOtFPF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GtpyqnJ4Aiy1nxw+fQU2cmUrjLa92BOysh2PJ5zEf43ln0RNYaXLLERuVXX3tyF5i RHuncBD10TqqSw7TWy2StmTp7Ngt8M5DImJ5VQpXeS+vQao0WiRyUEz5isat5d+ttv /FnVdffuKwPiSElZ5111qlWydHkTC0xh1vq9eZNXt0wJ9vyJ6eMr5BsD4XN8jQFYaP BO0G03L3k9UyovwOv6M9BshI9gb0fghzj85SZ4tg5wAUrG1F/Ppw0CQ8rTHog3TORD 1+H/T9Ehd14jyexmQKRlMHxJEf65bjQLygWF7QgEZ+vIrPymBIypuhZeF9HHBt5rVB B5KHC8TGPLcFA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D363267706; Mon, 25 Aug 2025 10:27:38 -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 zunhUOWH03zJ; Mon, 25 Aug 2025 10:27:38 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139258; bh=KHJJZlONr4YE1f3HrskLjzibpZsnqNPA2gXOlHZsv8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HqynWrjV5onrvApMaqwd+0TQhb+6FjB/MbD3M7LviBY/Gb+tSHWSKo973gMka4DJt LYPS/PcgQY/hxNEsgv8LZOdOMPW9PxIlRVeV7mOLQwD1lmFijj7buDNlYNnEAOsmcX OkoyTPDvs/6GetZTdI2HJ6wnSBntTJeW6UvlSnJ5EgFskDwv7+2VFT1SXxW/O1ZVeF IZfTETGfCj541qOAvjMt4bPLpuobicHCB+foaI3jF6F/L85iL/JiV7ZNkqqL5se2yH b6PDFa/MuVFPYt8rQR/vTqlVfsiLriouG2/JwUYQrPXMHsd/S/Vai+BkqKTbtZHnrr SeCacpkK3a79w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 443EC676E8; Mon, 25 Aug 2025 10:27:38 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:04 -0600 Message-ID: <20250825162727.3185381-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ILL55LUE2M72SNCFNOLBJZUJAYSCKZ6M X-Message-ID-Hash: ILL55LUE2M72SNCFNOLBJZUJAYSCKZ6M 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/16] bdinfo: Show the serial device 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 Show the name of the serial device with the 'bdinfo' command. Signed-off-by: Simon Glass --- (no changes since v1) cmd/bdinfo.c | 3 ++- test/cmd/bdinfo.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index b0d6663c6df..8208e03a4e2 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -105,7 +105,8 @@ static void print_serial(struct udevice *dev) if (ret) return; - lprint_num_l("serial addr", info.addr); + lprint_str("serial", dev->name); + lprint_num_l(" addr", info.addr); lprint_num_l(" width", info.reg_width); lprint_num_l(" shift", info.reg_shift); lprint_num_l(" offset", info.reg_offset); diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c index 88115a22203..c59823a2e9e 100644 --- a/test/cmd/bdinfo.c +++ b/test/cmd/bdinfo.c @@ -201,7 +201,9 @@ static int bdinfo_test_all(struct unit_test_state *uts) ut_assertnonnull(gd->cur_serial_dev); ut_assertok(serial_getinfo(gd->cur_serial_dev, &info)); - ut_assertok(test_num_l(uts, "serial addr", info.addr)); + ut_assert_nextline("serial = %s", + gd->cur_serial_dev->name); + ut_assertok(test_num_l(uts, " addr", info.addr)); ut_assertok(test_num_l(uts, " width", info.reg_width)); ut_assertok(test_num_l(uts, " shift", info.reg_shift)); ut_assertok(test_num_l(uts, " offset", info.reg_offset)); From patchwork Mon Aug 25 16:27:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 123 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=1756139263; bh=7e+GygGwnbJF7GyoBti5HzANNOFyFDuCzzelssKs+eo=; 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=OLpiGOUxWqAhhwYTHFVeKfyF3+3TeHQ2IotuqtIQv2hHVK5q3/TDFG92LC+2YcnZf /5H6g+XDbSq1VFy82Kkehim8AdO1hdh6zqTG5xkO2fRJGKK1a3HlFkIAPwJw8aS7eW qKErcAl/9ylLOxOjHmr1nmsjiXfK8PnFDzmxVIkwef7pDEukovC2IILxNakjy6MJIu uAKOmIgIovlgiLAXj/MVN/GPPO22NCIsJ2D11rYOtT57rYHSVJFPGZQ66bgWkVnOWS ndXXvkZX7oO92eu4MplAaGD7VkMzXT4RdSi8QY1YhcR4hf2BKqH6MN/S30lQ/HHvH1 nqoRTggoLu/9w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8E0F66779F for ; Mon, 25 Aug 2025 10:27:43 -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 aYo5oiXrhB8z for ; Mon, 25 Aug 2025 10:27:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139262; bh=7e+GygGwnbJF7GyoBti5HzANNOFyFDuCzzelssKs+eo=; 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=b6InToIEKfYZSrvoSBviBqqwucor8ovdsP8IOZXJy5R/Pt/RlQoTnjPtEKuDO26CQ hkb6+MZZaSiedFT/S+QglZi2RgNKyj1U3NIEMVi3tGswQh6QCMTf+kkV52Qk0K/Dn8 NKu1muL564l0nWphN59XipwmzoUe+tz1fInFKneK7uMjoF/ZerfM00ckB2MIRyqqMh pKBt/YRv6NGgqTV9ZZWHgE/OMjv1agMw0E3gTc5EbvTPqRbDVHfy4dq7xD5I5PRAAZ hbOtu4g608tu8O9AoeMFuke028xZnYzJiBy6aplZk4fYDhKgivGli9kC2MYRq+v2M9 H/PfaHw+3yvBw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8A2F76778F for ; Mon, 25 Aug 2025 10:27:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139259; bh=nalmGz0aQs5iax2PdaMnAQxWVvwy9tRTjI5o444PXmc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i38vqP3nw0suN5Lnj7PU5rFHgL6wBzy24JonkIwF1Xvv9Kio0FVgLhOw9XhwkMKNi lRRpBr7O8ZQ6t/bQfRx8gScp7lmi+PNyptcXqJ2059sTDBJFp2hp4zfcbUoke37vmA c7ZeD4q4kHJTkRUaZ1AOVV0l5Au5etOZUuqGhz/GVmnGiHtdn8ykT0XC715K+hy9CC owAbt0S8pp7CnG6hzl42p0pISQ4q7FSFE8N53xg8Ur55SJ3RX+fD/YLzFqjrr/0ZZs hWoC5Q3bnW8Ud2sQTCLbhxfv3w6AFZyr5Lyeocoof/wyM57ShEExCoZAOzHbXtxeKQ 1TxMGomcqq9FA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 98DB667744; Mon, 25 Aug 2025 10:27:39 -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 1xpgNlZwfk0Q; Mon, 25 Aug 2025 10:27:39 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139259; bh=y1y/4ADViI2mrcUnXLv9g+IMto5xvN/wz8ajiXnV5NQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ija9BNRBHjcpdaz+8UlNGCzCPsZvmCcepFRyCJd2dhfSX2KZ0EopEFS5st/iuDaKQ 7I1wJQP3fbyYZnmlEfYQ3uizc1RZpWHsW4rllZ72jYYsWW7RtAAkXSLa8lRLWAahvy Iuu16KYnU2FY2oG4hPrp77Z64rboStj8S3n8OiWuIl2HYHSVobDZQ6f3TmfNYm3b0h g+KF6odUkq07YBOgZXwYUkvDkyiCA4k4RkkXAAzlVT/zUtlgUvVIDzuqxvJxrnUwj5 ++h1coKoG3SnCjGref7v9q7gq4leVBFO855T6hgq+2tV/37KivElHD7FtAGXRfctkP aT8O6mWOc3Y3A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 21EC2676E8; Mon, 25 Aug 2025 10:27:39 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:05 -0600 Message-ID: <20250825162727.3185381-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: FFOCS5SBNN4FCRA6KMUXSLDZZDFQ2WZR X-Message-ID-Hash: FFOCS5SBNN4FCRA6KMUXSLDZZDFQ2WZR 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/16] video: Mark the vidconsole as a driver model stdio device 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 Set the DEV_FLAGS_DM flag so this stdio device is recognised as being provided by a driver model device. Signed-off-by: Simon Glass --- (no changes since v1) drivers/video/vidconsole-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index f1b2d61bd8f..a98344cf9a7 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -764,7 +764,7 @@ static int vidconsole_post_probe(struct udevice *dev) strcpy(sdev->name, "vidconsole"); } - sdev->flags = DEV_FLAGS_OUTPUT; + sdev->flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_DM; sdev->putc = vidconsole_putc; sdev->puts = vidconsole_puts; sdev->priv = dev; From patchwork Mon Aug 25 16:27:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 124 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=1756139264; bh=RhkVwSyeQ179Fj629hUVKIGrfcjRvXIlagWFMp1+8dI=; 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=krdj74V5Eet8eai9CrQb7IYtAEqrvwIN0v0yGNaROqiF+SKNfXL1dEZq04temCv7C 0jLHhKixLGAbr/AOWbaiHBFps+ocu3Flpthu+7U8iKVtrD9MIR7WL88VoYAob6d1Yc uJhZwM0aOeMYjNVddR9F28ptOYPGzcVIa1EWix4wS7z2YacHJB6mJXurgNAcJUY71l ZLpaq+meQplGXcEx8143aY6ZIGDEHOP3jhzTbHpje2snnLDR7d4kK5ai3SA1xDDE/W XchtXqWY4XOjfakWMTf67ioyloUpz/Ttd9U6PssxhieAWcsGXKJ4fqVCgkm19Ybvca 2Rauf4HjfVSCw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 158C3677A5 for ; Mon, 25 Aug 2025 10:27:44 -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 1i0U5qJsTKVz for ; Mon, 25 Aug 2025 10:27:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139263; bh=RhkVwSyeQ179Fj629hUVKIGrfcjRvXIlagWFMp1+8dI=; 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=vH8S4HNgnvvUJ4dZcrFd86TSaH/VjqYxFCva2/eNJt7+NsaxbQIyvOqomsukfDpI8 VVI7svaPc1YUxFk3ygQYY8TTJKxLbdJoVUtdKwojqjVFp7TNUBmKbQMvezIVjG2NmN koBJlCxG7FhQMzpeTMNcsL2VfhpPzjVNH1f7Vt8zsNuprRBelOs1IQrwwnEDfPiV95 U7g89NXfgVGU0txeMuexhsHfW/X4B/WFkq12iKBWeRZrq3a/AxY0WNb2TSVEwrhAuI WITNKwmLFgRL0Vx+OzlyUwFA1a4crQ7o5sB6nRd6Wf9Ijlciz+RgMyUpKjZyo1zN6n 07kUo+Ur0dIVg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3BE3E676E8 for ; Mon, 25 Aug 2025 10:27:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139260; bh=igLLOAChmcUs6DpyVnPzC7CpAxGI4XFNROi4LG7R7g0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jXToPlUtIJEtljKhUByotHNK8flyCPnGTc2vWYI0wsClNcUvzQw6d1ivoL0he3CbP C2bdAO1FfegixdDSh0S4uQNZ7j3C2Jyfqg5OWoMR0YSBufkmy8Jebno+ZTTg4WEqrS xwRlv4hHbUmO+ytarwPnnZV8diUUtW4/gFdM/4CLl15YC4k6CNgsgKigThvAvItI19 WPgfAoo01Q62nEE09lfK5FI0CbnGkkDV88vHagG59AiO2O/T7myo3m/cnP87DvRD5M q4NsrPP6V1eHz6ZPDN3CnSGi7yypeMjEPPu0OOy/WkrX7wNqkuh/8n6lnN2smtWBEA HY3XkCT6xVDyA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 81B6B67706; Mon, 25 Aug 2025 10:27:40 -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 hwn7odkeq_L3; Mon, 25 Aug 2025 10:27:40 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139260; bh=xkU/8TfD36xW2BNzafCJRdaBbQVgkIzPX3DY/LcnF/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KJWjBr6bCKGJNdrWqAiNERNJRmPcsfnyTetqpvb61mLXN7b4YQ0+iljXL33m/MMt9 osbPPdtVn6MQLLDGBI263P9pFCzonjHg2FeqfKdZlxik1wyQgkyyUhyCJFj9L57etQ pYuguKkYsKjRXM9wR0Z6E7xiknmkWe25s8BtO9dVx/I/uXn+/bx0dEenGZsRgCIIbm sdD6eKsMgJM21/kh/vETHN2ZqPrt7ph5P4+Ivkgz4RIltL0qxidveogVP2epkmuj6m 2TKhzh5uIfa7p2nrBykuOkICqbZYX/d2TvSWrTYKOLMQaIAI57f/SgdjQgtOuajBXh tyjWIQeZoQlcg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E299E676E8; Mon, 25 Aug 2025 10:27:39 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:06 -0600 Message-ID: <20250825162727.3185381-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: TIZQUJGERXOR6RQ2AUWVJDACTEXAD2UI X-Message-ID-Hash: TIZQUJGERXOR6RQ2AUWVJDACTEXAD2UI 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 03/16] video: Mark keyboards as driver model stdio devices 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 Set the DEV_FLAGS_DM flag so keybaords are recognised as being provided by a driver model device. Signed-off-by: Simon Glass --- (no changes since v1) drivers/input/keyboard-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/keyboard-uclass.c b/drivers/input/keyboard-uclass.c index df9ee8f7d65..dabf0d2e0bd 100644 --- a/drivers/input/keyboard-uclass.c +++ b/drivers/input/keyboard-uclass.c @@ -68,7 +68,7 @@ static int keyboard_pre_probe(struct udevice *dev) int ret; strlcpy(sdev->name, dev->name, sizeof(sdev->name)); - sdev->flags = DEV_FLAGS_INPUT; + sdev->flags = DEV_FLAGS_INPUT | DEV_FLAGS_DM; sdev->getc = keyboard_getc; sdev->tstc = keyboard_tstc; sdev->start = keyboard_start; From patchwork Mon Aug 25 16:27:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 125 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=1756139266; bh=329Z7Lugc4yfkCyg7EiFlhBEvFOOi7J41ahHDswgxeY=; 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=E9DWBoBXAxCjS6aPHhnFHTxv+faMnbec9bVUP9wkx9yP3YEBxwKxWUBwueKJQJopY Nepwa85upHBNB//mpsc0QC4Mjn9pAcywV7EOeO1PvWdSRoQiXUaU3ifKKrpdhgY6U7 2VsyH9dtWaXELzInCuLNPOAWMTTolXuGEbVfAeVOpF3p4ZRhdiKuBwjni8CStX+knj NuRIdydJA5f7NSYTKqDbX8AZPduUG2WWmgStdd7zGcri46AfmWhxsQhlqg3wS++1Ll /liRTEACRtCI9WZiQfX1IMUiMKTZybV2bPgUIxuxzqn78c42BXTOCJk6pLyz+Byfze r00sjlHkCeNuA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 92EFF677A0 for ; Mon, 25 Aug 2025 10:27:46 -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 BOuHjwibrSbh for ; Mon, 25 Aug 2025 10:27:46 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139263; bh=329Z7Lugc4yfkCyg7EiFlhBEvFOOi7J41ahHDswgxeY=; 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=qzuhk66Zmm3cvFPigfrNgvcnITs35H4chaFnxu2AH09SeZsh4i7zpMwELSbDv10IG 551SitqYY8ko1hlvSVQ6FId+nyFI/OfvoO73Y+38g+o4bs8Cv9gv7moewRN8bIOVJQ /i+rnuayxtyN37LVdL0XsqM08Oxt9I3LWmO8YWaxd4DnUDjiArk1NN2yZuk7Tv7TOP I5VC+AkHF2S+w21ZHMrU+eAOOeBxt9f31o9R4X6lX6jjV24+joEoNH3zVEbZJjGuse 47CExkHZdaJwySdmrz5y8PXoZ9MOTfCaJxRLHLv05EWqkONYlLCCcRz9TMo0kK83R+ o+ZRf/hWhSmEg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C3ED46779C for ; Mon, 25 Aug 2025 10:27:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139261; bh=D87RFgP7q7oRfM0Osrbwfy2tmMt0AfuKvfGoD/9j02g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bgMiBBwFG2NeOCi6f1u6XvvZjZb+ecaHMXfD9NxP5e+xHEAaKP28gPqz/+f/kHee3 H/UXHdgGf3dW6nyAD3gxGiKETOkzyGGADz5326++Uo1nZxfn3djX7FpEI67vyv5Kxl f2t3bYvBpRvgYPlXd7gx3lUCvGEy+ue/Oq5t5YWJM+hv6xVJQEEmkCIKX22DGTGIEy 12We6dyWSqr0joWQt/VbqfvbEPsRwdk87bBh8xTGLYGZoaE3jh6V16Uzhfv2FCiEv6 5ePrW1fK3E3d9BMNXySyCh3fYr6ypEo2sknHJoMI9ZtOdzjCDMrBdBHOB8Y3shJvWs FZx7wMmiXQLCw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 971CC6778A; Mon, 25 Aug 2025 10:27:41 -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 j4zky1XVKVKt; Mon, 25 Aug 2025 10:27:41 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139261; bh=o8l2oBLudPfRpxQ7L0Dq7KaDaR2t5IaknUcei2/XzwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YIPSUbsRwxqToOVQSA5h66wfOXoy7jj3+HQ1sVsrGu7hWdTtJxixsUSVC81gN/wPD cEeqE281IspWA8d+Dt8j+9IoyKXxvjPdt04sVFtP2vPoY7pMTAaGcqiVI+pSOY/Uf+ 77nzWRuqwuwZg3pwGc4wyOombej+fA6Qte4Lyg+tPGaFnUs1cI25SWPjrmSvkwEXdL sWMEkLFqR9Cfb5XGpEXu1gSJhzxk3xGfkk/ahbCBgVOPO4lxFamX6/ua0ydc0rYjhT ZCU81or1Ss1NVR4iGNN5F0P+QInDB3EAI0p1KxkTkCw5VDoxBtUCRAnmdXCr3bA/5G /64qE8fkx0oug== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C1C15676E8; Mon, 25 Aug 2025 10:27:40 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:07 -0600 Message-ID: <20250825162727.3185381-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: HHK65WF542SKNSIV2B5DJPDIZJYBCEVF X-Message-ID-Hash: HHK65WF542SKNSIV2B5DJPDIZJYBCEVF 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 04/16] serial: Generalise the code to check the terminal size 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 The EFI loader has some code to check the size (rows and columns) of an attached terminal. Move this over to the serial uclass so that it can be used elsewhere. Create a new CONFIG_SERIAL_TERM_PRESENT to control whether it should be used. Enable that for the EFI loader to preserve existing behaviour. Adjust the implementation so that it returns a useful error code on failure. Put the ESC and cESC values in the serial.h header. Signed-off-by: Simon Glass --- (no changes since v1) drivers/serial/Kconfig | 15 ++++ drivers/serial/serial-uclass.c | 118 +++++++++++++++++++++++++++++++ include/serial.h | 18 +++++ lib/efi_loader/efi_console.c | 124 +-------------------------------- 4 files changed, 154 insertions(+), 121 deletions(-) diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index d58152abc7f..7d27dad327d 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -202,6 +202,21 @@ config VPL_DM_SERIAL implements serial_putc() etc. The uclass interface is defined in include/serial.h. +config SERIAL_TERM_PRESENT + bool "Assume there is a serial terminal present on the serial line" + depends on DM_SERIAL + default y if EFI_LOADER + help + In some cases boards are connected to a serial terminal and it is + useful to emit ANSI codes or other characters to determine the + properties of the terminal. + + Enable this if you wish to have these features. + + Note that enabling this for a board which is sending its output to + a log will result in junk in the log. It also introduces a delay of + up to 100ms on startup. + config DEBUG_UART bool "Enable an early debug UART for debugging" help diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index a08678dde4e..1204fb5d4c4 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -557,6 +558,123 @@ static int on_baudrate(const char *name, const char *value, enum env_op op, } U_BOOT_ENV_CALLBACK(baudrate, on_baudrate); +/** + * term_get_char() - read a character from the console + * + * Wait for up to 100 ms to read a character from the console. + * + * @c: pointer to the buffer to receive the character + * Return: 0 on success, -ETIMEDOUT if timed out + */ +static int term_get_char(s32 *c) +{ + u64 timeout; + + /* Wait up to 100 ms for a character */ + timeout = timer_get_us() + 100000; + + while (!tstc()) + if (timer_get_us() > timeout) + return -ETIMEDOUT; + + *c = getchar(); + + return 0; +} + +/** + * term_read_reply() - receive and parse a reply from the terminal + * + * @n: array of return values + * @num: number of return values expected + * @end_char: character indicating end of terminal message + * Return: non-zero indicates error + */ +static int term_read_reply(int *n, int num, char end_char) +{ + int ret, i = 0; + s32 c; + + ret = term_get_char(&c); + if (ret) + return ret; + if (c != cESC) + return -EPROTO; + + ret = term_get_char(&c); + if (ret) + return ret; + if (c != '[') + return -EPROTO; + + n[0] = 0; + while (1) { + int ret; + + ret = term_get_char(&c); + if (ret) + return ret; + + if (c == ';') { + i++; + if (i >= num) + return -EPROTO; + n[i] = 0; + continue; + } else if (c == end_char) { + break; + } else if (c > '9' || c < '0') { + return -EPROTO; + } + + /* Read one more decimal position */ + n[i] *= 10; + n[i] += c - '0'; + } + if (i != num - 1) + return -EPROTO; + + return 0; +} + +int serial_query_size(int *rowsp, int *colsp) +{ + int ret = 0; + int n[2]; + + if (!CONFIG_IS_ENABLED(SERIAL_TERM_PRESENT)) + return -ENOENT; + + /* Empty input buffer */ + while (tstc()) + getchar(); + + /* + * Not all terminals understand CSI [18t for querying the console size. + * We should adhere to escape sequences documented in the console_codes + * man page and the ECMA-48 standard. + * + * So here we follow a different approach. We position the cursor to the + * bottom right and query its position. Before leaving the function we + * restore the original cursor position. + */ + puts(ESC "7" /* Save cursor position */ + ESC "[r" /* Set scrolling region to full window */ + ESC "[999;999H" /* Move to bottom right corner */ + ESC "[6n"); /* Query cursor position */ + + /* Read {rows,cols} */ + ret = term_read_reply(n, 2, 'R'); + if (!ret) { + *colsp = n[1]; + *rowsp = n[0]; + } + + printf(ESC "8"); /* Restore cursor position */ + + return ret; +} + #if CONFIG_IS_ENABLED(SERIAL_PRESENT) static int serial_post_probe(struct udevice *dev) { diff --git a/include/serial.h b/include/serial.h index e5f6d984d28..2aba4c313c2 100644 --- a/include/serial.h +++ b/include/serial.h @@ -3,6 +3,10 @@ #include +/* Escape value */ +#define cESC '\x1b' +#define ESC "\x1b" + struct serial_device { /* enough bytes to match alignment of following func pointer */ char name[16]; @@ -382,4 +386,18 @@ static inline void serial_flush(void) {} int serial_getc(void); int serial_tstc(void); +/** + * serial_query_size() - query serial console size + * + * When using a serial console or the net console we can only devise the + * terminal size by querying the terminal using ECMA-48 control sequences. + * + * @rowsp: returns number of rows + * @colsp: returns number of columns + * Returns: 0 on success, -NOENT if no terminal is present, -ETIMEDOUT if we + * checked for a terminal but didn't get a response in time, -EPROTO if the + * terminal did not respond as expected + */ +int serial_query_size(int *rowsp, int *colsp); + #endif diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index ade44cb6e36..d2eabfdb07e 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -59,9 +60,6 @@ const efi_guid_t efi_guid_text_input_protocol = const efi_guid_t efi_guid_text_output_protocol = EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID; -#define cESC '\x1b' -#define ESC "\x1b" - /* * efi_con_mode - mode information of the Simple Text Output Protocol * @@ -77,76 +75,6 @@ static struct simple_text_output_mode efi_con_mode = { .cursor_visible = 1, }; -/** - * term_get_char() - read a character from the console - * - * Wait for up to 100 ms to read a character from the console. - * - * @c: pointer to the buffer to receive the character - * Return: 0 on success, 1 otherwise - */ -static int term_get_char(s32 *c) -{ - u64 timeout; - - /* Wait up to 100 ms for a character */ - timeout = timer_get_us() + 100000; - - while (!tstc()) - if (timer_get_us() > timeout) - return 1; - - *c = getchar(); - return 0; -} - -/** - * term_read_reply() - receive and parse a reply from the terminal - * - * @n: array of return values - * @num: number of return values expected - * @end_char: character indicating end of terminal message - * Return: non-zero indicates error - */ -static int term_read_reply(int *n, int num, char end_char) -{ - s32 c; - int i = 0; - - if (term_get_char(&c) || c != cESC) - return -1; - - if (term_get_char(&c) || c != '[') - return -1; - - n[0] = 0; - while (1) { - if (!term_get_char(&c)) { - if (c == ';') { - i++; - if (i >= num) - return -1; - n[i] = 0; - continue; - } else if (c == end_char) { - break; - } else if (c > '9' || c < '0') { - return -1; - } - - /* Read one more decimal position */ - n[i] *= 10; - n[i] += c - '0'; - } else { - return -1; - } - } - if (i != num - 1) - return -1; - - return 0; -} - /** * efi_cout_output_string() - write Unicode string to console * @@ -272,52 +200,6 @@ static bool cout_mode_matches(struct cout_mode *mode, int rows, int cols) return (mode->rows == rows) && (mode->columns == cols); } -/** - * query_console_serial() - query serial console size - * - * When using a serial console or the net console we can only devise the - * terminal size by querying the terminal using ECMA-48 control sequences. - * - * @rows: pointer to return number of rows - * @cols: pointer to return number of columns - * Returns: 0 on success - */ -static int query_console_serial(int *rows, int *cols) -{ - int ret = 0; - int n[2]; - - /* Empty input buffer */ - while (tstc()) - getchar(); - - /* - * Not all terminals understand CSI [18t for querying the console size. - * We should adhere to escape sequences documented in the console_codes - * man page and the ECMA-48 standard. - * - * So here we follow a different approach. We position the cursor to the - * bottom right and query its position. Before leaving the function we - * restore the original cursor position. - */ - printf(ESC "7" /* Save cursor position */ - ESC "[r" /* Set scrolling region to full window */ - ESC "[999;999H" /* Move to bottom right corner */ - ESC "[6n"); /* Query cursor position */ - - /* Read {rows,cols} */ - if (term_read_reply(n, 2, 'R')) { - ret = 1; - goto out; - } - - *cols = n[1]; - *rows = n[0]; -out: - printf(ESC "8"); /* Restore cursor position */ - return ret; -} - /** * query_vidconsole() - query video console size * @@ -363,8 +245,8 @@ void efi_setup_console_size(void) if (IS_ENABLED(CONFIG_VIDEO)) ret = query_vidconsole(&rows, &cols); - if (ret) - ret = query_console_serial(&rows, &cols); + if (ret && IS_ENABLED(CONFIG_DM_SERIAL)) + ret = serial_query_size(&rows, &cols); if (ret) return; From patchwork Mon Aug 25 16:27:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 126 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=1756139271; bh=OKaP3LHorM6CPh88vXDFx40yE14fa7kLn0h8RPdGOEs=; 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=lr/uDh1vNvLji7F0DsPb4DIv88vLmHyqxOZNDggowOkglVyVROn8q8wrFuy9YWeAx IAVlFZQrBqWHMs7eVV8PlJZH0DEJ7/DNXpqzr8KeyXQKL4e8dvf9tJcIPHStELZ0KZ 02f9u7fS3+j2mFEGHKO9PfgPYtRllvpaY9Y5esL2oYRozknSKkOk+/vqZ5tVROtg7r 9+9OV9+mLc2yQfTt4R4RauKE85wLG18B7xbReeV2/5lNEythdxYZklO6Cwyt1WFd1N iEzkhg6/YkEmB+anF+ucVdUx4XXcFEVmUM/a+J+Hg9EO+35PQf+3d0F1i8H9cRieGA cAsYOYTBhF8EQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 28A8E677AC for ; Mon, 25 Aug 2025 10:27:51 -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 f7U9FsQyciqm for ; Mon, 25 Aug 2025 10:27:51 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139268; bh=OKaP3LHorM6CPh88vXDFx40yE14fa7kLn0h8RPdGOEs=; 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=RbR2NPu3Bwpg5COQKVEB2YFmhyUEjl50Y3w6xnD5NCUGKl4i99N2STT1HomFm8yxm mV7sM3iNf6Q28l8grnbk98fk2pJmI2WljrsrL0ewNXY4TFIJJuaaDmT86ze7xLsdAD 8OQnoA/7DxMX/znQGnuO9sOcnVGGK21xXca89l5p/Zk2gwrIh3FuP+ZxZVBguwP3go gftbwNDgngkgKuxrgvE5omeJTRb+xXn82yyK/EWwH1XCsMsTZMlDAOQyAWZGAIlIGi oXytCjmtIpT2qOKcrXF0R8aHLNKzvmKOBZthwmFhN941EIn/2f5a6clU5+xddhA9hG fmhK0QZAGyWyw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DF9C4676E8 for ; Mon, 25 Aug 2025 10:27:48 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139266; bh=D9QuotdVeFm24TNDJPIzNYMEGsHNsPvEhmpjr70gxpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hMKSy/SrxjqEmtASm0XuzJR3VHVkGZ6YxAOaHk+9GEQnTBHOa92uLsYNS3zVH0vIG NVQqpxPOljMpKXRboCx9eNqZ1fTNXoYrjLfjo8bbX4V7Wu/Sj/cb501T6m8rysuG6x KiXXjTraQIUue6/BRwgHWqQxcyHAL8ynjuoNYLz8kqZFxzxWvhd1aokS83WSHfh1cL VBfwAzKJKfWQBrLEgzVD1Rnp4LmoPZUlvPNHkjodHkCohxuPD1UayTkBI1hjqDsdJb h7aV6hBFDAngs2GlLJnavrXjohu/ubmyUhfHbdeBGgkdQMJHRixzKMfeBLiGCbfneh kvmT2GfXAHqSQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6F53767795; Mon, 25 Aug 2025 10:27:46 -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 SDR7dQO0EOPe; Mon, 25 Aug 2025 10:27:46 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139262; bh=laphQ1v8B8REKjJHGA64uz7dR0VJXM1cl+fxO5pi2d0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bNO1r0fUzb0LmqhPIa0s40gDabdGqJrkrBgGZ2A+Zkl0javXEnp4CBqPSfYpBg60y skBteEOOKDvQXQKKfvBuSG4ABIVpt3DeaF47qOFlNCh04FMn6G9fK0hiw0I76/6vCn Azmd7TJyX0iEHVlrubMJttusQbQ6pZgOsBe0/awGRFbN4d2E4QdQCp0HnGAnnBAB75 0/taC1fLF9Y0Tys6NvK2pR1oTgQTbHO48m/2ywgwoIbwoodVoQHCPWxCY2ghgkfOKB Av1aV2TgVlG4DhD4p+0AxaDj/AOoL2zsXkXh7CrBB3dTH+pw/Nrzo6g2f3DVTwLcPb JHYSdjeJg81IQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id D78E66778C; Mon, 25 Aug 2025 10:27:41 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:08 -0600 Message-ID: <20250825162727.3185381-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: MRK2AJ2GYOXK565GJ25DKVRJKPTVOLJV X-Message-ID-Hash: MRK2AJ2GYOXK565GJ25DKVRJKPTVOLJV 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 , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH v2 05/16] serial: Cache the terminal size 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 serial_priv structure to serial uclass to cache terminal dimensions. When serial_query_size() successfully queries the terminal, store the results in the uclass-private data for later retrieval. This avoids repeated terminal queries and improves performance when different subsystems need the terminal size. Co-developed-by: Claude Signed-off-by: Simon Glass --- (no changes since v1) drivers/serial/serial-uclass.c | 38 ++++++++++++++++++++++++++++++++++ include/serial.h | 24 +++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 1204fb5d4c4..27de461d196 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -24,6 +24,8 @@ DECLARE_GLOBAL_DATA_PTR; +#define ESC "\x1b" + /* * Table with supported baudrates (defined in config_xyz.h) */ @@ -666,8 +668,18 @@ int serial_query_size(int *rowsp, int *colsp) /* Read {rows,cols} */ ret = term_read_reply(n, 2, 'R'); if (!ret) { + struct serial_priv *priv; + struct uclass *uc; + *colsp = n[1]; *rowsp = n[0]; + + /* Store in serial uclass private data if available */ + if (!uclass_get(UCLASS_SERIAL, &uc)) { + priv = uclass_get_priv(uc); + priv->rows = n[0]; + priv->cols = n[1]; + } } printf(ESC "8"); /* Restore cursor position */ @@ -675,6 +687,31 @@ int serial_query_size(int *rowsp, int *colsp) return ret; } +int serial_get_size(struct udevice *dev, int *rowsp, int *colsp) +{ + struct serial_priv *priv; + struct uclass *uc; + int ret; + + ret = uclass_get(UCLASS_SERIAL, &uc); + if (ret) + return ret; + + priv = uclass_get_priv(uc); + + /* Check if we have cached values */ + if (priv->rows && priv->cols) { + *rowsp = priv->rows; + *colsp = priv->cols; + return 0; + } + + /* No cached values, query the terminal */ + ret = serial_query_size(rowsp, colsp); + + return ret; +} + #if CONFIG_IS_ENABLED(SERIAL_PRESENT) static int serial_post_probe(struct udevice *dev) { @@ -730,5 +767,6 @@ UCLASS_DRIVER(serial) = { .post_probe = serial_post_probe, .pre_remove = serial_pre_remove, .per_device_auto = sizeof(struct serial_dev_priv), + .priv_auto = sizeof(struct serial_priv), }; #endif diff --git a/include/serial.h b/include/serial.h index 2aba4c313c2..9ed3793b647 100644 --- a/include/serial.h +++ b/include/serial.h @@ -291,6 +291,17 @@ struct dm_serial_ops { int (*getinfo)(struct udevice *dev, struct serial_device_info *info); }; +/** + * struct serial_priv - private data for serial uclass + * + * @rows: Number of terminal rows (0 if unknown) + * @cols: Number of terminal columns (0 if unknown) + */ +struct serial_priv { + int rows; + int cols; +}; + /** * struct serial_dev_priv - information about a device used by the uclass * @@ -400,4 +411,17 @@ int serial_tstc(void); */ int serial_query_size(int *rowsp, int *colsp); +/** + * serial_get_size() - get serial console size + * + * Get the terminal size, using cached values if available, or failing that, + * query the terminal + * + * @dev: serial device to query (may be NULL) + * @rowsp: returns number of rows + * @colsp: returns number of columns + * Returns: 0 on success, -ve on error + */ +int serial_get_size(struct udevice *dev, int *rowsp, int *colsp); + #endif From patchwork Mon Aug 25 16:27:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 127 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=1756139271; bh=eWj6ZtXr9DUh9d/1V494zNWng2FZSaYoBX7MBf5EoEU=; 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=GfbsqxWer1UkWFLE89CoTexoo6iz4uj+LDi/0l9Mzi/T7UyeY7ES9r5Ah0ja4TB4f JEGJFkKPnRBkxs0EMhWSXLHArcORL3FEIFJrm8oftKjP1kIq7WpaSigb1a8Zb5EyLh b65VIg04J2JAeJe6itEa4vwqo9ol53uu0+2LjPQl1tewyT8yovU0Eoqsufe0OOtpef ofRg7WMfBSdR8ziGpP+eiC/IbaOTVEwopETrJeFt17ktjgDbgtWrKOrOcuHe0gDCOA PM6c+Fr9/3rCChLI9uhHWrgVrjhdsX4B81h8fdzdOsWNUnVULBJEe4TKvcgtbK3S8z 0zq9TFDrJF5Gg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6B35867791 for ; Mon, 25 Aug 2025 10:27:51 -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 HBaVJ0rTT0lu for ; Mon, 25 Aug 2025 10:27:51 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139269; bh=eWj6ZtXr9DUh9d/1V494zNWng2FZSaYoBX7MBf5EoEU=; 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=t5O/ac7FpuyM2aWbHSpXONEjJLlI7hAUXy5yjkZUqDWrvjbrecA+lBBeQEbG/A9Jc VZYmtY1zLHN/8e9nDoFKZiRZyV27BSjI4gR4KEaSDwpri7P+X09xRtbDj7YELS0MXI GJFp43tjYLe3dExYule8e2Wko/uLW8NAgiva2SscLib+QGyBUy1umYMIrlIbvTbgD1 64gW9USrAB+wxU6eOdwedvj9duQ5rZKskynJOyEnRpTHnbTE3jTYa3smOIQT6jl42W AvSlLnW0SaVWtAgOTU7r6/ka1F2PBFD2OIiTxu8vHIXIs7dK+SWkGSo7gFGEQfTFfx cRMt6m59MZ8wQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 563EF677A5 for ; Mon, 25 Aug 2025 10:27:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139266; bh=eSg8cuoI96F54Pbr8d/hs4ncdQSm2MI++PPwzrT8JZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ke8tA9dkO8z9gK9UdsjWy4BHOFvluQxWMR1EBItpKWhybV+J8JoO4SmkvFSi41fM1 zoVrWTvNkcwR1/vCCTMmC7Bz3p6lWSui/1OLQ8e7eNUugzbps9GLsdEwogl2NvwsAG Q4/+Jb2PaqNySUYbnqvrxRI4CY1S4n0/8YVTkzvR74yYRGi6JKWA1YCDKIN9YheoF3 0hIazIwnZz7mZYTRGah9JtNA924Y0atchLOLkd3B0v+I/FjVjUsFmM8NpM+e0q7v+P efeQCJcUq+1RTKIumt4K7JB+kg/8G08iEfcF06tWoxXKxunJLhhTMWepAYoQZknHug WPoX53Oo5LXyA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 786316778C; Mon, 25 Aug 2025 10:27:46 -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 31EP-eBI-hny; Mon, 25 Aug 2025 10:27:46 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139263; bh=S58pxnVXbKnCv+C0ku527Vd4hvYWW09raxLMyF+TrTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cXHv6Qzw5BqOwhRxvJzUfnG5uMMTbhOmn1adJ8HTLcXz6S9rt9jjbCYkN7bFYl7NV ebnMmo3GlexTpnHOE2L7s3qTK5K/eWD9sMfhpClDsU+ImHkmdGkxjIpVlLuHYQtlwZ rCVEI2GNKHY9MH0xn0ulS6tOfCK5tjnOrMDnFS8UEL8LrU3oxbYspMR071D96CaeNL 7mlsK7iciBFTuX5lvA6+8TyTi8rlypfxfRa/JdB/X78TyiifVSm9EI9wuFHvkONF/c Gfq3wixG7MCOm6ziaE1jnl3Qdlklw4XEvWs/oi+JtcrPK5vUKtTGrRxLhOZXHl/f7a DrKjlc876/F/Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C76E267792; Mon, 25 Aug 2025 10:27:42 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:09 -0600 Message-ID: <20250825162727.3185381-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: EMC3HJGI67QFISPVSIR2QH6G6ZQHAWX4 X-Message-ID-Hash: EMC3HJGI67QFISPVSIR2QH6G6ZQHAWX4 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 , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH v2 06/16] sandbox: Add a function to detect terminal connection 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 serial_is_tty() function that determines if the serial console is connected to a terminal. For sandbox, this uses os_isatty() to check stdin, except for cooked mode, where we don't want to assume anything about the terminal. For other platforms, it always returns true. Co-developed-by: Claude Signed-off-by: Simon Glass --- (no changes since v1) arch/sandbox/cpu/os.c | 5 +++++ arch/sandbox/cpu/start.c | 4 ++++ arch/sandbox/cpu/state.c | 7 +++++++ arch/sandbox/include/asm/state.h | 8 ++++++++ include/os.h | 8 ++++++++ include/serial.h | 21 +++++++++++++++++++++ 6 files changed, 53 insertions(+) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index c19f859d4e0..101d695a556 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -142,6 +142,11 @@ int os_close(int fd) return -1; } +int os_isatty(int fd) +{ + return isatty(fd); +} + int os_unlink(const char *pathname) { return unlink(pathname); diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index e4e4932c183..02d16bfe930 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -613,6 +613,10 @@ int sandbox_main(int argc, char *argv[]) if (os_parse_args(state, argc, argv)) return 1; + /* Detect if serial console is connected to a terminal */ + state->serial_is_tty = os_isatty(1) && + state->term_raw != STATE_TERM_COOKED; + if (state->ram_buf_fname) { ret = os_read_ram_buf(state->ram_buf_fname); if (ret) { diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index 949ca42de94..d883cf2132a 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -476,6 +476,13 @@ bool sandbox_sf_bootdev_enabled(void) return !state->disable_sf_bootdevs; } +bool sandbox_serial_is_tty(void) +{ + struct sandbox_state *state = state_get_current(); + + return state->serial_is_tty; +} + int state_init(void) { state = &main_state; diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index 3aa35c112be..5350ee6b8fa 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -157,6 +157,7 @@ struct sandbox_state { bool ignore_missing_state_on_read; /* No error if state missing */ bool show_lcd; /* Show LCD on start-up */ bool double_lcd; /* Double display size for high-DPI */ + bool serial_is_tty; /* Serial console is connected to a tty */ enum sysreset_t last_sysreset; /* Last system reset type */ bool sysreset_allowed[SYSRESET_COUNT]; /* Allowed system reset types */ enum state_terminal_raw term_raw; /* Terminal raw/cooked */ @@ -377,6 +378,13 @@ int state_get_rel_filename(const char *rel_path, char *buf, int size); */ int state_load_other_fdt(const char **bufp, int *sizep); +/** + * sandbox_serial_is_tty() - check if serial console is connected to a tty + * + * Return: true if serial console is connected to a terminal, false if not + */ +bool sandbox_serial_is_tty(void); + /** * Initialize the test system state */ diff --git a/include/os.h b/include/os.h index 35757fc8bb8..3393acb435a 100644 --- a/include/os.h +++ b/include/os.h @@ -90,6 +90,14 @@ int os_open(const char *pathname, int flags); */ int os_close(int fd); +/** + * os_isatty() - check if file descriptor refers to a terminal + * + * @fd: File descriptor to check + * Return: 1 if fd is a terminal, 0 if not, -1 on error + */ +int os_isatty(int fd); + /** * os_unlink() - access to the OS unlink() system call * diff --git a/include/serial.h b/include/serial.h index 9ed3793b647..02c28f8605c 100644 --- a/include/serial.h +++ b/include/serial.h @@ -2,6 +2,9 @@ #define __SERIAL_H__ #include +#ifdef CONFIG_SANDBOX +#include +#endif /* Escape value */ #define cESC '\x1b' @@ -424,4 +427,22 @@ int serial_query_size(int *rowsp, int *colsp); */ int serial_get_size(struct udevice *dev, int *rowsp, int *colsp); +/* + * serial_is_tty() - check if the serial console is connected to a terminal + * + * This does not indicate that there is actually a terminal, only that if there + * is one, we can assume it is present and connected + * + * Return: true if any serial console is likely connected to a terminal, false if not + */ +static inline bool serial_is_tty(void) +{ +#ifdef CONFIG_SANDBOX + return sandbox_serial_is_tty(); +#else + /* assume that it is! */ + return true; +#endif +} + #endif From patchwork Mon Aug 25 16:27:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 128 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=1756139271; bh=UNhcAxLKMo2qMzqHJbaHKsP3iQioXvxpcTrFAGkj+Gs=; 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=ZB1Lxejd9uqz8lSZtAcuc7G24hh3fQflQRbuDHMOVlwKeWs1Vn8PRf18HR77qVvBF cxXcziV5D07X0EO6/1i0wZFfydanKfCvtpjxKiovPJlPxwfqWD0kiOg95c2GqdRJjY TZm7sUKKBm53RhiFVP44XfONgO3lwxUGjBpfH/JlpWFIg3kZKO81EPXCPq5JGpl/MD 42gj9zB3/9LNBGufirPxTtGN76jXHYDhdBVI5TRGmCPS/8gaNwOJCAiyTSVyucpHAV ecapZee+BXpx83Hy81Bc1Yk+rxYrxnKKuJjq0usA0uiUCUDdTu6mnOejWFSMT3LqFF pHfBEmT7m0ddw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B3601677A9 for ; Mon, 25 Aug 2025 10:27:51 -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 cAeVnjNTjhvs for ; Mon, 25 Aug 2025 10:27:51 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139270; bh=UNhcAxLKMo2qMzqHJbaHKsP3iQioXvxpcTrFAGkj+Gs=; 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=MZrcP+X0VIeCvvPOtwPWWYG+DxzEpMYxwPuJ5LfhULGn9mYxDahV75nt0srwtTe3k hMavBCyxD7l30TCbiCcXwhGeqkxzroal+XdWhN7KrCKsbGT9QJMEvAc18+12uV2ako +Cc04AEIyCLeObsd9grpMDnmzS+JaBxPp5+6tyNIuoPwIdaFIaXf1eSOQEHiegns5T 1XUTguAXMXYQsYrkZbFHj957eHOeZVfZu6Otp8UdGNYxhLnILDTUawHAlnAXuowkH4 g7tFREjOOFum5ofBC8dext0ioAHKhwed2spA44gVUy0ClqSHpzOFYDAc6IsaPH+7Ut Tovd721tUYiPA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B36336778A for ; Mon, 25 Aug 2025 10:27:50 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139268; bh=AsX9Q/w/p+9p3n//r1xNoMS6dbyYqAiyomGpC7KY1hQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NJghK8fKdzaY6LmT2BvzHYLowhoqI7/EB9Pub4ozIG87sttVXpR1Goz7wvi2e2ff4 Con7ZUO5sP3ZKnvC9bCoLpL+6x2cITP/ac8ELor7o66mAWXX/7oisBrbQtYOZokcjS nbi48UjlZy1G7881KADL+BO4LX0N/W6s/ZzdA0hxfLZ5S7KdSod8LQ9zZcO6indmu1 tbZLwvsic88RY8x4CDekW3gZnYsImX5RjsnkywJi30cetusqED/JcvCwKClYNApvv9 SJUwdqq1kYU/uu4svEgooWLoWaq1jpBRTdydOal4lfL8UjVmuXYtJLo4t4nCZdDmVc HOACsu7BLR7xA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CC3AA67792; Mon, 25 Aug 2025 10:27:48 -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 MN8BNGcBXh2f; Mon, 25 Aug 2025 10:27:48 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139264; bh=ESAlCsU5WiGG2Eqk5Z/EgVC7VvWzUHzyo+h4AJMl9aM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CtlgrSuLzTD6JiWCoU1i37Y192zxxEsSXZMf7argPqRiXjcqbyuoQOTgb83AbsHhs M2mo0zQo36fCjySEHUM/ZzWbGjZtgb+aMBdIOjNHc79ZrTD/EZO8jP2JqrgQnaQXz6 bFgDhdRPutT2EOebt4QBH/v1f92fE4sGgbdfD5mPgcIPmxOGJVxklWujN05goP5Flq c1NKUzKYgNCg2LQLk68ZJiJxnly/PAf8fw23HFjlrj+Ronc6tFONpThLUboNakIZr/ li1mGqSndhpl7JqUY6JzPuDgvJim1kJcFcGsqib14cQnSj66xmeou2yPo9k24ZPZyE CZtWjz7I1rzmQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id D427A6778A; Mon, 25 Aug 2025 10:27:43 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:10 -0600 Message-ID: <20250825162727.3185381-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: TLPTLKJHF2E63QIV3I46HL4HVEH5OLES X-Message-ID-Hash: TLPTLKJHF2E63QIV3I46HL4HVEH5OLES 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 07/16] sandbox: Provide a way to tell if the video is visible 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 Sandbox is often run with the display disabled, so even though it has a video device, it is not being shown. Provide a way to detect this. For all other platforms, we assume the display is shown, when there is a video device. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to provide a way to tell if the video is visible arch/sandbox/cpu/state.c | 7 +++++++ arch/sandbox/include/asm/state.h | 7 +++++++ include/video.h | 21 +++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index d883cf2132a..e492855755b 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -483,6 +483,13 @@ bool sandbox_serial_is_tty(void) return state->serial_is_tty; } +bool sandbox_video_is_visible(void) +{ + struct sandbox_state *state = state_get_current(); + + return state->show_lcd; +} + int state_init(void) { state = &main_state; diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index 5350ee6b8fa..a9c4c889bd9 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -385,6 +385,13 @@ int state_load_other_fdt(const char **bufp, int *sizep); */ bool sandbox_serial_is_tty(void); +/* + * sandbox_video_is_visible() - check if video display is showing + * + * Return: true if display is active, false if just using the serial console + */ +bool sandbox_video_is_visible(void); + /** * Initialize the test system state */ diff --git a/include/video.h b/include/video.h index 5b539eafb89..b2eaecf5866 100644 --- a/include/video.h +++ b/include/video.h @@ -8,6 +8,9 @@ #define _VIDEO_H_ #include +#ifdef CONFIG_SANDBOX +#include +#endif struct udevice; @@ -460,4 +463,22 @@ int video_reserve_from_bloblist(struct video_handoff *ho); */ ulong video_get_fb(void); +/** + * video_is_visible() - check if the video display is being used + * + * This does not indicate that there is actually a display, only that if there + * is one, we can assume it is present + * + * Return: true if any display is likely visible, false if not + */ +static inline bool video_is_visible(void) +{ +#ifdef CONFIG_SANDBOX + return sandbox_video_is_visible(); +#else + /* assume that it is! */ + return true; +#endif +} + #endif From patchwork Mon Aug 25 16:27:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 129 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=1756139272; bh=n6zAOgEXU1bBllK/biiWeapGiSF95pVuae+iY25RpDA=; 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=ghSfmTDW8lAlTCTAJGbQccSz4m/ixBI0i+5ZjZl+nqkzbMS5vtVGfkVfxb/gh0+Dv 4c2O4hEayP/JX4C+M1fJKLsD+x2Vec3xOSHhlVVaSTzLIB/FjyKjgEGE2Z/klbF5xt JbbF5RpJ6wrJA8lTg3SeB6B/n1oahB2LT31bEq1qly0Z099MYgx6I9viB8j3MDfs/g +ncn4KyMZgsAHv8I3W0FHLVVhkHSTBsyAEMdV0CwrcAzkDZyunRW130G2AnRyZlxeG +xz+9sGpmnuXp7Lyq2Ty3T/PFM/u4pFmCJl6OEo6EKfLlLjiMaw5espsj7Wq/dwM52 Rc2RU/ZUL+K6A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1D45967795 for ; Mon, 25 Aug 2025 10:27:52 -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 VIFysFBu4Rrh for ; Mon, 25 Aug 2025 10:27:52 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139272; bh=n6zAOgEXU1bBllK/biiWeapGiSF95pVuae+iY25RpDA=; 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=ghSfmTDW8lAlTCTAJGbQccSz4m/ixBI0i+5ZjZl+nqkzbMS5vtVGfkVfxb/gh0+Dv 4c2O4hEayP/JX4C+M1fJKLsD+x2Vec3xOSHhlVVaSTzLIB/FjyKjgEGE2Z/klbF5xt JbbF5RpJ6wrJA8lTg3SeB6B/n1oahB2LT31bEq1qly0Z099MYgx6I9viB8j3MDfs/g +ncn4KyMZgsAHv8I3W0FHLVVhkHSTBsyAEMdV0CwrcAzkDZyunRW130G2AnRyZlxeG +xz+9sGpmnuXp7Lyq2Ty3T/PFM/u4pFmCJl6OEo6EKfLlLjiMaw5espsj7Wq/dwM52 Rc2RU/ZUL+K6A== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0988C676E8 for ; Mon, 25 Aug 2025 10:27:52 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139268; bh=cOdZFqCzkHYNj/Lcxf5DYYxypa1xMruHn3+mhMKC12M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fw2HujHSAu4Ur0zeAuQlJlcRmw4KNzByIb+Mte3ppsV5araZIaRhDmIXkDuZZoM5E 3DFXcGGffLT4uGxo+lrqyGtt2H/kcu80S1ORn3fYTN1qhJdt4Xp8rbfLE2a6L21Bmi wXtZWP/4aM1wTTea9qzeA0P2GTAFKcaXnY5ZyLhMoo42ppFnHnLJhptddpPVznhmVe Hxannh0E41UIsjqG208TyNbWNYoL62wb1w+Osdr7yCSeWmoSQXnkBqf4cpLwsa4VgF 1Gg2pIZPXv1SUBPGILZDOOliWiqpudCMMZCw0HO098EXvD3LRY2UGdPIXKGUe7bWxq Asz+sNxoZcyjA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D6CA66778A; Mon, 25 Aug 2025 10:27:48 -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 xatSBAtdfJhf; Mon, 25 Aug 2025 10:27:48 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139265; bh=JWf5kBKpF2jNHCpkX1KXlRkfTL2URACU6CHPDv4w184=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sLfFeFYXXnG9DYF6XxN5oUPbOBWL1ddGvUC4YpS00QavpPNT69cRqGrJMp5JfcgAJ UTMlE4ZcEpel9tTBhcUPDIbyhzs+lCdCaTUAu8BZtclnq7/L6evGMpkns5Xk72DkiI XUZ2XgWSineAjMo4e3tYb2gdBTzwhgDwfQyC/SzR0jKLyLeYVimghwRBZboRVs2ZOB Pg/9Dxt0mQetO7f5VaykRxEYIYFRpPnwP83Rjcdr4f7FYjYxX/tBonc+k+PCPJLFnR 85/8fkXsSqNqwRY9uDFWS/0IbV8OJ45Cc6DtwdJaNJvV20KCKDc1lEC5en0IeGCv9E kx1vm8uJ3UGvw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B54BE676E8; Mon, 25 Aug 2025 10:27:44 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:11 -0600 Message-ID: <20250825162727.3185381-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: HSIN7CMQ3QRVRHMODDPLYYRHAUM2XPJT X-Message-ID-Hash: HSIN7CMQ3QRVRHMODDPLYYRHAUM2XPJT 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 08/16] post: Include config.h in the header 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 The post system requires use of CFG_xxx values which are only included via the config.h header. Most files don't include this now. The serial.h header includes post.h which causes a build error on any platform which enables CONFIG_POST, such as pg_wcom_seli8 Add an explicit #include of config.h in the post.h header file. Signed-off-by: Simon Glass --- (no changes since v1) include/post.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/post.h b/include/post.h index da851e37fa2..74039e56e29 100644 --- a/include/post.h +++ b/include/post.h @@ -15,6 +15,8 @@ #if defined(CONFIG_POST) +#include + #ifndef CFG_POST_EXTERNAL_WORD_FUNCS #ifdef CFG_SYS_POST_WORD_ADDR #define _POST_WORD_ADDR CFG_SYS_POST_WORD_ADDR From patchwork Mon Aug 25 16:27:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 130 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=1756139274; bh=RZhQwQhd5NBkOW9ntwHpH6OYDuwPqWGmMiKVEvUE7Ug=; 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=iUCjY5JtXbR5l2qTE59l0BUfLoe5J+hx8mA1HI5CJrVNwfKmvHVXWUgnBrXKmKrC0 X74a/HPeNdI4AwejhurNZ1aApTQYNItexyXWWUO05p9UxMiyBWtk2JqzGbtNOHuhLL IPd6QXomerezHiPnStltuEdKX/bLIAFwAoSDQW/H/p+RlueOkZwpal4q38J0Wvro0R rdX5xIIe4vNLxyT1+jI0O9vYDcsF+ktasWV38i79TwPvl5gL1/1YajzzyJfOhFUSh4 frY6XlyX1LCLte37YfZTwLbdu64MHj7w19BuCaYDFNZK77eSz14MYXqwO2HX+po9zP hTJrfmFXF519A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5A590677AF for ; Mon, 25 Aug 2025 10:27:54 -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 gmfh7csV_j8r for ; Mon, 25 Aug 2025 10:27:54 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139273; bh=RZhQwQhd5NBkOW9ntwHpH6OYDuwPqWGmMiKVEvUE7Ug=; 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=Bz5buoJXL82THbAeRbcNxzVTexL9wItUhBZjl9gt/JDV6d83ty5XPxIdMujTAESho HiFF6QktSxTE5E3uh8BjApWL0lqUeZcw5sefwLxlSulgzRo1KNVzkfZtc2mxm9NbiL zIDZhwIX83D70Xt5TuoC2ofvHJVsNH6Z9+7I5bnaX4dp2W32Kx3LA4rV49hgWi3gFL NBN3KHO7wz/eGZaUsCYi8n9x152YjO5PfbDtrKEIoDWXfTWqfauahwqSuL9jZtS7vX lh4SySRVxobmTjMt8FetRNvI9IhU0DASes0bPOMpPp+OQmq251UezXv5vrshuW5KLa cPccHY8xqdNZw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7453367792 for ; Mon, 25 Aug 2025 10:27:53 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139268; bh=m3DDkv+RVLz3F5NpxRo+JdZo86UNciAU8etMLLMVZ4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pNFjMQHnvslVSJKC4+h/E8TK37slTqTrAIDXEcMqqFY32bAYMRMcklXULL7GdnfWH FQfyGeKT1BA6vt1jqv9XOJc6WGA+/d22sW6wRYom1YXGsUepVlzLI8F/HbNqLklR/h kWEw6nxReRIO6REKQH4oLzDHVBkLaKs0c1m/gCANnZJoQOLRPTU6InT6TJzIwocO4O gzrm2y/bazzLfzioEjNr/24nnPoz+UIaVSDhZjw0ppTymY3eIfwdHcqxZWfFs1E/CA vFTxjU5X5oefe136p2yaiIeqvkp3RbgSRHjN7tgfLAbhcs0rpCQxGkix3ZpwgCk2mE 7RkyWpKBX540A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E47E267795; Mon, 25 Aug 2025 10:27:48 -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 m2cJJChk8adU; Mon, 25 Aug 2025 10:27:48 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139265; bh=KKCp55lOe7ojv2mCq7LDZD05tbcaLXiexdi4LE9Sbek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rIpBJPn9Silbez3BuUOdC/AgjHGGQE0jAQtb9x8Y43ur0tMBsHPNxkzaRjX8AqvfY +T2nxAYxo3YC6L3gFJM06Yd4N6cn0fo4SOd/Cz4J750pzsB8SAquM9eVLKWz6YfWOr rKzkvVMO0a9fUxL26e6xDXZU9nQY90MK9hsfYzfmWrXJy+/skwhO2WjPKKSJHUk1UN oetu2pVI/fNIcJfL09YtGYc1yg5Yg9LqrMF/XZwuV1BUpyaQmYznC9exYIKqX1HKVU ceF+SK6RuyN3fhIoZgS5/FVLdEg614zSFDKtCN1QX8m7f1+3F1lpmAlOpOXD+HX5NZ WYz8/1DqWVqag== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 825B467787; Mon, 25 Aug 2025 10:27:45 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:12 -0600 Message-ID: <20250825162727.3185381-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: CQY5FI42RG5MBK7CSJPFZ4BHJWKR2PSY X-Message-ID-Hash: CQY5FI42RG5MBK7CSJPFZ4BHJWKR2PSY 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 09/16] cli: Avoid sending ANSI characters to a non-terminal 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 Detect if there is no terminal present (this only works on sandbox) and skip sending ANSI characters when the CLI starts up. This avoids having them in logs, for example. Signed-off-by: Simon Glass --- (no changes since v1) common/cli.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/cli.c b/common/cli.c index 4694a35cd0e..23988330dd8 100644 --- a/common/cli.c +++ b/common/cli.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -337,6 +338,6 @@ void cli_init(void) hush_init_var(); #endif - if (CONFIG_IS_ENABLED(VIDEO_ANSI)) + if (CONFIG_IS_ENABLED(VIDEO_ANSI) && serial_is_tty()) printf(ANSI_CURSOR_SHOW "\n"); } From patchwork Mon Aug 25 16:27:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 131 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=1756139274; bh=clZoumKB3L0JLbci2+nz4KWmpDBD8QcqAQ/f5JtJ24c=; 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=GC33hOEwiyeEdw6U8ndt/1QHK7hoaWOXeDaH0BXhWw9s5XUeymrJ64Rg62xyMCkWc T2a5eMFOmhCXuZVZY++3GdgDDOAlTPcp7NPbkyxLZFVyk3LuUq/5eqchwzbkpjnoDh RK1vJFqhlaiX3eHksZD/TEnh23H+wFLPCFASFTmw02BHSHecb1sCCvfHdcUX/vh+r4 jZZ8i7j2FP91Dmx/bVvWErw7S8Sg9ddyqNCYOLQcrcBfcmQ1IQ5U2kxykiIScHfpgQ W0/aH675nRNW/3NNOtPrREWYzfh6Tct1Vs2/YvyO0zXR0nbw+spk62RV4DSDASyBpR Dem4vLOp/NuCw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 94A78677A4 for ; Mon, 25 Aug 2025 10:27:54 -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 t1lNloXmoG94 for ; Mon, 25 Aug 2025 10:27:54 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139273; bh=clZoumKB3L0JLbci2+nz4KWmpDBD8QcqAQ/f5JtJ24c=; 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=Z/C2EphLrHmr5mwipBdlleR8MZ5xwM4gNxknoO8SDFRHFXz3rBR9vk38sFPPgvKP3 gbEecUVbmh7/YG1GcbMhSjHNSlyc9vUreNZ/kBZZseLxLZCO7shvj/3QfdRyjBpED6 Myad/nlc/qMiWkWosEUrvJt1QvRXV2d9i4Rl19kHWVvp0lqNC57zcLXmhzJv6J8Jsd GlA/0am+tdFcvj1vt+8oZG10pIc3rXbz+pIoV+cL7MC9LdbvUxItyQkX/61bJKpu8P 0tk77mx3ilIwuTQK9OoHd1Rb60dksKsFbgkLQgoK8LEm7nLv0+pdhkMEB6sVnDE9Jk 4gizypZvSQQJw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DB56B677A5 for ; Mon, 25 Aug 2025 10:27:53 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139268; bh=hpujzsAS+Tsg5UJ0y0C6j0RVO924tUDpf044YByRoJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EV6Y5A0GwR0KFYvoBmxP9rrhM/6Rd1qVmCrPsJYtFcU6Gl/EvIMWOMihPViYANKL/ JwJ8v1PKrLLvm+/uGFXC+xLzJdUKe7Phrib2vXnDQXUjsyKxG4eHA9EJiQHKuASvOT ApreHl9vb3Yfkn+ylM49oXD9KikRhUGPTliFz/HZE0z4dWbd27QKomqWKzsa3TQ0oC asAJuwExZ+nD3Z9qrcbX3mj2WXH+cNYHcEeEO5w1dCs/CVzS2IAcNI/F0HJdZWoNyu bNKp34Nqxz8RLPeAfQ+kxK52DytAzlQMVYvxo/pa0hBmaLjpfHdFWKuToBaSCb80aG Ld9X5I2rnmzGA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EECBD67787; Mon, 25 Aug 2025 10:27:48 -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 5KNZ24sSQway; Mon, 25 Aug 2025 10:27:48 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139266; bh=XG4+DVX5VxQWeCstiWC5rQ/phtcEYimW81WUj48M9ZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kcN73D1DyxyEfMB6FhdlL/zmPZ4TBwXDq+kPwYbDSeX6D1d4Zm3lTWrkvRgDQvGe7 WHn1Q/quFMZwpmQ4s7eqGTMlXwaIhnUER5WuaMk/JAK9wdnV94zT02eARX6cuifOgF QeOI7JiOCYXkD77pH2wmeL/vgL/Hi7pQ/FaddBmSh4pPmbWcKQ+p2GdtmktTScOkrk muSgu+xv+Th5BHrVqv0ZKKXWBjw8nNseJS/gSFm0FdKn9arZuTvxvw08AfDP0OpY68 eoIuPWjZEQJ/vFDdla2cp8rlvN84Z87Z7b17yZLD2JISyTe2cjmpcuHOYp6gOQPL53 grIAoqKqJ5bXQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 49B5C5E45E; Mon, 25 Aug 2025 10:27:46 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:13 -0600 Message-ID: <20250825162727.3185381-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: V5LMJWEEEGG25IWUZUDZNJ3FL5APSUM4 X-Message-ID-Hash: V5LMJWEEEGG25IWUZUDZNJ3FL5APSUM4 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 10/16] console: Update coninfo to use sdev instead of dev 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 The 'dev' variable is generally used for driver model, so change do_coninfo() to use sdev, to avoid confusion. Signed-off-by: Simon Glass --- (no changes since v1) cmd/console.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/cmd/console.c b/cmd/console.c index a8133ee3fa3..cb0c041d947 100644 --- a/cmd/console.c +++ b/cmd/console.c @@ -11,34 +11,33 @@ #include #include -extern void _do_coninfo (void); static int do_coninfo(struct cmd_tbl *cmd, int flag, int argc, char *const argv[]) { int l; struct list_head *list = stdio_get_list(); struct list_head *pos; - struct stdio_dev *dev; + struct stdio_dev *sdev; /* Scan for valid output and input devices */ puts("List of available devices\n"); list_for_each(pos, list) { - dev = list_entry(pos, struct stdio_dev, list); + sdev = list_entry(pos, struct stdio_dev, list); printf("|-- %s (%s%s)\n", - dev->name, - (dev->flags & DEV_FLAGS_INPUT) ? "I" : "", - (dev->flags & DEV_FLAGS_OUTPUT) ? "O" : ""); + sdev->name, + (sdev->flags & DEV_FLAGS_INPUT) ? "I" : "", + (sdev->flags & DEV_FLAGS_OUTPUT) ? "O" : ""); for (l = 0; l < MAX_FILES; l++) { if (CONFIG_IS_ENABLED(CONSOLE_MUX)) { if (iomux_match_device(console_devices[l], - cd_count[l], dev) >= 0) + cd_count[l], sdev) >= 0) printf("| |-- %s\n", stdio_names[l]); } else { - if (stdio_devices[l] == dev) + if (stdio_devices[l] == sdev) printf("| |-- %s\n", stdio_names[l]); } From patchwork Mon Aug 25 16:27:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 132 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=1756139274; bh=nP6fwrVzUVIjbGqocg+krxz2BxWOUgIYFWc7rzcvkM8=; 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=V4O25p7RxSJnuhtNu4EOThuj29rpH9TDamTUFnogSHbZPJttJwJbazkJ8DYvd380Y iBmpWKPcpEFV8G2CAhTvQXUxJAAZCz2l6k7CrY505hYR4Jj0fxyKyDWT6PBZ+3LXH2 BuuA2EgN/CIQBENe9sTySwtmkgcKqJZZMY7NjKi8RO5A5KLGjbB8MUYhXrRFDRjMkt M05ESNIR/gD1MmGWcasdOIdpV1vDmNQ4hU2EnTAjhMSonyoT+/UWuyEggpD7xieWLC CumaetKp/9D0P1E0msi3bbop4ei0sF8Dxx+RWJ9ZujmZvYxL+7IVeyfgJVq/W6buH3 ok2Lj/no+MCOg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D00EE67706 for ; Mon, 25 Aug 2025 10:27:54 -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 R8wapiXqxLac for ; Mon, 25 Aug 2025 10:27:54 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139274; bh=nP6fwrVzUVIjbGqocg+krxz2BxWOUgIYFWc7rzcvkM8=; 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=V4O25p7RxSJnuhtNu4EOThuj29rpH9TDamTUFnogSHbZPJttJwJbazkJ8DYvd380Y iBmpWKPcpEFV8G2CAhTvQXUxJAAZCz2l6k7CrY505hYR4Jj0fxyKyDWT6PBZ+3LXH2 BuuA2EgN/CIQBENe9sTySwtmkgcKqJZZMY7NjKi8RO5A5KLGjbB8MUYhXrRFDRjMkt M05ESNIR/gD1MmGWcasdOIdpV1vDmNQ4hU2EnTAjhMSonyoT+/UWuyEggpD7xieWLC CumaetKp/9D0P1E0msi3bbop4ei0sF8Dxx+RWJ9ZujmZvYxL+7IVeyfgJVq/W6buH3 ok2Lj/no+MCOg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 55C106778A for ; Mon, 25 Aug 2025 10:27:54 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139269; bh=Du4X6Je97QJCADCmCYmSZY2N9pUExc5XCqvD3FHzJYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IKia1U4xVTiFoXhWCAHVyHKCYmK9kX/LmRGDMtHTYGUDIsJt7A1Rgdm6KoiHIMF35 0eNndx7gNyDPaifT2w/GxydgjL7f0s6RG+bFEfHxvDUKuyaI7T7jxG+9lcmsMTzHLj m1Ssqry5XcGTQUNNHYUQ50aFen2VQAPVZxc7d2RaPqsTM1Pdvi9tv3XZ/h4Kas3Wqj D4kR90o0QiiO2Inb3Vn9eVHSF0U2N0L5eAkoj1hrWgCiakvuWO1UHUjp9P4+PdFZ/6 afani+u/1qxDABxCP3JuoGR/YF/ZBaQ3i8MWXtTKu/2dJl0bZ1TWcKufGWgCyOT7zq 86mtQIfFXUzfg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 08EDB6779C; Mon, 25 Aug 2025 10:27:49 -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 PzeRDrCLKjRB; Mon, 25 Aug 2025 10:27:48 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139267; bh=8jM5eQwWL9ja7bXg7xlbKojytHZWju+MaPNU5QGjFdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wZXyb8uUotoQC7LAoJgwXKMbMu79OK1q6mjFrDsKzZC4ZiVzAzQ1/c8OOIzkmZhxK waMgVfP5+odHnYwOh/L5Xdi3eccY4pBV2B5I/KzikhH3fyhGvctlsc6gN8PtKDuglr 6CM9ziFZiGKVaDbqGQETUHXpdwITYtwgz9H2/0sdPuy5lHVmJ21z/wbsfMfxRt4keU cB1HEs/EcHeD90VpJ6GgTA7IY0c9g10q50IU5g/kkTbSz4XxMxr/l0yD/x2WiWZ74M hXde72gU10kL/6LKFYlkpkoQmh4JWJmCWWt47rfWZeHcFkiq1x1LDx6AsaB0cG4aSF yEOaY8uZ1llkA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 15AB567791; Mon, 25 Aug 2025 10:27:47 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:14 -0600 Message-ID: <20250825162727.3185381-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ABOR3ZCITJUVDLAYAJVZUAASVEVIY3L6 X-Message-ID-Hash: ABOR3ZCITJUVDLAYAJVZUAASVEVIY3L6 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 11/16] console: Update conio command to show uclass 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 an stdio device is provided by a driver model device, optionally show the uclass. Be careful to avoid increasing code size, since this is a common command. Signed-off-by: Simon Glass --- (no changes since v1) cmd/Kconfig | 8 ++++++++ cmd/console.c | 30 ++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index 882a4ee02e3..99101ff6c82 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -175,6 +175,14 @@ config CMD_CONSOLE help Print console devices and information. +config CMD_CONSOLE_EXTRA + bool "Show uclass for driver model devices" + default y if SANDBOX + help + Expands the coninfo command to show the uclass for all stdio devices + which are provided by a driver model device. This increase code size + by about 200 bytes. + config CMD_CPU bool "cpu" depends on CPU diff --git a/cmd/console.c b/cmd/console.c index cb0c041d947..a9940467dbd 100644 --- a/cmd/console.c +++ b/cmd/console.c @@ -8,9 +8,17 @@ * Boot support */ #include +#include #include #include +/* shenangans to avoid code-size increase */ +#ifdef CONFIG_CMD_CONSOLE_EXTRA +#define USE_NL "" +#else +#define USE_NL "\n" +#endif + static int do_coninfo(struct cmd_tbl *cmd, int flag, int argc, char *const argv[]) { @@ -20,17 +28,32 @@ static int do_coninfo(struct cmd_tbl *cmd, int flag, int argc, struct stdio_dev *sdev; /* Scan for valid output and input devices */ - - puts("List of available devices\n"); + puts("List of available devices\n\n"); + if (IS_ENABLED(CONFIG_CMD_CONSOLE_EXTRA)) + puts("Device File Uclass\n"); list_for_each(pos, list) { sdev = list_entry(pos, struct stdio_dev, list); - printf("|-- %s (%s%s)\n", + printf("|-- %s (%s%s)" USE_NL, sdev->name, (sdev->flags & DEV_FLAGS_INPUT) ? "I" : "", (sdev->flags & DEV_FLAGS_OUTPUT) ? "O" : ""); + if (IS_ENABLED(CONFIG_CMD_CONSOLE_EXTRA) && + IS_ENABLED(CONFIG_DM_STDIO) && + (sdev->flags & DEV_FLAGS_DM)) { + struct udevice *dev = sdev->priv; + int len = 0; + + len += (sdev->flags & DEV_FLAGS_INPUT) != 0; + len += (sdev->flags & DEV_FLAGS_OUTPUT) != 0; + printf("%*s%s", 20 - len - (int)strlen(sdev->name), "", + dev_get_uclass_name(dev)); + } + if (IS_ENABLED(CONFIG_CMD_CONSOLE_EXTRA)) + puts("\n"); + for (l = 0; l < MAX_FILES; l++) { if (CONFIG_IS_ENABLED(CONSOLE_MUX)) { if (iomux_match_device(console_devices[l], @@ -40,7 +63,6 @@ static int do_coninfo(struct cmd_tbl *cmd, int flag, int argc, if (stdio_devices[l] == sdev) printf("| |-- %s\n", stdio_names[l]); } - } } return 0; From patchwork Mon Aug 25 16:27:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 133 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=1756139275; bh=sAWGVg3kKvOWFXHPagaq7+WujeuvXOTy8ki5+avGagI=; 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=phJVvJYNclNP9BOA7GVLe53mHX8dsQ+aoy0c3+YsnyUq9XuBsDVzIo70P0y0fb/CQ RNm/hn2kw3MF2IrxLybgSLULSmuy9c7ROTMcJr8l4iOHxGybNyPzprKxnVjfG6XNqz l+tM9MzvK68uOiH9lrB9Kh4YXTjTxNQCS0mZUtDonN/IoDEzPm4pnkj3zgr+2xeunp wTr7dNBjbDQuJRGcjroaMCETVVnBjokFbSyOCROz28jP4c1UYIwu+/VAWO51ZY9885 LMGPDyD+s9yxSMrctDVOiodm1InRraY0C4Cao0eEISeEm87uAbVmfc0lpmMA8gBGdc XFff6RCHkHCrw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 18DA4677B2 for ; Mon, 25 Aug 2025 10:27:55 -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 3QJ7TMSLFSlZ for ; Mon, 25 Aug 2025 10:27:55 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139274; bh=sAWGVg3kKvOWFXHPagaq7+WujeuvXOTy8ki5+avGagI=; 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=EgCcU4iTsaJeChbSt7uVlYf3qBJbtejUivdIPb/piVftGhXDYHqFfG17uAXBbvcdV W/GGXW8+eqMZTp/oiEUOp+LFa3a4J1qLncyE2Hbh9yG3/6Apyi5iFTwkvTAZf05CDl efXiEr5KolC6Em6uatYp8WtF6yAIVSBsNZv7qkyEhgMNMp9+8tw5TcvuGlBXJ3D4hp HOjvFX1DaKGkccEpCTGpxOw9QSY/qBA5tNY/Txd6Uq4jDYmPMP7XxinwHoFgmbXJ4T +r0sRJpnavCxeYs3hWMsIEPS4V/bpeAXPGqiRTC5hAjBk4SybHR9MB4miUcXzu2UmK 5qVEeg7PchTvw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C4B1867787 for ; Mon, 25 Aug 2025 10:27:54 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139269; bh=9IUGipPhl6pvWWBaQX7HQyq+YsdEBn9B7fekunO8xRI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wWMJhlr/kNojebld6uBnHQ7azB2cJP2dRw+2ZHJ9dCtf6RNlM+/6K8t/++x+Q3t/j xi+ow8L6dLMWSEbfVXIG7EzQMFWbSru1mEGwwxzEzAeiqvBUfOxSNfwP1CBSyqvvZN py/awyFaybypCbXH9Sk60FEyEKZLIzgmv+r/4IltdcRtF3WrW5YQmMB0odOipEHZF+ 1y58LoCWRr5fMq1cHEPmyDg1uPMSV6Gdsd75ISfsgmZJ8+LzZk7mNipEYFTj0gJDGK pXHLsWDxRsXfuREwXoVwk/SaT0Vkn5a7UViuShDZeGfLSHvPMwVSW4Whngw5XE0SVg OzLqpPcf/YLlQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1F7856779F; Mon, 25 Aug 2025 10:27:49 -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 OT2qqbpUBRRd; Mon, 25 Aug 2025 10:27:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139268; bh=LbWs6oUprjjIdnwDRRdnuR3pDdJcUypTD8Y+3tQd1II=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qwFtZGv9W2WrZs7J9F/wxgTLqs670vcH/mvSCHomxa3IDxCYPn609BNBYL0Z7Dw+T TXDfEApK+6auFjGYNjupwzp9VcQsFo0z5+wvNxzQ+5DecZGCRFI4jD7wyuUxG1HlTT w61DfdJRnZRFDRI/A8/RXPOBorvdSFdR/+NtLOFja0RnPde4zKbqQ2UMBFWxUhpgmh mFdZOadJyxAYCUzJoExVBRimfCKrF/Bgu/GpsiGaPkKnGC56Nhzhk5S80ncQjBxGaM swrPPxxvd2OWkmRP+EnurM6Q2M7chMr9rcyIZjMtQlku0jc2HUaQE0PWz30yUeye+O NAJrBs3qMcK8w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id D9F7A6778C; Mon, 25 Aug 2025 10:27:47 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:15 -0600 Message-ID: <20250825162727.3185381-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: F3FJYH2FPDPKDJOC7JL3YBADG2Y7COSX X-Message-ID-Hash: F3FJYH2FPDPKDJOC7JL3YBADG2Y7COSX 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 12/16] console: Move environment handling lower in the file 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 Move the environment callbacks lower so that we can call functions elsewhere in common/console.c Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to move environment handling lower in the file common/console.c | 130 +++++++++++++++++++++++------------------------ 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/common/console.c b/common/console.c index c6dfed6e201..51f646d9fd4 100644 --- a/common/console.c +++ b/common/console.c @@ -29,71 +29,6 @@ DECLARE_GLOBAL_DATA_PTR; #define CSI "\x1b[" -static int on_console(const char *name, const char *value, enum env_op op, - int flags) -{ - int console = -1; - - /* Check for console redirection */ - if (strcmp(name, "stdin") == 0) - console = stdin; - else if (strcmp(name, "stdout") == 0) - console = stdout; - else if (strcmp(name, "stderr") == 0) - console = stderr; - - /* if not actually setting a console variable, we don't care */ - if (console == -1 || (gd->flags & GD_FLG_DEVINIT) == 0) - return 0; - - switch (op) { - case env_op_create: - case env_op_overwrite: - - if (CONFIG_IS_ENABLED(CONSOLE_MUX)) { - if (iomux_doenv(console, value)) - return 1; - } else { - /* Try assigning specified device */ - if (console_assign(console, value) < 0) - return 1; - } - - return 0; - - case env_op_delete: - if ((flags & H_FORCE) == 0) - printf("Can't delete \"%s\"\n", name); - return 1; - - default: - return 0; - } -} -U_BOOT_ENV_CALLBACK(console, on_console); - -#ifdef CONFIG_SILENT_CONSOLE -static int on_silent(const char *name, const char *value, enum env_op op, - int flags) -{ - if (!CONFIG_IS_ENABLED(SILENT_CONSOLE_UPDATE_ON_SET)) - if (flags & H_INTERACTIVE) - return 0; - - if (!CONFIG_IS_ENABLED(SILENT_CONSOLE_UPDATE_ON_RELOC)) - if ((flags & H_INTERACTIVE) == 0) - return 0; - - if (value != NULL) - gd->flags |= GD_FLG_SILENT; - else - gd->flags &= ~GD_FLG_SILENT; - - return 0; -} -U_BOOT_ENV_CALLBACK(silent, on_silent); -#endif - #ifdef CONFIG_CONSOLE_RECORD /* helper function: access to gd->console_out and gd->console_in */ static void console_record_putc(const char c) @@ -1101,6 +1036,71 @@ static void stdio_print_current_devices(void) printf("%s\n", stderrname); } +static int on_console(const char *name, const char *value, enum env_op op, + int flags) +{ + int console = -1; + + /* Check for console redirection */ + if (strcmp(name, "stdin") == 0) + console = stdin; + else if (strcmp(name, "stdout") == 0) + console = stdout; + else if (strcmp(name, "stderr") == 0) + console = stderr; + + /* if not actually setting a console variable, we don't care */ + if (console == -1 || (gd->flags & GD_FLG_DEVINIT) == 0) + return 0; + + switch (op) { + case env_op_create: + case env_op_overwrite: + + if (CONFIG_IS_ENABLED(CONSOLE_MUX)) { + if (iomux_doenv(console, value)) + return 1; + } else { + /* Try assigning specified device */ + if (console_assign(console, value) < 0) + return 1; + } + + return 0; + + case env_op_delete: + if ((flags & H_FORCE) == 0) + printf("Can't delete \"%s\"\n", name); + return 1; + + default: + return 0; + } +} +U_BOOT_ENV_CALLBACK(console, on_console); + +#ifdef CONFIG_SILENT_CONSOLE +static int on_silent(const char *name, const char *value, enum env_op op, + int flags) +{ + if (!CONFIG_IS_ENABLED(SILENT_CONSOLE_UPDATE_ON_SET)) + if (flags & H_INTERACTIVE) + return 0; + + if (!CONFIG_IS_ENABLED(SILENT_CONSOLE_UPDATE_ON_RELOC)) + if ((flags & H_INTERACTIVE) == 0) + return 0; + + if (value) + gd->flags |= GD_FLG_SILENT; + else + gd->flags &= ~GD_FLG_SILENT; + + return 0; +} +U_BOOT_ENV_CALLBACK(silent, on_silent); +#endif + #if CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV) /* Called after the relocation - use desired console functions */ int console_init_r(void) From patchwork Mon Aug 25 16:27:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 134 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=1756139277; bh=i3vjmQQ3LRBIcGyr85IQEr1BwrUVaHoIDt/POA2Br84=; 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=BeHxzsh+kUzSEtVPz0y5b2wNfGXLoB62wQ6KrztogvoyUYMbQGXWIRiNqmCcA1SdO l4ALm4wn45SU4U7Anj+2VlfYZR1cWovbjOBD9UBre4JppnZ02v+TKbzawW3HLkPzG0 ZaN/zetrjWKSqJKGpadiOhwWh5JvHH8ocpn0s0h+2HAKymA9kWmYcI+X4usBuG1dvf LDYa1Tq0kupBOWwMMkTHV6a4OmgaNnhmiNy30kvE5hA2j7IoL1AbETW/60xM05Lwg5 Mjhi54h3lrJ6zux1QHTQ4e63x3f2mZsFO8zm1jdVLrLzn69t+uhiLqrzThM+8O3QNU MLxxbxKRviwIg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8D14A67787 for ; Mon, 25 Aug 2025 10:27: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 10024) with ESMTP id KuDzpvyz8f0n for ; Mon, 25 Aug 2025 10:27:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139275; bh=i3vjmQQ3LRBIcGyr85IQEr1BwrUVaHoIDt/POA2Br84=; 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=sNNO36+xsbBTRMMMO/dPrJ/arGHlx7iU++pWX+vLGBfTTv1UfM1Bg3ERcKuCsIkJv VSJCgf0s/R0l87Fg80K6WHHcx9u2kL7NHUwDHAjBjm5pT6CHjshQPwiivVtvpgcZxv UEsHtGdb9iE3ja+i9rG7wZ8KjxJCqV+BWoM61A2t7gV+li0Hyj/7phxeKOCK+sIH71 vxc1kASZXrRwzFmfQB4xcpMC3fx+oMQ79d4ojxN3TNbVLPYLviG48crR7F6KpmbDkX iSgNz63Fswj6kC5znbTtGFwNv7iifAVxEz/CM2KdncyjAHRf1IdFhvipPk2GqpULPR e4rtKGIXaf97Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 910DA67797 for ; Mon, 25 Aug 2025 10:27:55 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139274; bh=4F4AHenRyjfietUgw5++60rDpnc+2I9s3bq5aIzg3mQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aoy94orOpo4+Q+SVCYMlNg8Mrk+tXfjOMw4/rUCNb0SAO1mK/cvA0Tgg6HsLLeaOm 1MjDtgyWtPfDD/0umXwxFZOCokPKxfXKHRipNb5JEYNrcBzMzjBZA3IQyWYzYSswji TxpSocNy+DZOZdTQvgG077RCEBVNHB9JTikGhRq39BphE0dERRSmel52TgEGqbj9au WBRrtHzf4HsFqPVCnPOtnM7xQd2SNrTT8+EzMkov02S6JONgGOu1akQJfPsIsLO7If BgUgPLtqViajdyF0q5RpHBmLpEt6Fh7N62HvHEXPF8G55lmZarLWl7O/QxJsBYXcGu tnK1+08s+NtMw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 37CAF677AB; Mon, 25 Aug 2025 10:27:54 -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 kKKAE2u9kdKh; Mon, 25 Aug 2025 10:27:54 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139269; bh=krnolbIxkZabNFG3p8c7i7dojqG4WX+yYL5VUY+lq/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AY9no7fKLnIXaPMTDDirpubwuworO5/M0gB4kpySj0UMkICjfYA44jOfujrhdrV9a OJlRwYJpCQKpxIe8U4OTu2F89HiW7ARwwAJE/7RdSJzi4LCJPXjl+8ugs0OEHqPf1Z BssThbyi3mqNyPyTYY+HCjU7DPsjsXiveKR7Fs4p0QU/s5UEI/Xdz4njGnqr7R2k/m RSCDfXnZ57YvGHruZ1faziitGUnchtkNlNg2GzxsFr+fUWraOs6kDorrXHvR0UN7+d 2YOSRnEq8J9MNoEgFFhnYxQiAgdSG3uDLf9yQB5ZM7OvMgj8d0pFOCfjQB6CWlDiub ESYKdaBvq9Qng== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 03AC967797; Mon, 25 Aug 2025 10:27:48 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:16 -0600 Message-ID: <20250825162727.3185381-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: DP2TQSHH5Q6ZHS2QVTL56NUKMVBEKPNW X-Message-ID-Hash: DP2TQSHH5Q6ZHS2QVTL56NUKMVBEKPNW 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/16] console: Refactor handling of the result in on_console() 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 has lots of return statements in a switch statement. Move them out so we can (later) do something else in this function. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to refactor handling of the result in on_console() common/console.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/common/console.c b/common/console.c index 51f646d9fd4..e986fa0f3e5 100644 --- a/common/console.c +++ b/common/console.c @@ -1040,6 +1040,7 @@ static int on_console(const char *name, const char *value, enum env_op op, int flags) { int console = -1; + int result = 0; /* Check for console redirection */ if (strcmp(name, "stdin") == 0) @@ -1056,26 +1057,25 @@ static int on_console(const char *name, const char *value, enum env_op op, switch (op) { case env_op_create: case env_op_overwrite: - if (CONFIG_IS_ENABLED(CONSOLE_MUX)) { if (iomux_doenv(console, value)) - return 1; + result = 1; } else { /* Try assigning specified device */ if (console_assign(console, value) < 0) - return 1; + result = 1; } - - return 0; - + break; case env_op_delete: if ((flags & H_FORCE) == 0) printf("Can't delete \"%s\"\n", name); - return 1; - + result = 1; + break; default: - return 0; + break; } + + return result; } U_BOOT_ENV_CALLBACK(console, on_console); From patchwork Mon Aug 25 16:27: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: 135 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=1756139282; bh=fTIIwpAObZru5MGzGF7VYGtBHtReonqpFVyS3f6AoEA=; 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=KoNPY/6SfXNcE+S9+E3bcZOtvtJYia5IinqZ1ES9jcdykQdu5T8QSiYkKoZDu/G9d oOFS7/K27QKHbHGXJmVFMiiylYiKhshb5Bg0ccn8DeG/bmKQSjuKrmPaYvfjdGll+i lRoGsb6VMdWfNExcHzME4vjs9XLD7RIiREtvI0b9/gO9hqRDV2fZcGIsPdeL4lCKHH 3g4oQ58RwU2bmI581jY29TVyhR0lVZvDHwvz/jUxgEOTvuRLMTrTCvz4aQeendghir iIU8dPZJtTa9YzNNKJyTm0AmCXvu4GSgUmSrQQXh4XWNLuJptprGd5kzlm1csyoSVA xUDha3GNHJMlg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1B5AA677A4 for ; Mon, 25 Aug 2025 10:28: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 msEfwUTsseip for ; Mon, 25 Aug 2025 10:28:02 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139279; bh=fTIIwpAObZru5MGzGF7VYGtBHtReonqpFVyS3f6AoEA=; 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=a+5h2+Q7v2NQXfzAmX47Fif26yVIkirBgkfMQpKfAPiDQSmdb5+r38n3mJ+2+duPe onbAGl86brGVCmQNGVOTXNBMcnlH2PUi/D7c97HqaV1xToR3s/47o8ctXZZhBGc0Zi D8NBCM3GopWQNmRCqE4Fx+zfj+gl9yCWCUKsAv/ZUX5yW0EaPt1WSCjc8MDI83SFLq PmLZ9hBqE8Ffk5DBFGFGxdl8I09KANFzWYqOQhXfB1X9gRRwaM1ZY5GpHd2UpfWZWT lm9RKmbwnVNbU0IX5WsC+qFswfhMrn9f3qFiWLAgWUxayIGomBznmPKkJHJ+eXk9Mp hIg/FfCPD0Yrg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 018DB67787 for ; Mon, 25 Aug 2025 10:27:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139277; bh=knddmV5ghI9ZrwqrVOGPvKUddsY1jbz/eQaKAIMFUW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ufIgzGtmlfDszFerAv/kRocRwhsh2W/rhMvNMZrB5E5lGIQZK8mW/GC0W+LJmHG8U qXg26NWzQNo978HWjksPG0nmQeu2sr1KSu22wPSNBZ4GM2aRb7/pDhfy7sDDbLtbb9 ZPXJh7kK7MVxIw0bDXzl24hI8VBUyrHyNgzV1rtNwR7xIV93lizsN6YWMkHiWxv2uA q90vMGb+s/0aD/hwM4Tm6xeSRS2MFyJgNbwUccT1ZcqiJszQhMDq8LJCxkiwzG4lyg UFAGf0WcSRWo3pS0lfdazXgKVZWXMyEfXBecqSg5eDEWffYXaDjnRFXk0PO4AMaZ7s oEdN4V5ep3SYQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 62CE15E45E; Mon, 25 Aug 2025 10:27: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 X4RS0DXIYE7q; Mon, 25 Aug 2025 10:27:57 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139273; bh=VK5PPKdUvua3YiE2gHdZ+bGU5jU5ioG7/KtTtVnX/ow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wgaOPHWR1kz0Sda63/H9kWCcL7dAJMDNQmWwhDqWfItIPiuYX2W3xhXPyWg+WFv0z YeNq09NQOlyIUnVaUf2ZBADykuxhjzhB4KW3osLUvirHGFSTpZNeq5NfdHqMyOamsB oW4OMuWQAEgkUYoB1ocqKbqQU2u2jtV68a3NOyKEkJ2eX4ecMpMdNMatzqkDZh7iQI X00/aXGuf4okHX2xy7Upo+ZzHpZ01FlCNF33FLsvtr/nNc9AxLgPgNoopWVrWy2C3M BtrULvF1wzstOwe8u3K0eBwE8pVuvh7o4R9wTzi0WV0Jn9rWo215J/tRAgLqlkr82a EW/8JfmdzkaHQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 966166779E; Mon, 25 Aug 2025 10:27:53 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:17 -0600 Message-ID: <20250825162727.3185381-15-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: SOL75D6L5DALW35MHDELBCYM7FHKUMUD X-Message-ID-Hash: SOL75D6L5DALW35MHDELBCYM7FHKUMUD 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 14/16] doc: Remove obsolete text in README.console 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 The latter part of this file is very out-of-date, so drop it. Signed-off-by: Simon Glass --- (no changes since v1) doc/README.console | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/doc/README.console b/doc/README.console index 9f5812c89d1..debef45760d 100644 --- a/doc/README.console +++ b/doc/README.console @@ -58,43 +58,3 @@ You can use the following functions to access the console: Remember that all FILE-related functions CANNOT be used before U-Boot relocation (done in 'board_init_r' in arch/*/lib/board.c). - -HOW CAN I USE STANDARD FILE INTO APPLICATIONS? ----------------------------------------------- - -Use the 'bd_mon_fnc' field of the bd_info structure passed to the -application to do everything you want with the console. - -But REMEMBER that that will work only if you have not overwritten any -U-Boot code while loading (or uncompressing) the image of your -application. - -For example, you won't get the console stuff running in the Linux -kernel because the kernel overwrites U-Boot before running. Only -some parameters like the framebuffer descriptors are passed to the -kernel in the high memory area to let the applications (the kernel) -use the framebuffers initialized by U-Boot. - -SUPPORTED DRIVERS ------------------ - -Working drivers: - - serial (architecture dependent serial stuff) - video (mpc8xx video controller) - -Work in progress: - - wl_kbd (Wireless 4PPM keyboard) - -Waiting for volounteers: - - lcd (mpc8xx lcd controller; to ) - -TESTED CONFIGURATIONS ---------------------- - -The driver has been tested with the following configurations (see -CREDITS for other contact informations): - -- MPC823FADS with AD7176 on a PAL TV (YCbYCr) - arsenio@tin.it From patchwork Mon Aug 25 16:27: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: 136 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=1756139282; bh=0VXXA3ynHAbVrJBnk98DMhpqn/MUWpVuQZGx7/rQkVw=; 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=W8DtFaICvySBxKu04BN3bISmmz2oGjz/CwaO2UF2l8/cNsBvgPgAhwwcVAfqnHRer 0gKhA/+VYPoQR0byND/U6+Zzg5thCQpuGbiIx1ZXLZCcHd5QTHVtTjrpUNs4zlpknn APOIhTL5Lj2qK5WhnUxB+t/3tSkQkh4tv8cpYstbgQoKQ+STOsmDm6gGbdWpdSjvVf C8DsP0p4aUrtMIa6dbl0x+HMII9NmNDcQmkR9gbFE17oiJD1bKsk8iRJb6DftUgczq w+lcl++vVx8jtFmkGTMxSHQMNoQJRgq2nl2aa+kydTXVsNs73lZiHitaSZEgqJHEOs VBfhrMOGYBxtg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A0E5167706 for ; Mon, 25 Aug 2025 10:28: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 Gn77z5eUWmqT for ; Mon, 25 Aug 2025 10:28:02 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139281; bh=0VXXA3ynHAbVrJBnk98DMhpqn/MUWpVuQZGx7/rQkVw=; 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=r6DRziry0XyCCwhPYqLhuBdgotQKIcYOGQ+iww/+COF70rsTeiA38bWSM3d7xPSbN N67o2EyP7zLPK9KNI16m7EWrS873Z4JGM5xkn1WD82S3T82DOfvro4D5/2uHcpJ4GS iwHyqECHUtNuIGFEjoPRuJFW7e2SlwVQPU9XOxElKs7kds6tni+FRvwwHtk7QFbnxl ssJGi2TmFrF7CoewzTBYH7KPRMcAeQuhMy3GkEWHYhV5CuUsGjKn4Ulry76LyPWlhm ptx35E4Ok24+OinXSA+G3oG3zzKy+2rPBnI0Qx109zlGFQv1HvJ5fohWF3MKzJ29b+ mx+fWKn5TcBeA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 58AF06779C for ; Mon, 25 Aug 2025 10:28:01 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139279; bh=L5rCqxColhOY5vVxpbnWU5w7UObZ0ZJqJhjK1zaeqmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W8qoCe2ogeqNkZrXGjMUmhIcTkBQH6WpcIyt6krXO6MXmEWTfFmj/f1oLYUNUqueP 18wmvMp4u7imdFLRS0NLrPCavWEDGgA6EMfrQ8ftv5monFDdQ7OFgojcinKpRLVJKB LW77H4IbVFvgqfCHnmEE2135AjuuslLGVX5gm7+wg3UUA/6nGSFyeAKyjpGmdShB6W uZMNIuYPbfS2ob5Ow1yWscKYlZvPvisgL/81fFCsO48ExhEmL//s3i8tzLN7sO6Xik 91bMBz9BBKh/76G66XJb+jkcjIySVpDQyAGnYpM3gXs3BDRfsba0NubXoJs+tveCxL LqyuNb3Eql+hA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D29566779C; Mon, 25 Aug 2025 10:27: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 10026) with ESMTP id mLTG4m8Jfi26; Mon, 25 Aug 2025 10:27:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139275; bh=+n9d58T2je91PQQW1jAacu/6gIdRhzhWH7TQcASHGFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r6Q4IcFPSdJlf2gtPte7q7xMviwxi6HCMeNL+O9h3tDLpriIp5IvF/Da8ye5+Wau9 2jQR2dNc8Cjjb3lNpPlXmYVqS8XrFc6vYiqNOEV6djcE6/4gSU6YzPc+lujOMkyZfP xX9gZcl2nLPJCdcLlq6Kmg+E5Rtsne2dxbOG/ONDfQYZzdkRGqGSnSjCgZXq7ZTZ6p mA+spd9xGZBaNaXBTM/I17jRvRwCLoQ5Sa63vDczVkQ934LoqUjzmRiBNULiuFitZd iVO5Tw0ALKOSCSTokv7evhsPHoLpRV7jGkDRLTSXXYuZLo3aPfEtWBLyWxa35dV5ng ou4mCoco+jJGg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A0CD56779F; Mon, 25 Aug 2025 10:27:55 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:18 -0600 Message-ID: <20250825162727.3185381-16-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: BWPDHU3L2E6BAF7ZXAFYT45B4H4KX3KE X-Message-ID-Hash: BWPDHU3L2E6BAF7ZXAFYT45B4H4KX3KE 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 15/16] doc: Move console docs to rST 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 Move the console readme into the main documentation, with as few changes as possible. Signed-off-by: Simon Glass --- (no changes since v1) doc/{README.console => usage/console.rst} | 13 ++++++------- doc/usage/index.rst | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) rename doc/{README.console => usage/console.rst} (87%) diff --git a/doc/README.console b/doc/usage/console.rst similarity index 87% rename from doc/README.console rename to doc/usage/console.rst index debef45760d..f624cc58038 100644 --- a/doc/README.console +++ b/doc/usage/console.rst @@ -1,11 +1,10 @@ -SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2000 - * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it - */ +.. SPDX-License-Identifier: GPL-2.0+ +.. sectionauthor:: Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it +.. (C) Copyright 2000 +======================= U-Boot console handling -======================== +======================= HOW THE CONSOLE WORKS? ---------------------- @@ -57,4 +56,4 @@ You can use the following functions to access the console: fgetc (like getc but redirected to a file) Remember that all FILE-related functions CANNOT be used before -U-Boot relocation (done in 'board_init_r' in arch/*/lib/board.c). +U-Boot relocation (done in 'board_init_r' in `arch/*/lib/board.c`). diff --git a/doc/usage/index.rst b/doc/usage/index.rst index 20465b8bff6..585aa3f9784 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -6,6 +6,7 @@ Use U-Boot spl_boot blkmap + console dfu environment fdt_overlays From patchwork Mon Aug 25 16:27:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 137 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=1756139283; bh=xNkh2ZhO2RpO50TrW1UogUuxW/Ns6u6NmvIEv0s/LOQ=; 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=jUAJFKu7X+umngY7wSLpIs9ooqvO4Fv6V2g4ib9qfN3bsKeb8KQI/wXcNEef6tgrA DbniZlDqjvJda0w0OGuKSar424RGQiFv9e+Y+oaDZJM4AK2F2WQ4Z0vEKeHEmYzvlW 7gfvOIgOCT8+auFu8aRyOsDQLiOjM5e0W8pf38C5ty3rW2Mr/0qfgb/kMuBDvNrN93 OgQaaF+YnAl9TNr6/vbH9Bj+/lFxBzHXmm7Mhuwp8ZdSO4joqNKgFDBXZ86+2xy9kF qAGf5oFBNFMOkZIkuIady7rZkgJZwd9tJdU975iBxOim9ojvQC0GwzysDZlAZ4LosK aLUrarrCM0EVg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2282967797 for ; Mon, 25 Aug 2025 10:28:03 -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 lU-wtWqF-OHZ for ; Mon, 25 Aug 2025 10:28:03 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139281; bh=xNkh2ZhO2RpO50TrW1UogUuxW/Ns6u6NmvIEv0s/LOQ=; 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=CdUZxgD3o6hHDXDNn8DoKyUXFpmaiT0EHzTxV3ACO93TjNcPh+6bSYuxstHxUwQVR tnkiYXua0MmDJokZmBUSKkNmFmnt1R0U/B3KjNWbK17dJEpmP0Qtb8dUL1InvPrUCp iMzbVROuf9K37ZIU1+1DKIB6xaAK/nlyokjXIAaqdsWOE6x1LDc0QFa0yPfsQpASrs 4+70iaskJHo4xMgL2wxuHRLA25ahq93cOHydErRKMTwSxwH6IAy7ZwAB8A98f6VuS/ MhksRTtmzzON3CllGVvIhpy80yb+JAB/r1JxlQIUn8/n9bWREcCIKiQY35Dn1XfAe7 ZkvvqysID8uXg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A5CD8677A8 for ; Mon, 25 Aug 2025 10:28:01 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139279; bh=qsVeSFbu1pjH5YW5pEXbxABAMO3w6AksnO4zO2zinfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ua6HG2HElcPLkD+jMeFJWNQpieaX3ZA65Dp9JhPJ47HN0TARgzJpEbUb2BA/15GFb dCKcFc7vuftG2jouhnVLgnzSk081NoJx5rsxXyKUrGFwA+/mywdcpnjr1pBbFOp9PU Jy+O+HY7BE2UJLQm0+y0E5N8MQvtl+fvL2FMtXba4fp3X5239f2rSCLAR4vcXF5tQj BYpspYGHJEsyDnUcnL/f8u92gbp+KJRz1XifFnOE9pjxZmIowIw0FCdTkw8zLC2Gfl 1N3oRSjH9+y2lLbJxFjqme9VIZvMuA2N+oBgKhhvRPEkk36vgDRJdxGcO9/a0rejsf +msrzf09+AG/w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E5C0B6779E; Mon, 25 Aug 2025 10:27: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 10026) with ESMTP id QLl_D1Ncoy6B; Mon, 25 Aug 2025 10:27:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756139276; bh=v2O+LePaJDu4aO0qaqULi9vAXO6DF/fxUGo2cfFvTnY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UIiPSq/xHOIqn8SN0JihcQHxEkN++gyyvHweVetjye5SVqmHJ+vvNrzIU20oqDQX8 wLtQYE/uBH/yqyqzCcZ/6p0564ty2H/mfm/NPo+cnKQq/iwoYlsf2Jxo9V3KvEyg8p V0tlzBrVUFQibd9J8jVaQGQgZkL+mBkEg/RL8B58/GJ/XHVyO6woWriS+EbSfDa/QN nbH8l73WNEBgyOLcFytfoqpkpNefTngOpVM4fMu0sJroUIJ4L7HwvowcylJX5zwtIl otguGQdVpBm6tT8o/UFLeP7NKoFlXUVqbs+smGy0Dsyv7ylA3HP8FzJpjYJUgBnOeu Cgjf90w6c3M2Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6FEB267706; Mon, 25 Aug 2025 10:27:56 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 25 Aug 2025 10:27:19 -0600 Message-ID: <20250825162727.3185381-17-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250825162727.3185381-1-sjg@u-boot.org> References: <20250825162727.3185381-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 4UGOH7TO3WDGJAYSRULFE5NDZOTHI45A X-Message-ID-Hash: 4UGOH7TO3WDGJAYSRULFE5NDZOTHI45A 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 16/16] doc: Tidy up the console docs a little 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 Tweak the documentation to look better when viewed. Use 'write' instead of 'put'. Signed-off-by: Simon Glass --- (no changes since v1) doc/usage/console.rst | 69 ++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/doc/usage/console.rst b/doc/usage/console.rst index f624cc58038..d7d41bca187 100644 --- a/doc/usage/console.rst +++ b/doc/usage/console.rst @@ -6,10 +6,10 @@ U-Boot console handling ======================= -HOW THE CONSOLE WORKS? ----------------------- +Introduction +------------ -At system startup U-Boot initializes a serial console. When U-Boot +At system-startup U-Boot initializes a serial console. When U-Boot relocates itself to RAM, all console drivers are initialized (they will register all detected console devices to the system for further use). @@ -17,43 +17,46 @@ use). If not defined in the environment, the first input device is assigned to the 'stdin' file, the first output one to 'stdout' and 'stderr'. -You can use the command "coninfo" to see all registered console +You can use the command `coninfo` to see all registered console devices and their flags. You can assign a standard file (stdin, stdout or stderr) to any device you see in that list simply by assigning its name to the corresponding environment variable. For -example: +example:: - setenv stdin serial <- To use the serial input - setenv stdout video <- To use the video console + # Use the serial input + setenv stdin serial -Do a simple "saveenv" to save the console settings in the environment + # Use the video console + setenv stdout vidconsole + +Do a simple `saveenv` to save the console settings in the environment and get them working on the next startup, too. -HOW CAN I USE STANDARD FILE INTO THE SOURCES? ---------------------------------------------- +How to output text to the console +--------------------------------- You can use the following functions to access the console: -* STDOUT: - putc (to put a char to stdout) - puts (to put a string to stdout) - printf (to format and put a string to stdout) - -* STDIN: - tstc (to test for the presence of a char in stdin) - getc (to get a char from stdin) - -* STDERR: - eputc (to put a char to stderr) - eputs (to put a string to stderr) - eprintf (to format and put a string to stderr) - -* FILE (can be 'stdin', 'stdout', 'stderr'): - fputc (like putc but redirected to a file) - fputs (like puts but redirected to a file) - fprintf (like printf but redirected to a file) - ftstc (like tstc but redirected to a file) - fgetc (like getc but redirected to a file) - -Remember that all FILE-related functions CANNOT be used before -U-Boot relocation (done in 'board_init_r' in `arch/*/lib/board.c`). +stdout + - putc() - write a char to stdout + - puts() - write a string to stdout + - printf() - format and write a string to stdout + +stdin + - tstc() - test for the presence of a char in stdin + - getchar() - get a char from stdin + +stderr + - eputc() - write a char to stderr + - eputs() - write a string to stderr + - eprintf() - format and write a string to stderr + +file ('stdin', 'stdout' or 'stderr') + - fputc() - write a char to a file + - fputs() - write a string to a file + - fprintf() - format and write a string to a file + - ftstc() - test for the presence of a char in file + - fgetc() - get a char from a file + +Remember that FILE-related functions CANNOT be used before U-Boot relocation, +which is done in `board_init_r()`.