Browse Source

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 <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Ard Biesheuvel 6 years ago
parent
commit
7adc148590

+ 2 - 1
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

+ 2 - 2
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

+ 4 - 8
Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c

@@ -22,9 +22,7 @@
 
 #include <Protocol/AmdIscpDxeProtocol.h>
 
-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;
   }
 

+ 1 - 2
Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.inf

@@ -40,8 +40,7 @@
 
 [FixedPcd]
   gArmTokenSpaceGuid.PcdFdBaseAddress
-  gArmTokenSpaceGuid.PcdFvBaseAddress
-  gArmTokenSpaceGuid.PcdFvSize
+  gArmTokenSpaceGuid.PcdFdSize
 
 [Depex]
   gAmdIscpDxeProtocolGuid