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