2 Header file for SMI handler profile definition.
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef _SMI_HANDLER_PROFILE_H_
10 #define _SMI_HANDLER_PROFILE_H_
13 #include <Protocol/SmmGpiDispatch2.h>
14 #include <Protocol/SmmIoTrapDispatch2.h>
15 #include <Protocol/SmmPeriodicTimerDispatch2.h>
16 #include <Protocol/SmmPowerButtonDispatch2.h>
17 #include <Protocol/SmmStandbyButtonDispatch2.h>
18 #include <Protocol/SmmSwDispatch2.h>
19 #include <Protocol/SmmSxDispatch2.h>
20 #include <Protocol/SmmUsbDispatch2.h>
27 } SMM_CORE_DATABASE_COMMON_HEADER
;
29 #define SMM_CORE_IMAGE_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','I','D')
30 #define SMM_CORE_IMAGE_DATABASE_REVISION 0x0001
33 SMM_CORE_DATABASE_COMMON_HEADER Header
;
35 PHYSICAL_ADDRESS EntryPoint
;
36 PHYSICAL_ADDRESS ImageBase
;
39 UINT16 PdbStringOffset
;
42 } SMM_CORE_IMAGE_DATABASE_STRUCTURE
;
44 #define SMM_CORE_SMI_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','S','D')
45 #define SMM_CORE_SMI_DATABASE_REVISION 0x0001
48 SmmCoreSmiHandlerCategoryRootHandler
,
49 SmmCoreSmiHandlerCategoryGuidHandler
,
50 SmmCoreSmiHandlerCategoryHardwareHandler
,
51 } SMM_CORE_SMI_HANDLER_CATEGORY
;
54 // Context for SmmCoreSmiHandlerCategoryRootHandler:
56 // Context for SmmCoreSmiHandlerCategoryGuidHandler:
58 // Context for SmmCoreSmiHandlerCategoryHardwareHandler:
59 // (NOTE: The context field should NOT include any data pointer.)
60 // gEfiSmmSwDispatch2ProtocolGuid: (EFI_SMM_SW_REGISTER_CONTEXT => SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT)
61 // gEfiSmmSxDispatch2ProtocolGuid: EFI_SMM_SX_REGISTER_CONTEXT
62 // gEfiSmmPowerButtonDispatch2ProtocolGuid: EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT
63 // gEfiSmmStandbyButtonDispatch2ProtocolGuid: EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT
64 // gEfiSmmPeriodicTimerDispatch2ProtocolGuid: EFI_SMM_PERIODIC_TIMER_CONTEXT
65 // gEfiSmmGpiDispatch2ProtocolGuid: EFI_SMM_GPI_REGISTER_CONTEXT
66 // gEfiSmmIoTrapDispatch2ProtocolGuid: EFI_SMM_IO_TRAP_REGISTER_CONTEXT
67 // gEfiSmmUsbDispatch2ProtocolGuid: (EFI_SMM_USB_REGISTER_CONTEXT => SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT)
68 // Other: GUID specific
71 EFI_USB_SMI_TYPE Type
;
72 UINT32 DevicePathSize
;
73 // UINT8 DevicePath[DevicePathSize];
74 } SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT
;
77 UINT64 SwSmiInputValue
;
78 } SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT
;
83 PHYSICAL_ADDRESS CallerAddr
;
84 PHYSICAL_ADDRESS Handler
;
85 UINT16 ContextBufferOffset
;
87 UINT32 ContextBufferSize
;
88 // UINT8 ContextBuffer[];
89 } SMM_CORE_SMI_HANDLER_STRUCTURE
;
92 SMM_CORE_DATABASE_COMMON_HEADER Header
;
94 UINT32 HandlerCategory
;
96 // SMM_CORE_SMI_HANDLER_STRUCTURE Handler[HandlerCount];
97 } SMM_CORE_SMI_DATABASE_STRUCTURE
;
101 // +-------------------------------------+
102 // | SMM_CORE_IMAGE_DATABASE_STRUCTURE |
103 // +-------------------------------------+
104 // | SMM_CORE_SMI_DATABASE_STRUCTURE |
105 // +-------------------------------------+
109 // SMM_CORE dump command
111 #define SMI_HANDLER_PROFILE_COMMAND_GET_INFO 0x1
112 #define SMI_HANDLER_PROFILE_COMMAND_GET_DATA_BY_OFFSET 0x2
118 } SMI_HANDLER_PROFILE_PARAMETER_HEADER
;
121 SMI_HANDLER_PROFILE_PARAMETER_HEADER Header
;
123 } SMI_HANDLER_PROFILE_PARAMETER_GET_INFO
;
126 SMI_HANDLER_PROFILE_PARAMETER_HEADER Header
;
128 // On input, data buffer size.
129 // On output, actual data buffer size copied.
132 PHYSICAL_ADDRESS DataBuffer
;
134 // On input, data buffer offset to copy.
135 // On output, next time data buffer offset to copy.
138 } SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET
;
140 #define SMI_HANDLER_PROFILE_GUID {0x49174342, 0x7108, 0x409b, {0x8b, 0xbe, 0x65, 0xfd, 0xa8, 0x53, 0x89, 0xf5}}
142 extern EFI_GUID gSmiHandlerProfileGuid
;
144 typedef struct _SMI_HANDLER_PROFILE_PROTOCOL SMI_HANDLER_PROFILE_PROTOCOL
;
147 This function is called by SmmChildDispatcher module to report
148 a new SMI handler is registered, to SmmCore.
150 @param This The protocol instance
151 @param HandlerGuid The GUID to identify the type of the handler.
152 For the SmmChildDispatch protocol, the HandlerGuid
153 must be the GUID of SmmChildDispatch protocol.
154 @param Handler The SMI handler.
155 @param CallerAddress The address of the module who registers the SMI handler.
156 @param Context The context of the SMI handler.
157 For the SmmChildDispatch protocol, the Context
158 must match the one defined for SmmChildDispatch protocol.
159 @param ContextSize The size of the context in bytes.
160 For the SmmChildDispatch protocol, the Context
161 must match the one defined for SmmChildDispatch protocol.
163 @retval EFI_SUCCESS The information is recorded.
164 @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information.
168 (EFIAPI
*SMI_HANDLER_PROFILE_REGISTER_HANDLER
)(
169 IN SMI_HANDLER_PROFILE_PROTOCOL
*This
,
170 IN EFI_GUID
*HandlerGuid
,
171 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
172 IN PHYSICAL_ADDRESS CallerAddress
,
173 IN VOID
*Context OPTIONAL
,
174 IN UINTN ContextSize OPTIONAL
178 This function is called by SmmChildDispatcher module to report
179 an existing SMI handler is unregistered, to SmmCore.
181 @param This The protocol instance
182 @param HandlerGuid The GUID to identify the type of the handler.
183 For the SmmChildDispatch protocol, the HandlerGuid
184 must be the GUID of SmmChildDispatch protocol.
185 @param Handler The SMI handler.
186 @param Context The context of the SMI handler.
187 If it is NOT NULL, it will be used to check what is registered.
188 @param ContextSize The size of the context in bytes.
189 If Context is NOT NULL, it will be used to check what is registered.
191 @retval EFI_SUCCESS The original record is removed.
192 @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler.
196 (EFIAPI
*SMI_HANDLER_PROFILE_UNREGISTER_HANDLER
)(
197 IN SMI_HANDLER_PROFILE_PROTOCOL
*This
,
198 IN EFI_GUID
*HandlerGuid
,
199 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
200 IN VOID
*Context OPTIONAL
,
201 IN UINTN ContextSize OPTIONAL
204 struct _SMI_HANDLER_PROFILE_PROTOCOL
{
205 SMI_HANDLER_PROFILE_REGISTER_HANDLER RegisterHandler
;
206 SMI_HANDLER_PROFILE_UNREGISTER_HANDLER UnregisterHandler
;