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 <jwerner@chromium.org>
Change-Id: I8cf44026accc03c466105d06683027caf1693ff0
Reviewed-on: https://review.coreboot.org/c/coreboot/+/48278
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Julius Werner 2020-12-03 12:41:00 -08:00
parent 88d8e2b74e
commit 0247fcf87b
1 changed files with 10 additions and 1 deletions

View File

@ -52,8 +52,17 @@ cb_err_t cbfs_boot_lookup(const char *name, bool force_ro,
name); name);
return cbfs_boot_lookup(name, true, mdata, rdev); 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; return err;
}
if (rdev_chain(rdev, &cbd->rdev, data_offset, be32toh(mdata->h.len))) if (rdev_chain(rdev, &cbd->rdev, data_offset, be32toh(mdata->h.len)))
return CB_ERR; return CB_ERR;