2 SMM driver instance of SmiHandlerProfile Library.
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Library/SmiHandlerProfileLib.h>
11 #include <Library/SmmServicesTableLib.h>
12 #include <Guid/SmiHandlerProfile.h>
14 SMI_HANDLER_PROFILE_PROTOCOL
*mSmiHandlerProfile
;
17 This function is called by SmmChildDispatcher module to report
18 a new SMI handler is registered, to SmmCore.
20 @param HandlerGuid The GUID to identify the type of the handler.
21 For the SmmChildDispatch protocol, the HandlerGuid
22 must be the GUID of SmmChildDispatch protocol.
23 @param Handler The SMI handler.
24 @param CallerAddress The address of the module who registers the SMI handler.
25 @param Context The context of the SMI handler.
26 For the SmmChildDispatch protocol, the Context
27 must match the one defined for SmmChildDispatch protocol.
28 @param ContextSize The size of the context in bytes.
29 For the SmmChildDispatch protocol, the Context
30 must match the one defined for SmmChildDispatch protocol.
32 @retval EFI_SUCCESS The information is recorded.
33 @retval EFI_UNSUPPORTED The feature is unsupported.
34 @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information.
38 SmiHandlerProfileRegisterHandler (
39 IN EFI_GUID
*HandlerGuid
,
40 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
41 IN PHYSICAL_ADDRESS CallerAddress
,
42 IN VOID
*Context
, OPTIONAL
43 IN UINTN ContextSize OPTIONAL
46 if (mSmiHandlerProfile
!= NULL
) {
47 return mSmiHandlerProfile
->RegisterHandler (mSmiHandlerProfile
, HandlerGuid
, Handler
, CallerAddress
, Context
, ContextSize
);
49 return EFI_UNSUPPORTED
;
53 This function is called by SmmChildDispatcher module to report
54 an existing SMI handler is unregistered, to SmmCore.
56 @param HandlerGuid The GUID to identify the type of the handler.
57 For the SmmChildDispatch protocol, the HandlerGuid
58 must be the GUID of SmmChildDispatch protocol.
59 @param Handler The SMI handler.
60 @param Context The context of the SMI handler.
61 If it is NOT NULL, it will be used to check what is registered.
62 @param ContextSize The size of the context in bytes.
63 If Context is NOT NULL, it will be used to check what is registered.
65 @retval EFI_SUCCESS The original record is removed.
66 @retval EFI_UNSUPPORTED The feature is unsupported.
67 @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler.
71 SmiHandlerProfileUnregisterHandler (
72 IN EFI_GUID
*HandlerGuid
,
73 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
74 IN VOID
*Context
, OPTIONAL
75 IN UINTN ContextSize OPTIONAL
78 if (mSmiHandlerProfile
!= NULL
) {
79 return mSmiHandlerProfile
->UnregisterHandler (mSmiHandlerProfile
, HandlerGuid
, Handler
, Context
, ContextSize
);
81 return EFI_UNSUPPORTED
;
85 The constructor function for SMI handler profile.
87 @param ImageHandle The firmware allocated handle for the EFI image.
88 @param SystemTable A pointer to the EFI System Table.
90 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
94 SmmSmiHandlerProfileLibConstructor (
95 IN EFI_HANDLE ImageHandle
,
96 IN EFI_SYSTEM_TABLE
*SystemTable
99 gSmst
->SmmLocateProtocol (
100 &gSmiHandlerProfileGuid
,
102 (VOID
**) &mSmiHandlerProfile