From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.1.69; helo=eur01-ve1-obe.outbound.protection.outlook.com; envelope-from=supreeth.venkatesh@arm.com; receiver=edk2-devel@lists.01.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0069.outbound.protection.outlook.com [104.47.1.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EEAB82063E304 for ; Fri, 4 May 2018 16:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=XIlu6WmaVjDeUijEM6459PMqZvwsqweOwzobVTW/hHM=; b=TYWt7u1wINswqTfTX02dbpixBio4SuSaAkhc4OhY2Nq4B4TS16mWKYwjt/Sk8jtugzy3RBrW5dqecbsRM1zKvlZaPKQiEuVTY4DP4cczu8rEHE2jPlBLfjvUuSZ+NJaAea2le192k3UcSsWbO07pItb6lwqSTtRTdmgM98sQi0A= Received: from AM4PR0802MB2306.eurprd08.prod.outlook.com (10.172.218.15) by AM4PR0802MB2276.eurprd08.prod.outlook.com (10.172.218.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.735.16; Fri, 4 May 2018 23:24:37 +0000 Received: from AM4PR0802MB2306.eurprd08.prod.outlook.com ([fe80::e117:6f62:6a9b:6be4]) by AM4PR0802MB2306.eurprd08.prod.outlook.com ([fe80::e117:6f62:6a9b:6be4%8]) with mapi id 15.20.0735.016; Fri, 4 May 2018 23:24:37 +0000 From: Supreeth Venkatesh To: Achin Gupta CC: "edk2-devel@lists.01.org" Thread-Topic: [PATCH v1 11/18] StandaloneMmPkg: MM driver entry point library. Thread-Index: AQHTzbWilCEIZQ0Y6UyULVo16G+LRaQZg+6AgATVfUA= Date: Fri, 4 May 2018 23:24:37 +0000 Message-ID: References: <20180406144223.10931-1-supreeth.venkatesh@arm.com> <20180406144223.10931-12-supreeth.venkatesh@arm.com> <20180430142941.GV663@e104320-lin> In-Reply-To: <20180430142941.GV663@e104320-lin> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Supreeth.Venkatesh@arm.com; x-originating-ip: [217.140.111.135] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR0802MB2276; 7:+8ZLv26pbX5Waq1X51m7pW7NTv9RGJMyuCbfWYas+1CIG7DM6O6nhmur9ufmXsChzHWw0D3W33y3V9jKUd0QqULE4S0Zzl0p0Bgxoe6nGlqT/GJUrrASkgfg2qXCT/DrMX4IheEl2UbnMKLUjykQHvMI9OaVABVlLRKRfsTjj7anO1jHkAjhYGPHhQwRoXhRsjyO1xBihx5QvwIBLEaJgMRDb5dgss0aPrX9sIdTKZ7969LQ+L+1eyI7g7TWxN9G x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(2017052603328)(7153060)(7193020); SRVR:AM4PR0802MB2276; x-ms-traffictypediagnostic: AM4PR0802MB2276: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917)(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3231254)(944501410)(52105095)(3002001)(6055026)(6041310)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:AM4PR0802MB2276; BCL:0; PCL:0; RULEID:; SRVR:AM4PR0802MB2276; x-forefront-prvs: 06628F7CA4 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6029001)(376002)(39380400002)(346002)(366004)(39860400002)(396003)(13464003)(40434004)(189003)(199004)(6506007)(11346002)(26005)(105586002)(102836004)(305945005)(66066001)(33656002)(76176011)(7696005)(6436002)(3280700002)(3660700001)(478600001)(59450400001)(106356001)(15188155005)(16799955002)(446003)(486006)(2906002)(14454004)(5660300001)(53546011)(476003)(316002)(99286004)(81156014)(74316002)(9686003)(6306002)(2900100001)(3846002)(8936002)(6116002)(4326008)(53376002)(6636002)(53936002)(81166006)(7736002)(55016002)(6862004)(8676002)(72206003)(86362001)(966005)(25786009)(229853002)(97736004)(5250100002)(5890100001)(6246003)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR0802MB2276; H:AM4PR0802MB2306.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: kszNXBZgvDJrS+QJPNSgPTehbJ5uqYh7BU/akjDpoW4jikOb+YBRtiwz8ABiGrfzKxZHWI6lZ31VsXbRvsE7bBgHHIrvf0qylL2X9q3WA7/cjUrO5DGAy3C8icz1z13F134BxckiA7cT9R0VHN7KtnhB4hcjS3db/h2daNPPs+WpdbgaMSjRBRLizgFbZlWd spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 402d03a1-db38-4882-bef2-08d5b21633ff X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 402d03a1-db38-4882-bef2-08d5b21633ff X-MS-Exchange-CrossTenant-originalarrivaltime: 04 May 2018 23:24:37.2966 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0802MB2276 Subject: Re: [PATCH v1 11/18] StandaloneMmPkg: MM driver entry point library. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 May 2018 23:24:40 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable My response inline. -----Original Message----- From: Achin Gupta Sent: Monday, April 30, 2018 9:30 AM To: Supreeth Venkatesh Cc: edk2-devel@lists.01.org; michael.d.kinney@intel.com; liming.gao@intel.c= om; jiewen.yao@intel.com; leif.lindholm@linaro.org; ard.biesheuvel@linaro.o= rg; nd Subject: Re: [PATCH v1 11/18] StandaloneMmPkg: MM driver entry point librar= y. Hi Supreeth, Some of the DXE references will have to be removed and copyright years need= to be updated. If that sounds reasonable then.. [Supreeth] Ok. Acked-by: Achin Gupta cheers, Achin On Fri, Apr 06, 2018 at 03:42:16PM +0100, Supreeth Venkatesh wrote: > This patch implements module entry point library for Standalone > management mode (MM) Drivers. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Achin Gupta > Signed-off-by: Supreeth Venkatesh > --- > .../Include/Library/MmDriverStandaloneEntryPoint.h | 148 +++++++++++++++= ++++++ > .../StandaloneMmDriverEntryPoint.c | 102 ++++++++++++++ > .../StandaloneMmDriverEntryPoint.inf | 41 ++++++ > 3 files changed, 291 insertions(+) > create mode 100644 > StandaloneMmPkg/Include/Library/MmDriverStandaloneEntryPoint.h > create mode 100644 > StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDrive > rEntryPoint.c create mode 100644 > StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDrive > rEntryPoint.inf > > diff --git > a/StandaloneMmPkg/Include/Library/MmDriverStandaloneEntryPoint.h > b/StandaloneMmPkg/Include/Library/MmDriverStandaloneEntryPoint.h > new file mode 100644 > index 0000000000..6fb9224e2e > --- /dev/null > +++ b/StandaloneMmPkg/Include/Library/MmDriverStandaloneEntryPoint.h > @@ -0,0 +1,148 @@ > +/** @file > + Module entry point library for UEFI drivers, DXE Drivers, DXE > +Runtime Drivers, > + and DXE SMM Drivers. > + > +Copyright (c) 2006 - 2008, Intel Corporation. All rights > +reserved.
Copyright (c) 2016 - 2017, ARM Limited. All rights > +reserved.
> + > +This program and the accompanying materials are licensed and made > +available under the terms and conditions of the BSD License which > +accompanies this distribution. The full text of the license may be > +found at http://opensource.org/licenses/bsd-license.php > + > +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. > + > +**/ > + > +#ifndef __MODULE_ENTRY_POINT_H__ > +#define __MODULE_ENTRY_POINT_H__ > + > +/// > +///Declare the PI Specification Revision that this driver requires to ex= ecute correctly. > +/// > +extern CONST UINT32 _gMmRevision; > + > +/** > + The entry point of PE/COFF Image for a DXE Driver, DXE Runtime Driver,= DXE SMM Driver, or UEFI Driver. > + > + This function is the entry point for a DXE Driver, DXE Runtime > + Driver, DXE SMM Driver, or UEFI Driver. This function must call > + ProcessLibraryConstructorList() and ProcessModuleEntryPointList(). > + If the return status from ProcessModuleEntryPointList() is an error > + status, then ProcessLibraryDestructorList() must be called. The > + return value from ProcessModuleEntryPointList() is returned. If > + _gDriverUnloadImageCount is greater than zero, then an unload handler = must be registered for this image and the unload handler must invoke Proce= ssModuleUnloadList(). > + If _gUefiDriverRevision is not zero and SystemTable->Hdr.Revision > + is less than _gUefiDriverRevison, then return EFI_INCOMPATIBLE_VERSION= . > + > + > + @param ImageHandle The image handle of the DXE Driver, DXE Runtime D= river, DXE SMM Driver, or UEFI Driver. > + @param SystemTable A pointer to the EFI System Table. > + > + @retval EFI_SUCCESS The DXE Driver, DXE Runtime Driver,= DXE SMM Driver, > + or UEFI Driver exited normally. > + @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater tha= n SystemTable->Hdr.Revision. > + @retval Other Return value from ProcessModuleEntr= yPointList(). > + > +**/ > +EFI_STATUS > +EFIAPI > +_ModuleEntryPoint ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_MM_SYSTEM_TABLE *MmSystemTable > + ); > + > + > +/** > + Required by the EBC compiler and identical in functionality to _Module= EntryPoint(). > + > + This function is required to call _ModuleEntryPoint() passing in Image= Handle, and SystemTable. > + > + @param ImageHandle The image handle of the DXE Driver, DXE Runtime D= river, DXE SMM Driver, or UEFI Driver. > + @param SystemTable A pointer to the EFI System Table. > + > + @retval EFI_SUCCESS The DXE Driver, DXE Runtime Driver,= DXE SMM Driver, > + or UEFI Driver exited normally. > + @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater tha= n SystemTable->Hdr.Revision. > + @retval Other Return value from ProcessModuleEntr= yPointList(). > +**/ > +EFI_STATUS > +EFIAPI > +EfiMain ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_MM_SYSTEM_TABLE *MmSystemTable > + ); > + > + > +/** > + Autogenerated function that calls the library constructors for all > +of the module's > + dependent libraries. > + > + This function must be called by _ModuleEntryPoint(). > + This function calls the set of library constructors for the set of > + library instances that a module depends on. This includes library > + instances that a module depends on directly and library instances that= a module depends on indirectly through other libraries. > + This function is autogenerated by build tools and those build tools > + are responsible for collecting the set of library instances, > + determine which ones have constructors, and calling the library > + constructors in the proper order based upon each of the library instan= ces own dependencies. > + > + @param ImageHandle The image handle of the DXE Driver, DXE Runtime D= river, DXE SMM Driver, or UEFI Driver. > + @param SystemTable A pointer to the EFI System Table. > + > +**/ > +VOID > +EFIAPI > +ProcessLibraryConstructorList ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_MM_SYSTEM_TABLE *MmSystemTable > + ); > + > + > +/** > + Autogenerated function that calls the library descructors for all > +of the module's > + dependent libraries. > + > + This function may be called by _ModuleEntryPoint() or ExitDriver(). > + This function calls the set of library destructors for the set of > + library instances that a module depends on. This includes library > + instances that a module depends on directly and library instances that= a module depends on indirectly through other libraries. > + This function is autogenerated by build tools and those build tools > + are responsible for collecting the set of library instances, > + determine which ones have destructors, and calling the library destruc= tors in the proper order based upon each of the library instances own depen= dencies. > + > + @param ImageHandle The image handle of the DXE Driver, DXE Runtime D= river, DXE SMM Driver, or UEFI Driver. > + @param SystemTable A pointer to the EFI System Table. > + > +**/ > +VOID > +EFIAPI > +ProcessLibraryDestructorList ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_MM_SYSTEM_TABLE *MmSystemTable > + ); > + > + > +/** > + Autogenerated function that calls a set of module entry points. > + > + This function must be called by _ModuleEntryPoint(). > + This function calls the set of module entry points. > + This function is autogenerated by build tools and those build tools > + are responsible for collecting the module entry points and calling the= m in a specified order. > + > + @param ImageHandle The image handle of the DXE Driver, DXE Runtime D= river, DXE SMM Driver, or UEFI Driver. > + @param SystemTable A pointer to the EFI System Table. > + > + @retval EFI_SUCCESS The DXE Driver, DXE Runtime Driver, DXE SMM Dri= ver, or UEFI Driver executed normally. > + @retval !EFI_SUCCESS The DXE Driver, DXE Runtime Driver, DXE SMM Dri= ver, or UEFI Driver failed to execute normally. > +**/ > +EFI_STATUS > +EFIAPI > +ProcessModuleEntryPointList ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_MM_SYSTEM_TABLE *MmSystemTable > + ); > + > +#endif > diff --git > a/StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDri > verEntryPoint.c > b/StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDri > verEntryPoint.c > new file mode 100644 > index 0000000000..84b3d9cd08 > --- /dev/null > +++ b/StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneM > +++ mDriverEntryPoint.c > @@ -0,0 +1,102 @@ > +/** @file > + Entry point to a Standalone SMM driver. > + > +Copyright (c) 2015, Intel Corporation. All rights reserved.
> +Copyright (c) 2016-2017, ARM Ltd. All rights reserved.
> + > +This program and the accompanying materials are licensed and made > +available under the terms and conditions of the BSD License which > +accompanies this distribution. The full text of the license may be > +found at http://opensource.org/licenses/bsd-license.php > + > +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. > + > +**/ > + > + > + > +#include > + > +#include > +#include > + > +VOID > +EFIAPI > +ProcessLibraryConstructorList ( > + IN EFI_HANDLE ImageHandle, > + IN IN EFI_MM_SYSTEM_TABLE *MmSystemTable > + ); > + > +EFI_STATUS > +EFIAPI > +ProcessModuleEntryPointList ( > + IN EFI_HANDLE ImageHandle, > + IN IN EFI_MM_SYSTEM_TABLE *MmSystemTable > + ); > + > +VOID > +EFIAPI > +ProcessLibraryDestructorList ( > + IN EFI_HANDLE ImageHandle, > + IN IN EFI_MM_SYSTEM_TABLE *MmSystemTable > + ); > + > +/** > + The entry point of PE/COFF Image for a DXE Driver, DXE Runtime > +Driver, DXE SMM > + Driver, or UEFI Driver. > + > + This function is the entry point for a DXE Driver, DXE Runtime > + Driver, DXE SMM Driver, or UEFI Driver. This function must call > + ProcessLibraryConstructorList() and ProcessModuleEntryPointList(). > + If the return status from ProcessModuleEntryPointList() is an error > + status, then ProcessLibraryDestructorList() must be called. The > + return value from ProcessModuleEntryPointList() is returned. If > + _gDriverUnloadImageCount is greater than zero, then an unload handler = must be registered for this image and the unload handler must invoke Proce= ssModuleUnloadList(). > + If _gUefiDriverRevision is not zero and SystemTable->Hdr.Revision > + is less than _gUefiDriverRevison, then return EFI_INCOMPATIBLE_VERSION= . > + > + > + @param ImageHandle The image handle of the DXE Driver, DXE Runtime D= river, > + DXE SMM Driver, or UEFI Driver. > + @param SystemTable A pointer to the EFI System Table. > + > + @retval EFI_SUCCESS The DXE Driver, DXE Runtime Driver,= DXE SMM > + Driver, or UEFI Driver exited norma= lly. > + @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater tha= n > + SystemTable->Hdr.Revision. > + @retval Other Return value from ProcessModuleEntr= yPointList(). > + > +**/ > +EFI_STATUS > +EFIAPI > +_ModuleEntryPoint ( > + IN EFI_HANDLE ImageHandle, > + IN IN EFI_MM_SYSTEM_TABLE *MmSystemTable > + ) > +{ > + EFI_STATUS Status; > + > + // > + // Call constructor for all libraries // > + ProcessLibraryConstructorList (ImageHandle, MmSystemTable); > + > + // > + // Call the driver entry point > + // > + Status =3D ProcessModuleEntryPointList (ImageHandle, MmSystemTable); > + > + // > + // If all of the drivers returned errors, then invoke all of the > + library destructors // if (EFI_ERROR (Status)) { > + ProcessLibraryDestructorList (ImageHandle, MmSystemTable); } > + > + // > + // Return the cumulative return status code from all of the driver > +entry points > + // > + return Status; > +} > + > diff --git > a/StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDri > verEntryPoint.inf > b/StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDri > verEntryPoint.inf > new file mode 100644 > index 0000000000..564a3f14c8 > --- /dev/null > +++ b/StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneM > +++ mDriverEntryPoint.inf > @@ -0,0 +1,41 @@ > +## @file > +# Module entry point library for Standalone SMM driver. > +# > +# Copyright (c) 2015, Intel Corporation. All rights reserved.
# > +Copyright (c) 2016-2017, ARM Ltd. All rights reserved.
# # This > +program and the accompanying materials # are licensed and made > +available under the terms and conditions of the BSD License # which > +accompanies this distribution. The full text of the license may be > +found at # http://opensource.org/licenses/bsd-license.php. > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > +BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPR= ESS OR IMPLIED. > +# > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x0001001A > + BASE_NAME =3D StandaloneMmDriverEntryPoint > + FILE_GUID =3D BBC33478-98F8-4B78-B29D-574D681B7E4= 3 > + MODULE_TYPE =3D MM_STANDALONE > + VERSION_STRING =3D 1.0 > + PI_SPECIFICATION_VERSION =3D 0x00010032 > + LIBRARY_CLASS =3D StandaloneMmDriverEntryPoint|MM_STA= NDALONE > + > +# > +# The following information is for reference only and not required by th= e build tools. > +# > +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC > +# > + > +[Sources] > + StandaloneMmDriverEntryPoint.c > + > +[Packages] > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + BaseLib > + DebugLib > + > -- > 2.16.2 > IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.