public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org
Cc: leif.lindholm@linaro.org, alan@softiron.co.uk,
	marc.zyngier@arm.com, Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH edk2-platforms 2/4] Platform/AMD/OverdriveBoard: cover secure firmware in capsule update
Date: Thu,  1 Feb 2018 16:10:06 +0000	[thread overview]
Message-ID: <20180201161008.4037-3-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20180201161008.4037-1-ard.biesheuvel@linaro.org>

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(-)

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
-- 
2.11.0



  parent reply	other threads:[~2018-02-01 16:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-01 16:10 [PATCH edk2-platforms 0/4] Platform/Cello, Overdrive: various updates Ard Biesheuvel
2018-02-01 16:10 ` [PATCH edk2-platforms 1/4] Platform/Cello, Overdrive: switch to split SCP and secure AP firmware images Ard Biesheuvel
2018-02-01 16:10 ` Ard Biesheuvel [this message]
2018-02-01 16:10 ` [PATCH edk2-platforms 3/4] Platform/AMD/OverdriveBoard: enable ConsolePrefDxe Ard Biesheuvel
2018-02-01 16:10 ` [PATCH edk2-platforms 4/4] Platform/Cello, Overdrive: set fw vendor PCD from FIRMWARE_VENDOR Ard Biesheuvel
2018-02-01 16:40 ` [PATCH edk2-platforms 0/4] Platform/Cello, Overdrive: various updates Leif Lindholm
2018-02-06  9:57   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180201161008.4037-3-ard.biesheuvel@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox