public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Leif Lindholm" <leif@nuviainc.com>
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: [PATCH edk2-platforms 01/15] Silicon/AMD: update Styx to use PcdSet*S APIs
Date: Wed, 25 Nov 2020 12:55:45 +0000	[thread overview]
Message-ID: <20201125125559.11631-2-leif@nuviainc.com> (raw)
In-Reply-To: <20201125125559.11631-1-leif@nuviainc.com>

The non-status reporting PcdSet functions were deprecated and have now
been removed. Update Styx code to assert on error status.

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Leif Lindholm <leif@nuviainc.com>
---
 .../Styx/Drivers/PlatInitPei/PlatInitPei.c    | 11 ++++++----
 .../Library/MemoryInitPei/MemoryInitPeiLib.c  | 20 +++++++++++--------
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c b/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c
index 4de26404a8a7..3f359ffbd2d8 100644
--- a/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c
+++ b/Silicon/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c
@@ -111,7 +111,7 @@ PlatInitPeiEntryPoint (
   IN       CONST EFI_PEI_SERVICES   **PeiServices
   )
 {
-  EFI_STATUS                  Status = EFI_SUCCESS;
+  EFI_STATUS                  Status;
   AMD_MEMORY_RANGE_DESCRIPTOR IscpMemDescriptor = {0};
   ISCP_FUSE_INFO              IscpFuseInfo = {0};
   ISCP_CPU_RESET_INFO         CpuResetInfo = {0};
@@ -124,7 +124,8 @@ PlatInitPeiEntryPoint (
   DEBUG ((EFI_D_ERROR, "PlatInit PEIM Loaded\n"));
 
   // CPUID
-  PcdSet32 (PcdSocCpuId, *CpuIdReg);
+  Status = PcdSet32S (PcdSocCpuId, *CpuIdReg);
+  ASSERT_EFI_ERROR (Status);
   DEBUG ((EFI_D_ERROR, "SocCpuId = 0x%X\n", PcdGet32 (PcdSocCpuId)));
 
   // Update core count based on PCD option
@@ -186,7 +187,8 @@ PlatInitPeiEntryPoint (
 
   // Update SocCoreCount on Dynamic PCD
   if (PcdGet32 (PcdSocCoreCount) != mAmdCoreCount) {
-    PcdSet32 (PcdSocCoreCount, mAmdCoreCount);
+    Status = PcdSet32S (PcdSocCoreCount, mAmdCoreCount);
+    ASSERT_EFI_ERROR (Status);
   }
 
   DEBUG ((EFI_D_ERROR, "SocCoreCount = %d\n", PcdGet32 (PcdSocCoreCount)));
@@ -201,7 +203,8 @@ PlatInitPeiEntryPoint (
 
   // Update SystemMemorySize on Dynamic PCD
   if (IscpMemDescriptor.Size0) {
-    PcdSet64 (PcdSystemMemorySize, IscpMemDescriptor.Size0);
+    Status = PcdSet64S (PcdSystemMemorySize, IscpMemDescriptor.Size0);
+    ASSERT_EFI_ERROR (Status);
   }
   if (IscpMemDescriptor.Size0 == 0) {
     DEBUG ((EFI_D_ERROR, "Warning: Could not get SystemMemorySize via ISCP, using default value.\n"));
diff --git a/Silicon/AMD/Styx/Library/MemoryInitPei/MemoryInitPeiLib.c b/Silicon/AMD/Styx/Library/MemoryInitPei/MemoryInitPeiLib.c
index 0cbd960f30fb..c047d7444620 100644
--- a/Silicon/AMD/Styx/Library/MemoryInitPei/MemoryInitPeiLib.c
+++ b/Silicon/AMD/Styx/Library/MemoryInitPei/MemoryInitPeiLib.c
@@ -55,8 +55,9 @@ MoveNvStoreImage (
   VOID
   )
 {
-  VOID      *OldBase, *NewBase;
-  UINTN     Size;
+  VOID        *OldBase, *NewBase;
+  UINTN       Size;
+  EFI_STATUS  Status;
 
   //
   // Move the in-memory image of the NV store firmware volume to a dynamically
@@ -77,14 +78,17 @@ MoveNvStoreImage (
   DEBUG ((EFI_D_INFO, "%a: Relocating NV store FV from %p to %p\n",
     __FUNCTION__, OldBase, NewBase));
 
-  PcdSet64 (PcdFlashNvStorageVariableBase64, (UINT64)NewBase);
+  Status = PcdSet64S (PcdFlashNvStorageVariableBase64, (UINT64)NewBase);
+  ASSERT_EFI_ERROR (Status);
 
-  PcdSet64 (PcdFlashNvStorageFtwWorkingBase64, (UINT64)NewBase +
-    FixedPcdGet32 (PcdFlashNvStorageVariableSize));
+  Status = PcdSet64S (PcdFlashNvStorageFtwWorkingBase64,
+             (UINT64)NewBase + FixedPcdGet32 (PcdFlashNvStorageVariableSize));
+  ASSERT_EFI_ERROR (Status);
 
-  PcdSet64 (PcdFlashNvStorageFtwSpareBase64, (UINT64)NewBase +
-    FixedPcdGet32 (PcdFlashNvStorageVariableSize) +
-    FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize));
+  Status = PcdSet64S (PcdFlashNvStorageFtwSpareBase64, (UINT64)NewBase +
+             FixedPcdGet32 (PcdFlashNvStorageVariableSize) +
+             FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize));
+  ASSERT_EFI_ERROR (Status);
 }
 
 /*++
-- 
2.20.1


  reply	other threads:[~2020-11-25 12:56 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25 12:55 [PATCH edk2-platforms 00/15] arm platform fixes triggered by VariablePolicy Leif Lindholm
2020-11-25 12:55 ` Leif Lindholm [this message]
2020-11-25 12:55 ` [PATCH edk2-platforms 02/15] Platform/AMD: add RngLib for Overdriveboard Leif Lindholm
2020-11-25 13:09   ` Ard Biesheuvel
2020-11-25 13:20     ` Leif Lindholm
2020-11-25 13:22       ` Ard Biesheuvel
2020-11-25 12:55 ` [PATCH edk2-platforms 03/15] Platform,Silicon: fix beagleboard tautological compares Leif Lindholm
2020-11-25 12:55 ` [PATCH edk2-platforms 04/15] Silicon/Hisilicon: add RngLib for Hisilicon Leif Lindholm
2020-11-25 13:12   ` Leif Lindholm
2020-11-25 12:55 ` [PATCH edk2-platforms 05/15] Platform/ARM: VExpressPkg fixes to work with new VariablePolicyLib Leif Lindholm
2020-11-25 12:55 ` [PATCH edk2-platforms 06/15] Platform/AMD: add VariablePolicy library resolutions for Overdrive Leif Lindholm
2020-11-25 12:55 ` [PATCH edk2-platforms 07/15] Platform/SoftIron: add VariablePolicy resolutions for Overdrive1000 Leif Lindholm
2020-11-25 12:55 ` [PATCH edk2-platforms 08/15] Platform/LeMaker: add VariablePolicy resolutions for cello Leif Lindholm
2020-11-25 12:55 ` [PATCH edk2-platforms 09/15] Platform/SiFive: add VariablePolicy resolutions Leif Lindholm
2020-11-26  0:39   ` Abner Chang
2020-11-25 12:55 ` [PATCH edk2-platforms 10/15] Platform/Qemu: " Leif Lindholm
2020-11-25 12:55 ` [PATCH edk2-platforms 11/15] Silicon/Marvell: " Leif Lindholm
2020-11-25 12:55 ` [PATCH edk2-platforms 12/15] Platform/BeagleBoard: " Leif Lindholm
2020-11-25 12:55 ` [PATCH edk2-platforms 13/15] Silicon/NXP: " Leif Lindholm
2020-11-25 12:55 ` [PATCH edk2-platforms 14/15] Platform/SocioNext: " Leif Lindholm
2020-11-25 13:11   ` Ard Biesheuvel
2020-11-25 13:16     ` Leif Lindholm
2020-11-25 13:27       ` Ard Biesheuvel
2020-11-25 12:55 ` [PATCH edk2-platforms 15/15] Silicon/Hisilicon: " Leif Lindholm
2020-11-25 13:13   ` Leif Lindholm
2020-11-25 13:11 ` [PATCH edk2-platforms 00/15] arm platform fixes triggered by VariablePolicy Leif Lindholm
2020-11-26 10:44   ` wenyi,xie
2020-11-26 13:31     ` Leif Lindholm
2020-11-26 13:42       ` wenyi,xie
2020-11-25 13:12 ` 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=20201125125559.11631-2-leif@nuviainc.com \
    --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