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/+/84579?usp=email
to review the following change.
Change subject: amdfwtool: Add injection corruption to call if necessary ......................................................................
amdfwtool: Add injection corruption to call if necessary
Change-Id: I5be9456ad8b76c1b6b3975248ea18306acfa3e99 Signed-off-by: Zheng Bao fishbaozi@gmail.com --- M util/amdfwtool/amdfwtool.c 1 file changed, 28 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/79/84579/1
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 41214a0..ce164bc 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -1017,6 +1017,9 @@
if (cb_config->debug) check_ab_recovery(ctx->pspdir2, ctx->pspdir2_b); + /* Inject corruption to PSP L2A header, Entry=0x48, Level=2 */ + if (0) + *(uint8_t *)pspdir2 = 0xFF;
copy_psp_header(ctx->pspdir_bak, ctx->pspdir); } else if (pspdir2 != NULL) { @@ -1182,6 +1185,14 @@ pspdir->entries[count].addr = RUN_CURRENT(*ctx); pspdir->entries[count].address_mode = SET_ADDR_MODE_BY_TABLE(pspdir); + + if (0) + /* Inject corrption to SMU. EntryId=8, level=2 */ + if (fw_table[i].type == AMD_FW_PSP_SMU_FIRMWARE && + ctx->pspdir2 != NULL && + ctx->pspdir2_b == NULL) + *(uint8_t *)BUFF_CURRENT(*ctx) = 0xFF; + adjust_current_pointer(ctx, bytes, BLOB_ALIGNMENT); }
@@ -1342,6 +1353,9 @@ TABLE_L2_SIZE_MAX); if (cb_config->debug) check_ab_recovery(ctx->biosdir2, ctx->biosdir2_b); + /* Inject corrption to BIOS table header. TypeId=0x49, level=2 */ + if (0) + *(uint8_t *)ctx->biosdir2 = 0xFF; } } else if (ctx->biosdir2) { current_table_save = ctx->current_table; @@ -1549,6 +1563,14 @@ exit(1); }
+ /* Inject corrption to x86 reset vector, EntryId=0x62, level=2 */ + if (0) + if (ctx->biosdir2 != NULL && ctx->biosdir2_b == NULL) { + *((uint32_t *)BUFF_CURRENT(*ctx) + 0x100/4) = 0xFFFFFFFF; + *((uint32_t *)BUFF_CURRENT(*ctx) + 0x104/4) = 0xFFFFFFFF; + *((uint32_t *)BUFF_CURRENT(*ctx) + 0x108/4) = 0xFFFFFFFF; + *((uint32_t *)BUFF_CURRENT(*ctx) + 0x10C/4) = 0xFFFFFFFF; + } biosdir->entries[count].source = RUN_CURRENT_MODE(*ctx, AMD_ADDR_REL_TAB); biosdir->entries[count].address_mode = @@ -1575,6 +1597,12 @@ biosdir->entries[count].size = (uint32_t)bytes; biosdir->entries[count].source = RUN_CURRENT(*ctx); biosdir->entries[count].address_mode = SET_ADDR_MODE_BY_TABLE(biosdir); + /* Inject corrption to APCB. It can not boot based on test. */ + if (0) + if (fw_table[i].type == AMD_BIOS_APCB && + ctx->biosdir2 != NULL && + ctx->biosdir2_b == NULL) + *(uint8_t *)BUFF_CURRENT(*ctx) = 0xFF;
adjust_current_pointer(ctx, bytes, 0x100U); if (fw_table[i].type == AMD_BIOS_APCB && !cb_config->have_apcb_bk) {