3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. 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 drivers.
22 #include <RuntimeLibInternal.h>
26 IN EFI_RESET_TYPE ResetType
,
27 IN EFI_STATUS ResetStatus
,
35 Resets the entire platform.
39 ResetType - The type of reset to perform.
40 ResetStatus - The status code for the reset.
41 DataSize - The size, in bytes, of ResetData.
42 ResetData - A data buffer that includes a Null-terminated Unicode string, optionally
43 followed by additional binary data.
51 EFI_GUID Guid
= EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID
;
68 // The following functions hide the mRT local global from the call to
69 // runtime service in the EFI system table.
74 OUT EFI_TIME_CAPABILITIES
*Capabilities
80 Returns the current time and date information, and the time-keeping
81 capabilities of the hardware platform.
85 Time - A pointer to storage to receive a snapshot of the current time.
86 Capabilities - An optional pointer to a buffer to receive the real time clock device¡¯s
95 SAL_RETURN_REGS ReturnReg
;
96 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
98 ReturnReg
= EfiCallEsalService (&Guid
, GetTime
, (UINT64
) Time
, (UINT64
) Capabilities
, 0, 0, 0, 0, 0);
99 return ReturnReg
.Status
;
110 Sets the current local time and date information.
114 Time - A pointer to the current time.
122 SAL_RETURN_REGS ReturnReg
;
124 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
126 ReturnReg
= EfiCallEsalService (&Guid
, SetTime
, (UINT64
) Time
, 0, 0, 0, 0, 0, 0);
127 return ReturnReg
.Status
;
132 OUT BOOLEAN
*Enabled
,
133 OUT BOOLEAN
*Pending
,
140 Returns the current wakeup alarm clock setting.
144 Enabled - Indicates if the alarm is currently enabled or disabled.
145 Pending - Indicates if the alarm signal is pending and requires acknowledgement.
146 Time - The current alarm setting.
154 SAL_RETURN_REGS ReturnReg
;
156 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
158 ReturnReg
= EfiCallEsalService (&Guid
, GetWakeupTime
, (UINT64
) Enabled
, (UINT64
) Pending
, (UINT64
) Time
, 0, 0, 0, 0);
159 return ReturnReg
.Status
;
171 Sets the system wakeup alarm clock time.
175 Enable - Enable or disable the wakeup alarm.
176 Time - If Enable is TRUE, the time to set the wakeup alarm for.
177 If Enable is FALSE, then this parameter is optional, and may be NULL.
185 SAL_RETURN_REGS ReturnReg
;
187 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
189 ReturnReg
= EfiCallEsalService (&Guid
, SetWakeupTime
, (UINT64
) Enable
, (UINT64
) Time
, 0, 0, 0, 0, 0);
190 return ReturnReg
.Status
;
195 IN CHAR16
*VariableName
,
196 IN EFI_GUID
* VendorGuid
,
197 OUT UINT32
*Attributes OPTIONAL
,
198 IN OUT UINTN
*DataSize
,
205 Returns the value of a variable.
209 VariableName - A Null-terminated Unicode string that is the name of the
211 VendorGuid - A unique identifier for the vendor.
212 Attributes - If not NULL, a pointer to the memory location to return the
213 attributes bitmask for the variable.
214 DataSize - On input, the size in bytes of the return Data buffer.
215 On output the size of data returned in Data.
216 Data - The buffer to return the contents of the variable.
224 SAL_RETURN_REGS ReturnReg
;
225 EFI_GUID Guid
= EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID
;
227 ReturnReg
= EfiCallEsalService (
230 (UINT64
) VariableName
,
238 return (EFI_STATUS
) ReturnReg
.Status
;
242 EfiGetNextVariableName (
243 IN OUT UINTN
*VariableNameSize
,
244 IN OUT CHAR16
*VariableName
,
245 IN OUT EFI_GUID
*VendorGuid
251 Enumerates the current variable names.
255 VariableNameSize - The size of the VariableName buffer.
256 VariableName - On input, supplies the last VariableName that was returned
257 by GetNextVariableName().
258 On output, returns the Nullterminated Unicode string of the
260 VendorGuid - On input, supplies the last VendorGuid that was returned by
261 GetNextVariableName().
262 On output, returns the VendorGuid of the current variable.
270 SAL_RETURN_REGS ReturnReg
;
271 EFI_GUID Guid
= EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID
;
273 ReturnReg
= EfiCallEsalService (
275 EsalGetNextVariableName
,
276 (UINT64
) VariableNameSize
,
277 (UINT64
) VariableName
,
284 return (EFI_STATUS
) ReturnReg
.Status
;
289 IN CHAR16
*VariableName
,
290 IN EFI_GUID
*VendorGuid
,
291 IN UINT32 Attributes
,
299 Sets the value of a variable.
303 VariableName - A Null-terminated Unicode string that is the name of the
305 VendorGuid - A unique identifier for the vendor.
306 Attributes - Attributes bitmask to set for the variable.
307 DataSize - The size in bytes of the Data buffer.
308 Data - The contents for the variable.
316 SAL_RETURN_REGS ReturnReg
;
317 EFI_GUID Guid
= EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID
;
319 ReturnReg
= EfiCallEsalService (
322 (UINT64
) VariableName
,
330 return (EFI_STATUS
) ReturnReg
.Status
;
334 EfiGetNextHighMonotonicCount (
335 OUT UINT32
*HighCount
341 Returns the next high 32 bits of the platform¡¯s monotonic counter.
345 HighCount - Pointer to returned value.
353 SAL_RETURN_REGS ReturnReg
;
355 EFI_GUID Guid
= EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID
;
357 ReturnReg
= EfiCallEsalService (&Guid
, GetNextHighMonotonicCount
, (UINT64
) HighCount
, 0, 0, 0, 0, 0, 0);
358 return (EFI_STATUS
) ReturnReg
.Status
;
363 IN UINTN DebugDisposition
,
370 Determines the new virtual address that is to be used on subsequent memory accesses.
374 DebugDisposition - Supplies type information for the pointer being converted.
375 Address - A pointer to a pointer that is to be fixed to be the value needed
376 for the new virtual address mappings being applied.
384 return mRT
->ConvertPointer (DebugDisposition
, Address
);
389 IN UINTN DebugDisposition
,
390 IN OUT LIST_ENTRY
*ListHead
396 Conver the standard Lib double linked list to a virtual mapping.
400 DebugDisposition - Argument to EfiConvertPointer (EFI 1.0 API)
402 ListHead - Head of linked list to convert
411 LIST_ENTRY
*NextLink
;
414 // Convert all the ForwardLink & BackLink pointers in the list
418 NextLink
= Link
->ForwardLink
;
421 Link
->ForwardLink
== ListHead
? DebugDisposition
: 0,
422 (VOID
**) &Link
->ForwardLink
426 Link
->BackLink
== ListHead
? DebugDisposition
: 0,
427 (VOID
**) &Link
->BackLink
431 } while (Link
!= ListHead
);
437 Change the runtime addressing mode of EFI firmware from physical to virtual.
439 @param MemoryMapSize The size in bytes of VirtualMap.
440 @param DescriptorSize The size in bytes of an entry in the VirtualMap.
441 @param DescriptorVersion The version of the structure entries in VirtualMap.
442 @param VirtualMap An array of memory descriptors which contain new virtual
443 address mapping information for all runtime ranges. Type
444 EFI_MEMORY_DESCRIPTOR is defined in the
445 GetMemoryMap() function description.
447 @retval EFI_SUCCESS The virtual address map has been applied.
448 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in
449 virtual address mapped mode.
450 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is
452 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory
453 map that requires a mapping.
454 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found
459 EfiSetVirtualAddressMap (
460 IN UINTN MemoryMapSize
,
461 IN UINTN DescriptorSize
,
462 IN UINT32 DescriptorVersion
,
463 IN CONST EFI_MEMORY_DESCRIPTOR
*VirtualMap
466 SAL_RETURN_REGS ReturnReg
;
467 EFI_GUID Guid
= EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID
;
469 ReturnReg
= EfiCallEsalService (
472 (UINT64
) MemoryMapSize
,
473 (UINT64
) DescriptorSize
,
474 (UINT64
) DescriptorVersion
,
481 return ReturnReg
.Status
;
487 IN UEFI_CAPSULE_HEADER
**CapsuleHeaderArray
,
488 IN UINTN CapsuleCount
,
489 IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
492 return EFI_UNSUPPORTED
;
496 EfiQueryCapsuleCapabilities (
497 IN UEFI_CAPSULE_HEADER
**CapsuleHeaderArray
,
498 IN UINTN CapsuleCount
,
499 OUT UINT64
*MaximumCapsuleSize
,
500 OUT EFI_RESET_TYPE
*ResetType
503 return EFI_UNSUPPORTED
;
508 EfiQueryVariableInfo (
509 IN UINT32 Attributes
,
510 OUT UINT64
*MaximumVariableStorageSize
,
511 OUT UINT64
*RemainingVariableStorageSize
,
512 OUT UINT64
*MaximumVariableSize
515 return EFI_UNSUPPORTED
;