From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.515.1610691268503626672 for ; Thu, 14 Jan 2021 22:14:28 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=softfail (domain: linaro.org, ip: 217.140.110.172, mailfrom: sughosh.ganu@linaro.org) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 33B6CED1; Thu, 14 Jan 2021 22:14:28 -0800 (PST) Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 121293F70D; Thu, 14 Jan 2021 22:14:25 -0800 (PST) From: "Sughosh Ganu" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Sahil Malhotra , Ilias Apalodimas , Sughosh Ganu Subject: [PATCH v3 05/13] StandaloneMmPkg: Add macros for SPM version Date: Fri, 15 Jan 2021 11:43:56 +0530 Message-Id: <20210115061404.13552-6-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210115061404.13552-1-sughosh.ganu@linaro.org> References: <20210115061404.13552-1-sughosh.ganu@linaro.org> Declare module wide variables for SPM major and minor versions to be used in checking the SPM version compatibility. Declare the the values of SPM major and minor versions as macros. Signed-off-by: Sughosh Ganu --- Changes since V2: * Added a STATIC storage class specifier for mSpmMajorVer and mSpmMinorVer variables ArmPkg/Include/IndustryStandard/ArmMmSvc.h | 3 +++ StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ArmPkg/Include/IndustryStandard/ArmMmSvc.h b/ArmPkg/Include/IndustryStandard/ArmMmSvc.h index ee29c2fecc..71a5398558 100644 --- a/ArmPkg/Include/IndustryStandard/ArmMmSvc.h +++ b/ArmPkg/Include/IndustryStandard/ArmMmSvc.h @@ -41,4 +41,7 @@ #define ARM_SVC_SPM_RET_DENIED -3 #define ARM_SVC_SPM_RET_NO_MEMORY -5 +#define SPM_MAJOR_VERSION 0 +#define SPM_MINOR_VERSION 1 + #endif diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c index 3d78e8e9ae..2643473e88 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/StandaloneMmCoreEntryPoint.c @@ -32,8 +32,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define SPM_MINOR_VER_MASK 0x0000FFFF #define SPM_MAJOR_VER_SHIFT 16 -#define SPM_MAJOR_VER 0 -#define SPM_MINOR_VER 1 +STATIC CONST UINT32 mSpmMajorVer = SPM_MAJOR_VERSION; +STATIC CONST UINT32 mSpmMinorVer = SPM_MINOR_VERSION; #define BOOT_PAYLOAD_VERSION 1 @@ -196,8 +196,8 @@ GetSpmVersion (VOID) // revision A must work in a compatible way with revision B. // However, it is possible for revision B to have a higher // function count than revision A. - if ((SpmMajorVersion == SPM_MAJOR_VER) && - (SpmMinorVersion >= SPM_MINOR_VER)) + if ((SpmMajorVersion == mSpmMajorVer) && + (SpmMinorVersion >= mSpmMinorVer)) { DEBUG ((DEBUG_INFO, "SPM Version: Major=0x%x, Minor=0x%x\n", SpmMajorVersion, SpmMinorVersion)); @@ -206,7 +206,7 @@ GetSpmVersion (VOID) else { DEBUG ((DEBUG_INFO, "Incompatible SPM Versions.\n Current Version: Major=0x%x, Minor=0x%x.\n Expected: Major=0x%x, Minor>=0x%x.\n", - SpmMajorVersion, SpmMinorVersion, SPM_MAJOR_VER, SPM_MINOR_VER)); + SpmMajorVersion, SpmMinorVersion, mSpmMajorVer, mSpmMinorVer)); Status = EFI_UNSUPPORTED; } -- 2.17.1