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 // +-------------------------------------+
111 // SMM_CORE dump command
113 #define SMI_HANDLER_PROFILE_COMMAND_GET_INFO 0x1
114 #define SMI_HANDLER_PROFILE_COMMAND_GET_DATA_BY_OFFSET 0x2
120 } SMI_HANDLER_PROFILE_PARAMETER_HEADER
;
123 SMI_HANDLER_PROFILE_PARAMETER_HEADER Header
;
125 } SMI_HANDLER_PROFILE_PARAMETER_GET_INFO
;
128 SMI_HANDLER_PROFILE_PARAMETER_HEADER Header
;
130 // On input, data buffer size.
131 // On output, actual data buffer size copied.
134 PHYSICAL_ADDRESS DataBuffer
;
136 // On input, data buffer offset to copy.
137 // On output, next time data buffer offset to copy.
140 } SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET
;
142 #define SMI_HANDLER_PROFILE_GUID {0x49174342, 0x7108, 0x409b, {0x8b, 0xbe, 0x65, 0xfd, 0xa8, 0x53, 0x89, 0xf5}}
144 extern EFI_GUID gSmiHandlerProfileGuid
;
146 typedef struct _SMI_HANDLER_PROFILE_PROTOCOL SMI_HANDLER_PROFILE_PROTOCOL
;
149 This function is called by SmmChildDispatcher module to report
150 a new SMI handler is registered, to SmmCore.
152 @param This The protocol instance
153 @param HandlerGuid The GUID to identify the type of the handler.
154 For the SmmChildDispatch protocol, the HandlerGuid
155 must be the GUID of SmmChildDispatch protocol.
156 @param Handler The SMI handler.
157 @param CallerAddress The address of the module who registers the SMI handler.
158 @param Context The context of the SMI handler.
159 For the SmmChildDispatch protocol, the Context
160 must match the one defined for SmmChildDispatch protocol.
161 @param ContextSize The size of the context in bytes.
162 For the SmmChildDispatch protocol, the Context
163 must match the one defined for SmmChildDispatch protocol.
165 @retval EFI_SUCCESS The information is recorded.
166 @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information.
170 (EFIAPI
*SMI_HANDLER_PROFILE_REGISTER_HANDLER
) (
171 IN SMI_HANDLER_PROFILE_PROTOCOL
*This
,
172 IN EFI_GUID
*HandlerGuid
,
173 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
174 IN PHYSICAL_ADDRESS CallerAddress
,
175 IN VOID
*Context
, OPTIONAL
176 IN UINTN ContextSize OPTIONAL
180 This function is called by SmmChildDispatcher module to report
181 an existing SMI handler is unregistered, to SmmCore.
183 @param This The protocol instance
184 @param HandlerGuid The GUID to identify the type of the handler.
185 For the SmmChildDispatch protocol, the HandlerGuid
186 must be the GUID of SmmChildDispatch protocol.
187 @param Handler The SMI handler.
188 @param Context The context of the SMI handler.
189 If it is NOT NULL, it will be used to check what is registered.
190 @param ContextSize The size of the context in bytes.
191 If Context is NOT NULL, it will be used to check what is registered.
193 @retval EFI_SUCCESS The original record is removed.
194 @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler.
198 (EFIAPI
*SMI_HANDLER_PROFILE_UNREGISTER_HANDLER
) (
199 IN SMI_HANDLER_PROFILE_PROTOCOL
*This
,
200 IN EFI_GUID
*HandlerGuid
,
201 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
202 IN VOID
*Context
, OPTIONAL
203 IN UINTN ContextSize OPTIONAL
206 struct _SMI_HANDLER_PROFILE_PROTOCOL
{
207 SMI_HANDLER_PROFILE_REGISTER_HANDLER RegisterHandler
;
208 SMI_HANDLER_PROFILE_UNREGISTER_HANDLER UnregisterHandler
;