From: "Wu, Hao A" <hao.a.wu@intel.com>
To: Kun Qin <kun.q@outlook.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Wang, Jian J" <jian.j.wang@intel.com>,
"Dong, Eric" <eric.dong@intel.com>, "Ni, Ray" <ray.ni@intel.com>
Subject: Re: [PATCH v4 11/20] MdeModulePkg: SmmSmiHandlerProfileLib: Support StandaloneMm Instance
Date: Wed, 27 Jan 2021 00:56:34 +0000 [thread overview]
Message-ID: <BN8PR11MB366657361FE7A6A1E0AD2197CABB9@BN8PR11MB3666.namprd11.prod.outlook.com> (raw)
In-Reply-To: <MWHPR06MB310213F9533FB01BD3505455F3BC9@MWHPR06MB3102.namprd06.prod.outlook.com>
> -----Original Message-----
> From: Kun Qin <kun.q@outlook.com>
> Sent: Wednesday, January 27, 2021 3:47 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>;
> Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>
> Subject: [PATCH v4 11/20] MdeModulePkg: SmmSmiHandlerProfileLib:
> Support StandaloneMm Instance
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3185
>
> This change added support of SMI handler profile library router under
> StandaloneMm. This change replaces gSmst with gMmst. It also abstracts
> standalone and traditional MM driver entrypoints into separate files to allow
> maximal common implementations.
>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
>
> Signed-off-by: Kun Qin <kun.q@outlook.com>
> ---
>
> Notes:
> v4:
> - Newly created for SmmSmiHandlerProfileLib coverage.
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
>
>
> MdeModulePkg/Library/SmmSmiHandlerProfileLib/{SmmSmiHandlerProfileL
> ib.c => MmSmiHandlerProfileLib.c} | 20 ++---
>
> MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfileLi
> b.c | 90 ++------------------
>
> MdeModulePkg/Library/SmmSmiHandlerProfileLib/StandaloneMmSmiHandl
> erProfileLib.c | 31 +++++++
>
> MdeModulePkg/Library/SmmSmiHandlerProfileLib/MmSmiHandlerProfileLib
> .h | 23 +++++
>
> MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfileLi
> b.inf | 4 +-
>
> MdeModulePkg/Library/SmmSmiHandlerProfileLib/StandaloneMmSmiHandl
> erProfileLib.inf | 44 ++++++++++
> MdeModulePkg/MdeModulePkg.dsc | 1
> +
> 7 files changed, 117 insertions(+), 96 deletions(-)
>
> diff --git
> a/MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfile
> Lib.c
> b/MdeModulePkg/Library/SmmSmiHandlerProfileLib/MmSmiHandlerProfile
> Lib.c
> similarity index 86%
> copy from
> MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfileLi
> b.c
> copy to
> MdeModulePkg/Library/SmmSmiHandlerProfileLib/MmSmiHandlerProfileLib
> .c
> index b76e8f0dc132..f800220b549c 100644
> ---
> a/MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfile
> Lib.c
> +++
> b/MdeModulePkg/Library/SmmSmiHandlerProfileLib/MmSmiHandlerProfile
> Li
> +++ b.c
> @@ -1,14 +1,15 @@
> /** @file
> - SMM driver instance of SmiHandlerProfile Library.
> + MM driver instance of SmiHandlerProfile Library.
>
> Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) Microsoft Corporation.
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> **/
>
> -#include <PiSmm.h>
> +#include <PiMm.h>
> #include <Library/SmiHandlerProfileLib.h> -#include
> <Library/SmmServicesTableLib.h>
> +#include <Library/MmServicesTableLib.h>
> #include <Guid/SmiHandlerProfile.h>
>
> SMI_HANDLER_PROFILE_PROTOCOL *mSmiHandlerProfile; @@ -82,21
> +83,16 @@ SmiHandlerProfileUnregisterHandler ( }
>
> /**
> - The constructor function for SMI handler profile.
> -
> - @param ImageHandle The firmware allocated handle for the EFI image.
> - @param SystemTable A pointer to the EFI System Table.
> + The common constructor function for SMI handler profile.
>
> @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
> **/
> EFI_STATUS
> -EFIAPI
> -SmmSmiHandlerProfileLibConstructor (
> - IN EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE *SystemTable
> +MmSmiHandlerProfileLibInitialization (
> + VOID
> )
> {
> - gSmst->SmmLocateProtocol (
> + gMmst->MmLocateProtocol (
> &gSmiHandlerProfileGuid,
> NULL,
> (VOID **) &mSmiHandlerProfile diff --git
> a/MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfile
> Lib.c
> b/MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfil
> eLib.c
> index b76e8f0dc132..0167d81b880d 100644
> ---
> a/MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfile
> Lib.c
> +++
> b/MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfil
> eL
> +++ ib.c
> @@ -2,87 +2,17 @@
> SMM driver instance of SmiHandlerProfile Library.
>
> Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) Microsoft Corporation.
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> **/
>
> -#include <PiSmm.h>
> -#include <Library/SmiHandlerProfileLib.h> -#include
> <Library/SmmServicesTableLib.h> -#include <Guid/SmiHandlerProfile.h>
> +#include <PiMm.h>
>
> -SMI_HANDLER_PROFILE_PROTOCOL *mSmiHandlerProfile;
> +#include "MmSmiHandlerProfileLib.h"
>
> /**
> - This function is called by SmmChildDispatcher module to report
> - a new SMI handler is registered, to SmmCore.
> -
> - @param HandlerGuid The GUID to identify the type of the handler.
> - For the SmmChildDispatch protocol, the HandlerGuid
> - must be the GUID of SmmChildDispatch protocol.
> - @param Handler The SMI handler.
> - @param CallerAddress The address of the module who registers the SMI
> handler.
> - @param Context The context of the SMI handler.
> - For the SmmChildDispatch protocol, the Context
> - must match the one defined for SmmChildDispatch protocol.
> - @param ContextSize The size of the context in bytes.
> - For the SmmChildDispatch protocol, the Context
> - must match the one defined for SmmChildDispatch protocol.
> -
> - @retval EFI_SUCCESS The information is recorded.
> - @retval EFI_UNSUPPORTED The feature is unsupported.
> - @retval EFI_OUT_OF_RESOURCES There is no enough resource to record
> the information.
> -**/
> -EFI_STATUS
> -EFIAPI
> -SmiHandlerProfileRegisterHandler (
> - IN EFI_GUID *HandlerGuid,
> - IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
> - IN PHYSICAL_ADDRESS CallerAddress,
> - IN VOID *Context, OPTIONAL
> - IN UINTN ContextSize OPTIONAL
> - )
> -{
> - if (mSmiHandlerProfile != NULL) {
> - return mSmiHandlerProfile->RegisterHandler (mSmiHandlerProfile,
> HandlerGuid, Handler, CallerAddress, Context, ContextSize);
> - }
> - return EFI_UNSUPPORTED;
> -}
> -
> -/**
> - This function is called by SmmChildDispatcher module to report
> - an existing SMI handler is unregistered, to SmmCore.
> -
> - @param HandlerGuid The GUID to identify the type of the handler.
> - For the SmmChildDispatch protocol, the HandlerGuid
> - must be the GUID of SmmChildDispatch protocol.
> - @param Handler The SMI handler.
> - @param Context The context of the SMI handler.
> - If it is NOT NULL, it will be used to check what is registered.
> - @param ContextSize The size of the context in bytes.
> - If Context is NOT NULL, it will be used to check what is
> registered.
> -
> - @retval EFI_SUCCESS The original record is removed.
> - @retval EFI_UNSUPPORTED The feature is unsupported.
> - @retval EFI_NOT_FOUND There is no record for the HandlerGuid and
> handler.
> -**/
> -EFI_STATUS
> -EFIAPI
> -SmiHandlerProfileUnregisterHandler (
> - IN EFI_GUID *HandlerGuid,
> - IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
> - IN VOID *Context, OPTIONAL
> - IN UINTN ContextSize OPTIONAL
> - )
> -{
> - if (mSmiHandlerProfile != NULL) {
> - return mSmiHandlerProfile->UnregisterHandler (mSmiHandlerProfile,
> HandlerGuid, Handler, Context, ContextSize);
> - }
> - return EFI_UNSUPPORTED;
> -}
> -
> -/**
> - The constructor function for SMI handler profile.
> + The constructor function for traditional MM SMI handler profile.
>
> @param ImageHandle The firmware allocated handle for the EFI image.
> @param SystemTable A pointer to the EFI System Table.
> @@ -92,15 +22,9 @@ SmiHandlerProfileUnregisterHandler ( EFI_STATUS
> EFIAPI SmmSmiHandlerProfileLibConstructor (
> - IN EFI_HANDLE ImageHandle,
> - IN EFI_SYSTEM_TABLE *SystemTable
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE *SystemTable
> )
> {
> - gSmst->SmmLocateProtocol (
> - &gSmiHandlerProfileGuid,
> - NULL,
> - (VOID **) &mSmiHandlerProfile
> - );
> - return EFI_SUCCESS;
> + return MmSmiHandlerProfileLibInitialization ();
> }
> -
> diff --git
> a/MdeModulePkg/Library/SmmSmiHandlerProfileLib/StandaloneMmSmiHan
> dlerProfileLib.c
> b/MdeModulePkg/Library/SmmSmiHandlerProfileLib/StandaloneMmSmiHan
> dlerProfileLib.c
> new file mode 100644
> index 000000000000..a7714390e5b1
> --- /dev/null
> +++
> b/MdeModulePkg/Library/SmmSmiHandlerProfileLib/StandaloneMmSmiHan
> dle
> +++ rProfileLib.c
> @@ -0,0 +1,31 @@
> +/** @file
> + Standalone MM driver instance of SmiHandlerProfile Library.
> +
> + Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) Microsoft Corporation.
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <PiMm.h>
> +
> +#include "MmSmiHandlerProfileLib.h"
> +
> +/**
> + The constructor function for standalone MM SMI handler profile.
> +
> + @param ImageHandle The firmware allocated handle for the EFI image.
> + @param SystemTable A pointer to the EFI System Table.
> +
> + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
> +**/
> +EFI_STATUS
> +EFIAPI
> +StandaloneMmSmiHandlerProfileLibConstructor (
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_MM_SYSTEM_TABLE *SystemTable
> + )
> +{
> + return MmSmiHandlerProfileLibInitialization (); }
> +
> diff --git
> a/MdeModulePkg/Library/SmmSmiHandlerProfileLib/MmSmiHandlerProfileL
> ib.h
> b/MdeModulePkg/Library/SmmSmiHandlerProfileLib/MmSmiHandlerProfile
> Lib.h
> new file mode 100644
> index 000000000000..8e390590ee7b
> --- /dev/null
> +++
> b/MdeModulePkg/Library/SmmSmiHandlerProfileLib/MmSmiHandlerProfile
> Li
> +++ b.h
> @@ -0,0 +1,23 @@
> +/** @file
> + MM driver instance of SmiHandlerProfile Library.
> +
> + Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) Microsoft Corporation.
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef _MM_SMI_HANDLER_PROFILE_LIB_H_
> +#define _MM_SMI_HANDLER_PROFILE_LIB_H_
> +
> +/**
> + The common constructor function for SMI handler profile.
> +
> + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
> +**/
> +EFI_STATUS
> +MmSmiHandlerProfileLibInitialization (
> + VOID
> + );
> +
> +#endif //_SMM_SMI_HANDLER_PROFILE_LIB_H_
> diff --git
> a/MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfile
> Lib.inf
> b/MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfil
> eLib.inf
> index 1d738c7087c6..56007d502134 100644
> ---
> a/MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfile
> Lib.inf
> +++
> b/MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfil
> eL
> +++ ib.inf
> @@ -27,6 +27,8 @@ [Defines]
> #
>
> [Sources]
> + MmSmiHandlerProfileLib.c
> + MmSmiHandlerProfileLib.h
> SmmSmiHandlerProfileLib.c
>
> [Packages]
> @@ -34,7 +36,7 @@ [Packages]
> MdeModulePkg/MdeModulePkg.dec
>
> [LibraryClasses]
> - SmmServicesTableLib
> + MmServicesTableLib
>
> [Guids]
> gSmiHandlerProfileGuid ## CONSUMES ## GUID # Locate protocol
> diff --git
> a/MdeModulePkg/Library/SmmSmiHandlerProfileLib/StandaloneMmSmiHan
> dlerProfileLib.inf
> b/MdeModulePkg/Library/SmmSmiHandlerProfileLib/StandaloneMmSmiHan
> dlerProfileLib.inf
> new file mode 100644
> index 000000000000..a885cc2b2ae1
> --- /dev/null
> +++
> b/MdeModulePkg/Library/SmmSmiHandlerProfileLib/StandaloneMmSmiHan
> dle
> +++ rProfileLib.inf
> @@ -0,0 +1,44 @@
> +## @file
> +# Standalone MM driver instance of SmiHandlerProfile Library.
> +#
> +# This library instance provides real functionality for SmmChildDispatcher
> module.
> +#
> +# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> #
> +Copyright (c) Microsoft Corporation.
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent # # ##
> +
> +[Defines]
> + INF_VERSION = 0x00010005
> + BASE_NAME = StandaloneMmSmiHandlerProfileLib
> + FILE_GUID = 1F2ED27B-A01D-4867-B993-9B710E5926C5
> + MODULE_TYPE = MM_STANDALONE
> + VERSION_STRING = 1.0
> + PI_SPECIFICATION_VERSION = 0x10000032
> + LIBRARY_CLASS = SmiHandlerProfileLib|MM_STANDALONE
> + CONSTRUCTOR =
> StandaloneMmSmiHandlerProfileLibConstructor
> +
> +#
> +# The following information is for reference only and not required by the
> build tools.
> +#
> +# VALID_ARCHITECTURES = IA32 X64
> +#
> +
> +[Sources]
> + MmSmiHandlerProfileLib.c
> + MmSmiHandlerProfileLib.h
> + StandaloneMmSmiHandlerProfileLib.c
> +
> +[Packages]
> + MdePkg/MdePkg.dec
> + MdeModulePkg/MdeModulePkg.dec
> +
> +[LibraryClasses]
> + MmServicesTableLib
> +
> +[Guids]
> + gSmiHandlerProfileGuid ## CONSUMES ## GUID # Locate protocol
> +
> diff --git a/MdeModulePkg/MdeModulePkg.dsc
> b/MdeModulePkg/MdeModulePkg.dsc index f95c7cd69ee1..7ca4a1bb3080
> 100644
> --- a/MdeModulePkg/MdeModulePkg.dsc
> +++ b/MdeModulePkg/MdeModulePkg.dsc
> @@ -492,6 +492,7 @@ [Components.IA32, Components.X64]
>
> MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxStandaloneMmLib.inf
>
> MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformH
> ookLibNull.inf
>
> MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfileLi
> b.inf
> +
> +
> MdeModulePkg/Library/SmmSmiHandlerProfileLib/StandaloneMmSmiHandl
> erPro
> + fileLib.inf
>
> MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDeco
> mpressLib.inf
>
> MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutor
> Dxe.inf
> MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
> --
> 2.30.0.windows.1
next prev parent reply other threads:[~2021-01-27 0:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210126194710.2248-1-kun.q@outlook.com>
2021-01-26 19:46 ` [PATCH v4 04/20] StandaloneMmPkg: StandaloneMmCoreMemoryAllocationLib: Fix compiler warning Kun Qin
2021-01-26 19:46 ` [PATCH v4 05/20] StandaloneMmPkg: StandaloneMmMemLib: Extends support for X64 architecture Kun Qin
2021-01-26 19:46 ` [PATCH v4 06/20] MdeModulePkg: SmmLockBoxSmmLib: Support StandaloneMm for SmmLockBoxLib Kun Qin
2021-01-26 19:46 ` [PATCH v4 07/20] MdeModulePkg: SmmReportStatusCodeLib: ReportStatusCodeLib in StandaloneMm Kun Qin
2021-01-26 19:46 ` [PATCH v4 08/20] MdeModulePkg: StatusCodeHandler: StatusCodeHandler driver " Kun Qin
2021-01-26 19:46 ` [PATCH v4 09/20] MdeModulePkg: FirmwarePerformanceDataTable: Added StandaloneMm support Kun Qin
2021-01-26 19:47 ` [PATCH v4 10/20] MdeModulePkg: ReportStatusCodeRouter: Support StandaloneMm RSC Router Kun Qin
2021-01-26 19:47 ` [PATCH v4 11/20] MdeModulePkg: SmmSmiHandlerProfileLib: Support StandaloneMm Instance Kun Qin
2021-01-27 0:56 ` Wu, Hao A [this message]
2021-01-26 19:47 ` [PATCH v4 12/20] MdePkg: UefiDevicePathLib: Support UefiDevicePathLib under StandaloneMm Kun Qin
2021-01-26 19:47 ` [PATCH v4 13/20] PcAtChipsetPkg: AcpiTimerLib: Added StandaloneMm instance of AcpiTimerLib Kun Qin
2021-01-26 19:47 ` [PATCH v4 14/20] SecurityPkg: Tcg2PhysicalPresenceLib: Introduce StandaloneMm instance Kun Qin
2021-01-26 19:47 ` [PATCH v4 15/20] SecurityPkg: Tcg2PpVendorLibNull: Added support for MM_STANDALONE type Kun Qin
2021-01-26 19:47 ` [PATCH v4 16/20] SecurityPkg: Tpm2DeviceLibDTpm: Introduce StandaloneMm instance Kun Qin
2021-01-26 19:47 ` [PATCH v4 17/20] UefiCpuPkg: CpuIo2Smm: Move CpuIo2Smm driver to consume gMmst Kun Qin
2021-01-26 19:47 ` [PATCH v4 18/20] UefiCpuPkg: CpuIo2Smm: Abstract SMM specific functions into separate file Kun Qin
2021-01-29 7:06 ` Ni, Ray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BN8PR11MB366657361FE7A6A1E0AD2197CABB9@BN8PR11MB3666.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox