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 #include <RuntimeLibInternal.h>
23 IN EFI_RESET_TYPE ResetType
,
24 IN EFI_STATUS ResetStatus
,
32 Resets the entire platform.
36 ResetType - The type of reset to perform.
37 ResetStatus - The status code for the reset.
38 DataSize - The size, in bytes, of ResetData.
39 ResetData - A data buffer that includes a Null-terminated Unicode string, optionally
40 followed by additional binary data.
48 EFI_GUID Guid
= EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID
;
65 // The following functions hide the mRT local global from the call to
66 // runtime service in the EFI system table.
72 OUT EFI_TIME_CAPABILITIES
*Capabilities
78 Returns the current time and date information, and the time-keeping
79 capabilities of the hardware platform.
83 Time - A pointer to storage to receive a snapshot of the current time.
84 Capabilities - An optional pointer to a buffer to receive the real time clock device's
93 SAL_RETURN_REGS ReturnReg
;
94 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
96 ReturnReg
= EfiCallEsalService (&Guid
, GetTime
, (UINT64
) Time
, (UINT64
) Capabilities
, 0, 0, 0, 0, 0);
97 return ReturnReg
.Status
;
109 Sets the current local time and date information.
113 Time - A pointer to the current time.
121 SAL_RETURN_REGS ReturnReg
;
122 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
124 ReturnReg
= EfiCallEsalService (&Guid
, SetTime
, (UINT64
) Time
, 0, 0, 0, 0, 0, 0);
125 return ReturnReg
.Status
;
131 OUT BOOLEAN
*Enabled
,
132 OUT BOOLEAN
*Pending
,
139 Returns the current wakeup alarm clock setting.
143 Enabled - Indicates if the alarm is currently enabled or disabled.
144 Pending - Indicates if the alarm signal is pending and requires acknowledgement.
145 Time - The current alarm setting.
153 SAL_RETURN_REGS ReturnReg
;
154 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
156 ReturnReg
= EfiCallEsalService (&Guid
, GetWakeupTime
, (UINT64
) Enabled
, (UINT64
) Pending
, (UINT64
) Time
, 0, 0, 0, 0);
157 return ReturnReg
.Status
;
170 Sets the system wakeup alarm clock time.
174 Enable - Enable or disable the wakeup alarm.
175 Time - If Enable is TRUE, the time to set the wakeup alarm for.
176 If Enable is FALSE, then this parameter is optional, and may be NULL.
184 SAL_RETURN_REGS ReturnReg
;
185 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
187 ReturnReg
= EfiCallEsalService (&Guid
, SetWakeupTime
, (UINT64
) Enable
, (UINT64
) Time
, 0, 0, 0, 0, 0);
188 return ReturnReg
.Status
;
194 IN CHAR16
*VariableName
,
195 IN EFI_GUID
* VendorGuid
,
196 OUT UINT32
*Attributes OPTIONAL
,
197 IN OUT UINTN
*DataSize
,
204 Returns the value of a variable.
208 VariableName - A Null-terminated Unicode string that is the name of the
210 VendorGuid - A unique identifier for the vendor.
211 Attributes - If not NULL, a pointer to the memory location to return the
212 attributes bitmask for the variable.
213 DataSize - On input, the size in bytes of the return Data buffer.
214 On output the size of data returned in Data.
215 Data - The buffer to return the contents of the variable.
223 SAL_RETURN_REGS ReturnReg
;
224 EFI_GUID Guid
= EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID
;
226 ReturnReg
= EfiCallEsalService (
229 (UINT64
) VariableName
,
237 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
;
290 IN CHAR16
*VariableName
,
291 IN EFI_GUID
*VendorGuid
,
292 IN UINT32 Attributes
,
300 Sets the value of a variable.
304 VariableName - A Null-terminated Unicode string that is the name of the
306 VendorGuid - A unique identifier for the vendor.
307 Attributes - Attributes bitmask to set for the variable.
308 DataSize - The size in bytes of the Data buffer.
309 Data - The contents for the variable.
317 SAL_RETURN_REGS ReturnReg
;
318 EFI_GUID Guid
= EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID
;
320 ReturnReg
= EfiCallEsalService (
323 (UINT64
) VariableName
,
331 return (EFI_STATUS
) ReturnReg
.Status
;
336 EfiGetNextHighMonotonicCount (
337 OUT UINT32
*HighCount
343 Returns the next high 32 bits of the platform's monotonic counter.
347 HighCount - Pointer to returned value.
355 SAL_RETURN_REGS ReturnReg
;
356 EFI_GUID Guid
= EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID
;
358 ReturnReg
= EfiCallEsalService (&Guid
, GetNextHighMonotonicCount
, (UINT64
) HighCount
, 0, 0, 0, 0, 0, 0);
359 return (EFI_STATUS
) ReturnReg
.Status
;
365 IN UINTN DebugDisposition
,
366 IN OUT VOID
**Address
372 Determines the new virtual address that is to be used on subsequent memory accesses.
376 DebugDisposition - Supplies type information for the pointer being converted.
377 Address - A pointer to a pointer that is to be fixed to be the value needed
378 for the new virtual address mappings being applied.
386 return mRT
->ConvertPointer (DebugDisposition
, Address
);
392 IN UINTN DebugDisposition
,
393 IN OUT LIST_ENTRY
*ListHead
399 Conver the standard Lib double linked list to a virtual mapping.
403 DebugDisposition - Argument to EfiConvertPointer (EFI 1.0 API)
405 ListHead - Head of linked list to convert
414 LIST_ENTRY
*NextLink
;
417 // Convert all the ForwardLink & BackLink pointers in the list
421 NextLink
= Link
->ForwardLink
;
424 Link
->ForwardLink
== ListHead
? DebugDisposition
: 0,
425 (VOID
**) &Link
->ForwardLink
429 Link
->BackLink
== ListHead
? DebugDisposition
: 0,
430 (VOID
**) &Link
->BackLink
434 } while (Link
!= ListHead
);
440 Change the runtime addressing mode of EFI firmware from physical to virtual.
442 @param MemoryMapSize The size in bytes of VirtualMap.
443 @param DescriptorSize The size in bytes of an entry in the VirtualMap.
444 @param DescriptorVersion The version of the structure entries in VirtualMap.
445 @param VirtualMap An array of memory descriptors which contain new virtual
446 address mapping information for all runtime ranges. Type
447 EFI_MEMORY_DESCRIPTOR is defined in the
448 GetMemoryMap() function description.
450 @retval EFI_SUCCESS The virtual address map has been applied.
451 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in
452 virtual address mapped mode.
453 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is
455 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory
456 map that requires a mapping.
457 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found
462 EfiSetVirtualAddressMap (
463 IN UINTN MemoryMapSize
,
464 IN UINTN DescriptorSize
,
465 IN UINT32 DescriptorVersion
,
466 IN CONST EFI_MEMORY_DESCRIPTOR
*VirtualMap
469 SAL_RETURN_REGS ReturnReg
;
470 EFI_GUID Guid
= EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID
;
472 ReturnReg
= EfiCallEsalService (
475 (UINT64
) MemoryMapSize
,
476 (UINT64
) DescriptorSize
,
477 (UINT64
) DescriptorVersion
,
484 return ReturnReg
.Status
;
491 IN UEFI_CAPSULE_HEADER
**CapsuleHeaderArray
,
492 IN UINTN CapsuleCount
,
493 IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
496 return EFI_UNSUPPORTED
;
501 EfiQueryCapsuleCapabilities (
502 IN UEFI_CAPSULE_HEADER
**CapsuleHeaderArray
,
503 IN UINTN CapsuleCount
,
504 OUT UINT64
*MaximumCapsuleSize
,
505 OUT EFI_RESET_TYPE
*ResetType
508 return EFI_UNSUPPORTED
;
514 EfiQueryVariableInfo (
515 IN UINT32 Attributes
,
516 OUT UINT64
*MaximumVariableStorageSize
,
517 OUT UINT64
*RemainingVariableStorageSize
,
518 OUT UINT64
*MaximumVariableSize
521 return EFI_UNSUPPORTED
;