]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Guid/SmiHandlerProfile.h
MdeModulePkg SmiHandlerProfile: Fix no PDB case handling incorrectly
[mirror_edk2.git] / MdeModulePkg / Include / Guid / SmiHandlerProfile.h
CommitLineData
65fb940a
JY
1/** @file\r
2 Header file for SMI handler profile definition.\r
3\r
4Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _SMI_HANDLER_PROFILE_H_\r
16#define _SMI_HANDLER_PROFILE_H_\r
17\r
18#include <PiSmm.h>\r
19#include <Protocol/SmmGpiDispatch2.h>\r
20#include <Protocol/SmmIoTrapDispatch2.h>\r
21#include <Protocol/SmmPeriodicTimerDispatch2.h>\r
22#include <Protocol/SmmPowerButtonDispatch2.h>\r
23#include <Protocol/SmmStandbyButtonDispatch2.h>\r
24#include <Protocol/SmmSwDispatch2.h>\r
25#include <Protocol/SmmSxDispatch2.h>\r
26#include <Protocol/SmmUsbDispatch2.h>\r
27\r
28#pragma pack(1)\r
29\r
30typedef struct {\r
31 UINT32 Signature;\r
32 UINT32 Length;\r
33 UINT32 Revision;\r
34} SMM_CORE_DATABASE_COMMON_HEADER;\r
35\r
36#define SMM_CORE_IMAGE_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','I','D')\r
37#define SMM_CORE_IMAGE_DATABASE_REVISION 0x0001\r
38\r
39typedef struct {\r
40 SMM_CORE_DATABASE_COMMON_HEADER Header;\r
41 EFI_GUID FileGuid;\r
42 UINTN ImageRef;\r
43 UINTN EntryPoint;\r
44 UINTN ImageBase;\r
45 UINTN ImageSize;\r
46 UINT16 PdbStringOffset;\r
47 UINT8 Reserved2[6];\r
48//CHAR8 PdbString[];\r
49} SMM_CORE_IMAGE_DATABASE_STRUCTURE;\r
50\r
51#define SMM_CORE_SMI_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','S','D')\r
52#define SMM_CORE_SMI_DATABASE_REVISION 0x0001\r
53\r
54typedef enum {\r
55 SmmCoreSmiHandlerCategoryRootHandler,\r
56 SmmCoreSmiHandlerCategoryGuidHandler,\r
57 SmmCoreSmiHandlerCategoryHardwareHandler,\r
58} SMM_CORE_SMI_HANDLER_CATEGORY;\r
59\r
60//\r
61// Context for SmmCoreSmiHandlerCategoryRootHandler:\r
62// NULL\r
63// Context for SmmCoreSmiHandlerCategoryGuidHandler:\r
64// NULL\r
65// Context for SmmCoreSmiHandlerCategoryHardwareHandler:\r
66// (NOTE: The context field should NOT include any data pointer.)\r
67// gEfiSmmSwDispatch2ProtocolGuid: EFI_SMM_SW_REGISTER_CONTEXT\r
68// gEfiSmmSxDispatch2ProtocolGuid: EFI_SMM_SX_REGISTER_CONTEXT\r
69// gEfiSmmPowerButtonDispatch2ProtocolGuid: EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT\r
70// gEfiSmmStandbyButtonDispatch2ProtocolGuid: EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT\r
71// gEfiSmmPeriodicTimerDispatch2ProtocolGuid: EFI_SMM_PERIODIC_TIMER_CONTEXT\r
72// gEfiSmmGpiDispatch2ProtocolGuid: EFI_SMM_GPI_REGISTER_CONTEXT\r
73// gEfiSmmIoTrapDispatch2ProtocolGuid: EFI_SMM_IO_TRAP_REGISTER_CONTEXT\r
74// gEfiSmmUsbDispatch2ProtocolGuid: (EFI_SMM_USB_REGISTER_CONTEXT => SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT)\r
75// Other: GUID specific\r
76\r
77typedef struct {\r
78 EFI_USB_SMI_TYPE Type;\r
79 UINT32 DevicePathSize;\r
80//UINT8 DevicePath[DevicePathSize];\r
81} SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT;\r
82\r
83typedef struct {\r
84 UINT32 Length;\r
85 UINTN CallerAddr;\r
86 UINTN Handler;\r
87 UINTN ImageRef;\r
88 UINT16 ContextBufferOffset;\r
89 UINT8 Reserved2[2];\r
90 UINT32 ContextBufferSize;\r
91//UINT8 ContextBuffer[];\r
92} SMM_CORE_SMI_HANDLER_STRUCTURE;\r
93\r
94typedef struct {\r
95 SMM_CORE_DATABASE_COMMON_HEADER Header;\r
96 UINT32 HandlerCategory;\r
97 EFI_GUID HandlerType;\r
98 UINTN HandlerCount;\r
99//SMM_CORE_SMI_HANDLER_STRUCTURE Handler[HandlerCount];\r
100} SMM_CORE_SMI_DATABASE_STRUCTURE;\r
101\r
102//\r
103// Layout:\r
104// +-------------------------------------+\r
105// | SMM_CORE_IMAGE_DATABASE_STRUCTURE |\r
106// +-------------------------------------+\r
107// | SMM_CORE_SMI_DATABASE_STRUCTURE |\r
108// +-------------------------------------+\r
109//\r
110\r
111\r
112\r
113//\r
114// SMM_CORE dump command\r
115//\r
116#define SMI_HANDLER_PROFILE_COMMAND_GET_INFO 0x1\r
117#define SMI_HANDLER_PROFILE_COMMAND_GET_DATA_BY_OFFSET 0x2\r
118\r
119typedef struct {\r
120 UINT32 Command;\r
121 UINT32 DataLength;\r
122 UINT64 ReturnStatus;\r
123} SMI_HANDLER_PROFILE_PARAMETER_HEADER;\r
124\r
125typedef struct {\r
126 SMI_HANDLER_PROFILE_PARAMETER_HEADER Header;\r
127 UINT64 DataSize;\r
128} SMI_HANDLER_PROFILE_PARAMETER_GET_INFO;\r
129\r
130typedef struct {\r
131 SMI_HANDLER_PROFILE_PARAMETER_HEADER Header;\r
132 //\r
133 // On input, data buffer size.\r
134 // On output, actual data buffer size copied.\r
135 //\r
136 UINT64 DataSize;\r
137 PHYSICAL_ADDRESS DataBuffer;\r
138 //\r
139 // On input, data buffer offset to copy.\r
140 // On output, next time data buffer offset to copy.\r
141 //\r
142 UINT64 DataOffset;\r
143} SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET;\r
144\r
145#define SMI_HANDLER_PROFILE_GUID {0x49174342, 0x7108, 0x409b, {0x8b, 0xbe, 0x65, 0xfd, 0xa8, 0x53, 0x89, 0xf5}}\r
146\r
147#pragma pack()\r
148\r
149extern EFI_GUID gSmiHandlerProfileGuid;\r
150\r
151typedef struct _SMI_HANDLER_PROFILE_PROTOCOL SMI_HANDLER_PROFILE_PROTOCOL;\r
152\r
cb716d29
JY
153/**\r
154 This function is called by SmmChildDispatcher module to report\r
155 a new SMI handler is registered, to SmmCore.\r
156\r
157 @param This The protocol instance\r
158 @param HandlerGuid The GUID to identify the type of the handler.\r
159 For the SmmChildDispatch protocol, the HandlerGuid\r
160 must be the GUID of SmmChildDispatch protocol.\r
161 @param Handler The SMI handler.\r
162 @param CallerAddress The address of the module who registers the SMI handler.\r
163 @param Context The context of the SMI handler.\r
164 For the SmmChildDispatch protocol, the Context\r
165 must match the one defined for SmmChildDispatch protocol.\r
166 @param ContextSize The size of the context in bytes.\r
167 For the SmmChildDispatch protocol, the Context\r
168 must match the one defined for SmmChildDispatch protocol.\r
169\r
170 @retval EFI_SUCCESS The information is recorded.\r
171 @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information.\r
172**/\r
65fb940a
JY
173typedef\r
174EFI_STATUS\r
175(EFIAPI *SMI_HANDLER_PROFILE_REGISTER_HANDLER) (\r
176 IN SMI_HANDLER_PROFILE_PROTOCOL *This,\r
177 IN EFI_GUID *HandlerGuid,\r
178 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,\r
179 IN PHYSICAL_ADDRESS CallerAddress,\r
180 IN VOID *Context, OPTIONAL\r
181 IN UINTN ContextSize OPTIONAL\r
182 );\r
183\r
cb716d29
JY
184/**\r
185 This function is called by SmmChildDispatcher module to report\r
186 an existing SMI handler is unregistered, to SmmCore.\r
187\r
188 @param This The protocol instance\r
189 @param HandlerGuid The GUID to identify the type of the handler.\r
190 For the SmmChildDispatch protocol, the HandlerGuid\r
191 must be the GUID of SmmChildDispatch protocol.\r
192 @param Handler The SMI handler.\r
193 @param Context The context of the SMI handler.\r
194 If it is NOT NULL, it will be used to check what is registered.\r
195 @param ContextSize The size of the context in bytes.\r
196 If Context is NOT NULL, it will be used to check what is registered.\r
197\r
198 @retval EFI_SUCCESS The original record is removed.\r
199 @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler.\r
200**/\r
65fb940a
JY
201typedef\r
202EFI_STATUS\r
203(EFIAPI *SMI_HANDLER_PROFILE_UNREGISTER_HANDLER) (\r
204 IN SMI_HANDLER_PROFILE_PROTOCOL *This,\r
205 IN EFI_GUID *HandlerGuid,\r
cb716d29
JY
206 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,\r
207 IN VOID *Context, OPTIONAL\r
208 IN UINTN ContextSize OPTIONAL\r
65fb940a
JY
209 );\r
210\r
211struct _SMI_HANDLER_PROFILE_PROTOCOL {\r
212 SMI_HANDLER_PROFILE_REGISTER_HANDLER RegisterHandler;\r
213 SMI_HANDLER_PROFILE_UNREGISTER_HANDLER UnregisterHandler;\r
214};\r
215\r
216#endif\r