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>
33 } SMM_CORE_DATABASE_COMMON_HEADER
;
35 #define SMM_CORE_IMAGE_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','I','D')
36 #define SMM_CORE_IMAGE_DATABASE_REVISION 0x0001
39 SMM_CORE_DATABASE_COMMON_HEADER Header
;
41 PHYSICAL_ADDRESS EntryPoint
;
42 PHYSICAL_ADDRESS ImageBase
;
45 UINT16 PdbStringOffset
;
48 } SMM_CORE_IMAGE_DATABASE_STRUCTURE
;
50 #define SMM_CORE_SMI_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','S','D')
51 #define SMM_CORE_SMI_DATABASE_REVISION 0x0001
54 SmmCoreSmiHandlerCategoryRootHandler
,
55 SmmCoreSmiHandlerCategoryGuidHandler
,
56 SmmCoreSmiHandlerCategoryHardwareHandler
,
57 } SMM_CORE_SMI_HANDLER_CATEGORY
;
60 // Context for SmmCoreSmiHandlerCategoryRootHandler:
62 // Context for SmmCoreSmiHandlerCategoryGuidHandler:
64 // Context for SmmCoreSmiHandlerCategoryHardwareHandler:
65 // (NOTE: The context field should NOT include any data pointer.)
66 // gEfiSmmSwDispatch2ProtocolGuid: (EFI_SMM_SW_REGISTER_CONTEXT => SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT)
67 // gEfiSmmSxDispatch2ProtocolGuid: EFI_SMM_SX_REGISTER_CONTEXT
68 // gEfiSmmPowerButtonDispatch2ProtocolGuid: EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT
69 // gEfiSmmStandbyButtonDispatch2ProtocolGuid: EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT
70 // gEfiSmmPeriodicTimerDispatch2ProtocolGuid: EFI_SMM_PERIODIC_TIMER_CONTEXT
71 // gEfiSmmGpiDispatch2ProtocolGuid: EFI_SMM_GPI_REGISTER_CONTEXT
72 // gEfiSmmIoTrapDispatch2ProtocolGuid: EFI_SMM_IO_TRAP_REGISTER_CONTEXT
73 // gEfiSmmUsbDispatch2ProtocolGuid: (EFI_SMM_USB_REGISTER_CONTEXT => SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT)
74 // Other: GUID specific
77 EFI_USB_SMI_TYPE Type
;
78 UINT32 DevicePathSize
;
79 //UINT8 DevicePath[DevicePathSize];
80 } SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT
;
83 UINT64 SwSmiInputValue
;
84 } SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT
;
89 PHYSICAL_ADDRESS CallerAddr
;
90 PHYSICAL_ADDRESS Handler
;
91 UINT16 ContextBufferOffset
;
93 UINT32 ContextBufferSize
;
94 //UINT8 ContextBuffer[];
95 } SMM_CORE_SMI_HANDLER_STRUCTURE
;
98 SMM_CORE_DATABASE_COMMON_HEADER Header
;
100 UINT32 HandlerCategory
;
102 //SMM_CORE_SMI_HANDLER_STRUCTURE Handler[HandlerCount];
103 } SMM_CORE_SMI_DATABASE_STRUCTURE
;
107 // +-------------------------------------+
108 // | SMM_CORE_IMAGE_DATABASE_STRUCTURE |
109 // +-------------------------------------+
110 // | SMM_CORE_SMI_DATABASE_STRUCTURE |
111 // +-------------------------------------+
117 // SMM_CORE dump command
119 #define SMI_HANDLER_PROFILE_COMMAND_GET_INFO 0x1
120 #define SMI_HANDLER_PROFILE_COMMAND_GET_DATA_BY_OFFSET 0x2
126 } SMI_HANDLER_PROFILE_PARAMETER_HEADER
;
129 SMI_HANDLER_PROFILE_PARAMETER_HEADER Header
;
131 } SMI_HANDLER_PROFILE_PARAMETER_GET_INFO
;
134 SMI_HANDLER_PROFILE_PARAMETER_HEADER Header
;
136 // On input, data buffer size.
137 // On output, actual data buffer size copied.
140 PHYSICAL_ADDRESS DataBuffer
;
142 // On input, data buffer offset to copy.
143 // On output, next time data buffer offset to copy.
146 } SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET
;
148 #define SMI_HANDLER_PROFILE_GUID {0x49174342, 0x7108, 0x409b, {0x8b, 0xbe, 0x65, 0xfd, 0xa8, 0x53, 0x89, 0xf5}}
150 extern EFI_GUID gSmiHandlerProfileGuid
;
152 typedef struct _SMI_HANDLER_PROFILE_PROTOCOL SMI_HANDLER_PROFILE_PROTOCOL
;
155 This function is called by SmmChildDispatcher module to report
156 a new SMI handler is registered, to SmmCore.
158 @param This The protocol instance
159 @param HandlerGuid The GUID to identify the type of the handler.
160 For the SmmChildDispatch protocol, the HandlerGuid
161 must be the GUID of SmmChildDispatch protocol.
162 @param Handler The SMI handler.
163 @param CallerAddress The address of the module who registers the SMI handler.
164 @param Context The context of the SMI handler.
165 For the SmmChildDispatch protocol, the Context
166 must match the one defined for SmmChildDispatch protocol.
167 @param ContextSize The size of the context in bytes.
168 For the SmmChildDispatch protocol, the Context
169 must match the one defined for SmmChildDispatch protocol.
171 @retval EFI_SUCCESS The information is recorded.
172 @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information.
176 (EFIAPI
*SMI_HANDLER_PROFILE_REGISTER_HANDLER
) (
177 IN SMI_HANDLER_PROFILE_PROTOCOL
*This
,
178 IN EFI_GUID
*HandlerGuid
,
179 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
180 IN PHYSICAL_ADDRESS CallerAddress
,
181 IN VOID
*Context
, OPTIONAL
182 IN UINTN ContextSize OPTIONAL
186 This function is called by SmmChildDispatcher module to report
187 an existing SMI handler is unregistered, to SmmCore.
189 @param This The protocol instance
190 @param HandlerGuid The GUID to identify the type of the handler.
191 For the SmmChildDispatch protocol, the HandlerGuid
192 must be the GUID of SmmChildDispatch protocol.
193 @param Handler The SMI handler.
194 @param Context The context of the SMI handler.
195 If it is NOT NULL, it will be used to check what is registered.
196 @param ContextSize The size of the context in bytes.
197 If Context is NOT NULL, it will be used to check what is registered.
199 @retval EFI_SUCCESS The original record is removed.
200 @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler.
204 (EFIAPI
*SMI_HANDLER_PROFILE_UNREGISTER_HANDLER
) (
205 IN SMI_HANDLER_PROFILE_PROTOCOL
*This
,
206 IN EFI_GUID
*HandlerGuid
,
207 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
208 IN VOID
*Context
, OPTIONAL
209 IN UINTN ContextSize OPTIONAL
212 struct _SMI_HANDLER_PROFILE_PROTOCOL
{
213 SMI_HANDLER_PROFILE_REGISTER_HANDLER RegisterHandler
;
214 SMI_HANDLER_PROFILE_UNREGISTER_HANDLER UnregisterHandler
;