MdePkg/Include: Add SmiHandlerProfileLib.h
[mirror_edk2.git] / MdePkg / Include / Library / SmiHandlerProfileLib.h
1 /** @file
2 Provides services to log the SMI handler registration.
3
4 This API provides services for the SMM Child Dispatch Protocols provider,
5 to register SMI handler information to SmmCore.
6
7 NOTE:
8 There is no need to update the consumers of SMST->SmiHandlerRegister() or
9 the consumers of SMM Child Dispatch Protocols.
10 The SmmCore (who produces SMST) should have ability to register such
11 information directly.
12 The SmmChildDispatcher (who produces SMM Child Dispatch Protocols) should
13 be responsible to call the services to register information to SMM Core.
14
15 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
16 This program and the accompanying materials
17 are licensed and made available under the terms and conditions of the BSD License
18 which accompanies this distribution. The full text of the license may be found at
19 http://opensource.org/licenses/bsd-license.php
20
21 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
22 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23
24 **/
25
26 #ifndef __SMI_HANDLER_PROFILE_LIB_H__
27 #define __SMI_HANDLER_PROFILE_LIB_H__
28
29 #include <PiSmm.h>
30
31 /**
32 This function is called by SmmChildDispatcher module to report
33 a new SMI handler is registered, to SmmCore.
34
35 @param HandlerGuid The GUID to identify the type of the handler.
36 For the SmmChildDispatch protocol, the HandlerGuid
37 must be the GUID of SmmChildDispatch protocol.
38 @param Handler The SMI handler.
39 @param CallerAddress The address of the module who registers the SMI handler.
40 @param Context The context of the SMI handler.
41 For the SmmChildDispatch protocol, the Context
42 must match the one defined for SmmChildDispatch protocol.
43 @param ContextSize The size of the context in bytes.
44 For the SmmChildDispatch protocol, the Context
45 must match the one defined for SmmChildDispatch protocol.
46
47 @retval EFI_SUCCESS The information is recorded.
48 @retval EFI_UNSUPPORTED The feature is unsupported.
49 @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information.
50 **/
51 EFI_STATUS
52 EFIAPI
53 SmiHandlerProfileRegisterHandler (
54 IN EFI_GUID *HandlerGuid,
55 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
56 IN PHYSICAL_ADDRESS CallerAddress,
57 IN VOID *Context, OPTIONAL
58 IN UINTN ContextSize OPTIONAL
59 );
60
61 /**
62 This function is called by SmmChildDispatcher module to report
63 an existing SMI handler is unregistered, to SmmCore.
64
65 @param HandlerGuid The GUID to identify the type of the handler.
66 For the SmmChildDispatch protocol, the HandlerGuid
67 must be the GUID of SmmChildDispatch protocol.
68 @param Handler The SMI handler.
69
70 @retval EFI_SUCCESS The original record is removed.
71 @retval EFI_UNSUPPORTED The feature is unsupported.
72 @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler.
73 **/
74 EFI_STATUS
75 EFIAPI
76 SmiHandlerProfileUnregisterHandler (
77 IN EFI_GUID *HandlerGuid,
78 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
79 );
80
81 #endif