3 Copyright (c) 2004 - 2012, 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.
18 Light weight lib to support Tiano Sal drivers.
23 #include "EfiRuntimeLib.h"
24 #include EFI_PROTOCOL_DEFINITION (ExtendedSalBootService)
25 #include EFI_PROTOCOL_DEFINITION (ExtendedSalGuid)
26 #include "IpfDefines.h"
30 // Worker functions in EsalLib.s
38 SetEsalPhysicalEntryPoint (
44 SetEsalVirtualEntryPoint (
51 IN EFI_PHYSICAL_ADDRESS Start
,
56 // Module Globals. It's not valid to use these after the
57 // EfiRuntimeLibVirtualNotifyEvent has fired.
59 static EFI_EVENT mEfiVirtualNotifyEvent
;
60 static EFI_RUNTIME_SERVICES
*mRT
;
61 static EFI_PLABEL mPlabel
;
62 static EXTENDED_SAL_BOOT_SERVICE_PROTOCOL
*mEsalBootService
;
63 static BOOLEAN mRuntimeLibInitialized
= FALSE
;
67 EfiRuntimeLibVirtualNotifyEvent (
75 Fixup internal data so that EFI and SAL can be call in virtual mode.
76 Call the passed in Child Notify event and convert any pointers in
81 Event - The Event that is being processed
83 Context - Event Context
91 EFI_EVENT_NOTIFY ChildNotify
;
93 if (Context
!= NULL
) {
97 ChildNotify
= (EFI_EVENT_NOTIFY
) (UINTN
) Context
;
98 ChildNotify (Event
, NULL
);
101 mRT
->ConvertPointer (EFI_INTERNAL_POINTER
, (VOID
**) &mPlabel
.EntryPoint
);
102 mRT
->ConvertPointer (EFI_INTERNAL_POINTER
| EFI_IPF_GP_POINTER
, (VOID
**) &mPlabel
.GP
);
104 SetEsalVirtualEntryPoint (mPlabel
.EntryPoint
, mPlabel
.GP
);
107 // Clear out BootService globals
114 // Pointers don't work you must use a direct lib call
119 EfiInitializeRuntimeDriverLib (
120 IN EFI_HANDLE ImageHandle
,
121 IN EFI_SYSTEM_TABLE
*SystemTable
,
122 IN EFI_EVENT_NOTIFY GoVirtualChildEvent
128 Intialize runtime Driver Lib if it has not yet been initialized.
132 ImageHandle - The firmware allocated handle for the EFI image.
134 SystemTable - A pointer to the EFI System Table.
136 GoVirtualChildEvent - Caller can register a virtual notification event.
140 EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.
147 if (mRuntimeLibInitialized
) {
148 return EFI_ALREADY_STARTED
;
151 mRuntimeLibInitialized
= TRUE
;
154 gBS
= SystemTable
->BootServices
;
155 mRT
= SystemTable
->RuntimeServices
;
156 Status
= EfiLibGetSystemConfigurationTable (&gEfiDxeServicesTableGuid
, (VOID
**) &gDS
);
157 ASSERT_EFI_ERROR (Status
);
160 // The protocol contains a function pointer, which is an indirect procedure call.
161 // An indirect procedure call goes through a plabel, and pointer to a function is
162 // a pointer to a plabel. To implement indirect procedure calls that can work in
163 // both physical and virtual mode, two plabels are required (one physical and one
164 // virtual). So lets grap the physical PLABEL for the EsalEntryPoint and store it
165 // away. We cache it in a module global, so we can register the vitrual version.
167 Status
= gBS
->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid
, NULL
, (VOID
**) &mEsalBootService
);
168 ASSERT_EFI_ERROR (Status
);
170 Plabel
= (EFI_PLABEL
*) (UINTN
) mEsalBootService
->ExtendedSalProc
;
172 mPlabel
.EntryPoint
= Plabel
->EntryPoint
;
173 mPlabel
.GP
= Plabel
->GP
;
175 SetEsalPhysicalEntryPoint (mPlabel
.EntryPoint
, mPlabel
.GP
);
178 // Create a Virtual address change notification event. Pass in the callers
179 // GoVirtualChildEvent so it's get passed to the event as contex.
181 Status
= gBS
->CreateEvent (
182 EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE
,
184 EfiRuntimeLibVirtualNotifyEvent
,
185 (VOID
*) GoVirtualChildEvent
,
186 &mEfiVirtualNotifyEvent
188 ASSERT_EFI_ERROR (Status
);
194 EfiShutdownRuntimeDriverLib (
201 This routine will free some resources which have been allocated in
202 EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error,
203 it must call this routine to free the allocated resource before the exiting.
211 EFI_SUCCESS - Shotdown the Runtime Driver Lib successfully
212 EFI_UNSUPPORTED - Runtime Driver lib was not initialized at all
218 if (!mRuntimeLibInitialized
) {
220 // You must call EfiInitializeRuntimeDriverLib() first
222 return EFI_UNSUPPORTED
;
225 mRuntimeLibInitialized
= FALSE
;
228 // Close SetVirtualAddressMap () notify function
230 Status
= gBS
->CloseEvent (mEfiVirtualNotifyEvent
);
231 ASSERT_EFI_ERROR (Status
);
237 RegisterEsalFunction (
238 IN UINT64 FunctionId
,
239 IN EFI_GUID
*ClassGuid
,
240 IN SAL_INTERNAL_EXTENDED_SAL_PROC Function
,
241 IN VOID
*ModuleGlobal
247 Register ESAL Class Function and it's asociated global.
248 This function is boot service only!
251 FunctionId - ID of function to register
252 ClassGuid - GUID of function class
253 Function - Function to register under ClassGuid/FunctionId pair
254 ModuleGlobal - Module global for Function.
257 EFI_SUCCESS - If ClassGuid/FunctionId Function was registered.
261 return mEsalBootService
->AddExtendedSalProc (
272 IN EFI_GUID
*ClassGuid
,
273 IN VOID
*ModuleGlobal
,
280 Register ESAL Class and it's asociated global.
281 This function is boot service only!
284 ClassGuid - GUID of function class
285 ModuleGlobal - Module global for Function.
286 ... - SAL_INTERNAL_EXTENDED_SAL_PROC and FunctionId pairs. NULL
287 indicates the end of the list.
290 EFI_SUCCESS - All members of ClassGuid registered
296 SAL_INTERNAL_EXTENDED_SAL_PROC Function
;
298 EFI_HANDLE NewHandle
;
300 VA_START (Args
, ModuleGlobal
);
302 Status
= EFI_SUCCESS
;
303 while (!EFI_ERROR (Status
)) {
304 Function
= (SAL_INTERNAL_EXTENDED_SAL_PROC
) VA_ARG (Args
, SAL_INTERNAL_EXTENDED_SAL_PROC
);
305 if (Function
== NULL
) {
309 FunctionId
= VA_ARG (Args
, UINT64
);
311 Status
= RegisterEsalFunction (FunctionId
, ClassGuid
, Function
, ModuleGlobal
);
316 if (EFI_ERROR (Status
)) {
321 return gBS
->InstallProtocolInterface (
324 EFI_NATIVE_INTERFACE
,
331 IN EFI_GUID
*ClassGuid
,
332 IN UINT64 FunctionId
,
345 Call module that is not linked direclty to this module. This code is IP
346 relative and hides the binding issues of virtual or physical calling. The
347 function that gets dispatched has extra arguments that include the registered
348 module global and a boolean flag to indicate if the system is in virutal mode.
351 ClassGuid - GUID of function
352 FunctionId - Function in ClassGuid to call
353 Arg2 - Argument 2 ClassGuid/FunctionId defined
354 Arg3 - Argument 3 ClassGuid/FunctionId defined
355 Arg4 - Argument 4 ClassGuid/FunctionId defined
356 Arg5 - Argument 5 ClassGuid/FunctionId defined
357 Arg6 - Argument 6 ClassGuid/FunctionId defined
358 Arg7 - Argument 7 ClassGuid/FunctionId defined
359 Arg8 - Argument 8 ClassGuid/FunctionId defined
362 Status of ClassGuid/FuncitonId
366 SAL_RETURN_REGS ReturnReg
;
367 SAL_EXTENDED_SAL_PROC EsalProc
;
369 ReturnReg
= GetEsalEntryPoint ();
370 if (ReturnReg
.Status
!= EFI_SAL_SUCCESS
) {
374 if (ReturnReg
.r11
& PSR_IT_MASK
) {
376 // Virtual mode plabel to entry point
378 EsalProc
= (SAL_EXTENDED_SAL_PROC
) ReturnReg
.r10
;
381 // Physical mode plabel to entry point
383 EsalProc
= (SAL_EXTENDED_SAL_PROC
) ReturnReg
.r9
;
401 IN UINTN DebugDisposition
,
408 Determines the new virtual address that is to be used on subsequent memory accesses.
412 DebugDisposition - Supplies type information for the pointer being converted.
413 Address - A pointer to a pointer that is to be fixed to be the value needed
414 for the new virtual address mappings being applied.
422 return mRT
->ConvertPointer (DebugDisposition
, Address
);
432 Return TRUE if SetVirtualAddressMap () has been called
438 TRUE - If SetVirtualAddressMap () has been called
442 EFI_GUID Guid
= EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID
;
443 SAL_RETURN_REGS ReturnReg
;
445 ReturnReg
= EfiCallEsalService (&Guid
, IsVirtual
, 0, 0, 0, 0, 0, 0, 0);
447 return (BOOLEAN
) (ReturnReg
.r9
== 1);
457 Return TRUE if ExitBootService () has been called
463 TRUE - If ExitBootService () has been called
467 EFI_GUID Guid
= EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID
;
468 SAL_RETURN_REGS ReturnReg
;
470 ReturnReg
= EfiCallEsalService (&Guid
, IsEfiRuntime
, 0, 0, 0, 0, 0, 0, 0);
472 return (BOOLEAN
) (ReturnReg
.r9
== 1);
476 EfiReportStatusCode (
477 IN EFI_STATUS_CODE_TYPE CodeType
,
478 IN EFI_STATUS_CODE_VALUE Value
,
480 IN EFI_GUID
* CallerId
,
481 IN EFI_STATUS_CODE_DATA
* Data OPTIONAL
491 CodeType - Type of Status Code.
493 Value - Value to output for Status Code.
495 Instance - Instance Number of this status code.
497 CallerId - ID of the caller of this status code.
499 Data - Optional data associated with this status code.
507 EFI_GUID Guid
= EFI_EXTENDED_SAL_STATUS_CODE_SERVICES_PROTOCOL_GUID
;
508 SAL_RETURN_REGS ReturnReg
;
511 ReturnReg
= EfiCallEsalService (
523 return (EFI_STATUS
) ReturnReg
.Status
;
526 // Sal Reset Driver Class
530 IN EFI_RESET_TYPE ResetType
,
531 IN EFI_STATUS ResetStatus
,
539 Resets the entire platform.
543 ResetType - The type of reset to perform.
544 ResetStatus - The status code for the reset.
545 DataSize - The size, in bytes, of ResetData.
546 ResetData - A data buffer that includes a Null-terminated Unicode string, optionally
547 followed by additional binary data.
555 EFI_GUID Guid
= EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID
;
561 (UINT64
) ResetStatus
,
570 // Sal MTC Driver Class
573 EfiGetNextHighMonotonicCount (
574 OUT UINT32
*HighCount
580 Returns the next high 32 bits of the platform's monotonic counter.
584 HighCount - Pointer to returned value.
592 SAL_RETURN_REGS ReturnReg
;
594 EFI_GUID Guid
= EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID
;
596 ReturnReg
= EfiCallEsalService (&Guid
, GetNextHighMonotonicCount
, (UINT64
) HighCount
, 0, 0, 0, 0, 0, 0);
597 return (EFI_STATUS
) ReturnReg
.Status
;
600 // Sal Variable Driver Class
604 IN CHAR16
*VariableName
,
605 IN EFI_GUID
* VendorGuid
,
606 OUT UINT32
*Attributes OPTIONAL
,
607 IN OUT UINTN
*DataSize
,
614 Returns the value of a variable.
618 VariableName - A Null-terminated Unicode string that is the name of the
620 VendorGuid - A unique identifier for the vendor.
621 Attributes - If not NULL, a pointer to the memory location to return the
622 attributes bitmask for the variable.
623 DataSize - On input, the size in bytes of the return Data buffer.
624 On output the size of data returned in Data.
625 Data - The buffer to return the contents of the variable.
633 SAL_RETURN_REGS ReturnReg
;
634 EFI_GUID Guid
= EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID
;
636 ReturnReg
= EfiCallEsalService (
639 (UINT64
) VariableName
,
647 return (EFI_STATUS
) ReturnReg
.Status
;
651 EfiGetNextVariableName (
652 IN OUT UINTN
*VariableNameSize
,
653 IN OUT CHAR16
*VariableName
,
654 IN OUT EFI_GUID
*VendorGuid
660 Enumerates the current variable names.
664 VariableNameSize - The size of the VariableName buffer.
665 VariableName - On input, supplies the last VariableName that was returned
666 by GetNextVariableName().
667 On output, returns the Nullterminated Unicode string of the
669 VendorGuid - On input, supplies the last VendorGuid that was returned by
670 GetNextVariableName().
671 On output, returns the VendorGuid of the current variable.
679 SAL_RETURN_REGS ReturnReg
;
680 EFI_GUID Guid
= EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID
;
682 ReturnReg
= EfiCallEsalService (
684 EsalGetNextVariableName
,
685 (UINT64
) VariableNameSize
,
686 (UINT64
) VariableName
,
693 return (EFI_STATUS
) ReturnReg
.Status
;
698 IN CHAR16
*VariableName
,
699 IN EFI_GUID
*VendorGuid
,
700 IN UINT32 Attributes
,
708 Sets the value of a variable.
712 VariableName - A Null-terminated Unicode string that is the name of the
714 VendorGuid - A unique identifier for the vendor.
715 Attributes - Attributes bitmask to set for the variable.
716 DataSize - The size in bytes of the Data buffer.
717 Data - The contents for the variable.
725 SAL_RETURN_REGS ReturnReg
;
726 EFI_GUID Guid
= EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID
;
728 ReturnReg
= EfiCallEsalService (
731 (UINT64
) VariableName
,
739 return (EFI_STATUS
) ReturnReg
.Status
;
742 #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
745 EfiQueryVariableInfo (
746 IN UINT32 Attributes
,
747 OUT UINT64
*MaximumVariableStorageSize
,
748 OUT UINT64
*RemainingVariableStorageSize
,
749 OUT UINT64
*MaximumVariableSize
755 This code returns information about the EFI variables.
759 Attributes Attributes bitmask to specify the type of variables
760 on which to return information.
761 MaximumVariableStorageSize Pointer to the maximum size of the storage space available
762 for the EFI variables associated with the attributes specified.
763 RemainingVariableStorageSize Pointer to the remaining size of the storage space available
764 for the EFI variables associated with the attributes specified.
765 MaximumVariableSize Pointer to the maximum size of the individual EFI variables
766 associated with the attributes specified.
774 SAL_RETURN_REGS ReturnReg
;
775 EFI_GUID Guid
= EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID
;
777 ReturnReg
= EfiCallEsalService (
779 EsalQueryVariableInfo
,
781 (UINT64
) MaximumVariableStorageSize
,
782 (UINT64
) RemainingVariableStorageSize
,
783 (UINT64
) MaximumVariableSize
,
788 return (EFI_STATUS
) ReturnReg
.Status
;
794 // Sal RTC Driver Class.
799 OUT EFI_TIME_CAPABILITIES
*Capabilities
805 Returns the current time and date information, and the time-keeping
806 capabilities of the hardware platform.
810 Time - A pointer to storage to receive a snapshot of the current time.
811 Capabilities - An optional pointer to a buffer to receive the real time clock device's
820 SAL_RETURN_REGS ReturnReg
;
821 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
823 ReturnReg
= EfiCallEsalService (&Guid
, GetTime
, (UINT64
) Time
, (UINT64
) Capabilities
, 0, 0, 0, 0, 0);
824 return ReturnReg
.Status
;
835 Sets the current local time and date information.
839 Time - A pointer to the current time.
847 SAL_RETURN_REGS ReturnReg
;
849 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
851 ReturnReg
= EfiCallEsalService (&Guid
, SetTime
, (UINT64
) Time
, 0, 0, 0, 0, 0, 0);
852 return ReturnReg
.Status
;
857 OUT BOOLEAN
*Enabled
,
858 OUT BOOLEAN
*Pending
,
865 Returns the current wakeup alarm clock setting.
869 Enabled - Indicates if the alarm is currently enabled or disabled.
870 Pending - Indicates if the alarm signal is pending and requires acknowledgement.
871 Time - The current alarm setting.
879 SAL_RETURN_REGS ReturnReg
;
881 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
883 ReturnReg
= EfiCallEsalService (&Guid
, GetWakeupTime
, (UINT64
) Enabled
, (UINT64
) Pending
, (UINT64
) Time
, 0, 0, 0, 0);
884 return ReturnReg
.Status
;
896 Sets the system wakeup alarm clock time.
900 Enable - Enable or disable the wakeup alarm.
901 Time - If Enable is TRUE, the time to set the wakeup alarm for.
902 If Enable is FALSE, then this parameter is optional, and may be NULL.
910 SAL_RETURN_REGS ReturnReg
;
912 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
914 ReturnReg
= EfiCallEsalService (&Guid
, SetWakeupTime
, (UINT64
) Enable
, (UINT64
) Time
, 0, 0, 0, 0, 0);
915 return ReturnReg
.Status
;
925 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
933 Perform an IO read into Buffer.
936 Width - Width of read transaction, and repeat operation to use
937 Address - IO address to read
938 Count - Number of times to read the IO address.
939 Buffer - Buffer to read data into. size is Width * Count
947 SAL_RETURN_REGS ReturnReg
;
949 EFI_GUID Guid
= EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID
;
951 ReturnReg
= EfiCallEsalService (&Guid
, IoRead
, (UINT64
) Width
, Address
, Count
, (UINT64
) Buffer
, 0, 0, 0);
952 ASSERT (ReturnReg
.Status
== EFI_SAL_SUCCESS
);
954 return ReturnReg
.Status
;
960 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
968 Perform an IO write into Buffer.
971 Width - Width of write transaction, and repeat operation to use
972 Address - IO address to write
973 Count - Number of times to write the IO address.
974 Buffer - Buffer to write data from. size is Width * Count
982 SAL_RETURN_REGS ReturnReg
;
984 EFI_GUID Guid
= EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID
;
986 ReturnReg
= EfiCallEsalService (&Guid
, IoWrite
, (UINT64
) Width
, Address
, Count
, (UINT64
) Buffer
, 0, 0, 0);
988 return ReturnReg
.Status
;
994 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
1001 Routine Description:
1002 Perform a Memory mapped IO read into Buffer.
1005 Width - Width of each read transaction.
1006 Address - Memory mapped IO address to read
1007 Count - Number of Width quanta to read
1008 Buffer - Buffer to read data into. size is Width * Count
1016 SAL_RETURN_REGS ReturnReg
;
1018 EFI_GUID Guid
= EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID
;
1020 ReturnReg
= EfiCallEsalService (&Guid
, MemRead
, (UINT64
) Width
, Address
, Count
, (UINT64
) Buffer
, 0, 0, 0);
1021 ASSERT (ReturnReg
.Status
== EFI_SAL_SUCCESS
);
1023 return ReturnReg
.Status
;
1029 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
1036 Routine Description:
1037 Perform a memory mapped IO write into Buffer.
1040 Width - Width of write transaction, and repeat operation to use
1041 Address - IO address to write
1042 Count - Number of times to write the IO address.
1043 Buffer - Buffer to write data from. size is Width * Count
1051 SAL_RETURN_REGS ReturnReg
;
1053 EFI_GUID Guid
= EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID
;
1055 ReturnReg
= EfiCallEsalService (&Guid
, MemWrite
, (UINT64
) Width
, Address
, Count
, (UINT64
) Buffer
, 0, 0, 0);
1057 return ReturnReg
.Status
;
1062 #define EFI_PCI_ADDRESS_IPF(_seg, _bus, _devfunc, _reg) \
1063 (((_seg) << 24) | ((_bus) << 16) | ((_devfunc) << 8) | (_reg)) & 0xFFFFFFFF
1066 // PCI Class Functions
1077 Routine Description:
1078 Perform an one byte PCI config cycle read
1081 Segment - PCI Segment ACPI _SEG
1083 DevFunc - PCI Device(7:3) and Func(2:0)
1084 Register - PCI config space register
1087 Data read from PCI config space
1091 EFI_GUID Guid
= EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID
;
1093 SAL_RETURN_REGS Return
;
1095 Address
= EFI_PCI_ADDRESS_IPF (Segment
, Bus
, DevFunc
, Register
);
1096 Return
= EfiCallEsalService (&Guid
, SalPciConfigRead
, Address
, 1, 0, 0, 0, 0, 0);
1098 return (UINT8
) Return
.r9
;
1111 Routine Description:
1112 Perform an two byte PCI config cycle read
1115 Segment - PCI Segment ACPI _SEG
1117 DevFunc - PCI Device(7:3) and Func(2:0)
1118 Register - PCI config space register
1121 Data read from PCI config space
1125 EFI_GUID Guid
= EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID
;
1127 SAL_RETURN_REGS Return
;
1129 Address
= EFI_PCI_ADDRESS_IPF (Segment
, Bus
, DevFunc
, Register
);
1130 Return
= EfiCallEsalService (&Guid
, SalPciConfigRead
, Address
, 2, 0, 0, 0, 0, 0);
1132 return (UINT16
) Return
.r9
;
1144 Routine Description:
1145 Perform an four byte PCI config cycle read
1148 Segment - PCI Segment ACPI _SEG
1150 DevFunc - PCI Device(7:3) and Func(2:0)
1151 Register - PCI config space register
1154 Data read from PCI config space
1158 EFI_GUID Guid
= EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID
;
1160 SAL_RETURN_REGS Return
;
1162 Address
= EFI_PCI_ADDRESS_IPF (Segment
, Bus
, DevFunc
, Register
);
1163 Return
= EfiCallEsalService (&Guid
, SalPciConfigRead
, Address
, 4, 0, 0, 0, 0, 0);
1165 return (UINT32
) Return
.r9
;
1178 Routine Description:
1179 Perform an one byte PCI config cycle write
1182 Segment - PCI Segment ACPI _SEG
1184 DevFunc - PCI Device(7:3) and Func(2:0)
1185 Register - PCI config space register
1186 Data - Data to write
1193 EFI_GUID Guid
= EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID
;
1196 Address
= EFI_PCI_ADDRESS_IPF (Segment
, Bus
, DevFunc
, Register
);
1197 EfiCallEsalService (&Guid
, SalPciConfigWrite
, Address
, 1, Data
, 0, 0, 0, 0);
1210 Routine Description:
1211 Perform an two byte PCI config cycle write
1214 Segment - PCI Segment ACPI _SEG
1216 DevFunc - PCI Device(7:3) and Func(2:0)
1217 Register - PCI config space register
1218 Data - Data to write
1225 EFI_GUID Guid
= EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID
;
1228 Address
= EFI_PCI_ADDRESS_IPF (Segment
, Bus
, DevFunc
, Register
);
1229 EfiCallEsalService (&Guid
, SalPciConfigWrite
, Address
, 2, Data
, 0, 0, 0, 0);
1242 Routine Description:
1243 Perform an four byte PCI config cycle write
1246 Segment - PCI Segment ACPI _SEG
1248 DevFunc - PCI Device(7:3) and Func(2:0)
1249 Register - PCI config space register
1250 Data - Data to write
1257 EFI_GUID Guid
= EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID
;
1260 Address
= EFI_PCI_ADDRESS_IPF (Segment
, Bus
, DevFunc
, Register
);
1261 EfiCallEsalService (&Guid
, SalPciConfigWrite
, Address
, 4, Data
, 0, 0, 0, 0);
1265 // Stall class functions
1269 IN UINTN Microseconds
1273 Routine Description:
1274 Delay for at least the request number of microseconds
1277 Microseconds - Number of microseconds to delay.
1284 EFI_GUID Guid
= EFI_EXTENDED_SAL_STALL_SERVICES_PROTOCOL_GUID
;
1286 if (EfiAtRuntime ()) {
1287 EfiCallEsalService (&Guid
, Stall
, Microseconds
, 4, 0, 0, 0, 0, 0);
1289 gBS
->Stall (Microseconds
);
1293 // Cache Flush Routine.
1297 IN EFI_PHYSICAL_ADDRESS Start
,
1302 Routine Description:
1304 Flush cache with specified range.
1308 Start - Start address
1309 Length - Length in bytes
1315 EFI_SUCCESS - success
1319 SalFlushCache (Start
, Length
);