summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Roth <martinroth@chromium.org>2020-07-29 16:32:25 -0600
committerAaron Durbin <adurbin@chromium.org>2020-08-21 18:46:58 +0000
commit48dd9fe21fb0ad8a27e8a76e65c014c48a667258 (patch)
treee0d2a2f36d30e25cba28eb793b11f2f56d5d9fcb
parentdff9994b96fd61253f83edb568e7ced21e1bd24e (diff)
util/amdfwtool: Refactor APOB_NV requirements
amdfwtool currently assumes that we MUST have an apob_nv area if we have an aopb. This is not required, so if neither the apob_nv size or base are specified, just move on. BUG=b:158363448 TEST=Build an image with no APOB_NV region. Dump regions to show that it's not there. Signed-off-by: Martin Roth <martinroth@chromium.org> Change-Id: Ibaeacd3dcdfd73f690df61c2a19d39bbb9dcc838 Reviewed-on: https://review.coreboot.org/c/coreboot/+/44045 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--util/amdfwtool/amdfwtool.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c
index 14ffdb3d88..499a1bd29c 100644
--- a/util/amdfwtool/amdfwtool.c
+++ b/util/amdfwtool/amdfwtool.c
@@ -918,26 +918,19 @@ static void integrate_bios_firmwares(context *ctx,
/* BIOS Directory items may have additional requirements */
- /* APOB_NV must have a size if it has a source */
- if (fw_table[i].type == AMD_BIOS_APOB_NV && fw_table[i].src) {
- if (!fw_table[i].size) {
+ /* Check APOB_NV requirements */
+ if (fw_table[i].type == AMD_BIOS_APOB_NV) {
+ if (!fw_table[i].size && !fw_table[i].src)
+ continue; /* APOB_NV not used */
+ if (fw_table[i].src && !fw_table[i].size) {
printf("Error: APOB NV address provided, but no size\n");
free(ctx->rom);
exit(1);
}
- }
- /* APOB_NV needs a size, else no choice but to skip the item */
- if (fw_table[i].type == AMD_BIOS_APOB_NV && !fw_table[i].size) {
- /* Attempt to determine whether this is an error */
+ /* If the APOB isn't used, APOB_NV isn't used either */
apob_idx = find_bios_entry(AMD_BIOS_APOB);
- if (apob_idx < 0 || !fw_table[apob_idx].dest) {
- /* APOV NV not expected to be used */
- continue;
- } else {
- printf("Error: APOB NV must have a size\n");
- free(ctx->rom);
- exit(1);
- }
+ if (apob_idx < 0 || !fw_table[apob_idx].dest)
+ continue; /* APOV NV not supported */
}
/* APOB_DATA needs destination */