mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: mfe@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/3] ARM: layerscape: add helpful runtime warning when firmware is missing
Date: Fri,  3 May 2024 12:32:29 +0200	[thread overview]
Message-ID: <20240503103230.1367842-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240503103230.1367842-1-a.fatoum@pengutronix.de>

Firmware compiled into barebox PBL is rarely optional, so even if
CONFIG_MISSING_FIRMWARE_ERROR is disabled, barebox will not generate
images with missing PBL firmware.

We can relax this for firmware compiled into barebox proper though: If
the user disables CONFIG_MISSING_FIRMWARE_ERROR, just have the driver
fail at runtime as not to break other boards in the same build that
don't require the firmware.

Missing barebox proper firmware will be detectable as a 0-byte firmware
blob in the follow-up commit, so prepare for that by printing an
informative error message.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-layerscape/ppa.c | 4 ++++
 drivers/net/fsl-fman.c         | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/arch/arm/mach-layerscape/ppa.c b/arch/arm/mach-layerscape/ppa.c
index 21efaae3ab32..99b76b4c30d7 100644
--- a/arch/arm/mach-layerscape/ppa.c
+++ b/arch/arm/mach-layerscape/ppa.c
@@ -121,6 +121,10 @@ int ls1046a_ppa_init(resource_size_t ppa_start, resource_size_t ppa_size)
 	}
 
 	get_builtin_firmware(ppa_ls1046a_bin, &ppa_fw, &ppa_fw_size);
+	if (!ppa_fw_size) {
+		pr_err("PPA Firmware was not included in build\n");
+		return -ENOSYS;
+	}
 
 	if (el == 3) {
 		unsigned long cr;
diff --git a/drivers/net/fsl-fman.c b/drivers/net/fsl-fman.c
index 5528ecccc950..98af3dafb44a 100644
--- a/drivers/net/fsl-fman.c
+++ b/drivers/net/fsl-fman.c
@@ -213,6 +213,10 @@ static int fman_upload_firmware(struct device *dev, struct fm_imem *fm_imem)
 	const struct qe_firmware *firmware;
 
 	get_builtin_firmware(fsl_fman_ucode_ls1046_r1_0_106_4_18_bin, &firmware, &size);
+	if (!size) {
+		dev_err(dev, "FMan Firmware was not included in build\n");
+		return -ENOSYS;
+	}
 
 	ret = qe_validate_firmware(firmware, size);
 	if (ret)
-- 
2.39.2




  reply	other threads:[~2024-05-03 10:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-03 10:32 [PATCH 1/3] firmware: support optional firmware in barebox proper Ahmad Fatoum
2024-05-03 10:32 ` Ahmad Fatoum [this message]
2024-05-06  6:33   ` [PATCH 2/3] ARM: layerscape: add helpful runtime warning when firmware is missing Sascha Hauer
2024-05-03 10:32 ` [PATCH 3/3] ci: test: remove generation of dummy firmware Ahmad Fatoum
2024-05-06  6:32 ` [PATCH 1/3] firmware: support optional firmware in barebox proper Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240503103230.1367842-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=mfe@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox