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