[Linaro-uefi,RFC,1/7] Platforms/AMD/Styx: fix incorrect usage of ASSERT_EFI_ERROR

Message ID 1462196143-21998-2-git-send-email-ard.biesheuvel@linaro.org
State New
Headers show

Commit Message

Ard Biesheuvel May 2, 2016, 1:35 p.m.
The ASSERT_EFI_ERROR () macro takes a single EFI_STATUS argument, which
is converted into its textual equivalent before being printed if its
value does not equal EFI_SUCCESS. This macro is not appropriate for
doing asserts on arbitrary truth value expressions, we have ASSERT ()
for that.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Platforms/AMD/Styx/AcpiTables/Madt.c                       |  4 ++--
 Platforms/AMD/Styx/Drivers/FdtDxe/AArch64/BdsLinuxLoader.c |  4 ++--
 Platforms/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c       | 10 +++++-----
 3 files changed, 9 insertions(+), 9 deletions(-)

Patch

diff --git a/Platforms/AMD/Styx/AcpiTables/Madt.c b/Platforms/AMD/Styx/AcpiTables/Madt.c
index 0138aa370779..c9ee626d7472 100644
--- a/Platforms/AMD/Styx/AcpiTables/Madt.c
+++ b/Platforms/AMD/Styx/AcpiTables/Madt.c
@@ -283,8 +283,8 @@  MadtHeader (
 
   // Make sure SoC's core count does not exceed what we want to build
   CoreCount = ArmProcessorTable->NumberOfEntries;
-  ASSERT_EFI_ERROR (CoreCount > NUM_CORES);
-  ASSERT_EFI_ERROR (CoreCount > PcdGet32(PcdSocCoreCount));
+  ASSERT (CoreCount <= NUM_CORES);
+  ASSERT (CoreCount <= PcdGet32(PcdSocCoreCount));
 
   GicC = (EFI_ACPI_5_1_GIC_STRUCTURE *)&AcpiMadt.GicC[0];
   AcpiMadt.Header.Header.Length = sizeof (EFI_ACPI_5_1_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER);
diff --git a/Platforms/AMD/Styx/Drivers/FdtDxe/AArch64/BdsLinuxLoader.c b/Platforms/AMD/Styx/Drivers/FdtDxe/AArch64/BdsLinuxLoader.c
index 8e6fbfc3975e..9ec9e1d5061a 100644
--- a/Platforms/AMD/Styx/Drivers/FdtDxe/AArch64/BdsLinuxLoader.c
+++ b/Platforms/AMD/Styx/Drivers/FdtDxe/AArch64/BdsLinuxLoader.c
@@ -61,9 +61,9 @@  AmdStyxMoveParkedCores(
 
   // Get Parking area (4KB-aligned, 4KB per core)
   MpParkingBase = FixedPcdGet64 (PcdParkingProtocolBase);
-  ASSERT_EFI_ERROR (MpParkingBase & (SIZE_4KB - 1));
+  ASSERT ((MpParkingBase & (SIZE_4KB - 1)) == 0);
   MpParkingSize = ArmCoreCount * SIZE_4KB;
-  ASSERT_EFI_ERROR (MpParkingSize > FixedPcdGet64 (PcdParkingProtocolSize));
+  ASSERT (MpParkingSize <= FixedPcdGet64 (PcdParkingProtocolSize));
 
   //
   // Set Pen at the 2K-offset of the Parking area, skipping an 8-byte slot for the Core#.
diff --git a/Platforms/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c b/Platforms/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c
index 0ceb873f7b48..a1f6cabee901 100644
--- a/Platforms/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c
+++ b/Platforms/AMD/Styx/Drivers/PlatInitPei/PlatInitPei.c
@@ -228,9 +228,9 @@  PlatInitPeiEntryPoint (
     CpuCoreCount = IscpFuseInfo.SocConfiguration.CpuCoreCount;
     CpuMapSize = sizeof (IscpFuseInfo.SocConfiguration.CpuMap) * 8;
 
-    ASSERT_EFI_ERROR (CpuMap == 0);
-    ASSERT_EFI_ERROR (CpuCoreCount == 0);
-    ASSERT_EFI_ERROR (CpuCoreCount > CpuMapSize);
+    ASSERT (CpuMap != 0);
+    ASSERT (CpuCoreCount != 0);
+    ASSERT (CpuCoreCount <= CpuMapSize);
 
     // Update core count based on fusing
     if (mAmdCoreCount > CpuCoreCount) {
@@ -259,8 +259,8 @@  PlatInitPeiEntryPoint (
         Status = PeiIscpPpi->ExecuteCpuRetrieveIdTransaction (
                    PeiServices, &CpuResetInfo );
         ASSERT_EFI_ERROR (Status);
-        ASSERT_EFI_ERROR (CpuResetInfo.CoreStatus.Status == CPU_CORE_DISABLED);
-        ASSERT_EFI_ERROR (CpuResetInfo.CoreStatus.Status == CPU_CORE_UNDEFINED);
+        ASSERT (CpuResetInfo.CoreStatus.Status != CPU_CORE_DISABLED);
+        ASSERT (CpuResetInfo.CoreStatus.Status != CPU_CORE_UNDEFINED);
 
         mAmdMpCoreInfoTable[Index].ClusterId = CpuResetInfo.CoreStatus.ClusterId;
         mAmdMpCoreInfoTable[Index].CoreId = CpuResetInfo.CoreStatus.CoreId;