From 0247fcf87b8574b8b9ecd1f49d5b7f4087384c83 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Thu, 3 Dec 2020 12:41:00 -0800 Subject: cbfs: Add more error messages for lookup The new CBFS stack will log messages for found files but leaves error messages up to the caller. This patch adds appropriate generic error messages to cbfs_lookup(), matching the behavior of the old CBFS stack for not found files. Signed-off-by: Julius Werner Change-Id: I8cf44026accc03c466105d06683027caf1693ff0 Reviewed-on: https://review.coreboot.org/c/coreboot/+/48278 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/lib/cbfs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c index 5df1d8bd85..d27550576a 100644 --- a/src/lib/cbfs.c +++ b/src/lib/cbfs.c @@ -52,8 +52,17 @@ cb_err_t cbfs_boot_lookup(const char *name, bool force_ro, name); return cbfs_boot_lookup(name, true, mdata, rdev); } - if (err) + if (err) { + if (err == CB_CBFS_NOT_FOUND) + printk(BIOS_WARNING, "CBFS: '%s' not found.\n", name); + else if (err == CB_CBFS_HASH_MISMATCH) + printk(BIOS_ERR, "CBFS ERROR: metadata hash mismatch!\n"); + else + printk(BIOS_ERR, + "CBFS ERROR: error %d when looking up '%s'\n", + err, name); return err; + } if (rdev_chain(rdev, &cbd->rdev, data_offset, be32toh(mdata->h.len))) return CB_ERR; -- cgit v1.2.3