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

Function dump_flashrom_layout

util/ifdtool/ifdtool.c:479–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

477}
478
479static void dump_flashrom_layout(char *image, int size, const char *layout_fname)
480{
481 const struct frba *frba = find_frba(image, size);
482 if (!frba)
483 exit(EXIT_FAILURE);
484
485 int layout_fd = open(layout_fname, O_WRONLY | O_CREAT | O_TRUNC, 0644);
486 if (layout_fd == -1) {
487 perror("Could not open file");
488 exit(EXIT_FAILURE);
489 }
490
491 for (unsigned int i = 0; i < max_regions; i++) {
492 struct region region = get_region(frba, i);
493
494 /* A region limit of 0 is an indicator of an unused region
495 * A region base of 7FFFh is an indicator of a reserved region
496 */
497 if (region.limit == 0 || region.base == 0x07FFF000)
498 continue;
499
500 char buf[LAYOUT_LINELEN];
501 snprintf(buf, LAYOUT_LINELEN, "%08x:%08x %s\n", region.base, region.limit, region_names[i].terse);
502 if (write(layout_fd, buf, strlen(buf)) < 0) {
503 perror("Could not write to file");
504 exit(EXIT_FAILURE);
505 }
506 }
507 close(layout_fd);
508 printf("Wrote layout to %s\n", layout_fname);
509}
510
511static void _decode_spi_frequency(unsigned int freq)
512{

Callers 1

mainFunction · 0.85

Calls 8

find_frbaFunction · 0.85
exitFunction · 0.85
perrorFunction · 0.85
get_regionFunction · 0.85
writeFunction · 0.85
strlenFunction · 0.85
printfFunction · 0.85
snprintfFunction · 0.50

Tested by

no test coverage detected