int cbmem_initialize_id_size(u32 id, u64 size) { struct imd *imd; struct imd imd_backing; const int recovery = 1; cbmem_top_init_once(); imd = imd_init_backing(&imd_backing); imd_handle_init(imd, cbmem_top()); if (imd_recover(imd)) return 1; #if defined(__PRE_RAM__) /* * Lock the imd in romstage on a recovery. The assumption is that * if the imd area was recovered in romstage then S3 resume path * is being taken. */ imd_lockdown(imd); #endif /* Add the specified range first */ if (size) cbmem_add(id, size); /* Complete migration to CBMEM. */ cbmem_run_init_hooks(recovery); /* Recovery successful. */ return 0; }
static void stage_cache_recover(void) { struct imd *imd; void *base; size_t size; imd = imd_get(); stage_cache_external_region(&base, &size); imd_handle_init(imd, (void *)(size + (uintptr_t)base)); if (imd_recover(imd)) printk(BIOS_DEBUG, "Unable to recover external stage cache.\n"); }