2 SMM driver instance of SmiHandlerProfile Library.
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <Library/SmiHandlerProfileLib.h>
17 #include <Library/SmmServicesTableLib.h>
18 #include <Guid/SmiHandlerProfile.h>
20 SMI_HANDLER_PROFILE_PROTOCOL
*mSmiHandlerProfile
;
23 This function is called by SmmChildDispatcher module to report
24 a new SMI handler is registered, to SmmCore.
26 @param HandlerGuid The GUID to identify the type of the handler.
27 For the SmmChildDispatch protocol, the HandlerGuid
28 must be the GUID of SmmChildDispatch protocol.
29 @param Handler The SMI handler.
30 @param CallerAddress The address of the module who registers the SMI handler.
31 @param Context The context of the SMI handler.
32 For the SmmChildDispatch protocol, the Context
33 must match the one defined for SmmChildDispatch protocol.
34 @param ContextSize The size of the context in bytes.
35 For the SmmChildDispatch protocol, the Context
36 must match the one defined for SmmChildDispatch protocol.
38 @retval EFI_SUCCESS The information is recorded.
39 @retval EFI_UNSUPPORTED The feature is unsupported.
40 @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information.
44 SmiHandlerProfileRegisterHandler (
45 IN EFI_GUID
*HandlerGuid
,
46 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
47 IN PHYSICAL_ADDRESS CallerAddress
,
48 IN VOID
*Context
, OPTIONAL
49 IN UINTN ContextSize OPTIONAL
52 if (mSmiHandlerProfile
!= NULL
) {
53 return mSmiHandlerProfile
->RegisterHandler (mSmiHandlerProfile
, HandlerGuid
, Handler
, CallerAddress
, Context
, ContextSize
);
55 return EFI_UNSUPPORTED
;
59 This function is called by SmmChildDispatcher module to report
60 an existing SMI handler is unregistered, to SmmCore.
62 @param HandlerGuid The GUID to identify the type of the handler.
63 For the SmmChildDispatch protocol, the HandlerGuid
64 must be the GUID of SmmChildDispatch protocol.
65 @param Handler The SMI handler.
66 @param Context The context of the SMI handler.
67 If it is NOT NULL, it will be used to check what is registered.
68 @param ContextSize The size of the context in bytes.
69 If Context is NOT NULL, it will be used to check what is registered.
71 @retval EFI_SUCCESS The original record is removed.
72 @retval EFI_UNSUPPORTED The feature is unsupported.
73 @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler.
77 SmiHandlerProfileUnregisterHandler (
78 IN EFI_GUID
*HandlerGuid
,
79 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
80 IN VOID
*Context
, OPTIONAL
81 IN UINTN ContextSize OPTIONAL
84 if (mSmiHandlerProfile
!= NULL
) {
85 return mSmiHandlerProfile
->UnregisterHandler (mSmiHandlerProfile
, HandlerGuid
, Handler
, Context
, ContextSize
);
87 return EFI_UNSUPPORTED
;
91 The constructor function for SMI handler profile.
93 @param ImageHandle The firmware allocated handle for the EFI image.
94 @param SystemTable A pointer to the EFI System Table.
96 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
100 SmmSmiHandlerProfileLibConstructor (
101 IN EFI_HANDLE ImageHandle
,
102 IN EFI_SYSTEM_TABLE
*SystemTable
105 gSmst
->SmmLocateProtocol (
106 &gSmiHandlerProfileGuid
,
108 (VOID
**) &mSmiHandlerProfile