]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfileLib.c
ArmPkg/CpuDxe: remove VirtualUncachedPages protocol and implementation
[mirror_edk2.git] / MdeModulePkg / Library / SmmSmiHandlerProfileLib / SmmSmiHandlerProfileLib.c
CommitLineData
e08bfc7d
JY
1/** @file\r
2 SMM driver instance of SmiHandlerProfile Library.\r
3\r
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php.\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include <PiSmm.h>\r
16#include <Library/SmiHandlerProfileLib.h>\r
17#include <Library/SmmServicesTableLib.h>\r
18#include <Guid/SmiHandlerProfile.h>\r
19\r
20SMI_HANDLER_PROFILE_PROTOCOL *mSmiHandlerProfile;\r
21\r
22/**\r
23 This function is called by SmmChildDispatcher module to report\r
24 a new SMI handler is registered, to SmmCore.\r
25\r
26 @param HandlerGuid The GUID to identify the type of the handler.\r
27 For the SmmChildDispatch protocol, the HandlerGuid\r
28 must be the GUID of SmmChildDispatch protocol.\r
29 @param Handler The SMI handler.\r
30 @param CallerAddress The address of the module who registers the SMI handler.\r
31 @param Context The context of the SMI handler.\r
32 For the SmmChildDispatch protocol, the Context\r
33 must match the one defined for SmmChildDispatch protocol.\r
34 @param ContextSize The size of the context in bytes.\r
35 For the SmmChildDispatch protocol, the Context\r
36 must match the one defined for SmmChildDispatch protocol.\r
37\r
38 @retval EFI_SUCCESS The information is recorded.\r
39 @retval EFI_UNSUPPORTED The feature is unsupported.\r
40 @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information.\r
41**/\r
42EFI_STATUS\r
43EFIAPI\r
44SmiHandlerProfileRegisterHandler (\r
45 IN EFI_GUID *HandlerGuid,\r
46 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,\r
47 IN PHYSICAL_ADDRESS CallerAddress,\r
48 IN VOID *Context, OPTIONAL\r
49 IN UINTN ContextSize OPTIONAL\r
50 )\r
51{\r
52 if (mSmiHandlerProfile != NULL) {\r
53 return mSmiHandlerProfile->RegisterHandler (mSmiHandlerProfile, HandlerGuid, Handler, CallerAddress, Context, ContextSize);\r
54 }\r
55 return EFI_UNSUPPORTED;\r
56}\r
57\r
58/**\r
59 This function is called by SmmChildDispatcher module to report\r
60 an existing SMI handler is unregistered, to SmmCore.\r
61\r
62 @param HandlerGuid The GUID to identify the type of the handler.\r
63 For the SmmChildDispatch protocol, the HandlerGuid\r
64 must be the GUID of SmmChildDispatch protocol.\r
65 @param Handler The SMI handler.\r
66\r
67 @retval EFI_SUCCESS The original record is removed.\r
68 @retval EFI_UNSUPPORTED The feature is unsupported.\r
69 @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler.\r
70**/\r
71EFI_STATUS\r
72EFIAPI\r
73SmiHandlerProfileUnregisterHandler (\r
74 IN EFI_GUID *HandlerGuid,\r
75 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler\r
76 )\r
77{\r
78 if (mSmiHandlerProfile != NULL) {\r
79 return mSmiHandlerProfile->UnregisterHandler (mSmiHandlerProfile, HandlerGuid, Handler);\r
80 }\r
81 return EFI_UNSUPPORTED;\r
82}\r
83\r
84/**\r
85 The constructor function for SMI handler profile.\r
86\r
87 @param ImageHandle The firmware allocated handle for the EFI image.\r
88 @param SystemTable A pointer to the EFI System Table.\r
89\r
90 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r
91**/\r
92EFI_STATUS\r
93EFIAPI\r
94SmmSmiHandlerProfileLibConstructor (\r
95 IN EFI_HANDLE ImageHandle,\r
96 IN EFI_SYSTEM_TABLE *SystemTable\r
97 )\r
98{\r
99 gSmst->SmmLocateProtocol (\r
100 &gSmiHandlerProfileGuid,\r
101 NULL,\r
102 &mSmiHandlerProfile\r
103 );\r
104 return EFI_SUCCESS;\r
105}\r
106\r