From patchwork Mon May 2 13:35:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 67027 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp46737qge; Mon, 2 May 2016 06:36:15 -0700 (PDT) X-Received: by 10.55.90.130 with SMTP id o124mr34598180qkb.178.1462196175577; Mon, 02 May 2016 06:36:15 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j60si14702959qge.116.2016.05.02.06.36.15; Mon, 02 May 2016 06:36:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 2BD7C61611; Mon, 2 May 2016 13:36:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 1727A615F5; Mon, 2 May 2016 13:36:09 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 501AD61617; Mon, 2 May 2016 13:36:06 +0000 (UTC) Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by lists.linaro.org (Postfix) with ESMTPS id 5E7FE615F5 for ; Mon, 2 May 2016 13:35:51 +0000 (UTC) Received: by mail-wm0-f53.google.com with SMTP id n129so107704812wmn.1 for ; Mon, 02 May 2016 06:35:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=g8/0ZZU+SCjwKuwOIVToLilbkaKynifJjA89pxkUXjc=; b=Yb9cFR0f5v+fQkXcCJtLd1/0XaXvnSi+ExIwD1WK+VNWM5JV04lAFxu7k2ZooLgK1k E93/rIBTx4BtE/LsiQgJIizWT+Iip8649JcfTj+uISHUQr4kY2VDKpJSFEtP/S9rBdx7 sMrP+H+1W6Nc3ZTyqB4OaNX1DemTd2OBCfB+kJG+IFFxHtbE0FkSSkhTYakBzMCVJWB9 7gGuaRPcg9nAzq14LAC54wFLXVfrIIsNFI15rpuon1Eye7OnOyYAZ3hS38saaci18VZ5 Fa6HYEBlBgVx8eIRUnAYaYQ2kg9x3IadYfGcpZIzR420aWKf6aeDbb0Lj0UtlUdEsb/C xYrw== X-Gm-Message-State: AOPr4FVUTq5SkazejlH4QhAzFgwgbBc0m5E8vDl8gl6adAkrFCADSwkR2hIEWE9DD7E0ccBAuKc= X-Received: by 10.28.187.85 with SMTP id l82mr15921007wmf.2.1462196149943; Mon, 02 May 2016 06:35:49 -0700 (PDT) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id d1sm30424544wjb.47.2016.05.02.06.35.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 May 2016 06:35:48 -0700 (PDT) From: Ard Biesheuvel To: linaro-uefi@lists.linaro.org Date: Mon, 2 May 2016 15:35:37 +0200 Message-Id: <1462196143-21998-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1462196143-21998-1-git-send-email-ard.biesheuvel@linaro.org> References: <1462196143-21998-1-git-send-email-ard.biesheuvel@linaro.org> Cc: leo.duran@amd.com Subject: [Linaro-uefi] [RFC PATCH 1/7] Platforms/AMD/Styx: fix incorrect usage of ASSERT_EFI_ERROR X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" 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 --- 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(-) 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;