From 7adc148590263ffe614d3e5bbb139323122bdc0b Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Sat, 27 Jan 2018 10:16:18 +0000 Subject: Platform/AMD/OverdriveBoard: cover secure firmware in capsule update Add the first part of the flash device (FD) to the capsule image so we can update the secure and SCP firmware in one go along with the UEFI firmware volume (FV). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- Platform/AMD/OverdriveBoard/OverdriveBoard.fdf | 3 ++- .../SystemFirmwareUpdateConfig.ini | 4 ++-- .../StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c | 12 ++++-------- .../StyxPlatformFlashAccessLib.inf | 3 +-- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf b/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf index eae869ff9a..326e6d68d8 100644 --- a/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf +++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf @@ -340,7 +340,7 @@ READ_LOCK_CAP = TRUE READ_LOCK_STATUS = TRUE FILE RAW = 642e4fcf-2df7-4415-8b70-a03909c57b55 { # PcdEdkiiSystemFirmwareFileGuid - FV = STYX_EFI + FD = STYX_ROM } FILE RAW = ce57b167-b0e4-41e8-a897-5f4feb781d40 { # gEdkiiSystemFmpCapsuleDriverFvFileGuid @@ -350,6 +350,7 @@ READ_LOCK_STATUS = TRUE FILE RAW = 812136D3-4D3A-433A-9418-29BB9BF78F6E { # gEdkiiSystemFmpCapsuleConfigFileGuid Platform/AMD/OverdriveBoard/SystemFirmwareUpdateConfig/SystemFirmwareUpdateConfig.ini } + INF RuleOverride = FMP_IMAGE_DESC Platform/AMD/OverdriveBoard/SystemFirmwareDescriptor/SystemFirmwareDescriptor.inf [FmpPayload.FmpPayloadSystemFirmwarePkcs7] IMAGE_HEADER_INIT_VERSION = 0x02 diff --git a/Platform/AMD/OverdriveBoard/SystemFirmwareUpdateConfig/SystemFirmwareUpdateConfig.ini b/Platform/AMD/OverdriveBoard/SystemFirmwareUpdateConfig/SystemFirmwareUpdateConfig.ini index c89e95f60f..49b6480b4e 100644 --- a/Platform/AMD/OverdriveBoard/SystemFirmwareUpdateConfig/SystemFirmwareUpdateConfig.ini +++ b/Platform/AMD/OverdriveBoard/SystemFirmwareUpdateConfig/SystemFirmwareUpdateConfig.ini @@ -19,7 +19,7 @@ Update0 = StyxFvMain [StyxFvMain] FirmwareType = 0 # SystemFirmware AddressType = 0 # 0 - relative address, 1 - absolute address. -BaseAddress = 0x00200000 # Base address offset on flash -Length = 0x00260000 # Length +BaseAddress = 0x00000000 # Base address offset on flash +Length = 0x00460000 # Length ImageOffset = 0x00000000 # Image offset of this SystemFirmware image FileGuid = 642e4fcf-2df7-4415-8b70-a03909c57b55 # PcdEdkiiSystemFirmwareFileGuid diff --git a/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c b/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c index a23500dd35..a94373bb4b 100644 --- a/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c +++ b/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c @@ -22,9 +22,7 @@ #include -STATIC CONST UINT64 mFlashOffset = FixedPcdGet64 (PcdFvBaseAddress) - - FixedPcdGet64 (PcdFdBaseAddress); -STATIC CONST UINT64 mFlashMaxSize = FixedPcdGet64 (PcdFvSize); +STATIC CONST UINT64 mFlashMaxSize = FixedPcdGet64 (PcdFdSize); STATIC CONST UINTN mBlockSize = SIZE_64KB; @@ -77,12 +75,10 @@ PerformFlashWrite ( return EFI_INVALID_PARAMETER; } - if (FlashAddress < mFlashOffset || - (FlashAddress + Length) > (mFlashOffset + mFlashMaxSize)) { + if ((FlashAddress + Length) > mFlashMaxSize) { DEBUG ((DEBUG_ERROR, - "%a: updated region [0x%lx, 0x%lx) outside of FV region [0x%lx, 0x%lx)\n", - __FUNCTION__, FlashAddress, FlashAddress + Length, mFlashOffset, - mFlashOffset + mFlashMaxSize)); + "%a: updated region [0x%lx, 0x%lx) outside of FV region [0x0, 0x%lx)\n", + __FUNCTION__, FlashAddress, FlashAddress + Length, mFlashMaxSize)); return EFI_INVALID_PARAMETER; } diff --git a/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.inf b/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.inf index 411173f1f3..b54a2e90ff 100644 --- a/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.inf +++ b/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.inf @@ -40,8 +40,7 @@ [FixedPcd] gArmTokenSpaceGuid.PcdFdBaseAddress - gArmTokenSpaceGuid.PcdFvBaseAddress - gArmTokenSpaceGuid.PcdFvSize + gArmTokenSpaceGuid.PcdFdSize [Depex] gAmdIscpDxeProtocolGuid -- cgit v1.2.3