2 Header file for SMI handler profile definition.
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.
15 #ifndef _SMI_HANDLER_PROFILE_H_
16 #define _SMI_HANDLER_PROFILE_H_
19 #include <Protocol/SmmGpiDispatch2.h>
20 #include <Protocol/SmmIoTrapDispatch2.h>
21 #include <Protocol/SmmPeriodicTimerDispatch2.h>
22 #include <Protocol/SmmPowerButtonDispatch2.h>
23 #include <Protocol/SmmStandbyButtonDispatch2.h>
24 #include <Protocol/SmmSwDispatch2.h>
25 #include <Protocol/SmmSxDispatch2.h>
26 #include <Protocol/SmmUsbDispatch2.h>
34 } SMM_CORE_DATABASE_COMMON_HEADER
;
36 #define SMM_CORE_IMAGE_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','I','D')
37 #define SMM_CORE_IMAGE_DATABASE_REVISION 0x0001
40 SMM_CORE_DATABASE_COMMON_HEADER Header
;
46 UINT16 PdbStringOffset
;
49 } SMM_CORE_IMAGE_DATABASE_STRUCTURE
;
51 #define SMM_CORE_SMI_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','S','D')
52 #define SMM_CORE_SMI_DATABASE_REVISION 0x0001
55 SmmCoreSmiHandlerCategoryRootHandler
,
56 SmmCoreSmiHandlerCategoryGuidHandler
,
57 SmmCoreSmiHandlerCategoryHardwareHandler
,
58 } SMM_CORE_SMI_HANDLER_CATEGORY
;
61 // Context for SmmCoreSmiHandlerCategoryRootHandler:
63 // Context for SmmCoreSmiHandlerCategoryGuidHandler:
65 // Context for SmmCoreSmiHandlerCategoryHardwareHandler:
66 // (NOTE: The context field should NOT include any data pointer.)
67 // gEfiSmmSwDispatch2ProtocolGuid: EFI_SMM_SW_REGISTER_CONTEXT
68 // gEfiSmmSxDispatch2ProtocolGuid: EFI_SMM_SX_REGISTER_CONTEXT
69 // gEfiSmmPowerButtonDispatch2ProtocolGuid: EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT
70 // gEfiSmmStandbyButtonDispatch2ProtocolGuid: EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT
71 // gEfiSmmPeriodicTimerDispatch2ProtocolGuid: EFI_SMM_PERIODIC_TIMER_CONTEXT
72 // gEfiSmmGpiDispatch2ProtocolGuid: EFI_SMM_GPI_REGISTER_CONTEXT
73 // gEfiSmmIoTrapDispatch2ProtocolGuid: EFI_SMM_IO_TRAP_REGISTER_CONTEXT
74 // gEfiSmmUsbDispatch2ProtocolGuid: (EFI_SMM_USB_REGISTER_CONTEXT => SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT)
75 // Other: GUID specific
78 EFI_USB_SMI_TYPE Type
;
79 UINT32 DevicePathSize
;
80 //UINT8 DevicePath[DevicePathSize];
81 } SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT
;
88 UINT16 ContextBufferOffset
;
90 UINT32 ContextBufferSize
;
91 //UINT8 ContextBuffer[];
92 } SMM_CORE_SMI_HANDLER_STRUCTURE
;
95 SMM_CORE_DATABASE_COMMON_HEADER Header
;
96 UINT32 HandlerCategory
;
99 //SMM_CORE_SMI_HANDLER_STRUCTURE Handler[HandlerCount];
100 } SMM_CORE_SMI_DATABASE_STRUCTURE
;
104 // +-------------------------------------+
105 // | SMM_CORE_IMAGE_DATABASE_STRUCTURE |
106 // +-------------------------------------+
107 // | SMM_CORE_SMI_DATABASE_STRUCTURE |
108 // +-------------------------------------+
114 // SMM_CORE dump command
116 #define SMI_HANDLER_PROFILE_COMMAND_GET_INFO 0x1
117 #define SMI_HANDLER_PROFILE_COMMAND_GET_DATA_BY_OFFSET 0x2
123 } SMI_HANDLER_PROFILE_PARAMETER_HEADER
;
126 SMI_HANDLER_PROFILE_PARAMETER_HEADER Header
;
128 } SMI_HANDLER_PROFILE_PARAMETER_GET_INFO
;
131 SMI_HANDLER_PROFILE_PARAMETER_HEADER Header
;
133 // On input, data buffer size.
134 // On output, actual data buffer size copied.
137 PHYSICAL_ADDRESS DataBuffer
;
139 // On input, data buffer offset to copy.
140 // On output, next time data buffer offset to copy.
143 } SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET
;
145 #define SMI_HANDLER_PROFILE_GUID {0x49174342, 0x7108, 0x409b, {0x8b, 0xbe, 0x65, 0xfd, 0xa8, 0x53, 0x89, 0xf5}}
149 extern EFI_GUID gSmiHandlerProfileGuid
;
151 typedef struct _SMI_HANDLER_PROFILE_PROTOCOL SMI_HANDLER_PROFILE_PROTOCOL
;
154 This function is called by SmmChildDispatcher module to report
155 a new SMI handler is registered, to SmmCore.
157 @param This The protocol instance
158 @param HandlerGuid The GUID to identify the type of the handler.
159 For the SmmChildDispatch protocol, the HandlerGuid
160 must be the GUID of SmmChildDispatch protocol.
161 @param Handler The SMI handler.
162 @param CallerAddress The address of the module who registers the SMI handler.
163 @param Context The context of the SMI handler.
164 For the SmmChildDispatch protocol, the Context
165 must match the one defined for SmmChildDispatch protocol.
166 @param ContextSize The size of the context in bytes.
167 For the SmmChildDispatch protocol, the Context
168 must match the one defined for SmmChildDispatch protocol.
170 @retval EFI_SUCCESS The information is recorded.
171 @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information.
175 (EFIAPI
*SMI_HANDLER_PROFILE_REGISTER_HANDLER
) (
176 IN SMI_HANDLER_PROFILE_PROTOCOL
*This
,
177 IN EFI_GUID
*HandlerGuid
,
178 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
179 IN PHYSICAL_ADDRESS CallerAddress
,
180 IN VOID
*Context
, OPTIONAL
181 IN UINTN ContextSize OPTIONAL
185 This function is called by SmmChildDispatcher module to report
186 an existing SMI handler is unregistered, to SmmCore.
188 @param This The protocol instance
189 @param HandlerGuid The GUID to identify the type of the handler.
190 For the SmmChildDispatch protocol, the HandlerGuid
191 must be the GUID of SmmChildDispatch protocol.
192 @param Handler The SMI handler.
193 @param Context The context of the SMI handler.
194 If it is NOT NULL, it will be used to check what is registered.
195 @param ContextSize The size of the context in bytes.
196 If Context is NOT NULL, it will be used to check what is registered.
198 @retval EFI_SUCCESS The original record is removed.
199 @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler.
203 (EFIAPI
*SMI_HANDLER_PROFILE_UNREGISTER_HANDLER
) (
204 IN SMI_HANDLER_PROFILE_PROTOCOL
*This
,
205 IN EFI_GUID
*HandlerGuid
,
206 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
207 IN VOID
*Context
, OPTIONAL
208 IN UINTN ContextSize OPTIONAL
211 struct _SMI_HANDLER_PROFILE_PROTOCOL
{
212 SMI_HANDLER_PROFILE_REGISTER_HANDLER RegisterHandler
;
213 SMI_HANDLER_PROFILE_UNREGISTER_HANDLER UnregisterHandler
;