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
;
123 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
125 ReturnReg
= EfiCallEsalService (&Guid
, SetTime
, (UINT64
) Time
, 0, 0, 0, 0, 0, 0);
126 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
;
172 Sets the system wakeup alarm clock time.
176 Enable - Enable or disable the wakeup alarm.
177 Time - If Enable is TRUE, the time to set the wakeup alarm for.
178 If Enable is FALSE, then this parameter is optional, and may be NULL.
186 SAL_RETURN_REGS ReturnReg
;
188 EFI_GUID Guid
= EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID
;
190 ReturnReg
= EfiCallEsalService (&Guid
, SetWakeupTime
, (UINT64
) Enable
, (UINT64
) Time
, 0, 0, 0, 0, 0);
191 return ReturnReg
.Status
;
197 IN CHAR16
*VariableName
,
198 IN EFI_GUID
* VendorGuid
,
199 OUT UINT32
*Attributes OPTIONAL
,
200 IN OUT UINTN
*DataSize
,
207 Returns the value of a variable.
211 VariableName - A Null-terminated Unicode string that is the name of the
213 VendorGuid - A unique identifier for the vendor.
214 Attributes - If not NULL, a pointer to the memory location to return the
215 attributes bitmask for the variable.
216 DataSize - On input, the size in bytes of the return Data buffer.
217 On output the size of data returned in Data.
218 Data - The buffer to return the contents of the variable.
226 SAL_RETURN_REGS ReturnReg
;
227 EFI_GUID Guid
= EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID
;
229 ReturnReg
= EfiCallEsalService (
232 (UINT64
) VariableName
,
240 return (EFI_STATUS
) ReturnReg
.Status
;
245 EfiGetNextVariableName (
246 IN OUT UINTN
*VariableNameSize
,
247 IN OUT CHAR16
*VariableName
,
248 IN OUT EFI_GUID
*VendorGuid
254 Enumerates the current variable names.
258 VariableNameSize - The size of the VariableName buffer.
259 VariableName - On input, supplies the last VariableName that was returned
260 by GetNextVariableName().
261 On output, returns the Nullterminated Unicode string of the
263 VendorGuid - On input, supplies the last VendorGuid that was returned by
264 GetNextVariableName().
265 On output, returns the VendorGuid of the current variable.
273 SAL_RETURN_REGS ReturnReg
;
274 EFI_GUID Guid
= EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID
;
276 ReturnReg
= EfiCallEsalService (
278 EsalGetNextVariableName
,
279 (UINT64
) VariableNameSize
,
280 (UINT64
) VariableName
,
287 return (EFI_STATUS
) ReturnReg
.Status
;
293 IN CHAR16
*VariableName
,
294 IN EFI_GUID
*VendorGuid
,
295 IN UINT32 Attributes
,
303 Sets the value of a variable.
307 VariableName - A Null-terminated Unicode string that is the name of the
309 VendorGuid - A unique identifier for the vendor.
310 Attributes - Attributes bitmask to set for the variable.
311 DataSize - The size in bytes of the Data buffer.
312 Data - The contents for the variable.
320 SAL_RETURN_REGS ReturnReg
;
321 EFI_GUID Guid
= EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID
;
323 ReturnReg
= EfiCallEsalService (
326 (UINT64
) VariableName
,
334 return (EFI_STATUS
) ReturnReg
.Status
;
339 EfiGetNextHighMonotonicCount (
340 OUT UINT32
*HighCount
346 Returns the next high 32 bits of the platform¡¯s monotonic counter.
350 HighCount - Pointer to returned value.
358 SAL_RETURN_REGS ReturnReg
;
360 EFI_GUID Guid
= EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID
;
362 ReturnReg
= EfiCallEsalService (&Guid
, GetNextHighMonotonicCount
, (UINT64
) HighCount
, 0, 0, 0, 0, 0, 0);
363 return (EFI_STATUS
) ReturnReg
.Status
;
369 IN UINTN DebugDisposition
,
370 IN OUT VOID
**Address
376 Determines the new virtual address that is to be used on subsequent memory accesses.
380 DebugDisposition - Supplies type information for the pointer being converted.
381 Address - A pointer to a pointer that is to be fixed to be the value needed
382 for the new virtual address mappings being applied.
390 return mRT
->ConvertPointer (DebugDisposition
, Address
);
396 IN UINTN DebugDisposition
,
397 IN OUT LIST_ENTRY
*ListHead
403 Conver the standard Lib double linked list to a virtual mapping.
407 DebugDisposition - Argument to EfiConvertPointer (EFI 1.0 API)
409 ListHead - Head of linked list to convert
418 LIST_ENTRY
*NextLink
;
421 // Convert all the ForwardLink & BackLink pointers in the list
425 NextLink
= Link
->ForwardLink
;
428 Link
->ForwardLink
== ListHead
? DebugDisposition
: 0,
429 (VOID
**) &Link
->ForwardLink
433 Link
->BackLink
== ListHead
? DebugDisposition
: 0,
434 (VOID
**) &Link
->BackLink
438 } while (Link
!= ListHead
);
444 Change the runtime addressing mode of EFI firmware from physical to virtual.
446 @param MemoryMapSize The size in bytes of VirtualMap.
447 @param DescriptorSize The size in bytes of an entry in the VirtualMap.
448 @param DescriptorVersion The version of the structure entries in VirtualMap.
449 @param VirtualMap An array of memory descriptors which contain new virtual
450 address mapping information for all runtime ranges. Type
451 EFI_MEMORY_DESCRIPTOR is defined in the
452 GetMemoryMap() function description.
454 @retval EFI_SUCCESS The virtual address map has been applied.
455 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in
456 virtual address mapped mode.
457 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is
459 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory
460 map that requires a mapping.
461 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found
466 EfiSetVirtualAddressMap (
467 IN UINTN MemoryMapSize
,
468 IN UINTN DescriptorSize
,
469 IN UINT32 DescriptorVersion
,
470 IN CONST EFI_MEMORY_DESCRIPTOR
*VirtualMap
473 SAL_RETURN_REGS ReturnReg
;
474 EFI_GUID Guid
= EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID
;
476 ReturnReg
= EfiCallEsalService (
479 (UINT64
) MemoryMapSize
,
480 (UINT64
) DescriptorSize
,
481 (UINT64
) DescriptorVersion
,
488 return ReturnReg
.Status
;
495 IN UEFI_CAPSULE_HEADER
**CapsuleHeaderArray
,
496 IN UINTN CapsuleCount
,
497 IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
500 return EFI_UNSUPPORTED
;
505 EfiQueryCapsuleCapabilities (
506 IN UEFI_CAPSULE_HEADER
**CapsuleHeaderArray
,
507 IN UINTN CapsuleCount
,
508 OUT UINT64
*MaximumCapsuleSize
,
509 OUT EFI_RESET_TYPE
*ResetType
512 return EFI_UNSUPPORTED
;
518 EfiQueryVariableInfo (
519 IN UINT32 Attributes
,
520 OUT UINT64
*MaximumVariableStorageSize
,
521 OUT UINT64
*RemainingVariableStorageSize
,
522 OUT UINT64
*MaximumVariableSize
525 return EFI_UNSUPPORTED
;