aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ext_stage_cache.c
diff options
context:
space:
mode:
authorMarshall Dawson <marshalldawson3rd@gmail.com>2018-01-30 15:54:52 -0700
committerMartin Roth <martinroth@google.com>2018-02-01 17:20:39 +0000
commit0876caa4736fe97bf6586d19ab9c3e2ea29408f7 (patch)
treecfb8100b169f77872be8ff81788245fa013a2596 /src/lib/ext_stage_cache.c
parent8cc5fdec904352ee2e474d1b0ba6f44ba2192ce6 (diff)
lib/stage_cache: Add debug messages for failures
Communicate additional status to the console when the save and load functions do not function as expected. The most likely scenario for an error is when using a cache that is external to cbmem, and restricted in size. Change-Id: Ic9a709c11152b3b9cb40abfc204151f9636b5a4c Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com> Reviewed-on: https://review.coreboot.org/23517 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/lib/ext_stage_cache.c')
-rw-r--r--src/lib/ext_stage_cache.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/lib/ext_stage_cache.c b/src/lib/ext_stage_cache.c
index 2a991889f4..cea9f52625 100644
--- a/src/lib/ext_stage_cache.c
+++ b/src/lib/ext_stage_cache.c
@@ -68,8 +68,11 @@ void stage_cache_add(int stage_id, const struct prog *stage)
imd = imd_get();
e = imd_entry_add(imd, CBMEM_ID_STAGEx_META + stage_id, sizeof(*meta));
- if (e == NULL)
+ if (e == NULL) {
+ printk(BIOS_DEBUG, "Error: Can't add %x metadata to imd\n",
+ CBMEM_ID_STAGEx_META + stage_id);
return;
+ }
meta = imd_entry_at(imd, e);
@@ -79,8 +82,11 @@ void stage_cache_add(int stage_id, const struct prog *stage)
e = imd_entry_add(imd, CBMEM_ID_STAGEx_CACHE + stage_id,
prog_size(stage));
- if (e == NULL)
+ if (e == NULL) {
+ printk(BIOS_DEBUG, "Error: Can't add stage_cache %x to imd\n",
+ CBMEM_ID_STAGEx_CACHE + stage_id);
return;
+ }
c = imd_entry_at(imd, e);
@@ -97,15 +103,21 @@ void stage_cache_load_stage(int stage_id, struct prog *stage)
imd = imd_get();
e = imd_entry_find(imd, CBMEM_ID_STAGEx_META + stage_id);
- if (e == NULL)
+ if (e == NULL) {
+ printk(BIOS_DEBUG, "Error: Can't find %x metadata in imd\n",
+ CBMEM_ID_STAGEx_META + stage_id);
return;
+ }
meta = imd_entry_at(imd, e);
e = imd_entry_find(imd, CBMEM_ID_STAGEx_CACHE + stage_id);
- if (e == NULL)
+ if (e == NULL) {
+ printk(BIOS_DEBUG, "Error: Can't find stage_cache %x in imd\n",
+ CBMEM_ID_STAGEx_CACHE + stage_id);
return;
+ }
c = imd_entry_at(imd, e);
size = imd_entry_size(imd, e);