diff mbox series

[edk2,edk2-platforms,2/4] Platform/AMD/OverdriveBoard: cover secure firmware in capsule update

Message ID 20180201161008.4037-3-ard.biesheuvel@linaro.org
State New
Headers show
Series Platform/Cello, Overdrive: various updates | expand

Commit Message

Ard Biesheuvel Feb. 1, 2018, 4:10 p.m. UTC
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>

---
 Platform/AMD/OverdriveBoard/OverdriveBoard.fdf                                        |  3 ++-
 Platform/AMD/OverdriveBoard/SystemFirmwareUpdateConfig/SystemFirmwareUpdateConfig.ini |  4 ++--
 Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c      | 12 ++++--------
 Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.inf    |  3 +--
 4 files changed, 9 insertions(+), 13 deletions(-)

-- 
2.11.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf b/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf
index 54f209571f0e..8ceee9552765 100644
--- a/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf
+++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf
@@ -343,7 +343,7 @@  [FV.SystemFirmwareUpdateCargo]
 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
@@ -353,6 +353,7 @@  [FV.SystemFirmwareUpdateCargo]
   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 c89e95f60fba..49b6480b4ed0 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 a23500dd35dc..a94373bb4b53 100644
--- a/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c
+++ b/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;
   }
 
diff --git a/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.inf b/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.inf
index 411173f1f3c5..b54a2e90ff02 100644
--- a/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.inf
+++ b/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.inf
@@ -40,8 +40,7 @@  [Protocols]
 
 [FixedPcd]
   gArmTokenSpaceGuid.PcdFdBaseAddress
-  gArmTokenSpaceGuid.PcdFvBaseAddress
-  gArmTokenSpaceGuid.PcdFvSize
+  gArmTokenSpaceGuid.PcdFdSize
 
 [Depex]
   gAmdIscpDxeProtocolGuid