soc/amd/mendocino: Split the EFS from the AMDFW body

Contents of unsigned AMDFW in RW sections are verified twice in PSP
verstage - first time by vboot verifying the firmware body, second time
by CBFS verification while the file is loaded to update PSP about the
boot region. This redundant verification adds to boot time. Minimize the
redundancy by splitting the EFS header from the AMDFW body and keep them
as 2 separate CBFS files. This helps to improve the boot time by another
25 ms.

BUG=None
TEST=Build Skyrim BIOS image and boot to OS. Observe boot time
improvement of ~25ms.
Before:
   6:end of verified boot              363,676 (16)
  11:start of bootblock                641,392 (277,716)
After:
   6:end of verified boot              361,655 (16)
  11:start of bootblock                616,967 (255,312)

Change-Id: Ib18a4f5c6781e5a7868e9395c0f1212da0823100
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70839
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Karthikeyan Ramasubramanian 2022-12-15 14:57:05 -07:00 committed by Martin L Roth
parent ecb4e31531
commit 716c8f0711
2 changed files with 21 additions and 4 deletions

View File

@ -527,7 +527,7 @@ if VBOOT_SLOTS_RW_A && VBOOT_STARTS_BEFORE_BOOTBLOCK
config RWA_REGION_ONLY
string
default "apu/amdfw_a"
default "apu/amdfw_a apu/amdfw_a_body"
help
Add a space-delimited list of filenames that should only be in the
RW-A section.
@ -538,7 +538,7 @@ if VBOOT_SLOTS_RW_AB && VBOOT_STARTS_BEFORE_BOOTBLOCK
config RWB_REGION_ONLY
string
default "apu/amdfw_b"
default "apu/amdfw_b apu/amdfw_b_body"
help
Add a space-delimited list of filenames that should only be in the
RW-B section.

View File

@ -86,6 +86,9 @@ MENDOCINO_FW_A_POSITION=$(call int-add, \
MENDOCINO_FW_B_POSITION=$(call int-add, \
$(shell awk '$$2 == "FMAP_SECTION_FW_MAIN_B_START" {print $$3}' $(obj)/fmap_config.h) \
$(AMD_FW_AB_POSITION))
MENDOCINO_FW_BODY_OFFSET := 0x100
#
# PSP Directory Table items
#
@ -286,6 +289,7 @@ $(obj)/amdfw_a.rom: $(obj)/amdfw.rom
$(OPT_SIGNED_AMDFW_A_POSITION) \
$(OPT_SIGNED_AMDFW_A_FILE) \
--location $(shell printf "%#x" $(MENDOCINO_FW_A_POSITION)) \
--body-location $(shell printf "%#x" $$(($(MENDOCINO_FW_A_POSITION) + $(MENDOCINO_FW_BODY_OFFSET)))) \
--anywhere \
--output $@
@ -300,22 +304,35 @@ $(obj)/amdfw_b.rom: $(obj)/amdfw.rom
$(OPT_SIGNED_AMDFW_B_POSITION) \
$(OPT_SIGNED_AMDFW_B_FILE) \
--location $(shell printf "%#x" $(MENDOCINO_FW_B_POSITION)) \
--body-location $(shell printf "%#x" $$(($(MENDOCINO_FW_B_POSITION) + $(MENDOCINO_FW_BODY_OFFSET)))) \
--anywhere \
--output $@
$(obj)/amdfw_a.rom.efs: $(obj)/amdfw_a.rom
$(obj)/amdfw_b.rom.efs: $(obj)/amdfw_b.rom
ifeq ($(CONFIG_VBOOT_SLOTS_RW_A)$(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),yy)
cbfs-files-y += apu/amdfw_a
apu/amdfw_a-file := $(obj)/amdfw_a.rom
apu/amdfw_a-file := $(obj)/amdfw_a.rom.efs
apu/amdfw_a-position := $(AMD_FW_AB_POSITION)
apu/amdfw_a-type := raw
cbfs-files-y += apu/amdfw_a_body
apu/amdfw_a_body-file := $(obj)/amdfw_a.rom
apu/amdfw_a_body-position := $(call int-add, $(AMD_FW_AB_POSITION) $(MENDOCINO_FW_BODY_OFFSET))
apu/amdfw_a_body-type := raw
endif
ifeq ($(CONFIG_VBOOT_SLOTS_RW_AB)$(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),yy)
cbfs-files-y += apu/amdfw_b
apu/amdfw_b-file := $(obj)/amdfw_b.rom
apu/amdfw_b-file := $(obj)/amdfw_b.rom.efs
apu/amdfw_b-position := $(AMD_FW_AB_POSITION)
apu/amdfw_b-type := raw
cbfs-files-y += apu/amdfw_b_body
apu/amdfw_b_body-file := $(obj)/amdfw_b.rom
apu/amdfw_b_body-position := $(call int-add, $(AMD_FW_AB_POSITION) $(MENDOCINO_FW_BODY_OFFSET))
apu/amdfw_b_body-type := raw
endif
ifeq ($(CONFIG_SEPARATE_SIGNED_PSPFW)$(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),yy)