]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Guid/SmiHandlerProfile.h
MdeModulePkg/S3SmmInitDone.h: Fix copyright coding style error.
[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
65fb940a
JY
28typedef struct {\r
29 UINT32 Signature;\r
30 UINT32 Length;\r
31 UINT32 Revision;\r
f2485395 32 UINT8 Reserved[4];\r
65fb940a
JY
33} SMM_CORE_DATABASE_COMMON_HEADER;\r
34\r
35#define SMM_CORE_IMAGE_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','I','D')\r
36#define SMM_CORE_IMAGE_DATABASE_REVISION 0x0001\r
37\r
38typedef struct {\r
39 SMM_CORE_DATABASE_COMMON_HEADER Header;\r
40 EFI_GUID FileGuid;\r
f2485395
SZ
41 PHYSICAL_ADDRESS EntryPoint;\r
42 PHYSICAL_ADDRESS ImageBase;\r
43 UINT64 ImageSize;\r
44 UINT32 ImageRef;\r
65fb940a 45 UINT16 PdbStringOffset;\r
f2485395 46 UINT8 Reserved[2];\r
65fb940a
JY
47//CHAR8 PdbString[];\r
48} SMM_CORE_IMAGE_DATABASE_STRUCTURE;\r
49\r
50#define SMM_CORE_SMI_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','S','D')\r
51#define SMM_CORE_SMI_DATABASE_REVISION 0x0001\r
52\r
53typedef enum {\r
54 SmmCoreSmiHandlerCategoryRootHandler,\r
55 SmmCoreSmiHandlerCategoryGuidHandler,\r
56 SmmCoreSmiHandlerCategoryHardwareHandler,\r
57} SMM_CORE_SMI_HANDLER_CATEGORY;\r
58\r
59//\r
60// Context for SmmCoreSmiHandlerCategoryRootHandler:\r
61// NULL\r
62// Context for SmmCoreSmiHandlerCategoryGuidHandler:\r
63// NULL\r
64// Context for SmmCoreSmiHandlerCategoryHardwareHandler:\r
65// (NOTE: The context field should NOT include any data pointer.)\r
f2485395 66// gEfiSmmSwDispatch2ProtocolGuid: (EFI_SMM_SW_REGISTER_CONTEXT => SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT)\r
65fb940a
JY
67// gEfiSmmSxDispatch2ProtocolGuid: EFI_SMM_SX_REGISTER_CONTEXT\r
68// gEfiSmmPowerButtonDispatch2ProtocolGuid: EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT\r
69// gEfiSmmStandbyButtonDispatch2ProtocolGuid: EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT\r
70// gEfiSmmPeriodicTimerDispatch2ProtocolGuid: EFI_SMM_PERIODIC_TIMER_CONTEXT\r
71// gEfiSmmGpiDispatch2ProtocolGuid: EFI_SMM_GPI_REGISTER_CONTEXT\r
72// gEfiSmmIoTrapDispatch2ProtocolGuid: EFI_SMM_IO_TRAP_REGISTER_CONTEXT\r
73// gEfiSmmUsbDispatch2ProtocolGuid: (EFI_SMM_USB_REGISTER_CONTEXT => SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT)\r
74// Other: GUID specific\r
75\r
76typedef struct {\r
77 EFI_USB_SMI_TYPE Type;\r
78 UINT32 DevicePathSize;\r
79//UINT8 DevicePath[DevicePathSize];\r
80} SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT;\r
81\r
82typedef struct {\r
f2485395
SZ
83 UINT64 SwSmiInputValue;\r
84} SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT;\r
85\r
86typedef struct {\r
87 UINT32 Length;\r
88 UINT32 ImageRef;\r
89 PHYSICAL_ADDRESS CallerAddr;\r
90 PHYSICAL_ADDRESS Handler;\r
91 UINT16 ContextBufferOffset;\r
92 UINT8 Reserved[2];\r
93 UINT32 ContextBufferSize;\r
94//UINT8 ContextBuffer[];\r
65fb940a
JY
95} SMM_CORE_SMI_HANDLER_STRUCTURE;\r
96\r
97typedef struct {\r
98 SMM_CORE_DATABASE_COMMON_HEADER Header;\r
65fb940a 99 EFI_GUID HandlerType;\r
f2485395
SZ
100 UINT32 HandlerCategory;\r
101 UINT32 HandlerCount;\r
65fb940a
JY
102//SMM_CORE_SMI_HANDLER_STRUCTURE Handler[HandlerCount];\r
103} SMM_CORE_SMI_DATABASE_STRUCTURE;\r
104\r
105//\r
106// Layout:\r
107// +-------------------------------------+\r
108// | SMM_CORE_IMAGE_DATABASE_STRUCTURE |\r
109// +-------------------------------------+\r
110// | SMM_CORE_SMI_DATABASE_STRUCTURE |\r
111// +-------------------------------------+\r
112//\r
113\r
114\r
115\r
116//\r
117// SMM_CORE dump command\r
118//\r
119#define SMI_HANDLER_PROFILE_COMMAND_GET_INFO 0x1\r
120#define SMI_HANDLER_PROFILE_COMMAND_GET_DATA_BY_OFFSET 0x2\r
121\r
122typedef struct {\r
123 UINT32 Command;\r
124 UINT32 DataLength;\r
125 UINT64 ReturnStatus;\r
126} SMI_HANDLER_PROFILE_PARAMETER_HEADER;\r
127\r
128typedef struct {\r
129 SMI_HANDLER_PROFILE_PARAMETER_HEADER Header;\r
130 UINT64 DataSize;\r
131} SMI_HANDLER_PROFILE_PARAMETER_GET_INFO;\r
132\r
133typedef struct {\r
134 SMI_HANDLER_PROFILE_PARAMETER_HEADER Header;\r
135 //\r
136 // On input, data buffer size.\r
137 // On output, actual data buffer size copied.\r
138 //\r
139 UINT64 DataSize;\r
140 PHYSICAL_ADDRESS DataBuffer;\r
141 //\r
142 // On input, data buffer offset to copy.\r
143 // On output, next time data buffer offset to copy.\r
144 //\r
145 UINT64 DataOffset;\r
146} SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET;\r
147\r
148#define SMI_HANDLER_PROFILE_GUID {0x49174342, 0x7108, 0x409b, {0x8b, 0xbe, 0x65, 0xfd, 0xa8, 0x53, 0x89, 0xf5}}\r
149\r
65fb940a
JY
150extern EFI_GUID gSmiHandlerProfileGuid;\r
151\r
152typedef struct _SMI_HANDLER_PROFILE_PROTOCOL SMI_HANDLER_PROFILE_PROTOCOL;\r
153\r
cb716d29
JY
154/**\r
155 This function is called by SmmChildDispatcher module to report\r
156 a new SMI handler is registered, to SmmCore.\r
157\r
158 @param This The protocol instance\r
159 @param HandlerGuid The GUID to identify the type of the handler.\r
160 For the SmmChildDispatch protocol, the HandlerGuid\r
161 must be the GUID of SmmChildDispatch protocol.\r
162 @param Handler The SMI handler.\r
163 @param CallerAddress The address of the module who registers the SMI handler.\r
164 @param Context The context of the SMI handler.\r
165 For the SmmChildDispatch protocol, the Context\r
166 must match the one defined for SmmChildDispatch protocol.\r
167 @param ContextSize The size of the context in bytes.\r
168 For the SmmChildDispatch protocol, the Context\r
169 must match the one defined for SmmChildDispatch protocol.\r
170\r
171 @retval EFI_SUCCESS The information is recorded.\r
172 @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information.\r
173**/\r
65fb940a
JY
174typedef\r
175EFI_STATUS\r
176(EFIAPI *SMI_HANDLER_PROFILE_REGISTER_HANDLER) (\r
177 IN SMI_HANDLER_PROFILE_PROTOCOL *This,\r
178 IN EFI_GUID *HandlerGuid,\r
179 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,\r
180 IN PHYSICAL_ADDRESS CallerAddress,\r
181 IN VOID *Context, OPTIONAL\r
182 IN UINTN ContextSize OPTIONAL\r
183 );\r
184\r
cb716d29
JY
185/**\r
186 This function is called by SmmChildDispatcher module to report\r
187 an existing SMI handler is unregistered, to SmmCore.\r
188\r
189 @param This The protocol instance\r
190 @param HandlerGuid The GUID to identify the type of the handler.\r
191 For the SmmChildDispatch protocol, the HandlerGuid\r
192 must be the GUID of SmmChildDispatch protocol.\r
193 @param Handler The SMI handler.\r
194 @param Context The context of the SMI handler.\r
195 If it is NOT NULL, it will be used to check what is registered.\r
196 @param ContextSize The size of the context in bytes.\r
197 If Context is NOT NULL, it will be used to check what is registered.\r
198\r
199 @retval EFI_SUCCESS The original record is removed.\r
200 @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler.\r
201**/\r
65fb940a
JY
202typedef\r
203EFI_STATUS\r
204(EFIAPI *SMI_HANDLER_PROFILE_UNREGISTER_HANDLER) (\r
205 IN SMI_HANDLER_PROFILE_PROTOCOL *This,\r
206 IN EFI_GUID *HandlerGuid,\r
cb716d29
JY
207 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,\r
208 IN VOID *Context, OPTIONAL\r
209 IN UINTN ContextSize OPTIONAL\r
65fb940a
JY
210 );\r
211\r
212struct _SMI_HANDLER_PROFILE_PROTOCOL {\r
213 SMI_HANDLER_PROFILE_REGISTER_HANDLER RegisterHandler;\r
214 SMI_HANDLER_PROFILE_UNREGISTER_HANDLER UnregisterHandler;\r
215};\r
216\r
217#endif\r