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

Function load_spd_cache

src/lib/spd_cache.c:95–117  ·  view source on GitHub ↗

* Locate the RW_SPD_CACHE area in the fmap and read SPD_CACHE data. * return CB_SUCCESS ,if the SPD_CACHE data is ready and the pointer return at *spd_cache. * return CB_ERR ,if it cannot locate RW_SPD_CACHE area in the fmap or data cannot be read. */

Source from the content-addressed store, hash-verified

93 * return CB_ERR ,if it cannot locate RW_SPD_CACHE area in the fmap or data cannot be read.
94 */
95enum cb_err load_spd_cache(uint8_t **spd_cache, size_t *spd_cache_sz)
96{
97 struct region_device rdev;
98
99 if (fmap_locate_area_as_rdev(SPD_CACHE_FMAP_NAME, &rdev) < 0) {
100 printk(BIOS_ERR, "SPD_CACHE: Cannot find %s region\n", SPD_CACHE_FMAP_NAME);
101 return CB_ERR;
102 }
103
104 /* Assume boot device is memory mapped. */
105 assert(CONFIG(BOOT_DEVICE_MEMORY_MAPPED));
106 *spd_cache = rdev_mmap_full(&rdev);
107
108 if (*spd_cache == NULL)
109 return CB_ERR;
110
111 *spd_cache_sz = region_device_sz(&rdev);
112
113 /* SPD cache found */
114 printk(BIOS_INFO, "SPD_CACHE: cache found, size 0x%zx\n", *spd_cache_sz);
115
116 return CB_SUCCESS;
117}
118
119/* Use to verify the cache data is valid. */
120bool spd_cache_is_valid(uint8_t *spd_cache, size_t spd_cache_sz)

Calls 4

rdev_mmap_fullFunction · 0.85
region_device_szFunction · 0.85
fmap_locate_area_as_rdevFunction · 0.70
printkFunction · 0.50