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.70; helo=eur01-ve1-obe.outbound.protection.outlook.com; envelope-from=achin.gupta@arm.com; receiver=edk2-devel@lists.01.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0070.outbound.protection.outlook.com [104.47.1.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E572E2033D1DF for ; Mon, 30 Apr 2018 07:28:15 -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=EPnjY7nyEC4ErQ4X1mZwODgknfsFUm2ftQnpn3qG+5E=; b=Kxe5b9Tx543XXa7zaw4YYZVlrRK+aNlk2Dtx27I+AomdRuhZzd6or7F9N2eD5mRUb46l4gDwDbHSNWx9mH0R/fH1GRzhuh+bFd+wtKpiM5sQknSckeLvm1xgic3CFPfTXJuml6Eb6Sbpito3g+m0eEe3tZX7nWCWs4+lC2lyE70= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Achin.Gupta@arm.com; Received: from e104320-lin (217.140.96.140) by AM0PR08MB2978.eurprd08.prod.outlook.com (2603:10a6:208:5b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.18; Mon, 30 Apr 2018 14:28:12 +0000 Date: Mon, 30 Apr 2018 15:29:41 +0100 From: Achin Gupta To: Supreeth Venkatesh Cc: edk2-devel@lists.01.org, michael.d.kinney@intel.com, liming.gao@intel.com, jiewen.yao@intel.com, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, nd@arm.com Message-ID: <20180430142941.GV663@e104320-lin> References: <20180406144223.10931-1-supreeth.venkatesh@arm.com> <20180406144223.10931-12-supreeth.venkatesh@arm.com> MIME-Version: 1.0 In-Reply-To: <20180406144223.10931-12-supreeth.venkatesh@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [217.140.96.140] X-ClientProxiedBy: DB6PR0601CA0042.eurprd06.prod.outlook.com (2603:10a6:4:17::28) To AM0PR08MB2978.eurprd08.prod.outlook.com (2603:10a6:208:5b::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB2978; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB2978; 3:sotoM/U1OGNWmsiqMEuVxHilbQyhMq65uZgNREd6TdxZBGb5QhgxmbfYsvr5DGLa38RuE86ukMZHr2iEL9qQ7dPx8dlQN0+IvQ+VzK0GqTPUxLI7Io0pBT7MgAV17XPfsvfCHoaw0lIy2ujGG93TyuVUWbq2vbwvCNlDD087bfW8nd9xKEaq9aZzuVv92WCRQRWg5G2f2x0oe0zNot8aeI6na/qhRTltK4xlr6oB1HVd6glPQEiVDZ12aWGIykE4; 25:3dqKIvjCyZUAbqbJK2tVM533MBFgdkoYNM7KWNplPsYS43LHcmHEm5BEk9Fn03Y6Vf9KiReausRRZcf+SeVbYhsa/WRBcmmxmmWcBM8Fvn9hySJlZdZUpcueURV8eWSF02lQE96dnhSXLuUiTdpKFKhJkD9r2V6+Lcx2i4HErCplcR3JTZQwTfJwm87ijbCS0DgHdOqCCfgI1MZseBWkOaSY9pDZ5hL66Ov8BYzjbjT3IuJhfbJntu6tYKSQQFWZOHOhfCS58cwPUoidg8AjamYoFX1OU3/yUPJ0DaXJKZ9GOojZwwFyuRnoyShmE73w7FdZH2vzuXlUW6WPT/wbVg==; 31:aEmuej9bsOsIrHsz25WTCLuZoYEsQI9XI8e5zJ6iUG+e9KFGtaqQAeyBbux+lBJ9dddX2QE8to0GD5RRqnsVUzOEUa7Pt+64VMLsZ6rN9r656GJzDaSkCIQtoG7xuVeWzAAbl1lYD70WnfE23X2cmP2uWmkds+M4Vqx1Q9eyo/pGOv1xarCnJ3GN5MrghtiDHcxXEU+armjxnBPqSEo2MFbUYxNPeGSp1pSExzlPt28= X-MS-TrafficTypeDiagnostic: AM0PR08MB2978: NoDisclaimer: True X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB2978; 20:31PBw4VFofJDVCCsLlY1blKzNO8MKJQYi77dmXZdzSYbEzW+D00wrAVLpFUCTJY8Sogi5p4STrTC1EBi3jp6V8lflKo5q2HSG00kNkDOj+04OO05oRN0QsN11hITD95Bk+cMa2q+OcZadAUmg7TLy1dLH12e0YU4phbNvhnLVY0fmSEXF98e1l2GmEH+QtHYCR4qltbOUo8nJr0K3bCfpAvhFHEOTXiq6wPiFZeQm3pWasw8bO/VNWfGnyq8xdVk; 4:5YrdSgPu8JNNQd9ltpWmGRaet8/+1nkMtxu2IbrCS6sWqZ+sns/HEtRZD8Vybm6OfjYwN6Q8rkE02rPl6S/UaiIItgo8mwUEzcfTyW6BjA3gNz46rn5NfGfvkiRB9tlbByP3gL4f1CBrVXwCsel+n1gtq8AGH9zPq3oeaek/2Yf6b18r6oodY15q/f7OY+GCC9DeJFSNxhZUUF3YYrxESIehccYiJJQrfRNLJITGnkUmHJK4vMzwHSwpGZz0mFrywO3BYmJjLX4qzs3Ep/JQ5Nd3xcNmjRv60lQA0Y3uO5x+Vwna7aPn2iPDpd5MAw9M X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231254)(944501410)(52105095)(6055026)(6041310)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:AM0PR08MB2978; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB2978; X-Forefront-PRVS: 0658BAF71F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6029001)(346002)(376002)(39380400002)(39860400002)(396003)(366004)(189003)(199004)(55016002)(11346002)(33896004)(6496006)(486006)(966005)(4326008)(6306002)(26005)(316002)(16586007)(106356001)(66066001)(6246003)(50466002)(97736004)(44832011)(59450400001)(25786009)(476003)(446003)(53376002)(956004)(478600001)(9686003)(72206003)(52116002)(53936002)(86362001)(76176011)(6862004)(305945005)(7736002)(33656002)(5660300001)(386003)(23726003)(6116002)(68736007)(3846002)(16526019)(1076002)(229853002)(81166006)(16799955002)(15188155005)(8936002)(6636002)(6666003)(105586002)(58126008)(81156014)(8676002)(33716001)(47776003)(2906002)(18370500001)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR08MB2978; H:e104320-lin; 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-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR08MB2978; 23:4Wb4iu7Uq4KWtzyK/Fj8t8S1GO439h0zRprT9CfyC?= =?us-ascii?Q?4YyCC9rw8SMZ7d8SI1LedsYhls/7wIYXSi/Jtfm/98PRsao+xdcOrLv8nY3C?= =?us-ascii?Q?hK64sKuuNwz0jAIjPsi7m2uraOA0lHs1rrlqvHhSdObPDtFw4ieHhNok2LqQ?= =?us-ascii?Q?k1Yo6FUqMkxMr9AAlqV/YUk/sL/Z5KlyAFrtYaXVRO3VA22hE68uZ7o+W3mB?= =?us-ascii?Q?psbhb7ZnooI598ccPfxjILrqpTybG9uV987HWOCopFH+qF1OuqcZogW6r3iq?= =?us-ascii?Q?VWeZ4dFit7XkwUCjrXt2idwOqMrqdzi2XbJmd67MBk0WXNcOrq7QbWOEzB+X?= =?us-ascii?Q?HUOFCBHLMwt/tTSb3b1u5zC8+uzl2BKo5jjP6K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7FTb2zHoofPf6WKP8YrSLJiN5uvmVCCQDf4mAcz8BFilwBstMYEpymvmTRHGCANKeSk+d6KNMYfUPG6T1HIlllA6zS2JFeZwZG9X1WL73R+JBM72UJoCC9DG/KgjwRsyiXEAZohHbuw1X3djg+d90Z6g4=; 24:SFYd1uI3bReHxEHZ26JkP+Y2Z8Ijyp4PcV/vibCh7oHyceCeeMxW7WfIttzuU50aC+iUvo3axMBBx+mYWI5Ax42Env7dfsVioZRMA7uV9gI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB2978; 7:V1PuGui0WGJ7jUDY7SkEouSszlV77pLAROeaHxBVEON7GB56VC7hGNlI7Lh6WmLEAdQd2p+8b+lvLOK/ll7gjjp2UkrGbKP3x2KzJH5D4Dv/GwfDrzNs3SbuM1uH4aMyt8NPnD4jGT+sgfvMuvmGnw8DSWQvLzKNeDpNElURjKxwfdRLsPl98BTatJISIH7alUye++ueDgKnLmewVzQRjEI0aL5u/ny1/xhOwd1UTuu2x53hndbfDuW6DgfV0pB6 X-MS-Office365-Filtering-Correlation-Id: 25baa378-06ee-4883-2fdd-08d5aea69b21 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2018 14:28:12.9022 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 25baa378-06ee-4883-2fdd-08d5aea69b21 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB2978 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: Mon, 30 Apr 2018 14:28:17 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Supreeth, Some of the DXE references will have to be removed and copyright years need to be updated. If that sounds reasonable then.. 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/StandaloneMmDriverEntryPoint.c > create mode 100644 StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.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 IMPLIED. > + > +**/ > + > +#ifndef __MODULE_ENTRY_POINT_H__ > +#define __MODULE_ENTRY_POINT_H__ > + > +/// > +///Declare the PI Specification Revision that this driver requires to execute 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 ProcessModuleUnloadList(). > + 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 Driver, 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 than SystemTable->Hdr.Revision. > + @retval Other Return value from ProcessModuleEntryPointList(). > + > +**/ > +EFI_STATUS > +EFIAPI > +_ModuleEntryPoint ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_MM_SYSTEM_TABLE *MmSystemTable > + ); > + > + > +/** > + Required by the EBC compiler and identical in functionality to _ModuleEntryPoint(). > + > + This function is required to call _ModuleEntryPoint() passing in ImageHandle, and SystemTable. > + > + @param ImageHandle The image handle of the DXE Driver, DXE Runtime Driver, 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 than SystemTable->Hdr.Revision. > + @retval Other Return value from ProcessModuleEntryPointList(). > +**/ > +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 > + instances own dependencies. > + > + @param ImageHandle The image handle of the DXE Driver, DXE Runtime Driver, 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 destructors in the proper order based upon each of the library instances own dependencies. > + > + @param ImageHandle The image handle of the DXE Driver, DXE Runtime Driver, 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 them in a specified order. > + > + @param ImageHandle The image handle of the DXE Driver, DXE Runtime Driver, 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 executed normally. > + @retval !EFI_SUCCESS The DXE Driver, DXE Runtime Driver, DXE SMM Driver, 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/StandaloneMmDriverEntryPoint.c b/StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.c > new file mode 100644 > index 0000000000..84b3d9cd08 > --- /dev/null > +++ b/StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.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 IMPLIED. > + > +**/ > + > + > + > +#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 ProcessModuleUnloadList(). > + 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 Driver, > + 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 than > + SystemTable->Hdr.Revision. > + @retval Other Return value from ProcessModuleEntryPointList(). > + > +**/ > +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 = 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/StandaloneMmDriverEntryPoint.inf b/StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf > new file mode 100644 > index 0000000000..564a3f14c8 > --- /dev/null > +++ b/StandaloneMmPkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.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 EXPRESS OR IMPLIED. > +# > +# > +## > + > +[Defines] > + INF_VERSION = 0x0001001A > + BASE_NAME = StandaloneMmDriverEntryPoint > + FILE_GUID = BBC33478-98F8-4B78-B29D-574D681B7E43 > + MODULE_TYPE = MM_STANDALONE > + VERSION_STRING = 1.0 > + PI_SPECIFICATION_VERSION = 0x00010032 > + LIBRARY_CLASS = StandaloneMmDriverEntryPoint|MM_STANDALONE > + > +# > +# The following information is for reference only and not required by the build tools. > +# > +# VALID_ARCHITECTURES = IA32 X64 IPF EBC > +# > + > +[Sources] > + StandaloneMmDriverEntryPoint.c > + > +[Packages] > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + BaseLib > + DebugLib > + > -- > 2.16.2 >