]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/ExtendedSalLib.h
MdePkg/BaseLib: add PatchInstructionX86()
[mirror_edk2.git] / MdePkg / Include / Library / ExtendedSalLib.h
CommitLineData
863be5d0 1/** @file\r
2 Library class definition of Extended SAL Library.\r
3\r
4Copyright (c) 2007 - 2011, 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 _EXTENDED_SAL_LIB_H__\r
16#define _EXTENDED_SAL_LIB_H__\r
17\r
18#include <IndustryStandard/Sal.h>\r
19\r
20/**\r
21 Register ESAL Class and its associated global.\r
22 \r
23 This function Registers one or more Extended SAL services in a given\r
24 class along with the associated global context.\r
25 This function is only available prior to ExitBootServices().\r
26\r
27 @param ClassGuidLo GUID of function class, lower 64-bits\r
28 @param ClassGuidHi GUID of function class, upper 64-bits\r
29 @param ModuleGlobal Module global for Function.\r
30 @param ... List of Function/FunctionId pairs, ended by NULL\r
31\r
32 @retval EFI_SUCCESS The Extended SAL services were registered.\r
33 @retval EFI_UNSUPPORTED This function was called after ExitBootServices().\r
34 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to register one or more of the specified services.\r
35 @retval Other ClassGuid could not be installed onto a new handle. \r
36\r
37**/\r
38EFI_STATUS\r
39EFIAPI\r
40RegisterEsalClass (\r
41 IN CONST UINT64 ClassGuidLo,\r
42 IN CONST UINT64 ClassGuidHi,\r
43 IN VOID *ModuleGlobal, OPTIONAL\r
44 ...\r
45 );\r
46\r
47/**\r
48 Calls an Extended SAL Class service that was previously registered with RegisterEsalClass().\r
49 \r
50 This function calls an Extended SAL Class service that was previously registered with RegisterEsalClass().\r
51\r
52 @param ClassGuidLo GUID of function, lower 64-bits\r
53 @param ClassGuidHi GUID of function, upper 64-bits\r
54 @param FunctionId Function in ClassGuid to call\r
55 @param Arg2 Argument 2 ClassGuid/FunctionId defined\r
56 @param Arg3 Argument 3 ClassGuid/FunctionId defined\r
57 @param Arg4 Argument 4 ClassGuid/FunctionId defined\r
58 @param Arg5 Argument 5 ClassGuid/FunctionId defined\r
59 @param Arg6 Argument 6 ClassGuid/FunctionId defined\r
60 @param Arg7 Argument 7 ClassGuid/FunctionId defined\r
61 @param Arg8 Argument 8 ClassGuid/FunctionId defined\r
62 \r
63 @retval EFI_SAL_ERROR The address of ExtendedSalProc() can not be determined\r
64 for the current CPU execution mode.\r
65 @retval Other See the return status from ExtendedSalProc() in the\r
66 EXTENDED_SAL_BOOT_SERVICE_PROTOCOL. \r
67\r
68**/\r
69SAL_RETURN_REGS\r
70EFIAPI\r
71EsalCall (\r
72 IN UINT64 ClassGuidLo,\r
73 IN UINT64 ClassGuidHi,\r
74 IN UINT64 FunctionId,\r
75 IN UINT64 Arg2,\r
76 IN UINT64 Arg3,\r
77 IN UINT64 Arg4,\r
78 IN UINT64 Arg5,\r
79 IN UINT64 Arg6,\r
80 IN UINT64 Arg7,\r
81 IN UINT64 Arg8\r
82 );\r
83\r
84/**\r
85 Wrapper for the EsalStallFunctionId service of Extended SAL Stall Services Class.\r
86 \r
87 This function is a wrapper for the EsalStallFunctionId service of Extended SAL\r
88 Stall Services Class. See EsalStallFunctionId of Extended SAL Specification.\r
89\r
90 @param Microseconds The number of microseconds to delay.\r
91\r
92 @retval EFI_SAL_SUCCESS Call completed without error.\r
93 @retval EFI_SAL_INVALID_ARGUMENT Invalid argument.\r
94 @retval EFI_SAL_VIRTUAL_ADDRESS_ERROR Virtual address not registered\r
95\r
96**/\r
97SAL_RETURN_REGS\r
98EFIAPI\r
99EsalStall (\r
100 IN UINTN Microseconds\r
101 );\r
102\r
103/**\r
104 Wrapper for the EsalSetNewPalEntryFunctionId service of Extended SAL PAL Services Services Class.\r
105 \r
106 This function is a wrapper for the EsalSetNewPalEntryFunctionId service of Extended SAL\r
107 PAL Services Services Class. See EsalSetNewPalEntryFunctionId of Extended SAL Specification.\r
108\r
109 @param PhysicalAddress If TRUE, then PalEntryPoint is a physical address.\r
110 If FALSE, then PalEntryPoint is a virtual address.\r
111 @param PalEntryPoint The PAL Entry Point being set.\r
112\r
113 @retval EFI_SAL_SUCCESS The PAL Entry Point was set.\r
114 @retval EFI_SAL_VIRTUAL_ADDRESS_ERROR This function was called in virtual mode before\r
115 virtual mappings for the specified Extended SAL\r
116 Procedure are available.\r
117\r
118**/\r
119SAL_RETURN_REGS\r
120EFIAPI\r
121EsalSetNewPalEntry (\r
122 IN BOOLEAN PhysicalAddress,\r
123 IN UINT64 PalEntryPoint\r
124 );\r
125\r
126/**\r
127 Wrapper for the EsalGetNewPalEntryFunctionId service of Extended SAL PAL Services Services Class.\r
128 \r
129 This function is a wrapper for the EsalGetNewPalEntryFunctionId service of Extended SAL\r
130 PAL Services Services Class. See EsalGetNewPalEntryFunctionId of Extended SAL Specification.\r
131\r
132 @param PhysicalAddress If TRUE, then PalEntryPoint is a physical address.\r
133 If FALSE, then PalEntryPoint is a virtual address.\r
134\r
135 @retval EFI_SAL_SUCCESS The PAL Entry Point was retrieved and returned in\r
136 SAL_RETURN_REGS.r9.\r
137 @retval EFI_SAL_VIRTUAL_ADDRESS_ERROR This function was called in virtual mode before\r
138 virtual mappings for the specified Extended SAL\r
139 Procedure are available.\r
140 @return r9 PAL entry point retrieved.\r
141\r
142**/\r
143SAL_RETURN_REGS\r
144EFIAPI\r
145EsalGetNewPalEntry (\r
146 IN BOOLEAN PhysicalAddress\r
147 );\r
148\r
149/**\r
150 Wrapper for the EsalGetStateBufferFunctionId service of Extended SAL MCA Log Services Class.\r
151 \r
152 This function is a wrapper for the EsalGetStateBufferFunctionId service of Extended SAL\r
153 MCA Log Services Class. See EsalGetStateBufferFunctionId of Extended SAL Specification.\r
154\r
155 @param McaType See type parameter of SAL Procedure SAL_GET_STATE_INFO.\r
156 @param McaBuffer A pointer to the base address of the returned buffer.\r
157 Copied from SAL_RETURN_REGS.r9.\r
158 @param BufferSize A pointer to the size, in bytes, of the returned buffer.\r
159 Copied from SAL_RETURN_REGS.r10.\r
160\r
161 @retval EFI_SAL_SUCCESS The memory buffer to store error records was returned in r9 and r10.\r
162 @retval EFI_OUT_OF_RESOURCES A memory buffer for string error records in not available\r
163 @return r9 Base address of the returned buffer\r
164 @return r10 Size of the returned buffer in bytes\r
165\r
166**/\r
167SAL_RETURN_REGS\r
168EFIAPI\r
169EsalGetStateBuffer (\r
170 IN UINT64 McaType,\r
171 OUT UINT8 **McaBuffer,\r
172 OUT UINTN *BufferSize\r
173 );\r
174\r
175/**\r
176 Wrapper for the EsalSaveStateBufferFunctionId service of Extended SAL MCA Log Services Class.\r
177 \r
178 This function is a wrapper for the EsalSaveStateBufferFunctionId service of Extended SAL\r
179 MCA Log Services Class. See EsalSaveStateBufferFunctionId of Extended SAL Specification.\r
180\r
181 @param McaType See type parameter of SAL Procedure SAL_GET_STATE_INFO.\r
182\r
183 @retval EFI_SUCCESS The memory buffer containing the error record was written to nonvolatile storage.\r
184\r
185**/\r
186SAL_RETURN_REGS\r
187EFIAPI\r
188EsalSaveStateBuffer (\r
189 IN UINT64 McaType\r
190 );\r
191\r
192/**\r
193 Wrapper for the EsalGetVectorsFunctionId service of Extended SAL Base Services Class.\r
194 \r
195 This function is a wrapper for the EsalGetVectorsFunctionId service of Extended SAL\r
196 Base Services Class. See EsalGetVectorsFunctionId of Extended SAL Specification.\r
197\r
198 @param VectorType The vector type to retrieve.\r
199 0 - MCA, 1 - BSP INIT, 2 - BOOT_RENDEZ, 3 - AP INIT.\r
200\r
201 @retval EFI_SAL_SUCCESS Call completed without error.\r
202 @retval EFI_SAL_INVALID_ARGUMENT Invalid argument.\r
203 @retval EFI_SAL_NO_INFORMATION The requested vector has not been registered\r
204 with the SAL Procedure SAL_SET_VECTORS.\r
205\r
206**/\r
207SAL_RETURN_REGS\r
208EFIAPI\r
209EsalGetVectors (\r
210 IN UINT64 VectorType\r
211 );\r
212\r
213/**\r
214 Wrapper for the EsalMcGetParamsFunctionId service of Extended SAL Base Services Class.\r
215 \r
216 This function is a wrapper for the EsalMcGetParamsFunctionId service of Extended SAL\r
217 Base Services Class. See EsalMcGetParamsFunctionId of Extended SAL Specification.\r
218\r
219 @param ParamInfoType The parameter type to retrieve.\r
220 1 - rendezvous interrupt\r
221 2 - wake up\r
222 3 - Corrected Platform Error Vector.\r
223\r
224 @retval EFI_SAL_SUCCESS Call completed without error.\r
225 @retval EFI_SAL_INVALID_ARGUMENT Invalid argument.\r
226 @retval EFI_SAL_NO_INFORMATION The requested vector has not been registered\r
227 with the SAL Procedure SAL_MC_SET_PARAMS.\r
228\r
229**/\r
230SAL_RETURN_REGS\r
231EFIAPI\r
232EsalMcGetParams (\r
233 IN UINT64 ParamInfoType\r
234 );\r
235\r
236/**\r
237 Wrapper for the EsalMcGetParamsFunctionId service of Extended SAL Base Services Class.\r
238 \r
239 This function is a wrapper for the EsalMcGetParamsFunctionId service of Extended SAL\r
240 Base Services Class. See EsalMcGetParamsFunctionId of Extended SAL Specification.\r
241\r
242 @retval EFI_SAL_SUCCESS Call completed without error.\r
243 @retval EFI_SAL_NO_INFORMATION The requested vector has not been registered\r
244 with the SAL Procedure SAL_MC_SET_PARAMS.\r
245\r
246**/\r
247SAL_RETURN_REGS\r
248EFIAPI\r
249EsalMcGetMcParams (\r
250 VOID\r
251 );\r
252\r
253/**\r
254 Wrapper for the EsalGetMcCheckinFlagsFunctionId service of Extended SAL Base Services Class.\r
255 \r
256 This function is a wrapper for the EsalGetMcCheckinFlagsFunctionId service of Extended SAL\r
257 Base Services Class. See EsalGetMcCheckinFlagsFunctionId of Extended SAL Specification.\r
258\r
259 @param CpuIndex The index of the CPU of set of enabled CPUs to check.\r
260\r
261 @retval EFI_SAL_SUCCESS The checkin status of the requested CPU was returned.\r
262\r
263**/\r
264SAL_RETURN_REGS\r
265EFIAPI\r
266EsalGetMcCheckinFlags (\r
267 IN UINT64 CpuIndex\r
268 );\r
269\r
270/**\r
271 Wrapper for the EsalAddCpuDataFunctionId service of Extended SAL MP Services Class.\r
272 \r
273 This function is a wrapper for the EsalAddCpuDataFunctionId service of Extended SAL\r
274 MP Services Class. See EsalAddCpuDataFunctionId of Extended SAL Specification.\r
275\r
276 @param CpuGlobalId The Global ID for the CPU being added.\r
277 @param Enabled The enable flag for the CPU being added.\r
278 TRUE means the CPU is enabled.\r
279 FALSE means the CPU is disabled.\r
280 @param PalCompatibility The PAL Compatibility value for the CPU being added.\r
281\r
282 @retval EFI_SAL_SUCCESS The CPU was added to the database.\r
283 @retval EFI_SAL_NOT_ENOUGH_SCRATCH There are not enough resource available to add the CPU.\r
284\r
285**/\r
286SAL_RETURN_REGS\r
287EFIAPI\r
288EsalAddCpuData (\r
289 IN UINT64 CpuGlobalId,\r
290 IN BOOLEAN Enabled,\r
291 IN UINT64 PalCompatibility\r
292 );\r
293\r
294/**\r
295 Wrapper for the EsalRemoveCpuDataFunctionId service of Extended SAL MP Services Class.\r
296 \r
297 This function is a wrapper for the EsalRemoveCpuDataFunctionId service of Extended SAL\r
298 MP Services Class. See EsalRemoveCpuDataFunctionId of Extended SAL Specification.\r
299\r
300 @param CpuGlobalId The Global ID for the CPU being removed.\r
301\r
302 @retval EFI_SAL_SUCCESS The CPU was removed from the database.\r
303 @retval EFI_SAL_NO_INFORMATION The specified CPU is not in the database.\r
304\r
305**/\r
306SAL_RETURN_REGS\r
307EFIAPI\r
308EsalRemoveCpuData (\r
309 IN UINT64 CpuGlobalId\r
310 );\r
311\r
312/**\r
313 Wrapper for the EsalModifyCpuDataFunctionId service of Extended SAL MP Services Class.\r
314 \r
315 This function is a wrapper for the EsalModifyCpuDataFunctionId service of Extended SAL\r
316 MP Services Class. See EsalModifyCpuDataFunctionId of Extended SAL Specification.\r
317\r
318 @param CpuGlobalId The Global ID for the CPU being modified.\r
319 @param Enabled The enable flag for the CPU being modified.\r
320 TRUE means the CPU is enabled.\r
321 FALSE means the CPU is disabled.\r
322 @param PalCompatibility The PAL Compatibility value for the CPU being modified.\r
323\r
324 @retval EFI_SAL_SUCCESS The CPU database was updated.\r
325 @retval EFI_SAL_NO_INFORMATION The specified CPU is not in the database.\r
326\r
327**/\r
328SAL_RETURN_REGS\r
329EFIAPI\r
330EsalModifyCpuData (\r
331 IN UINT64 CpuGlobalId,\r
332 IN BOOLEAN Enabled,\r
333 IN UINT64 PalCompatibility\r
334 );\r
335\r
336/**\r
337 Wrapper for the EsalGetCpuDataByIdFunctionId service of Extended SAL MP Services Class.\r
338 \r
339 This function is a wrapper for the EsalGetCpuDataByIdFunctionId service of Extended SAL\r
340 MP Services Class. See EsalGetCpuDataByIdFunctionId of Extended SAL Specification.\r
341\r
342 @param CpuGlobalId The Global ID for the CPU being looked up.\r
343 @param IndexByEnabledCpu If TRUE, then the index of set of enabled CPUs of database is returned.\r
344 If FALSE, then the index of set of all CPUs of database is returned.\r
345\r
346 @retval EFI_SAL_SUCCESS The information on the specified CPU was returned.\r
347 @retval EFI_SAL_NO_INFORMATION The specified CPU is not in the database.\r
348\r
349**/\r
350SAL_RETURN_REGS\r
351EFIAPI\r
352EsalGetCpuDataById (\r
353 IN UINT64 CpuGlobalId,\r
354 IN BOOLEAN IndexByEnabledCpu\r
355 );\r
356\r
357/**\r
358 Wrapper for the EsalGetCpuDataByIndexFunctionId service of Extended SAL MP Services Class.\r
359 \r
360 This function is a wrapper for the EsalGetCpuDataByIndexFunctionId service of Extended SAL\r
361 MP Services Class. See EsalGetCpuDataByIndexFunctionId of Extended SAL Specification.\r
362\r
363 @param Index The Global ID for the CPU being modified.\r
364 @param IndexByEnabledCpu If TRUE, then the index of set of enabled CPUs of database is returned.\r
365 If FALSE, then the index of set of all CPUs of database is returned.\r
366\r
367 @retval EFI_SAL_SUCCESS The information on the specified CPU was returned.\r
368 @retval EFI_SAL_NO_INFORMATION The specified CPU is not in the database.\r
369\r
370**/\r
371SAL_RETURN_REGS\r
372EFIAPI\r
373EsalGetCpuDataByIndex (\r
374 IN UINT64 Index,\r
375 IN BOOLEAN IndexByEnabledCpu\r
376 );\r
377\r
378/**\r
379 Wrapper for the EsalWhoAmIFunctionId service of Extended SAL MP Services Class.\r
380 \r
381 This function is a wrapper for the EsalWhoAmIFunctionId service of Extended SAL\r
382 MP Services Class. See EsalWhoAmIFunctionId of Extended SAL Specification.\r
383\r
384 @param IndexByEnabledCpu If TRUE, then the index of set of enabled CPUs of database is returned.\r
385 If FALSE, then the index of set of all CPUs of database is returned.\r
386\r
387 @retval EFI_SAL_SUCCESS The Global ID for the calling CPU was returned.\r
388 @retval EFI_SAL_NO_INFORMATION The calling CPU is not in the database.\r
389\r
390**/\r
391SAL_RETURN_REGS\r
392EFIAPI\r
393EsalWhoAmI (\r
394 IN BOOLEAN IndexByEnabledCpu\r
395 );\r
396\r
397/**\r
398 Wrapper for the EsalNumProcessors service of Extended SAL MP Services Class.\r
399 \r
400 This function is a wrapper for the EsalNumProcessors service of Extended SAL\r
401 MP Services Class. See EsalNumProcessors of Extended SAL Specification.\r
402\r
403 @retval EFI_SAL_SUCCESS The information on the number of CPUs in the platform\r
404 was returned.\r
405\r
406**/\r
407SAL_RETURN_REGS\r
408EFIAPI\r
409EsalNumProcessors (\r
410 VOID\r
411 );\r
412\r
413/**\r
414 Wrapper for the EsalSetMinStateFnctionId service of Extended SAL MP Services Class.\r
415 \r
416 This function is a wrapper for the EsalSetMinStateFnctionId service of Extended SAL\r
417 MP Services Class. See EsalSetMinStateFnctionId of Extended SAL Specification.\r
418\r
419 @param CpuGlobalId The Global ID for the CPU whose MINSTATE pointer is being set.\r
420 @param MinStatePointer The physical address of the MINSTATE buffer for the CPU\r
421 specified by CpuGlobalId.\r
422\r
423 @retval EFI_SAL_SUCCESS The MINSTATE pointer was set for the specified CPU.\r
424 @retval EFI_SAL_NO_INFORMATION The specified CPU is not in the database.\r
425\r
426**/\r
427SAL_RETURN_REGS\r
428EFIAPI\r
429EsalSetMinState (\r
430 IN UINT64 CpuGlobalId,\r
431 IN EFI_PHYSICAL_ADDRESS MinStatePointer\r
432 );\r
433\r
434/**\r
435 Wrapper for the EsalGetMinStateFunctionId service of Extended SAL MP Services Class.\r
436 \r
437 This function is a wrapper for the EsalGetMinStateFunctionId service of Extended SAL\r
438 MP Services Class. See EsalGetMinStateFunctionId of Extended SAL Specification.\r
439\r
440 @param CpuGlobalId The Global ID for the CPU whose MINSTATE pointer is being retrieved.\r
441\r
442 @retval EFI_SAL_SUCCESS The MINSTATE pointer for the specified CPU was retrieved.\r
443 @retval EFI_SAL_NO_INFORMATION The specified CPU is not in the database.\r
444\r
445**/\r
446SAL_RETURN_REGS\r
447EFIAPI\r
448EsalGetMinState (\r
449 IN UINT64 CpuGlobalId\r
450 );\r
451\r
452/**\r
453 Wrapper for the EsalMcsGetStateInfoFunctionId service of Extended SAL MCA Services Class.\r
454 \r
455 This function is a wrapper for the EsalMcsGetStateInfoFunctionId service of Extended SAL\r
456 MCA Services Class. See EsalMcsGetStateInfoFunctionId of Extended SAL Specification.\r
457\r
458 @param CpuGlobalId The Global ID for the CPU whose MCA state buffer is being retrieved.\r
459 @param StateBufferPointer A pointer to the returned MCA state buffer.\r
460 @param RequiredStateBufferSize A pointer to the size, in bytes, of the returned MCA state buffer.\r
461\r
462 @retval EFI_SUCCESS MINSTATE successfully got and size calculated.\r
463 @retval EFI_SAL_NO_INFORMATION Fail to get MINSTATE.\r
464\r
465**/\r
466SAL_RETURN_REGS\r
467EFIAPI\r
468EsalMcaGetStateInfo (\r
469 IN UINT64 CpuGlobalId,\r
470 OUT EFI_PHYSICAL_ADDRESS *StateBufferPointer,\r
471 OUT UINT64 *RequiredStateBufferSize\r
472 );\r
473\r
474/**\r
475 Wrapper for the EsalMcaRegisterCpuFunctionId service of Extended SAL MCA Services Class.\r
476 \r
477 This function is a wrapper for the EsalMcaRegisterCpuFunctionId service of Extended SAL\r
478 MCA Services Class. See EsalMcaRegisterCpuFunctionId of Extended SAL Specification.\r
479\r
480 @param CpuGlobalId The Global ID for the CPU whose MCA state buffer is being set.\r
481 @param StateBufferPointer A pointer to the MCA state buffer.\r
482\r
483 @retval EFI_SAL_NO_INFORMATION Cannot get the processor info with the CpuId\r
484 @retval EFI_SUCCESS Save the processor's state info successfully\r
485\r
486**/\r
487SAL_RETURN_REGS\r
488EFIAPI\r
489EsalMcaRegisterCpu (\r
490 IN UINT64 CpuGlobalId,\r
491 IN EFI_PHYSICAL_ADDRESS StateBufferPointer\r
492 );\r
493\r
494#endif\r