Attention is currently required from: Zheng Bao.
Hello Zheng Bao,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/69856
to review the following change.
Change subject: amdfwtool: Allow the location to be a relative address ......................................................................
amdfwtool: Allow the location to be a relative address
When the BIOS size is more than 32M, the physical address of EFS header will be complicated, like 0xfe020000 or 0xfc020000. So we make it simpler to allow to use relative address.
Change-Id: I4308ec9ea05a87329aba0b409508c79ebf42325c Signed-off-by: Zheng Bao fishbaozi@gmail.com --- M util/amdfwtool/amdfwtool.c 1 file changed, 27 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/56/69856/1
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 5a4c034..1d98e68 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -2344,10 +2344,6 @@ printf(" AMDFWTOOL Using ROM size of %dKB\n", ctx.rom_size / 1024);
rom_base_address = 0xFFFFFFFF - ctx.rom_size + 1; - if (dir_location && (dir_location < rom_base_address)) { - fprintf(stderr, "Error: Directory location outside of ROM.\n\n"); - return 1; - }
if (any_location) { if (dir_location & 0x3f) { @@ -2357,18 +2353,29 @@ } } else { switch (dir_location) { - case 0: /* Fall through */ case 0xFFFA0000: /* Fall through */ case 0xFFF20000: /* Fall through */ case 0xFFE20000: /* Fall through */ case 0xFFC20000: /* Fall through */ case 0xFF820000: /* Fall through */ case 0xFF020000: /* Fall through */ + /* Physical address. */ + dir_location = dir_location - rom_base_address; + break; + case 0xFA0000: /* Fall through */ + case 0xF20000: /* Fall through */ + case 0xE20000: /* Fall through */ + case 0xC20000: /* Fall through */ + case 0x820000: /* Fall through */ + case 0x020000: /* Fall through */ + /* Relative address. */ break; default: fprintf(stderr, "Error: Invalid Directory location.\n"); fprintf(stderr, " Valid locations are 0xFFFA0000, 0xFFF20000,\n"); fprintf(stderr, " 0xFFE20000, 0xFFC20000, 0xFF820000, 0xFF020000\n"); + fprintf(stderr, " 0xFA0000, 0xF20000, 0xE20000, 0xC20000,\n"); + fprintf(stderr, " 0x820000, 0x020000\n"); return 1; } } @@ -2380,7 +2387,7 @@ memset(ctx.rom, 0xFF, ctx.rom_size);
if (dir_location) - romsig_offset = ctx.current = dir_location - rom_base_address; + romsig_offset = ctx.current = dir_location; else romsig_offset = ctx.current = AMD_ROMSIG_OFFSET;