MCPcopy Create free account
hub / github.com/coreboot/coreboot / fmap_add_cbmem_cache

Function fmap_add_cbmem_cache

src/lib/fmap.c:299–320  ·  view source on GitHub ↗

* The main reason to copy the FMAP into CBMEM is to make it available to the * OS on every architecture. As side effect use the CBMEM copy as cache. */

Source from the content-addressed store, hash-verified

297 * OS on every architecture. As side effect use the CBMEM copy as cache.
298 */
299static void fmap_add_cbmem_cache(void)
300{
301 struct region_device fmrd;
302
303 if (find_fmap_directory(&fmrd))
304 return;
305
306 /* Reloads the FMAP even on ACPI S3 resume */
307 const size_t s = region_device_sz(&fmrd);
308 struct fmap *fmap = cbmem_add(CBMEM_ID_FMAP, s);
309 if (!fmap) {
310 printk(BIOS_ERR, "Failed to allocate CBMEM\n");
311 return;
312 }
313
314 const ssize_t ret = rdev_readat(&fmrd, fmap, 0, s);
315 if (ret != s) {
316 printk(BIOS_ERR, "Failed to read FMAP into CBMEM\n");
317 cbmem_entry_remove(cbmem_entry_find(CBMEM_ID_FMAP));
318 return;
319 }
320}
321
322static void fmap_setup_cbmem_cache(int unused)
323{

Callers 1

fmap_setup_cbmem_cacheFunction · 0.85

Calls 7

find_fmap_directoryFunction · 0.85
region_device_szFunction · 0.85
rdev_readatFunction · 0.85
cbmem_entry_removeFunction · 0.85
cbmem_entry_findFunction · 0.85
cbmem_addFunction · 0.70
printkFunction · 0.50

Tested by

no test coverage detected