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.
23 #include "../RuntimeLibInternal.h"
28 IN EFI_RESET_TYPE ResetType
,
29 IN EFI_STATUS ResetStatus
,
37 Resets the entire platform.
41 ResetType - The type of reset to perform.
42 ResetStatus - The status code for the reset.
43 DataSize - The size, in bytes, of ResetData.
44 ResetData - A data buffer that includes a Null-terminated Unicode string, optionally
45 followed by additional binary data.
55 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_LO
;
56 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_HI
;
73 // The following functions hide the mRTEdkDxeRuntimeDriverLib local global from the call to
74 // runtime service in the EFI system table.
80 OUT EFI_TIME_CAPABILITIES
*Capabilities
86 Returns the current time and date information, and the time-keeping
87 capabilities of the hardware platform.
91 Time - A pointer to storage to receive a snapshot of the current time.
92 Capabilities - An optional pointer to a buffer to receive the real time clock device's
101 SAL_RETURN_REGS ReturnReg
;
104 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO
;
105 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI
;
107 ReturnReg
= EfiCallEsalService (&Guid
, GetTime
, (UINT64
) Time
, (UINT64
) Capabilities
, 0, 0, 0, 0, 0);
108 return ReturnReg
.Status
;
120 Sets the current local time and date information.
124 Time - A pointer to the current time.
132 SAL_RETURN_REGS ReturnReg
;
135 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO
;
136 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI
;
138 ReturnReg
= EfiCallEsalService (&Guid
, SetTime
, (UINT64
) Time
, 0, 0, 0, 0, 0, 0);
139 return ReturnReg
.Status
;
145 OUT BOOLEAN
*Enabled
,
146 OUT BOOLEAN
*Pending
,
153 Returns the current wakeup alarm clock setting.
157 Enabled - Indicates if the alarm is currently enabled or disabled.
158 Pending - Indicates if the alarm signal is pending and requires acknowledgement.
159 Time - The current alarm setting.
167 SAL_RETURN_REGS ReturnReg
;
170 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO
;
171 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI
;
173 ReturnReg
= EfiCallEsalService (&Guid
, GetWakeupTime
, (UINT64
) Enabled
, (UINT64
) Pending
, (UINT64
) Time
, 0, 0, 0, 0);
174 return ReturnReg
.Status
;
187 Sets the system wakeup alarm clock time.
191 Enable - Enable or disable the wakeup alarm.
192 Time - If Enable is TRUE, the time to set the wakeup alarm for.
193 If Enable is FALSE, then this parameter is optional, and may be NULL.
201 SAL_RETURN_REGS ReturnReg
;
204 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO
;
205 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI
;
207 ReturnReg
= EfiCallEsalService (&Guid
, SetWakeupTime
, (UINT64
) Enable
, (UINT64
) Time
, 0, 0, 0, 0, 0);
208 return ReturnReg
.Status
;
214 IN CHAR16
*VariableName
,
215 IN EFI_GUID
* VendorGuid
,
216 OUT UINT32
*Attributes OPTIONAL
,
217 IN OUT UINTN
*DataSize
,
224 Returns the value of a variable.
228 VariableName - A Null-terminated Unicode string that is the name of the
230 VendorGuid - A unique identifier for the vendor.
231 Attributes - If not NULL, a pointer to the memory location to return the
232 attributes bitmask for the variable.
233 DataSize - On input, the size in bytes of the return Data buffer.
234 On output the size of data returned in Data.
235 Data - The buffer to return the contents of the variable.
243 SAL_RETURN_REGS ReturnReg
;
246 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO
;
247 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI
;
249 ReturnReg
= EfiCallEsalService (
252 (UINT64
) VariableName
,
260 return (EFI_STATUS
) ReturnReg
.Status
;
265 EfiGetNextVariableName (
266 IN OUT UINTN
*VariableNameSize
,
267 IN OUT CHAR16
*VariableName
,
268 IN OUT EFI_GUID
*VendorGuid
274 Enumerates the current variable names.
278 VariableNameSize - The size of the VariableName buffer.
279 VariableName - On input, supplies the last VariableName that was returned
280 by GetNextVariableName().
281 On output, returns the Nullterminated Unicode string of the
283 VendorGuid - On input, supplies the last VendorGuid that was returned by
284 GetNextVariableName().
285 On output, returns the VendorGuid of the current variable.
293 SAL_RETURN_REGS ReturnReg
;
296 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO
;
297 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI
;
299 ReturnReg
= EfiCallEsalService (
301 EsalGetNextVariableName
,
302 (UINT64
) VariableNameSize
,
303 (UINT64
) VariableName
,
310 return (EFI_STATUS
) ReturnReg
.Status
;
316 IN CHAR16
*VariableName
,
317 IN EFI_GUID
*VendorGuid
,
318 IN UINT32 Attributes
,
326 Sets the value of a variable.
330 VariableName - A Null-terminated Unicode string that is the name of the
332 VendorGuid - A unique identifier for the vendor.
333 Attributes - Attributes bitmask to set for the variable.
334 DataSize - The size in bytes of the Data buffer.
335 Data - The contents for the variable.
343 SAL_RETURN_REGS ReturnReg
;
346 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO
;
347 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI
;
349 ReturnReg
= EfiCallEsalService (
352 (UINT64
) VariableName
,
360 return (EFI_STATUS
) ReturnReg
.Status
;
365 EfiGetNextHighMonotonicCount (
366 OUT UINT32
*HighCount
372 Returns the next high 32 bits of the platform's monotonic counter.
376 HighCount - Pointer to returned value.
384 SAL_RETURN_REGS ReturnReg
;
387 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_LO
;
388 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_HI
;
390 ReturnReg
= EfiCallEsalService (&Guid
, GetNextHighMonotonicCount
, (UINT64
) HighCount
, 0, 0, 0, 0, 0, 0);
391 return (EFI_STATUS
) ReturnReg
.Status
;
397 IN UINTN DebugDisposition
,
398 IN OUT VOID
**Address
404 Determines the new virtual address that is to be used on subsequent memory accesses.
408 DebugDisposition - Supplies type information for the pointer being converted.
409 Address - A pointer to a pointer that is to be fixed to be the value needed
410 for the new virtual address mappings being applied.
418 return mRTEdkDxeRuntimeDriverLib
->ConvertPointer (DebugDisposition
, Address
);
424 IN UINTN DebugDisposition
,
425 IN OUT LIST_ENTRY
*ListHead
431 Conver the standard Lib double linked list to a virtual mapping.
435 DebugDisposition - Argument to EfiConvertPointer (EFI 1.0 API)
437 ListHead - Head of linked list to convert
446 LIST_ENTRY
*NextLink
;
449 // Convert all the ForwardLink & BackLink pointers in the list
453 NextLink
= Link
->ForwardLink
;
456 Link
->ForwardLink
== ListHead
? DebugDisposition
: 0,
457 (VOID
**) &Link
->ForwardLink
461 Link
->BackLink
== ListHead
? DebugDisposition
: 0,
462 (VOID
**) &Link
->BackLink
466 } while (Link
!= ListHead
);
472 Change the runtime addressing mode of EFI firmware from physical to virtual.
474 @param MemoryMapSize The size in bytes of VirtualMap.
475 @param DescriptorSize The size in bytes of an entry in the VirtualMap.
476 @param DescriptorVersion The version of the structure entries in VirtualMap.
477 @param VirtualMap An array of memory descriptors which contain new virtual
478 address mapping information for all runtime ranges. Type
479 EFI_MEMORY_DESCRIPTOR is defined in the
480 GetMemoryMap() function description.
482 @retval EFI_SUCCESS The virtual address map has been applied.
483 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in
484 virtual address mapped mode.
485 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is
487 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory
488 map that requires a mapping.
489 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found
494 EfiSetVirtualAddressMap (
495 IN UINTN MemoryMapSize
,
496 IN UINTN DescriptorSize
,
497 IN UINT32 DescriptorVersion
,
498 IN CONST EFI_MEMORY_DESCRIPTOR
*VirtualMap
501 SAL_RETURN_REGS ReturnReg
;
504 *((UINT64
*) &Guid
) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_LO
;
505 *(((UINT64
*)&Guid
) + 1) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_HI
;
507 ReturnReg
= EfiCallEsalService (
510 (UINT64
) MemoryMapSize
,
511 (UINT64
) DescriptorSize
,
512 (UINT64
) DescriptorVersion
,
519 return ReturnReg
.Status
;
526 IN UEFI_CAPSULE_HEADER
**CapsuleHeaderArray
,
527 IN UINTN CapsuleCount
,
528 IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
531 return EFI_UNSUPPORTED
;
536 EfiQueryCapsuleCapabilities (
537 IN UEFI_CAPSULE_HEADER
**CapsuleHeaderArray
,
538 IN UINTN CapsuleCount
,
539 OUT UINT64
*MaximumCapsuleSize
,
540 OUT EFI_RESET_TYPE
*ResetType
543 return EFI_UNSUPPORTED
;
549 EfiQueryVariableInfo (
550 IN UINT32 Attributes
,
551 OUT UINT64
*MaximumVariableStorageSize
,
552 OUT UINT64
*RemainingVariableStorageSize
,
553 OUT UINT64
*MaximumVariableSize
556 return EFI_UNSUPPORTED
;