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

Function find_fmap_directory

src/lib/fmap.c:111–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111static int find_fmap_directory(struct region_device *fmrd)
112{
113 const struct region_device *boot;
114 struct fmap *fmap;
115 size_t offset = FMAP_OFFSET;
116
117 /* Try FMAP cache first */
118 if (!region_device_sz(&fmap_cache))
119 setup_preram_cache(&fmap_cache);
120 if (region_device_sz(&fmap_cache))
121 return rdev_chain_full(fmrd, &fmap_cache);
122
123 /* Cache setup in pre-RAM stages can't fail, unless flash I/O in general failed. */
124 if (!CONFIG(NO_FMAP_CACHE) && ENV_ROMSTAGE_OR_BEFORE)
125 return -1;
126
127 boot_device_init();
128 boot = boot_device_ro();
129
130 if (boot == NULL)
131 return -1;
132
133 fmap = rdev_mmap(boot, offset,
134 CONFIG(CBFS_VERIFICATION) ? FMAP_SIZE : sizeof(struct fmap));
135
136 if (fmap == NULL)
137 return -1;
138
139 if (verify_fmap(fmap)) {
140 rdev_munmap(boot, fmap);
141 return -1;
142 }
143
144 report(fmap);
145
146 rdev_munmap(boot, fmap);
147
148 return rdev_chain(fmrd, boot, offset, FMAP_SIZE);
149}
150
151int fmap_locate_area_as_rdev(const char *name, struct region_device *area)
152{

Callers 3

fmap_locate_areaFunction · 0.85
fmap_find_region_nameFunction · 0.85
fmap_add_cbmem_cacheFunction · 0.85

Calls 10

region_device_szFunction · 0.85
setup_preram_cacheFunction · 0.85
rdev_chain_fullFunction · 0.85
rdev_mmapFunction · 0.85
verify_fmapFunction · 0.85
rdev_munmapFunction · 0.85
reportFunction · 0.85
rdev_chainFunction · 0.85
boot_device_initFunction · 0.70
boot_device_roFunction · 0.50

Tested by

no test coverage detected