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>
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index 5df1d8b..d275505 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -52,8 +52,17 @@
 		       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;