2 MM driver instance of SmiHandlerProfile Library.
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
5 Copyright (c) Microsoft Corporation.
6 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Library/SmiHandlerProfileLib.h>
12 #include <Library/MmServicesTableLib.h>
13 #include <Guid/SmiHandlerProfile.h>
15 SMI_HANDLER_PROFILE_PROTOCOL
*mSmiHandlerProfile
;
18 This function is called by SmmChildDispatcher module to report
19 a new SMI handler is registered, to SmmCore.
21 @param HandlerGuid The GUID to identify the type of the handler.
22 For the SmmChildDispatch protocol, the HandlerGuid
23 must be the GUID of SmmChildDispatch protocol.
24 @param Handler The SMI handler.
25 @param CallerAddress The address of the module who registers the SMI handler.
26 @param Context The context of the SMI handler.
27 For the SmmChildDispatch protocol, the Context
28 must match the one defined for SmmChildDispatch protocol.
29 @param ContextSize The size of the context in bytes.
30 For the SmmChildDispatch protocol, the Context
31 must match the one defined for SmmChildDispatch protocol.
33 @retval EFI_SUCCESS The information is recorded.
34 @retval EFI_UNSUPPORTED The feature is unsupported.
35 @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information.
39 SmiHandlerProfileRegisterHandler (
40 IN EFI_GUID
*HandlerGuid
,
41 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
42 IN PHYSICAL_ADDRESS CallerAddress
,
43 IN VOID
*Context OPTIONAL
,
44 IN UINTN ContextSize OPTIONAL
47 if (mSmiHandlerProfile
!= NULL
) {
48 return mSmiHandlerProfile
->RegisterHandler (mSmiHandlerProfile
, HandlerGuid
, Handler
, CallerAddress
, Context
, ContextSize
);
50 return EFI_UNSUPPORTED
;
54 This function is called by SmmChildDispatcher module to report
55 an existing SMI handler is unregistered, to SmmCore.
57 @param HandlerGuid The GUID to identify the type of the handler.
58 For the SmmChildDispatch protocol, the HandlerGuid
59 must be the GUID of SmmChildDispatch protocol.
60 @param Handler The SMI handler.
61 @param Context The context of the SMI handler.
62 If it is NOT NULL, it will be used to check what is registered.
63 @param ContextSize The size of the context in bytes.
64 If Context is NOT NULL, it will be used to check what is registered.
66 @retval EFI_SUCCESS The original record is removed.
67 @retval EFI_UNSUPPORTED The feature is unsupported.
68 @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler.
72 SmiHandlerProfileUnregisterHandler (
73 IN EFI_GUID
*HandlerGuid
,
74 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
75 IN VOID
*Context OPTIONAL
,
76 IN UINTN ContextSize OPTIONAL
79 if (mSmiHandlerProfile
!= NULL
) {
80 return mSmiHandlerProfile
->UnregisterHandler (mSmiHandlerProfile
, HandlerGuid
, Handler
, Context
, ContextSize
);
82 return EFI_UNSUPPORTED
;
86 The common constructor function for SMI handler profile.
88 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
91 MmSmiHandlerProfileLibInitialization (
95 gMmst
->MmLocateProtocol (
96 &gSmiHandlerProfileGuid
,
98 (VOID
**) &mSmiHandlerProfile