From patchwork Mon Aug 5 18:46:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Dannenberg X-Patchwork-Id: 1142423 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="LEwc34Dj"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 462RjQ62hsz9sN4 for ; Tue, 6 Aug 2019 04:52:58 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 85340C21EE7; Mon, 5 Aug 2019 18:50:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 47B69C21D8A; Mon, 5 Aug 2019 18:50:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 790C2C21D8A; Mon, 5 Aug 2019 18:47:13 +0000 (UTC) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lists.denx.de (Postfix) with ESMTPS id D19C8C21E60 for ; Mon, 5 Aug 2019 18:47:12 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x75IlAJs099723; Mon, 5 Aug 2019 13:47:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1565030830; bh=J6lDbcETnq2mdJegm7MNghf5Herw7orcfBEUH7ek/Jo=; h=From:To:CC:Subject:Date; b=LEwc34Dj8UkGtA/k+fFJu7VlFJ971ktPKwDoQuavR2TvM/UBnsSzYNuobiYB8PSKT 61l0A0q6ORzoL1Am6VJfvlmPn6Oyuj3h+tgpZpcRYJ2I6ZNgkHzGf5bVGg5g/oIPpJ 6b0PeXQuD0wnwO8xja4Jxa4ayMxdgoMSwEkGQCEE= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x75IlAYB116837 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 5 Aug 2019 13:47:10 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 5 Aug 2019 13:47:10 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Mon, 5 Aug 2019 13:47:10 -0500 Received: from jiji.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x75IlApk079359; Mon, 5 Aug 2019 13:47:10 -0500 From: Andreas Dannenberg To: Tom Rini , Date: Mon, 5 Aug 2019 13:46:23 -0500 Message-ID: <20190805184623.19244-1-dannenberg@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Subject: [U-Boot] [PATCH] arm: K3: sysfw-loader: Do not require full printf() for version info X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" A previous commit... commit 2a51e16bd57a ("configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default") ...causes the System Firmware version string during SPL boot to no longer getting printed to the console as expected. To fix this issue rework the handling of that string to only use basic printf() syntax rather than for example disabling CONFIG_USE_TINY_PRINTF on affected devices, this way maintaining most of the memory size benefit the initial patch brings when it comes to SPL. Signed-off-by: Andreas Dannenberg Reviewed-by: Tom Rini --- arch/arm/mach-k3/sysfw-loader.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c index 2ede82004a..7a482bdc8a 100644 --- a/arch/arm/mach-k3/sysfw-loader.c +++ b/arch/arm/mach-k3/sysfw-loader.c @@ -251,10 +251,21 @@ void k3_sysfw_loader(void (*config_pm_done_callback)(void)) if (config_pm_done_callback) config_pm_done_callback(); - /* Output System Firmware version info */ - printf("SYSFW ABI: %d.%d (firmware rev 0x%04x '%.*s')\n", + /* + * Output System Firmware version info. Note that since the + * 'firmware_description' field is not guaranteed to be zero- + * terminated we manually add a \0 terminator if needed. Further + * note that we intentionally no longer rely on the extended + * printf() formatter '%.*s' to not having to require a more + * full-featured printf() implementation. + */ + char fw_desc[sizeof(ti_sci->version.firmware_description) + 1]; + + strncpy(fw_desc, ti_sci->version.firmware_description, + sizeof(ti_sci->version.firmware_description)); + fw_desc[sizeof(fw_desc) - 1] = '\0'; + + printf("SYSFW ABI: %d.%d (firmware rev 0x%04x '%s')\n", ti_sci->version.abi_major, ti_sci->version.abi_minor, - ti_sci->version.firmware_revision, - sizeof(ti_sci->version.firmware_description), - ti_sci->version.firmware_description); + ti_sci->version.firmware_revision, fw_desc); }