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