]>
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 JY |
22 | typedef struct {\r |
23 | UINT32 Signature;\r | |
24 | UINT32 Length;\r | |
25 | UINT32 Revision;\r | |
f2485395 | 26 | UINT8 Reserved[4];\r |
65fb940a JY |
27 | } SMM_CORE_DATABASE_COMMON_HEADER;\r |
28 | \r | |
29 | #define SMM_CORE_IMAGE_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','I','D')\r | |
30 | #define SMM_CORE_IMAGE_DATABASE_REVISION 0x0001\r | |
31 | \r | |
32 | typedef struct {\r | |
33 | SMM_CORE_DATABASE_COMMON_HEADER Header;\r | |
34 | EFI_GUID FileGuid;\r | |
f2485395 SZ |
35 | PHYSICAL_ADDRESS EntryPoint;\r |
36 | PHYSICAL_ADDRESS ImageBase;\r | |
37 | UINT64 ImageSize;\r | |
38 | UINT32 ImageRef;\r | |
65fb940a | 39 | UINT16 PdbStringOffset;\r |
f2485395 | 40 | UINT8 Reserved[2];\r |
65fb940a JY |
41 | //CHAR8 PdbString[];\r |
42 | } SMM_CORE_IMAGE_DATABASE_STRUCTURE;\r | |
43 | \r | |
44 | #define SMM_CORE_SMI_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','S','D')\r | |
45 | #define SMM_CORE_SMI_DATABASE_REVISION 0x0001\r | |
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 | |
71 | EFI_USB_SMI_TYPE Type;\r | |
72 | UINT32 DevicePathSize;\r | |
73 | //UINT8 DevicePath[DevicePathSize];\r | |
74 | } SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT;\r | |
75 | \r | |
76 | typedef struct {\r | |
f2485395 SZ |
77 | UINT64 SwSmiInputValue;\r |
78 | } SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT;\r | |
79 | \r | |
80 | typedef struct {\r | |
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 | |
92 | SMM_CORE_DATABASE_COMMON_HEADER Header;\r | |
65fb940a | 93 | EFI_GUID HandlerType;\r |
f2485395 SZ |
94 | UINT32 HandlerCategory;\r |
95 | UINT32 HandlerCount;\r | |
65fb940a JY |
96 | //SMM_CORE_SMI_HANDLER_STRUCTURE Handler[HandlerCount];\r |
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 | |
108 | \r | |
109 | \r | |
110 | //\r | |
111 | // SMM_CORE dump command\r | |
112 | //\r | |
113 | #define SMI_HANDLER_PROFILE_COMMAND_GET_INFO 0x1\r | |
114 | #define SMI_HANDLER_PROFILE_COMMAND_GET_DATA_BY_OFFSET 0x2\r | |
115 | \r | |
116 | typedef struct {\r | |
117 | UINT32 Command;\r | |
118 | UINT32 DataLength;\r | |
119 | UINT64 ReturnStatus;\r | |
120 | } SMI_HANDLER_PROFILE_PARAMETER_HEADER;\r | |
121 | \r | |
122 | typedef struct {\r | |
123 | SMI_HANDLER_PROFILE_PARAMETER_HEADER Header;\r | |
124 | UINT64 DataSize;\r | |
125 | } SMI_HANDLER_PROFILE_PARAMETER_GET_INFO;\r | |
126 | \r | |
127 | typedef struct {\r | |
128 | SMI_HANDLER_PROFILE_PARAMETER_HEADER Header;\r | |
129 | //\r | |
130 | // On input, data buffer size.\r | |
131 | // On output, actual data buffer size copied.\r | |
132 | //\r | |
133 | UINT64 DataSize;\r | |
134 | PHYSICAL_ADDRESS DataBuffer;\r | |
135 | //\r | |
136 | // On input, data buffer offset to copy.\r | |
137 | // On output, next time data buffer offset to copy.\r | |
138 | //\r | |
139 | UINT64 DataOffset;\r | |
140 | } SMI_HANDLER_PROFILE_PARAMETER_GET_DATA_BY_OFFSET;\r | |
141 | \r | |
142 | #define SMI_HANDLER_PROFILE_GUID {0x49174342, 0x7108, 0x409b, {0x8b, 0xbe, 0x65, 0xfd, 0xa8, 0x53, 0x89, 0xf5}}\r | |
143 | \r | |
65fb940a JY |
144 | extern EFI_GUID gSmiHandlerProfileGuid;\r |
145 | \r | |
146 | typedef struct _SMI_HANDLER_PROFILE_PROTOCOL SMI_HANDLER_PROFILE_PROTOCOL;\r | |
147 | \r | |
cb716d29 JY |
148 | /**\r |
149 | This function is called by SmmChildDispatcher module to report\r | |
150 | a new SMI handler is registered, to SmmCore.\r | |
151 | \r | |
152 | @param This The protocol instance\r | |
153 | @param HandlerGuid The GUID to identify the type of the handler.\r | |
154 | For the SmmChildDispatch protocol, the HandlerGuid\r | |
155 | must be the GUID of SmmChildDispatch protocol.\r | |
156 | @param Handler The SMI handler.\r | |
157 | @param CallerAddress The address of the module who registers the SMI handler.\r | |
158 | @param Context The context of the SMI handler.\r | |
159 | For the SmmChildDispatch protocol, the Context\r | |
160 | must match the one defined for SmmChildDispatch protocol.\r | |
161 | @param ContextSize The size of the context in bytes.\r | |
162 | For the SmmChildDispatch protocol, the Context\r | |
163 | must match the one defined for SmmChildDispatch protocol.\r | |
164 | \r | |
165 | @retval EFI_SUCCESS The information is recorded.\r | |
166 | @retval EFI_OUT_OF_RESOURCES There is no enough resource to record the information.\r | |
167 | **/\r | |
65fb940a JY |
168 | typedef\r |
169 | EFI_STATUS\r | |
170 | (EFIAPI *SMI_HANDLER_PROFILE_REGISTER_HANDLER) (\r | |
171 | IN SMI_HANDLER_PROFILE_PROTOCOL *This,\r | |
172 | IN EFI_GUID *HandlerGuid,\r | |
173 | IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,\r | |
174 | IN PHYSICAL_ADDRESS CallerAddress,\r | |
175 | IN VOID *Context, OPTIONAL\r | |
176 | IN UINTN ContextSize OPTIONAL\r | |
177 | );\r | |
178 | \r | |
cb716d29 JY |
179 | /**\r |
180 | This function is called by SmmChildDispatcher module to report\r | |
181 | an existing SMI handler is unregistered, to SmmCore.\r | |
182 | \r | |
183 | @param This The protocol instance\r | |
184 | @param HandlerGuid The GUID to identify the type of the handler.\r | |
185 | For the SmmChildDispatch protocol, the HandlerGuid\r | |
186 | must be the GUID of SmmChildDispatch protocol.\r | |
187 | @param Handler The SMI handler.\r | |
188 | @param Context The context of the SMI handler.\r | |
189 | If it is NOT NULL, it will be used to check what is registered.\r | |
190 | @param ContextSize The size of the context in bytes.\r | |
191 | If Context is NOT NULL, it will be used to check what is registered.\r | |
192 | \r | |
193 | @retval EFI_SUCCESS The original record is removed.\r | |
194 | @retval EFI_NOT_FOUND There is no record for the HandlerGuid and handler.\r | |
195 | **/\r | |
65fb940a JY |
196 | typedef\r |
197 | EFI_STATUS\r | |
198 | (EFIAPI *SMI_HANDLER_PROFILE_UNREGISTER_HANDLER) (\r | |
199 | IN SMI_HANDLER_PROFILE_PROTOCOL *This,\r | |
200 | IN EFI_GUID *HandlerGuid,\r | |
cb716d29 JY |
201 | IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,\r |
202 | IN VOID *Context, OPTIONAL\r | |
203 | IN UINTN ContextSize OPTIONAL\r | |
65fb940a JY |
204 | );\r |
205 | \r | |
206 | struct _SMI_HANDLER_PROFILE_PROTOCOL {\r | |
207 | SMI_HANDLER_PROFILE_REGISTER_HANDLER RegisterHandler;\r | |
208 | SMI_HANDLER_PROFILE_UNREGISTER_HANDLER UnregisterHandler;\r | |
209 | };\r | |
210 | \r | |
211 | #endif\r |