3 Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
24 #ifndef _SAL_DRIVER_LIB_H_
25 #define _SAL_DRIVER_LIB_H_
28 #include "EfiDriverLib.h"
31 #include EFI_PROTOCOL_DEFINITION (ExtendedSalBootService)
32 #include EFI_PROTOCOL_DEFINITION (ExtendedSalGuid)
45 Get Esal global data in physical mode.
66 Get Esal global data in virtual mode.
88 Set Esal global data in physical mode.
92 Ptr - Pointer to the data
111 Set Esal global data in virtual mode.
115 Ptr - Pointer to the data
126 LibGetGlobalPhyData (
133 Get Esal global data in physical mode.
147 LibGetGlobalVirtData (
154 Get Esal global data in virtual mode.
168 LibSetGlobalPhyData (
176 Set Esal global data in physical mode.
180 Ptr - Pointer to the data
191 LibSetGlobalVirtData (
199 Set Esal global data in virtual mode.
203 Ptr - Pointer to the data
221 Get interrupt request register.
235 PrepareApsForHandOverToOS (
242 Prepare AP info for hand over to OS.
265 Hand over AP info to OS.
269 a1 - Address to call into
337 NewBsp - New BSP index
338 OldBsp - Old BSP index
352 IN EFI_RESET_TYPE ResetType
,
353 IN EFI_STATUS ResetStatus
,
365 ResetType - Reset type
366 ResetStatus - Reset status
367 DataSize - Size of ResetData
368 ResetData - Description string
395 Arg1 - Pal call index
408 SalRegisterNewPalEntry (
409 IN BOOLEAN PhysicalPalAddress
,
410 IN EFI_PHYSICAL_ADDRESS NewPalAddress
420 PhysicalPalAddress - The address is physical or virtual
421 NewPalAddress - New Pal entry address
431 SalGetPalEntryPointer (
432 IN BOOLEAN PhysicalPalAddress
442 PhysicalPalAddress - The address is physical or virtual
455 SalGetNextHighMonotonicCount (
456 OUT UINT32
*HighCount
462 Get next high 32 bits of monotonic count.
466 HighCount - High 32 bits of monotonic count.
480 IN UINT64 SalVectorType
,
496 SalVectorType - Vector type
497 PhyAddr1 - OS MCA entry point
498 Gp1 - GP for OS MCA entry
499 LengthCs1 - Length of OS MCA
500 PhyAddr2 - OS INIT entry point
501 Gp2 - GP for OS Init entry
502 LengthCs2 - Length of OS INIT
519 Mc rendezvous function.
536 IN UINT64 IntOrMemVal
,
548 ParamType - Parameter type
549 IntOrMem - Interrupt or memory address
550 IntOrMemVal - Interrupt number or memory address value
551 Timeout - Time out value
552 McaOpt - Option for MCA
573 VectorType - Vector type
583 EsalProcMcGetParams (
584 IN UINT64 ParamInfoType
594 ParamInfoType - Parameter info type
604 EsalProcMcGetMcParams (
624 EsalProcGetMcCheckinFlags (
625 IN UINT64 ProcessorUnit
635 ProcessorUnit - Processor Index
645 // Sal Base Class enums
652 } ESAL_GET_VECTOR_TYPE
;
660 OUT EFI_TIME_CAPABILITIES
*Capabilities
666 Returns the current time and date information, and the time-keeping
667 capabilities of the hardware platform.
671 Time - A pointer to storage to receive a snapshot of the current time.
672 Capabilities - An optional pointer to a buffer to receive the real time clock device's
690 Sets the current local time and date information.
694 Time - A pointer to the current time.
705 OUT BOOLEAN
*Enabled
,
706 OUT BOOLEAN
*Pending
,
713 Returns the current wakeup alarm clock setting.
717 Enabled - Indicates if the alarm is currently enabled or disabled.
718 Pending - Indicates if the alarm signal is pending and requires acknowledgement.
719 Time - The current alarm setting.
737 Sets the system wakeup alarm clock time.
741 Enable - Enable or disable the wakeup alarm.
742 Time - If Enable is TRUE, the time to set the wakeup alarm for.
743 If Enable is FALSE, then this parameter is optional, and may be NULL.
753 SalInitializeThreshold (
754 IN VOID
*ThresholdStruct
,
762 Init threshold structure.
766 ThresholdStruct - Threshold structure
767 Count - Threshold count
778 SalBumpThresholdCount (
779 IN VOID
*ThresholdStruct
,
787 Bump threshold count.
791 ThresholdStruct - Threshold structure
792 Count - Threshold count
803 SalGetThresholdCount (
804 IN VOID
*ThresholdStruct
,
812 Get threshold structure.
816 ThresholdStruct - Threshold structure
817 Count - Threshold count
828 // Common Lib Function
831 RegisterEsalFunction (
832 IN UINT64 FunctionId
,
833 IN EFI_GUID
*ClassGuid
,
834 IN SAL_INTERNAL_EXTENDED_SAL_PROC Function
,
835 IN VOID
*ModuleGlobal
841 Register ESAL Class Function and it's asociated global.
842 This function is boot service only!
845 FunctionId - ID of function to register
846 ClassGuid - GUID of function class
847 Function - Function to register under ClassGuid/FunctionId pair
848 ModuleGlobal - Module global for Function.
851 EFI_SUCCESS - If ClassGuid/FunctionId Function was registered.
857 EfiInitializeSalDriverLib (
864 Initialize Sal driver lib.
867 Runtime - At runtime or not?
876 // MCA PMI INIT Registeration Functions.
879 LibRegisterMcaFunction (
880 IN EFI_SAL_MCA_HANDLER McaHandler
,
881 IN VOID
*ModuleGlobal
,
882 IN BOOLEAN MakeFirst
,
889 Register MCA handler.
892 McaHandler - MCA handler
893 ModuleGlobal - Module global for function
894 MakeFirst - Make it as first?
895 MakeLast - Make it as last?
904 LibRegisterPmiFunction (
905 IN EFI_SAL_PMI_HANDLER PmiHandler
,
906 IN VOID
*ModuleGlobal
,
907 IN BOOLEAN MakeFirst
,
914 Register PMI handler.
917 PmiHandler - PMI handler
918 ModuleGlobal - Module global for function
919 MakeFirst - Make it as first?
920 MakeLast - Make it as last?
929 LibRegisterInitFunction (
930 IN EFI_SAL_INIT_HANDLER InitHandler
,
931 IN VOID
*ModuleGlobal
,
932 IN BOOLEAN MakeFirst
,
939 Register INIT handler.
942 InitHandler - INIT handler
943 ModuleGlobal - Module global for function
944 MakeFirst - Make it as first?
945 MakeLast - Make it as last?
954 // Base IO Class Functions
958 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
971 Width - Width of read operation
972 Address - Start IO address to read
974 Buffer - Buffer to store result
985 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
998 Width - Width of write operation
999 Address - Start IO address to write
1001 Buffer - Buffer to write to the address
1012 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
1019 Routine Description:
1020 Perform a Memory mapped IO read into Buffer.
1023 Width - Width of each read transaction.
1024 Address - Memory mapped IO address to read
1025 Count - Number of Width quanta to read
1026 Buffer - Buffer to read data into. size is Width * Count
1036 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
1043 Routine Description:
1044 Perform a memory mapped IO write into Buffer.
1047 Width - Width of write transaction, and repeat operation to use
1048 Address - IO address to write
1049 Count - Number of times to write the IO address.
1050 Buffer - Buffer to write data from. size is Width * Count
1059 // PCI Class Functions
1068 Routine Description:
1069 Pci config space read.
1072 Address - PCI address to read
1089 Routine Description:
1090 Pci config space write.
1093 Address - PCI address to write
1094 Size - Size to write
1095 Value - Value to write
1104 // MP Class Functions
1108 IN UINT64 CpuGlobalId
,
1110 IN UINT64 PalCompatability
1114 Routine Description:
1118 CpuGlobalId - CPU ID
1119 Enabled - Enabled or not
1120 PalCompatability - Pal compatability
1129 LibMPRemoveCpuData (
1130 IN UINT64 CpuGlobalId
1134 Routine Description:
1138 CpuGlobalId - CPU ID
1147 LibMPModifyCpuData (
1148 IN UINT64 CpuGlobalId
,
1150 IN UINT64 PalCompatability
1154 Routine Description:
1158 CpuGlobalId - CPU ID
1159 Enabled - Enabled or not
1160 PalCompatability - Pal compatability
1169 LibMPGetCpuDataByID (
1170 IN UINT64 CpuGlobalId
,
1171 IN BOOLEAN IndexByEnabledCpu
1175 Routine Description:
1179 CpuGlobalId - CPU ID
1180 IndexByEnabledCpu - Whether indexed by enabled CPU
1189 LibMPGetCpuDataByIndex (
1191 IN BOOLEAN IndexByEnabledCpu
1195 Routine Description:
1200 IndexByEnabledCpu - Whether indexed by enabled CPU
1210 IN UINT64 ProcessorNumber
,
1211 IN UINT64 VectorNumber
,
1212 IN EFI_DELIVERY_MODE DeliveryMode
,
1217 Routine Description:
1221 ProcessorNumber - Processor number
1222 VectorNumber - Vector number
1223 DeliveryMode - Delivery mode
1224 IRFlag - Interrupt Redirection flag
1233 LibMpCurrentProcessor (
1234 IN BOOLEAN IndexByEnabledCpu
1238 Routine Description:
1239 Get current processor index.
1242 IndexByEnabledCpu - Whether indexed by enabled CPU
1251 LibGetNumProcessors (
1256 Routine Description:
1257 Get number of processors.
1269 LibMpSaveMinStatePointer (
1270 IN UINT64 CpuGlobalId
,
1271 IN EFI_PHYSICAL_ADDRESS MinStatePointer
1275 Routine Description:
1276 Register pointer to save min state.
1279 CpuGlobalId - CPU global ID
1280 MinStatePointer - Pointer to save min state
1289 LibMpRestoreMinStatePointer (
1290 IN UINT64 CpuGlobalId
1294 Routine Description:
1295 Restore pointer to save min state.
1298 CpuGlobalId - CPU global ID
1307 // MCA Class Functions
1310 LibMcaGetStateInfo (
1312 OUT EFI_PHYSICAL_ADDRESS
*StateBufferPointer
,
1313 OUT UINT64
*RequiredStateBufferSize
1317 Routine Description:
1322 StateBufferPointer - Pointer of state buffer
1323 RequiredStateBufferSize - Size of required state buffer
1334 IN EFI_PHYSICAL_ADDRESS StateBufferAddress
1338 Routine Description:
1339 MCA register CPU state info.
1343 StateBufferAddress - Pointer of state buffer
1352 // SAL ELOG Functions
1355 LibSalGetStateInfo (
1357 IN UINT8
*McaBuffer
,
1362 Routine Description:
1367 McaBuffer - Info buffer provided by caller
1377 LibSalGetStateInfoSize (
1383 Routine Description:
1384 Get state info size.
1388 Size - Size required
1397 LibSalClearStateInfo (
1402 Routine Description:
1415 LibEsalGetStateBuffer (
1417 OUT UINT8
**McaBuffer
,
1422 Routine Description:
1427 McaBuffer - MCA buffer
1437 LibEsalSaveStateBuffer (
1442 Routine Description: