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

Function convert_flash_to_host

util/cbfstool/cbfstool.c:545–570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

543}
544
545static unsigned int convert_flash_to_host(const struct buffer *region, unsigned int addr)
546{
547 int idx;
548 const struct region *to, *from;
549
550 /*
551 * region->offset is added because caller provides offset in the given region. This is
552 * converted to an absolute address in the SPI flash space. This is done before the
553 * conversion as opposed to after in convert_host_to_flash() above because the address
554 * is actually an offset within the region. So, it needs to be converted into an
555 * absolute address in the SPI flash space before converting into an address in host
556 * space.
557 */
558 addr += region->offset;
559 idx = find_mmap_window(FLASH_SPACE_ADDR, addr);
560
561 if (idx == -1) {
562 ERROR("SPI flash address(%x) not in any mmap window!\n", addr);
563 return 0;
564 }
565
566 to = &mmap_window_table[idx].host_space;
567 from = &mmap_window_table[idx].flash_space;
568
569 return convert_address(to, from, addr);
570}
571
572static unsigned int convert_addr_space(const struct buffer *region, unsigned int addr)
573{

Callers 1

convert_addr_spaceFunction · 0.85

Calls 2

find_mmap_windowFunction · 0.85
convert_addressFunction · 0.85

Tested by

no test coverage detected