\r
This library hides the global variable for the EFI Runtime Services so the\r
caller does not need to deal with the possibility of being called from an\r
- OS virtual address space. All pointer values are different for a virtual \r
+ OS virtual address space. All pointer values are different for a virtual\r
mapping than from the normal physical mapping at boot services time.\r
\r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
///\r
/// Driver Lib Module Globals\r
///\r
-EFI_EVENT mEfiVirtualNotifyEvent;\r
-EFI_EVENT mEfiExitBootServicesEvent;\r
-BOOLEAN mEfiGoneVirtual = FALSE;\r
-BOOLEAN mEfiAtRuntime = FALSE;\r
-EFI_RUNTIME_SERVICES *mInternalRT;\r
+EFI_EVENT mEfiVirtualNotifyEvent;\r
+EFI_EVENT mEfiExitBootServicesEvent;\r
+BOOLEAN mEfiGoneVirtual = FALSE;\r
+BOOLEAN mEfiAtRuntime = FALSE;\r
+EFI_RUNTIME_SERVICES *mInternalRT;\r
\r
/**\r
Set AtRuntime flag as TRUE after ExitBootServices.\r
\r
- @param[in] Event The Event that is being processed\r
- @param[in] Context Event Context\r
+ @param[in] Event The Event that is being processed.\r
+ @param[in] Context The Event Context.\r
\r
**/\r
VOID\r
EFIAPI\r
RuntimeLibExitBootServicesEvent (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
)\r
{\r
mEfiAtRuntime = TRUE;\r
Call the passed in Child Notify event and convert any pointers in\r
lib to virtual mode.\r
\r
- @param[in] Event The Event that is being processed\r
- @param[in] Context Event Context\r
+ @param[in] Event The Event that is being processed.\r
+ @param[in] Context The Event Context.\r
**/\r
VOID\r
EFIAPI\r
RuntimeLibVirtualNotifyEvent (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
)\r
{\r
//\r
// Update global for Runtime Services Table and IO\r
//\r
- EfiConvertPointer (0, (VOID **) &mInternalRT);\r
+ EfiConvertPointer (0, (VOID **)&mInternalRT);\r
\r
mEfiGoneVirtual = TRUE;\r
}\r
EFI_STATUS\r
EFIAPI\r
RuntimeDriverLibConstruct (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
EFI_STATUS Status;\r
//\r
// Register SetVirtualAddressMap () notify function\r
//\r
- Status = gBS->CreateEventEx (\r
- EVT_NOTIFY_SIGNAL,\r
+ Status = gBS->CreateEvent (\r
+ EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,\r
TPL_NOTIFY,\r
RuntimeLibVirtualNotifyEvent,\r
NULL,\r
- &gEfiEventVirtualAddressChangeGuid,\r
&mEfiVirtualNotifyEvent\r
);\r
\r
ASSERT_EFI_ERROR (Status);\r
\r
- Status = gBS->CreateEventEx (\r
- EVT_NOTIFY_SIGNAL,\r
+ Status = gBS->CreateEvent (\r
+ EVT_SIGNAL_EXIT_BOOT_SERVICES,\r
TPL_NOTIFY,\r
RuntimeLibExitBootServicesEvent,\r
NULL,\r
- &gEfiEventExitBootServicesGuid,\r
&mEfiExitBootServicesEvent\r
);\r
\r
}\r
\r
/**\r
- If a runtime driver exits with an error, it must call this routine \r
+ If a runtime driver exits with an error, it must call this routine\r
to free the allocated resource before the exiting.\r
It will ASSERT() if gBS is NULL.\r
It will ASSERT() if that operation fails.\r
@param[in] ImageHandle The firmware allocated handle for the EFI image.\r
@param[in] SystemTable A pointer to the EFI System Table.\r
\r
- @retval EFI_SUCCESS Shutdown the Runtime Driver Lib successfully\r
- @retval EFI_UNSUPPORTED Runtime Driver lib was not initialized at all\r
+ @retval EFI_SUCCESS The Runtime Driver Lib shutdown successfully.\r
+ @retval EFI_UNSUPPORTED Runtime Driver lib was not initialized.\r
**/\r
EFI_STATUS\r
EFIAPI\r
}\r
\r
/**\r
- This function allows the caller to determine if UEFI SetVirtualAddressMap() has been called. \r
+ This function allows the caller to determine if UEFI SetVirtualAddressMap() has been called.\r
\r
This function returns TRUE after all the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE functions have\r
executed as a result of the OS calling SetVirtualAddressMap(). Prior to this time FALSE\r
return mEfiGoneVirtual;\r
}\r
\r
-\r
/**\r
This service is a wrapper for the UEFI Runtime Service ResetSystem().\r
\r
VOID\r
EFIAPI\r
EfiResetSystem (\r
- IN EFI_RESET_TYPE ResetType,\r
- IN EFI_STATUS ResetStatus,\r
- IN UINTN DataSize,\r
- IN VOID *ResetData OPTIONAL\r
+ IN EFI_RESET_TYPE ResetType,\r
+ IN EFI_STATUS ResetStatus,\r
+ IN UINTN DataSize,\r
+ IN VOID *ResetData OPTIONAL\r
)\r
{\r
mInternalRT->ResetSystem (ResetType, ResetStatus, DataSize, ResetData);\r
}\r
\r
-\r
/**\r
This service is a wrapper for the UEFI Runtime Service GetTime().\r
\r
EFI_STATUS\r
EFIAPI\r
EfiGetTime (\r
- OUT EFI_TIME *Time,\r
- OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL\r
+ OUT EFI_TIME *Time,\r
+ OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL\r
)\r
{\r
return mInternalRT->GetTime (Time, Capabilities);\r
}\r
\r
-\r
/**\r
This service is a wrapper for the UEFI Runtime Service SetTime().\r
\r
EFI_STATUS\r
EFIAPI\r
EfiSetTime (\r
- IN EFI_TIME *Time\r
+ IN EFI_TIME *Time\r
)\r
{\r
return mInternalRT->SetTime (Time);\r
}\r
\r
-\r
/**\r
This service is a wrapper for the UEFI Runtime Service GetWakeupTime().\r
\r
@param Time The current alarm setting. Type EFI_TIME is defined in the GetTime()\r
function description.\r
\r
- @retval EFI_SUCCESS The alarm settings were returned.\r
+ @retval EFI_SUCCESS The alarm settings were returned.\r
@retval EFI_INVALID_PARAMETER Enabled is NULL.\r
@retval EFI_INVALID_PARAMETER Pending is NULL.\r
@retval EFI_INVALID_PARAMETER Time is NULL.\r
EFI_STATUS\r
EFIAPI\r
EfiGetWakeupTime (\r
- OUT BOOLEAN *Enabled,\r
- OUT BOOLEAN *Pending,\r
- OUT EFI_TIME *Time\r
+ OUT BOOLEAN *Enabled,\r
+ OUT BOOLEAN *Pending,\r
+ OUT EFI_TIME *Time\r
)\r
{\r
return mInternalRT->GetWakeupTime (Enabled, Pending, Time);\r
}\r
\r
-\r
-\r
/**\r
This service is a wrapper for the UEFI Runtime Service SetWakeupTime()\r
\r
EFI_STATUS\r
EFIAPI\r
EfiSetWakeupTime (\r
- IN BOOLEAN Enable,\r
- IN EFI_TIME *Time OPTIONAL\r
+ IN BOOLEAN Enable,\r
+ IN EFI_TIME *Time OPTIONAL\r
)\r
{\r
return mInternalRT->SetWakeupTime (Enable, Time);\r
}\r
\r
-\r
/**\r
This service is a wrapper for the UEFI Runtime Service GetVariable().\r
\r
EFI_STATUS\r
EFIAPI\r
EfiGetVariable (\r
- IN CHAR16 *VariableName,\r
- IN EFI_GUID *VendorGuid,\r
- OUT UINT32 *Attributes OPTIONAL,\r
- IN OUT UINTN *DataSize,\r
- OUT VOID *Data\r
+ IN CHAR16 *VariableName,\r
+ IN EFI_GUID *VendorGuid,\r
+ OUT UINT32 *Attributes OPTIONAL,\r
+ IN OUT UINTN *DataSize,\r
+ OUT VOID *Data\r
)\r
{\r
return mInternalRT->GetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);\r
}\r
\r
-\r
/**\r
This service is a wrapper for the UEFI Runtime Service GetNextVariableName().\r
\r
EFI_STATUS\r
EFIAPI\r
EfiGetNextVariableName (\r
- IN OUT UINTN *VariableNameSize,\r
- IN OUT CHAR16 *VariableName,\r
- IN OUT EFI_GUID *VendorGuid\r
+ IN OUT UINTN *VariableNameSize,\r
+ IN OUT CHAR16 *VariableName,\r
+ IN OUT EFI_GUID *VendorGuid\r
)\r
{\r
return mInternalRT->GetNextVariableName (VariableNameSize, VariableName, VendorGuid);\r
}\r
\r
-\r
/**\r
This service is a wrapper for the UEFI Runtime Service GetNextVariableName()\r
\r
Variables are stored by the firmware and may maintain their values across power cycles. Each vendor\r
may create and manage its own variables without the risk of name conflicts by using a unique VendorGuid.\r
\r
- @param VariableName the name of the vendor's variable, it's a\r
- Null-Terminated Unicode String\r
+ @param VariableName The name of the vendor's variable; it's a Null-Terminated\r
+ Unicode String\r
@param VendorGuid Unify identifier for vendor.\r
- @param Attributes Point to memory location to return the attributes of variable. If the point\r
+ @param Attributes Points to a memory location to return the attributes of variable. If the point\r
is NULL, the parameter would be ignored.\r
@param DataSize The size in bytes of Data-Buffer.\r
- @param Data Point to the content of the variable.\r
+ @param Data Points to the content of the variable.\r
\r
@retval EFI_SUCCESS The firmware has successfully stored the variable and its data as\r
defined by the Attributes.\r
@retval EFI_DEVICE_ERROR The variable could not be saved due to a hardware failure.\r
@retval EFI_WRITE_PROTECTED The variable in question is read-only.\r
@retval EFI_WRITE_PROTECTED The variable in question cannot be deleted.\r
- @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS\r
+ @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS\r
set but the AuthInfo does NOT pass the validation check carried\r
out by the firmware.\r
@retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found.\r
EFI_STATUS\r
EFIAPI\r
EfiSetVariable (\r
- IN CHAR16 *VariableName,\r
- IN EFI_GUID *VendorGuid,\r
- IN UINT32 Attributes,\r
- IN UINTN DataSize,\r
- IN VOID *Data\r
+ IN CHAR16 *VariableName,\r
+ IN EFI_GUID *VendorGuid,\r
+ IN UINT32 Attributes,\r
+ IN UINTN DataSize,\r
+ IN VOID *Data\r
)\r
{\r
return mInternalRT->SetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);\r
}\r
\r
-\r
/**\r
This service is a wrapper for the UEFI Runtime Service GetNextHighMonotonicCount().\r
\r
32-bit value is nonvolatile and is increased by 1 whenever the system resets or whenever the low\r
32-bit count (returned by GetNextMonoticCount()) overflows.\r
\r
- @param HighCount Pointer to returned value.\r
+ @param HighCount The pointer to returned value.\r
\r
@retval EFI_SUCCESS The next high monotonic count was returned.\r
@retval EFI_DEVICE_ERROR The device is not functioning properly.\r
EFI_STATUS\r
EFIAPI\r
EfiGetNextHighMonotonicCount (\r
- OUT UINT32 *HighCount\r
+ OUT UINT32 *HighCount\r
)\r
{\r
return mInternalRT->GetNextHighMonotonicCount (HighCount);\r
}\r
\r
-\r
/**\r
- This service is a wrapper for the UEFI Runtime Service ConvertPointer(). \r
+ This service is a wrapper for the UEFI Runtime Service ConvertPointer().\r
\r
The ConvertPointer() function is used by an EFI component during the SetVirtualAddressMap() operation.\r
ConvertPointer()must be called using physical address pointers during the execution of SetVirtualAddressMap().\r
EFI_STATUS\r
EFIAPI\r
EfiConvertPointer (\r
- IN UINTN DebugDisposition,\r
- IN OUT VOID **Address\r
+ IN UINTN DebugDisposition,\r
+ IN OUT VOID **Address\r
)\r
{\r
return gRT->ConvertPointer (DebugDisposition, Address);\r
}\r
\r
-\r
/**\r
Determines the new virtual address that is to be used on subsequent memory accesses.\r
\r
For IA32, x64, and EBC, this service is a wrapper for the UEFI Runtime Service\r
- ConvertPointer(). See the UEFI Specification for details. \r
+ ConvertPointer(). See the UEFI Specification for details.\r
For IPF, this function interprets Address as a pointer to an EFI_PLABEL structure\r
and both the EntryPoint and GP fields of an EFI_PLABEL are converted from physical\r
to virtiual addressing. Since IPF allows the GP to point to an address outside\r
EFI_STATUS\r
EFIAPI\r
EfiConvertFunctionPointer (\r
- IN UINTN DebugDisposition,\r
- IN OUT VOID **Address\r
+ IN UINTN DebugDisposition,\r
+ IN OUT VOID **Address\r
)\r
{\r
return EfiConvertPointer (DebugDisposition, Address);\r
}\r
\r
-\r
/**\r
Convert the standard Lib double linked list to a virtual mapping.\r
\r
EFI_STATUS\r
EFIAPI\r
EfiConvertList (\r
- IN UINTN DebugDisposition,\r
- IN OUT LIST_ENTRY *ListHead\r
+ IN UINTN DebugDisposition,\r
+ IN OUT LIST_ENTRY *ListHead\r
)\r
{\r
LIST_ENTRY *Link;\r
LIST_ENTRY *NextLink;\r
- \r
+\r
//\r
// For NULL List, return EFI_SUCCESS\r
//\r
\r
EfiConvertPointer (\r
Link->ForwardLink == ListHead ? DebugDisposition : 0,\r
- (VOID **) &Link->ForwardLink\r
+ (VOID **)&Link->ForwardLink\r
);\r
\r
EfiConvertPointer (\r
Link->BackLink == ListHead ? DebugDisposition : 0,\r
- (VOID **) &Link->BackLink\r
+ (VOID **)&Link->BackLink\r
);\r
\r
Link = NextLink;\r
} while (Link != ListHead);\r
+\r
return EFI_SUCCESS;\r
}\r
\r
-\r
/**\r
This service is a wrapper for the UEFI Runtime Service SetVirtualAddressMap().\r
\r
EFI_STATUS\r
EFIAPI\r
EfiSetVirtualAddressMap (\r
- IN UINTN MemoryMapSize,\r
- IN UINTN DescriptorSize,\r
- IN UINT32 DescriptorVersion,\r
- IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap\r
+ IN UINTN MemoryMapSize,\r
+ IN UINTN DescriptorSize,\r
+ IN UINT32 DescriptorVersion,\r
+ IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap\r
)\r
{\r
return mInternalRT->SetVirtualAddressMap (\r
MemoryMapSize,\r
DescriptorSize,\r
DescriptorVersion,\r
- (EFI_MEMORY_DESCRIPTOR *) VirtualMap\r
+ (EFI_MEMORY_DESCRIPTOR *)VirtualMap\r
);\r
}\r
\r
-\r
/**\r
This service is a wrapper for the UEFI Runtime Service UpdateCapsule().\r
\r
CapsuleHeaderArray must be the same capsules as the\r
ScatterGatherList. The CapsuleHeaderArray must\r
have the capsules in the same order as the ScatterGatherList.\r
- @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in\r
+ @param CapsuleCount The number of pointers to EFI_CAPSULE_HEADER in\r
CaspuleHeaderArray.\r
@param ScatterGatherList Physical pointer to a set of\r
EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the\r
EFI_STATUS\r
EFIAPI\r
EfiUpdateCapsule (\r
- IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
- IN UINTN CapsuleCount,\r
- IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL\r
+ IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
+ IN UINTN CapsuleCount,\r
+ IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL\r
)\r
{\r
return mInternalRT->UpdateCapsule (\r
);\r
}\r
\r
-\r
/**\r
This service is a wrapper for the UEFI Runtime Service QueryCapsuleCapabilities().\r
\r
@param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules\r
being passed into update capsule. The capsules are assumed to\r
stored in contiguous virtual memory.\r
- @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in\r
+ @param CapsuleCount The number of pointers to EFI_CAPSULE_HEADER in\r
CaspuleHeaderArray.\r
@param MaximumCapsuleSize On output the maximum size that UpdateCapsule() can\r
support as an argument to UpdateCapsule() via\r
Undefined on input.\r
@param ResetType Returns the type of reset required for the capsule update.\r
\r
- @retval EFI_SUCCESS Valid answer returned.\r
+ @retval EFI_SUCCESS A valid answer was returned.\r
@retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.\r
@retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and\r
MaximumCapsuleSize and ResetType are undefined.\r
EFI_STATUS\r
EFIAPI\r
EfiQueryCapsuleCapabilities (\r
- IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
- IN UINTN CapsuleCount,\r
- OUT UINT64 *MaximumCapsuleSize,\r
- OUT EFI_RESET_TYPE *ResetType\r
+ IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
+ IN UINTN CapsuleCount,\r
+ OUT UINT64 *MaximumCapsuleSize,\r
+ OUT EFI_RESET_TYPE *ResetType\r
)\r
{\r
return mInternalRT->QueryCapsuleCapabilities (\r
);\r
}\r
\r
-\r
/**\r
This service is a wrapper for the UEFI Runtime Service QueryVariableInfo().\r
\r
@param MaximumVariableSize Returns the maximum size of the individual EFI\r
variables associated with the attributes specified.\r
\r
- @retval EFI_SUCCESS Valid answer returned.\r
+ @retval EFI_SUCCESS A valid answer was returned.\r
@retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.\r
@retval EFI_UNSUPPORTED EFI_UNSUPPORTED The attribute is not supported on this platform, and the\r
MaximumVariableStorageSize,\r