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.
50 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_LO
;
51 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_HI
;
68 // The following functions hide the mRT local global from the call to
69 // runtime service in the EFI system table.
75 OUT EFI_TIME_CAPABILITIES
*Capabilities
81 Returns the current time and date information, and the time-keeping
82 capabilities of the hardware platform.
86 Time - A pointer to storage to receive a snapshot of the current time.
87 Capabilities - An optional pointer to a buffer to receive the real time clock device's
96 SAL_RETURN_REGS ReturnReg
;
99 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO
;
100 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI
;
102 ReturnReg
= EfiCallEsalService (&Guid
, GetTime
, (UINT64
) Time
, (UINT64
) Capabilities
, 0, 0, 0, 0, 0);
103 return ReturnReg
.Status
;
115 Sets the current local time and date information.
119 Time - A pointer to the current time.
127 SAL_RETURN_REGS ReturnReg
;
130 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO
;
131 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI
;
133 ReturnReg
= EfiCallEsalService (&Guid
, SetTime
, (UINT64
) Time
, 0, 0, 0, 0, 0, 0);
134 return ReturnReg
.Status
;
140 OUT BOOLEAN
*Enabled
,
141 OUT BOOLEAN
*Pending
,
148 Returns the current wakeup alarm clock setting.
152 Enabled - Indicates if the alarm is currently enabled or disabled.
153 Pending - Indicates if the alarm signal is pending and requires acknowledgement.
154 Time - The current alarm setting.
162 SAL_RETURN_REGS ReturnReg
;
165 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO
;
166 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI
;
168 ReturnReg
= EfiCallEsalService (&Guid
, GetWakeupTime
, (UINT64
) Enabled
, (UINT64
) Pending
, (UINT64
) Time
, 0, 0, 0, 0);
169 return ReturnReg
.Status
;
182 Sets the system wakeup alarm clock time.
186 Enable - Enable or disable the wakeup alarm.
187 Time - If Enable is TRUE, the time to set the wakeup alarm for.
188 If Enable is FALSE, then this parameter is optional, and may be NULL.
196 SAL_RETURN_REGS ReturnReg
;
199 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO
;
200 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI
;
202 ReturnReg
= EfiCallEsalService (&Guid
, SetWakeupTime
, (UINT64
) Enable
, (UINT64
) Time
, 0, 0, 0, 0, 0);
203 return ReturnReg
.Status
;
209 IN CHAR16
*VariableName
,
210 IN EFI_GUID
* VendorGuid
,
211 OUT UINT32
*Attributes OPTIONAL
,
212 IN OUT UINTN
*DataSize
,
219 Returns the value of a variable.
223 VariableName - A Null-terminated Unicode string that is the name of the
225 VendorGuid - A unique identifier for the vendor.
226 Attributes - If not NULL, a pointer to the memory location to return the
227 attributes bitmask for the variable.
228 DataSize - On input, the size in bytes of the return Data buffer.
229 On output the size of data returned in Data.
230 Data - The buffer to return the contents of the variable.
238 SAL_RETURN_REGS ReturnReg
;
241 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO
;
242 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI
;
244 ReturnReg
= EfiCallEsalService (
247 (UINT64
) VariableName
,
255 return (EFI_STATUS
) ReturnReg
.Status
;
260 EfiGetNextVariableName (
261 IN OUT UINTN
*VariableNameSize
,
262 IN OUT CHAR16
*VariableName
,
263 IN OUT EFI_GUID
*VendorGuid
269 Enumerates the current variable names.
273 VariableNameSize - The size of the VariableName buffer.
274 VariableName - On input, supplies the last VariableName that was returned
275 by GetNextVariableName().
276 On output, returns the Nullterminated Unicode string of the
278 VendorGuid - On input, supplies the last VendorGuid that was returned by
279 GetNextVariableName().
280 On output, returns the VendorGuid of the current variable.
288 SAL_RETURN_REGS ReturnReg
;
291 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO
;
292 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI
;
294 ReturnReg
= EfiCallEsalService (
296 EsalGetNextVariableName
,
297 (UINT64
) VariableNameSize
,
298 (UINT64
) VariableName
,
305 return (EFI_STATUS
) ReturnReg
.Status
;
311 IN CHAR16
*VariableName
,
312 IN EFI_GUID
*VendorGuid
,
313 IN UINT32 Attributes
,
321 Sets the value of a variable.
325 VariableName - A Null-terminated Unicode string that is the name of the
327 VendorGuid - A unique identifier for the vendor.
328 Attributes - Attributes bitmask to set for the variable.
329 DataSize - The size in bytes of the Data buffer.
330 Data - The contents for the variable.
338 SAL_RETURN_REGS ReturnReg
;
341 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO
;
342 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI
;
344 ReturnReg
= EfiCallEsalService (
347 (UINT64
) VariableName
,
355 return (EFI_STATUS
) ReturnReg
.Status
;
360 EfiGetNextHighMonotonicCount (
361 OUT UINT32
*HighCount
367 Returns the next high 32 bits of the platform's monotonic counter.
371 HighCount - Pointer to returned value.
379 SAL_RETURN_REGS ReturnReg
;
382 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_LO
;
383 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_HI
;
385 ReturnReg
= EfiCallEsalService (&Guid
, GetNextHighMonotonicCount
, (UINT64
) HighCount
, 0, 0, 0, 0, 0, 0);
386 return (EFI_STATUS
) ReturnReg
.Status
;
392 IN UINTN DebugDisposition
,
393 IN OUT VOID
**Address
399 Determines the new virtual address that is to be used on subsequent memory accesses.
403 DebugDisposition - Supplies type information for the pointer being converted.
404 Address - A pointer to a pointer that is to be fixed to be the value needed
405 for the new virtual address mappings being applied.
413 return mRT
->ConvertPointer (DebugDisposition
, Address
);
419 IN UINTN DebugDisposition
,
420 IN OUT LIST_ENTRY
*ListHead
426 Conver the standard Lib double linked list to a virtual mapping.
430 DebugDisposition - Argument to EfiConvertPointer (EFI 1.0 API)
432 ListHead - Head of linked list to convert
441 LIST_ENTRY
*NextLink
;
444 // Convert all the ForwardLink & BackLink pointers in the list
448 NextLink
= Link
->ForwardLink
;
451 Link
->ForwardLink
== ListHead
? DebugDisposition
: 0,
452 (VOID
**) &Link
->ForwardLink
456 Link
->BackLink
== ListHead
? DebugDisposition
: 0,
457 (VOID
**) &Link
->BackLink
461 } while (Link
!= ListHead
);
467 Change the runtime addressing mode of EFI firmware from physical to virtual.
469 @param MemoryMapSize The size in bytes of VirtualMap.
470 @param DescriptorSize The size in bytes of an entry in the VirtualMap.
471 @param DescriptorVersion The version of the structure entries in VirtualMap.
472 @param VirtualMap An array of memory descriptors which contain new virtual
473 address mapping information for all runtime ranges. Type
474 EFI_MEMORY_DESCRIPTOR is defined in the
475 GetMemoryMap() function description.
477 @retval EFI_SUCCESS The virtual address map has been applied.
478 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in
479 virtual address mapped mode.
480 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is
482 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory
483 map that requires a mapping.
484 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found
489 EfiSetVirtualAddressMap (
490 IN UINTN MemoryMapSize
,
491 IN UINTN DescriptorSize
,
492 IN UINT32 DescriptorVersion
,
493 IN CONST EFI_MEMORY_DESCRIPTOR
*VirtualMap
496 SAL_RETURN_REGS ReturnReg
;
499 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_LO
;
500 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_HI
;
502 ReturnReg
= EfiCallEsalService (
505 (UINT64
) MemoryMapSize
,
506 (UINT64
) DescriptorSize
,
507 (UINT64
) DescriptorVersion
,
514 return ReturnReg
.Status
;
521 IN UEFI_CAPSULE_HEADER
**CapsuleHeaderArray
,
522 IN UINTN CapsuleCount
,
523 IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
526 return EFI_UNSUPPORTED
;
531 EfiQueryCapsuleCapabilities (
532 IN UEFI_CAPSULE_HEADER
**CapsuleHeaderArray
,
533 IN UINTN CapsuleCount
,
534 OUT UINT64
*MaximumCapsuleSize
,
535 OUT EFI_RESET_TYPE
*ResetType
538 return EFI_UNSUPPORTED
;
544 EfiQueryVariableInfo (
545 IN UINT32 Attributes
,
546 OUT UINT64
*MaximumVariableStorageSize
,
547 OUT UINT64
*RemainingVariableStorageSize
,
548 OUT UINT64
*MaximumVariableSize
551 return EFI_UNSUPPORTED
;