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