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

Function fmap_locate_area

src/lib/fmap.c:171–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171int fmap_locate_area(const char *name, struct region *ar)
172{
173 struct region_device fmrd;
174 size_t offset;
175
176 if (name == NULL || ar == NULL)
177 return -1;
178
179 if (find_fmap_directory(&fmrd))
180 return -1;
181
182 /* Start reading the areas just after fmap header. */
183 offset = sizeof(struct fmap);
184
185 while (1) {
186 struct fmap_area *area;
187
188 area = rdev_mmap(&fmrd, offset, sizeof(*area));
189
190 if (area == NULL)
191 return -1;
192
193 if (strcmp((const char *)area->name, name)) {
194 rdev_munmap(&fmrd, area);
195 offset += sizeof(struct fmap_area);
196 continue;
197 }
198
199 printk(BIOS_DEBUG, "FMAP: area %s found @ %x (%d bytes)\n",
200 name, le32toh(area->offset), le32toh(area->size));
201
202 *ar = region_create(le32toh(area->offset), le32toh(area->size));
203
204 rdev_munmap(&fmrd, area);
205
206 return 0;
207 }
208
209 printk(BIOS_DEBUG, "FMAP: area %s not found\n", name);
210
211 return -1;
212}
213
214int fmap_find_region_name(const struct region * const ar,
215 char name[FMAP_STRLEN])

Callers 15

fmap_locate_area_as_rdevFunction · 0.70
protect_ro_rgn_spi_flashFunction · 0.50
mainboard_print_infoFunction · 0.50
synchronize_regionFunction · 0.50
erase_regionFunction · 0.50
lookup_store_regionFunction · 0.50
lookup_region_by_nameFunction · 0.50
update_boot_regionFunction · 0.50
kti_cache_loadFunction · 0.50
kti_cache_protectFunction · 0.50

Calls 6

find_fmap_directoryFunction · 0.85
rdev_mmapFunction · 0.85
rdev_munmapFunction · 0.85
region_createFunction · 0.85
strcmpFunction · 0.70
printkFunction · 0.50

Tested by 2

test_fmap_locate_areaFunction · 0.40