3 Copyright (c) 2004 - 2010, 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
);
314 if (EFI_ERROR (Status
)) {
319 return gBS
->InstallProtocolInterface (
322 EFI_NATIVE_INTERFACE
,
329 IN EFI_GUID
*ClassGuid
,
330 IN UINT64 FunctionId
,
343 Call module that is not linked direclty to this module. This code is IP
344 relative and hides the binding issues of virtual or physical calling. The
345 function that gets dispatched has extra arguments that include the registered
346 module global and a boolean flag to indicate if the system is in virutal mode.
349 ClassGuid - GUID of function
350 FunctionId - Function in ClassGuid to call
351 Arg2 - Argument 2 ClassGuid/FunctionId defined
352 Arg3 - Argument 3 ClassGuid/FunctionId defined
353 Arg4 - Argument 4 ClassGuid/FunctionId defined
354 Arg5 - Argument 5 ClassGuid/FunctionId defined
355 Arg6 - Argument 6 ClassGuid/FunctionId defined
356 Arg7 - Argument 7 ClassGuid/FunctionId defined
357 Arg8 - Argument 8 ClassGuid/FunctionId defined
360 Status of ClassGuid/FuncitonId
364 SAL_RETURN_REGS ReturnReg
;
365 SAL_EXTENDED_SAL_PROC EsalProc
;
367 ReturnReg
= GetEsalEntryPoint ();
368 if (ReturnReg
.Status
!= EFI_SAL_SUCCESS
) {
372 if (ReturnReg
.r11
& PSR_IT_MASK
) {
374 // Virtual mode plabel to entry point
376 EsalProc
= (SAL_EXTENDED_SAL_PROC
) ReturnReg
.r10
;
379 // Physical mode plabel to entry point
381 EsalProc
= (SAL_EXTENDED_SAL_PROC
) ReturnReg
.r9
;
399 IN UINTN DebugDisposition
,
406 Determines the new virtual address that is to be used on subsequent memory accesses.
410 DebugDisposition - Supplies type information for the pointer being converted.
411 Address - A pointer to a pointer that is to be fixed to be the value needed
412 for the new virtual address mappings being applied.
420 return mRT
->ConvertPointer (DebugDisposition
, Address
);
430 Return TRUE if SetVirtualAddressMap () has been called
436 TRUE - If SetVirtualAddressMap () has been called
440 EFI_GUID Guid
= EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID
;
441 SAL_RETURN_REGS ReturnReg
;
443 ReturnReg
= EfiCallEsalService (&Guid
, IsVirtual
, 0, 0, 0, 0, 0, 0, 0);
445 return (BOOLEAN
) (ReturnReg
.r9
== 1);
455 Return TRUE if ExitBootService () has been called
461 TRUE - If ExitBootService () has been called
465 EFI_GUID Guid
= EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID
;
466 SAL_RETURN_REGS ReturnReg
;
468 ReturnReg
= EfiCallEsalService (&Guid
, IsEfiRuntime
, 0, 0, 0, 0, 0, 0, 0);
470 return (BOOLEAN
) (ReturnReg
.r9
== 1);
474 EfiReportStatusCode (
475 IN EFI_STATUS_CODE_TYPE CodeType
,
476 IN EFI_STATUS_CODE_VALUE Value
,
478 IN EFI_GUID
* CallerId
,
479 IN EFI_STATUS_CODE_DATA
* Data OPTIONAL
489 CodeType - Type of Status Code.
491 Value - Value to output for Status Code.
493 Instance - Instance Number of this status code.
495 CallerId - ID of the caller of this status code.
497 Data - Optional data associated with this status code.
505 EFI_GUID Guid
= EFI_EXTENDED_SAL_STATUS_CODE_SERVICES_PROTOCOL_GUID
;
506 SAL_RETURN_REGS ReturnReg
;
509 ReturnReg
= EfiCallEsalService (
521 return (EFI_STATUS
) ReturnReg
.Status
;
524 // Sal Reset Driver Class
528 IN EFI_RESET_TYPE ResetType
,
529 IN EFI_STATUS ResetStatus
,
537 Resets the entire platform.
541 ResetType - The type of reset to perform.
542 ResetStatus - The status code for the reset.
543 DataSize - The size, in bytes, of ResetData.
544 ResetData - A data buffer that includes a Null-terminated Unicode string, optionally
545 followed by additional binary data.
553 EFI_GUID Guid
= EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID
;
559 (UINT64
) ResetStatus
,
568 // Sal MTC Driver Class
571 EfiGetNextHighMonotonicCount (
572 OUT UINT32
*HighCount
578 Returns the next high 32 bits of the platform's monotonic counter.
582 HighCount - Pointer to returned value.
590 SAL_RETURN_REGS ReturnReg
;
592 EFI_GUID Guid
= EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID
;
594 ReturnReg
= EfiCallEsalService (&Guid
, GetNextHighMonotonicCount
, (UINT64
) HighCount
, 0, 0, 0, 0, 0, 0);
595 return (EFI_STATUS
) ReturnReg
.Status
;
598 // Sal Variable Driver Class
602 IN CHAR16
*VariableName
,
603 IN EFI_GUID
* VendorGuid
,
604 OUT UINT32
*Attributes OPTIONAL
,
605 IN OUT UINTN
*DataSize
,
612 Returns the value of a variable.
616 VariableName - A Null-terminated Unicode string that is the name of the
618 VendorGuid - A unique identifier for the vendor.
619 Attributes - If not NULL, a pointer to the memory location to return the
620 attributes bitmask for the variable.
621 DataSize - On input, the size in bytes of the return Data buffer.
622 On output the size of data returned in Data.
623 Data - The buffer to return the contents of the variable.
631 SAL_RETURN_REGS ReturnReg
;
632 EFI_GUID Guid
= EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID
;
634 ReturnReg
= EfiCallEsalService (
637 (UINT64
) VariableName
,
645 return (EFI_STATUS
) ReturnReg
.Status
;
649 EfiGetNextVariableName (
650 IN OUT UINTN
*VariableNameSize
,
651 IN OUT CHAR16
*VariableName
,
652 IN OUT EFI_GUID
*VendorGuid
658 Enumerates the current variable names.
662 VariableNameSize - The size of the VariableName buffer.
663 VariableName - On input, supplies the last VariableName that was returned
664 by GetNextVariableName().
665 On output, returns the Nullterminated Unicode string of the
667 VendorGuid - On input, supplies the last VendorGuid that was returned by
668 GetNextVariableName().
669 On output, returns the VendorGuid of the current variable.
677 SAL_RETURN_REGS ReturnReg
;
678 EFI_GUID Guid
= EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID
;
680 ReturnReg
= EfiCallEsalService (
682 EsalGetNextVariableName
,
683 (UINT64
) VariableNameSize
,
684 (UINT64
) VariableName
,
691 return (EFI_STATUS
) ReturnReg
.Status
;
696 IN CHAR16
*VariableName
,
697 IN EFI_GUID
*VendorGuid
,
698 IN UINT32 Attributes
,
706 Sets the value of a variable.
710 VariableName - A Null-terminated Unicode string that is the name of the
712 VendorGuid - A unique identifier for the vendor.
713 Attributes - Attributes bitmask to set for the variable.
714 DataSize - The size in bytes of the Data buffer.
715 Data - The contents for the variable.
723 SAL_RETURN_REGS ReturnReg
;
724 EFI_GUID Guid
= EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID
;
726 ReturnReg
= EfiCallEsalService (
729 (UINT64
) VariableName
,
737 return (EFI_STATUS
) ReturnReg
.Status
;
740 #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
743 EfiQueryVariableInfo (
744 IN UINT32 Attributes
,
745 OUT UINT64
*MaximumVariableStorageSize
,
746 OUT UINT64
*RemainingVariableStorageSize
,
747 OUT UINT64
*MaximumVariableSize
753 This code returns information about the EFI variables.
757 Attributes Attributes bitmask to specify the type of variables
758 on which to return information.
759 MaximumVariableStorageSize Pointer to the maximum size of the storage space available
760 for the EFI variables associated with the attributes specified.
761 RemainingVariableStorageSize Pointer to the remaining size of the storage space available
762 for the EFI variables associated with the attributes specified.
763 MaximumVariableSize Pointer to the maximum size of the individual EFI variables
764 associated with the attributes specified.
772 SAL_RETURN_REGS ReturnReg
;
773 EFI_GUID Guid
= EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID
;
775 ReturnReg
= EfiCallEsalService (
777 EsalQueryVariableInfo
,
779 (UINT64
) MaximumVariableStorageSize
,
780 (UINT64
) RemainingVariableStorageSize
,
781 (UINT64
) MaximumVariableSize
,
786 return (EFI_STATUS
) ReturnReg
.Status
;
792 // Sal RTC Driver Class.
797 OUT EFI_TIME_CAPABILITIES
*Capabilities
803 Returns the current time and date information, and the time-keeping
804 capabilities of the hardware platform.
808 Time - A pointer to storage to receive a snapshot of the current time.
809 Capabilities - An optional pointer to a buffer to receive the real time clock device's
818 SAL_RETURN_REGS ReturnReg
;
819 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
821 ReturnReg
= EfiCallEsalService (&Guid
, GetTime
, (UINT64
) Time
, (UINT64
) Capabilities
, 0, 0, 0, 0, 0);
822 return ReturnReg
.Status
;
833 Sets the current local time and date information.
837 Time - A pointer to the current time.
845 SAL_RETURN_REGS ReturnReg
;
847 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
849 ReturnReg
= EfiCallEsalService (&Guid
, SetTime
, (UINT64
) Time
, 0, 0, 0, 0, 0, 0);
850 return ReturnReg
.Status
;
855 OUT BOOLEAN
*Enabled
,
856 OUT BOOLEAN
*Pending
,
863 Returns the current wakeup alarm clock setting.
867 Enabled - Indicates if the alarm is currently enabled or disabled.
868 Pending - Indicates if the alarm signal is pending and requires acknowledgement.
869 Time - The current alarm setting.
877 SAL_RETURN_REGS ReturnReg
;
879 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
881 ReturnReg
= EfiCallEsalService (&Guid
, GetWakeupTime
, (UINT64
) Enabled
, (UINT64
) Pending
, (UINT64
) Time
, 0, 0, 0, 0);
882 return ReturnReg
.Status
;
894 Sets the system wakeup alarm clock time.
898 Enable - Enable or disable the wakeup alarm.
899 Time - If Enable is TRUE, the time to set the wakeup alarm for.
900 If Enable is FALSE, then this parameter is optional, and may be NULL.
908 SAL_RETURN_REGS ReturnReg
;
910 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
912 ReturnReg
= EfiCallEsalService (&Guid
, SetWakeupTime
, (UINT64
) Enable
, (UINT64
) Time
, 0, 0, 0, 0, 0);
913 return ReturnReg
.Status
;
923 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
931 Perform an IO read into Buffer.
934 Width - Width of read transaction, and repeat operation to use
935 Address - IO address to read
936 Count - Number of times to read the IO address.
937 Buffer - Buffer to read data into. size is Width * Count
945 SAL_RETURN_REGS ReturnReg
;
947 EFI_GUID Guid
= EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID
;
949 ReturnReg
= EfiCallEsalService (&Guid
, IoRead
, (UINT64
) Width
, Address
, Count
, (UINT64
) Buffer
, 0, 0, 0);
950 ASSERT (ReturnReg
.Status
== EFI_SAL_SUCCESS
);
952 return ReturnReg
.Status
;
958 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
966 Perform an IO write into Buffer.
969 Width - Width of write transaction, and repeat operation to use
970 Address - IO address to write
971 Count - Number of times to write the IO address.
972 Buffer - Buffer to write data from. size is Width * Count
980 SAL_RETURN_REGS ReturnReg
;
982 EFI_GUID Guid
= EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID
;
984 ReturnReg
= EfiCallEsalService (&Guid
, IoWrite
, (UINT64
) Width
, Address
, Count
, (UINT64
) Buffer
, 0, 0, 0);
986 return ReturnReg
.Status
;
992 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
1000 Perform a Memory mapped IO read into Buffer.
1003 Width - Width of each read transaction.
1004 Address - Memory mapped IO address to read
1005 Count - Number of Width quanta to read
1006 Buffer - Buffer to read data into. size is Width * Count
1014 SAL_RETURN_REGS ReturnReg
;
1016 EFI_GUID Guid
= EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID
;
1018 ReturnReg
= EfiCallEsalService (&Guid
, MemRead
, (UINT64
) Width
, Address
, Count
, (UINT64
) Buffer
, 0, 0, 0);
1019 ASSERT (ReturnReg
.Status
== EFI_SAL_SUCCESS
);
1021 return ReturnReg
.Status
;
1027 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
1034 Routine Description:
1035 Perform a memory mapped IO write into Buffer.
1038 Width - Width of write transaction, and repeat operation to use
1039 Address - IO address to write
1040 Count - Number of times to write the IO address.
1041 Buffer - Buffer to write data from. size is Width * Count
1049 SAL_RETURN_REGS ReturnReg
;
1051 EFI_GUID Guid
= EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID
;
1053 ReturnReg
= EfiCallEsalService (&Guid
, MemWrite
, (UINT64
) Width
, Address
, Count
, (UINT64
) Buffer
, 0, 0, 0);
1055 return ReturnReg
.Status
;
1060 #define EFI_PCI_ADDRESS_IPF(_seg, _bus, _devfunc, _reg) \
1061 (((_seg) << 24) | ((_bus) << 16) | ((_devfunc) << 8) | (_reg)) & 0xFFFFFFFF
1064 // PCI Class Functions
1075 Routine Description:
1076 Perform an one byte PCI config cycle read
1079 Segment - PCI Segment ACPI _SEG
1081 DevFunc - PCI Device(7:3) and Func(2:0)
1082 Register - PCI config space register
1085 Data read from PCI config space
1089 EFI_GUID Guid
= EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID
;
1091 SAL_RETURN_REGS Return
;
1093 Address
= EFI_PCI_ADDRESS_IPF (Segment
, Bus
, DevFunc
, Register
);
1094 Return
= EfiCallEsalService (&Guid
, SalPciConfigRead
, Address
, 1, 0, 0, 0, 0, 0);
1096 return (UINT8
) Return
.r9
;
1109 Routine Description:
1110 Perform an two byte PCI config cycle read
1113 Segment - PCI Segment ACPI _SEG
1115 DevFunc - PCI Device(7:3) and Func(2:0)
1116 Register - PCI config space register
1119 Data read from PCI config space
1123 EFI_GUID Guid
= EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID
;
1125 SAL_RETURN_REGS Return
;
1127 Address
= EFI_PCI_ADDRESS_IPF (Segment
, Bus
, DevFunc
, Register
);
1128 Return
= EfiCallEsalService (&Guid
, SalPciConfigRead
, Address
, 2, 0, 0, 0, 0, 0);
1130 return (UINT16
) Return
.r9
;
1142 Routine Description:
1143 Perform an four byte PCI config cycle read
1146 Segment - PCI Segment ACPI _SEG
1148 DevFunc - PCI Device(7:3) and Func(2:0)
1149 Register - PCI config space register
1152 Data read from PCI config space
1156 EFI_GUID Guid
= EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID
;
1158 SAL_RETURN_REGS Return
;
1160 Address
= EFI_PCI_ADDRESS_IPF (Segment
, Bus
, DevFunc
, Register
);
1161 Return
= EfiCallEsalService (&Guid
, SalPciConfigRead
, Address
, 4, 0, 0, 0, 0, 0);
1163 return (UINT32
) Return
.r9
;
1176 Routine Description:
1177 Perform an one byte PCI config cycle write
1180 Segment - PCI Segment ACPI _SEG
1182 DevFunc - PCI Device(7:3) and Func(2:0)
1183 Register - PCI config space register
1184 Data - Data to write
1191 EFI_GUID Guid
= EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID
;
1194 Address
= EFI_PCI_ADDRESS_IPF (Segment
, Bus
, DevFunc
, Register
);
1195 EfiCallEsalService (&Guid
, SalPciConfigWrite
, Address
, 1, Data
, 0, 0, 0, 0);
1208 Routine Description:
1209 Perform an two byte PCI config cycle write
1212 Segment - PCI Segment ACPI _SEG
1214 DevFunc - PCI Device(7:3) and Func(2:0)
1215 Register - PCI config space register
1216 Data - Data to write
1223 EFI_GUID Guid
= EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID
;
1226 Address
= EFI_PCI_ADDRESS_IPF (Segment
, Bus
, DevFunc
, Register
);
1227 EfiCallEsalService (&Guid
, SalPciConfigWrite
, Address
, 2, Data
, 0, 0, 0, 0);
1240 Routine Description:
1241 Perform an four byte PCI config cycle write
1244 Segment - PCI Segment ACPI _SEG
1246 DevFunc - PCI Device(7:3) and Func(2:0)
1247 Register - PCI config space register
1248 Data - Data to write
1255 EFI_GUID Guid
= EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID
;
1258 Address
= EFI_PCI_ADDRESS_IPF (Segment
, Bus
, DevFunc
, Register
);
1259 EfiCallEsalService (&Guid
, SalPciConfigWrite
, Address
, 4, Data
, 0, 0, 0, 0);
1263 // Stall class functions
1267 IN UINTN Microseconds
1271 Routine Description:
1272 Delay for at least the request number of microseconds
1275 Microseconds - Number of microseconds to delay.
1282 EFI_GUID Guid
= EFI_EXTENDED_SAL_STALL_SERVICES_PROTOCOL_GUID
;
1284 if (EfiAtRuntime ()) {
1285 EfiCallEsalService (&Guid
, Stall
, Microseconds
, 4, 0, 0, 0, 0, 0);
1287 gBS
->Stall (Microseconds
);
1291 // Cache Flush Routine.
1295 IN EFI_PHYSICAL_ADDRESS Start
,
1300 Routine Description:
1302 Flush cache with specified range.
1306 Start - Start address
1307 Length - Length in bytes
1313 EFI_SUCCESS - success
1317 SalFlushCache (Start
, Length
);