From nobody Thu Jul 17 05:05:30 2025 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1498161326206930.9960225020872; Thu, 22 Jun 2017 12:55:26 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BFFB52095D215; Thu, 22 Jun 2017 12:53:59 -0700 (PDT) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id 7060521C943F4 for ; Thu, 22 Jun 2017 12:53:58 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AF7A22B; Thu, 22 Jun 2017 12:55:23 -0700 (PDT) Received: from u201365.usa.Arm.com (bc-c3-3-14.eu.iaas.arm.com [10.6.43.238]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1F7033F587; Thu, 22 Jun 2017 12:55:21 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org From: Supreeth Venkatesh To: edk2-devel@lists.01.org Date: Thu, 22 Jun 2017 20:54:19 +0100 Message-Id: <1498161266-18877-4-git-send-email-supreeth.venkatesh@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498161266-18877-1-git-send-email-supreeth.venkatesh@arm.com> References: <1498161266-18877-1-git-send-email-supreeth.venkatesh@arm.com> Subject: [edk2] [PATCH v3 03/10] BaseTools: Tools change to support PI v1.5 Specification. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jonathan.zhang@cavium.com, liming.gao@intel.com, Jiewen Yao , leif.lindholm@linaro.org, felixp@ami.com, michael.d.kinney@intel.com, jbrasen@qti.qualcomm.com MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This patch adds changes to auto generate SMM_CORE_STANDALONE and SMM_STANDALONE Entry Point templates. Also, it adds changes to help auto generate dependency expressions for SMM_STANDALONE modules. PI Specification v1.5 specifies Management Mode System Table (MMST) which is a collection of common services for managing MMRAM allocation and providing basic I/O services. MMST is similar to the UEFI System Table. Some of auto generated SMM_CORE_STANDALONE and SMM_STANDALONE template APIs use MMST as parameter. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao Signed-off-by: Supreeth Venkatesh --- BaseTools/Source/Python/AutoGen/GenC.py | 148 ++++++++++++++++++++++++= +++- BaseTools/Source/Python/AutoGen/GenDepex.py | 17 +++- 2 files changed, 162 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index 67aaef7..d42dd45 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -237,6 +237,100 @@ ProcessModuleEntryPointList ( ${END} """) =20 +## SMM_CORE_STANDALONE Entry Point Templates +gSmmCoreStandaloneEntryPointPrototype =3D TemplateString(""" +${BEGIN} +EFI_STATUS +EFIAPI +${Function} ( + IN VOID *HobStart + ); +${END} +""") + +gSmmCoreStandaloneEntryPointString =3D TemplateString(""" +${BEGIN} +const UINT32 _gSmmRevision =3D ${PiSpecVersion}; + +VOID +EFIAPI +ProcessModuleEntryPointList ( + IN VOID *HobStart + ) +{ + ${Function} (HobStart); +} +${END} +""") + +## SMM_STANDALONE Entry Point Templates +gSmmStandaloneEntryPointPrototype =3D TemplateString(""" +${BEGIN} +EFI_STATUS +EFIAPI +${Function} ( + IN EFI_HANDLE ImageHandle, + IN EFI_SMM_SYSTEM_TABLE2 *SmmSystemTable + ); +${END} +""") + +gSmmStandaloneEntryPointString =3D [ +TemplateString(""" +GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gSmmRevision =3D ${PiSpecVersi= on}; + +EFI_STATUS +EFIAPI +ProcessModuleEntryPointList ( + IN EFI_HANDLE ImageHandle, + IN EFI_SMM_SYSTEM_TABLE2 *SmmSystemTable + ) + +{ + return EFI_SUCCESS; +} +"""), +TemplateString(""" +GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gSmmRevision =3D ${PiSpecVersi= on}; +${BEGIN} +EFI_STATUS +EFIAPI +ProcessModuleEntryPointList ( + IN EFI_HANDLE ImageHandle, + IN EFI_SMM_SYSTEM_TABLE2 *SmmSystemTable + ) + +{ + return ${Function} (ImageHandle, SmmSystemTable); +} +${END} +"""), +TemplateString(""" +GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gSmmRevision =3D ${PiSpecVersi= on}; + +EFI_STATUS +EFIAPI +ProcessModuleEntryPointList ( + IN EFI_HANDLE ImageHandle, + IN EFI_SMM_SYSTEM_TABLE2 *SmmSystemTable + ) + +{ + EFI_STATUS Status; + EFI_STATUS CombinedStatus; + + CombinedStatus =3D EFI_LOAD_ERROR; +${BEGIN} + Status =3D ${Function} (ImageHandle, SmmSystemTable); + if (!EFI_ERROR (Status) || EFI_ERROR (CombinedStatus)) { + CombinedStatus =3D Status; + } +${END} + return CombinedStatus; +} +""") +] + ## DXE SMM Entry Point Templates gDxeSmmEntryPointPrototype =3D TemplateString(""" ${BEGIN} @@ -580,6 +674,15 @@ ${Function} ( IN EFI_SYSTEM_TABLE *SystemTable );${END} """), + +'SMM' : TemplateString("""${BEGIN} +EFI_STATUS +EFIAPI +${Function} ( + IN EFI_HANDLE ImageHandle, + IN EFI_SMM_SYSTEM_TABLE2 *SmmSystemTable + );${END} +"""), } =20 gLibraryStructorCall =3D { @@ -597,6 +700,11 @@ gLibraryStructorCall =3D { Status =3D ${Function} (ImageHandle, SystemTable); ASSERT_EFI_ERROR (Status);${END} """), + +'SMM' : TemplateString("""${BEGIN} + Status =3D ${Function} (ImageHandle, SmmSystemTable); + ASSERT_EFI_ERROR (Status);${END} +"""), } =20 ## Library Constructor and Destructor Templates @@ -644,6 +752,21 @@ ${BEGIN} EFI_STATUS Status; ${FunctionCall}${END} } """), + +'SMM' : TemplateString(""" +${BEGIN}${FunctionPrototype}${END} + +VOID +EFIAPI +ProcessLibrary${Type}List ( + IN EFI_HANDLE ImageHandle, + IN EFI_SMM_SYSTEM_TABLE2 *SmmSystemTable + ) +{ +${BEGIN} EFI_STATUS Status; +${FunctionCall}${END} +} +"""), } =20 gBasicHeaderFile =3D "Base.h" @@ -661,6 +784,8 @@ gModuleTypeHeaderFile =3D { "UEFI_DRIVER" : ["Uefi.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoin= t.h"], "UEFI_APPLICATION" : ["Uefi.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplicationEntr= yPoint.h"], "SMM_CORE" : ["PiDxe.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiDriverEntryPoint.h"], + "SMM_STANDALONE" : ["PiSmm.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/SmmDriverStandaloneEntryPoint.h"], + "SMM_CORE_STANDALONE" : ["PiSmm.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/SmmCoreStandaloneEntryPoint.h"], "USER_DEFINED" : [gBasicHeaderFile] } =20 @@ -1266,6 +1391,9 @@ def CreateLibraryConstructorCode(Info, AutoGenC, Auto= GenH): 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLI= CATION','SMM_CORE']: ConstructorPrototypeString.Append(gLibraryStructorPrototype['D= XE'].Replace(Dict)) ConstructorCallingString.Append(gLibraryStructorCall['DXE'].Re= place(Dict)) + elif Lib.ModuleType in ['SMM_STANDALONE','SMM_CORE_STANDALONE']: + ConstructorPrototypeString.Append(gLibraryStructorPrototype['S= MM'].Replace(Dict)) + ConstructorCallingString.Append(gLibraryStructorCall['SMM'].Re= place(Dict)) =20 if str(ConstructorPrototypeString) =3D=3D '': ConstructorPrototypeList =3D [] @@ -1291,6 +1419,8 @@ def CreateLibraryConstructorCode(Info, AutoGenC, Auto= GenH): elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER',= 'DXE_RUNTIME_DRIVER', 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPL= ICATION','SMM_CORE']: AutoGenC.Append(gLibraryString['DXE'].Replace(Dict)) + elif Info.ModuleType in ['SMM_STANDALONE','SMM_CORE_STANDALONE']: + AutoGenC.Append(gLibraryString['SMM'].Replace(Dict)) =20 ## Create code for library destructor # @@ -1323,6 +1453,9 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoG= enH): 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLI= CATION', 'SMM_CORE']: DestructorPrototypeString.Append(gLibraryStructorPrototype['DX= E'].Replace(Dict)) DestructorCallingString.Append(gLibraryStructorCall['DXE'].Rep= lace(Dict)) + elif Lib.ModuleType in ['SMM_STANDALONE','SMM_CORE_STANDALONE']: + DestructorPrototypeString.Append(gLibraryStructorPrototype['SM= M'].Replace(Dict)) + DestructorCallingString.Append(gLibraryStructorCall['SMM'].Rep= lace(Dict)) =20 if str(DestructorPrototypeString) =3D=3D '': DestructorPrototypeList =3D [] @@ -1348,6 +1481,8 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoG= enH): elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER',= 'DXE_RUNTIME_DRIVER', 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPL= ICATION','SMM_CORE']: AutoGenC.Append(gLibraryString['DXE'].Replace(Dict)) + elif Info.ModuleType in ['SMM_STANDALONE','SMM_CORE_STANDALONE']: + AutoGenC.Append(gLibraryString['SMM'].Replace(Dict)) =20 =20 ## Create code for ModuleEntryPoint @@ -1377,7 +1512,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGe= nH): 'UefiSpecVersion': UefiSpecVersion + 'U' } =20 - if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE']: + if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE', 'SMM_CORE_S= TANDALONE']: if Info.SourceFileList <> None and Info.SourceFileList <> []: if NumEntryPoints !=3D 1: EdkLogger.error( @@ -1396,6 +1531,9 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGe= nH): elif Info.ModuleType =3D=3D 'SMM_CORE': AutoGenC.Append(gSmmCoreEntryPointString.Replace(Dict)) AutoGenH.Append(gSmmCoreEntryPointPrototype.Replace(Dict)) + elif Info.ModuleType =3D=3D 'SMM_CORE_STANDALONE': + AutoGenC.Append(gSmmCoreStandaloneEntryPointString.Replace(Dict)) + AutoGenH.Append(gSmmCoreStandaloneEntryPointPrototype.Replace(Dict= )) elif Info.ModuleType =3D=3D 'PEIM': if NumEntryPoints < 2: AutoGenC.Append(gPeimEntryPointString[NumEntryPoints].Replace(= Dict)) @@ -1413,7 +1551,13 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoG= enH): AutoGenC.Append(gDxeSmmEntryPointString[0].Replace(Dict)) else: AutoGenC.Append(gDxeSmmEntryPointString[1].Replace(Dict)) - AutoGenH.Append(gDxeSmmEntryPointPrototype.Replace(Dict)) =20 + AutoGenH.Append(gDxeSmmEntryPointPrototype.Replace(Dict)) + elif Info.ModuleType =3D=3D 'SMM_STANDALONE': + if NumEntryPoints < 2: + AutoGenC.Append(gSmmStandaloneEntryPointString[NumEntryPoints]= .Replace(Dict)) + else: + AutoGenC.Append(gSmmStandaloneEntryPointString[2].Replace(Dict= )) + AutoGenH.Append(gSmmStandaloneEntryPointPrototype.Replace(Dict)) elif Info.ModuleType =3D=3D 'UEFI_APPLICATION': if NumEntryPoints < 2: AutoGenC.Append(gUefiApplicationEntryPointString[NumEntryPoint= s].Replace(Dict)) diff --git a/BaseTools/Source/Python/AutoGen/GenDepex.py b/BaseTools/Source= /Python/AutoGen/GenDepex.py index 5923a75..9d3002f 100644 --- a/BaseTools/Source/Python/AutoGen/GenDepex.py +++ b/BaseTools/Source/Python/AutoGen/GenDepex.py @@ -42,6 +42,8 @@ gType2Phase =3D { "UEFI_DRIVER" : "DXE", "UEFI_APPLICATION" : "DXE", "SMM_CORE" : "DXE", + "SMM_STANDALONE" : "SMM", + "SMM_CORE_STANDALONE" : "SMM", } =20 ## Convert dependency expression string into EFI internal representation @@ -98,6 +100,19 @@ class DependencyExpression: "FALSE" : 0x07, "END" : 0x08, "SOR" : 0x09 + }, + + "SMM" : { + "BEFORE": 0x00, + "AFTER" : 0x01, + "PUSH" : 0x02, + "AND" : 0x03, + "OR" : 0x04, + "NOT" : 0x05, + "TRUE" : 0x06, + "FALSE" : 0x07, + "END" : 0x08, + "SOR" : 0x09 } } =20 @@ -289,7 +304,7 @@ class DependencyExpression: return =20 # don't generate depex if all operands are architecture protocols - if self.ModuleType in ['UEFI_DRIVER', 'DXE_DRIVER', 'DXE_RUNTIME_D= RIVER', 'DXE_SAL_DRIVER', 'DXE_SMM_DRIVER'] and \ + if self.ModuleType in ['UEFI_DRIVER', 'DXE_DRIVER', 'DXE_RUNTIME_D= RIVER', 'DXE_SAL_DRIVER', 'DXE_SMM_DRIVER', 'SMM_STANDALONE'] and \ Op =3D=3D 'AND' and \ self.ArchProtocols =3D=3D set([GuidStructureStringToGuidString(= Guid) for Guid in AllOperand]): self.PostfixNotation =3D [] --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel