| 543 | } |
| 544 | |
| 545 | static 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 | |
| 572 | static unsigned int convert_addr_space(const struct buffer *region, unsigned int addr) |
| 573 | { |
no test coverage detected