-/*++\r
+/** @file\r
+ UEFI Runtime Library implementation for non IPF processor types.\r
\r
-Copyright (c) 2006 - 2007, Intel Corporation\r
-All rights reserved. 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
+ This library hides the global variable for the EFI Runtime Services so the\r
+ caller does not need to deal with the possiblitly of being called from an\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
-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 - 2008, Intel Corporation.<BR>\r
+ All rights reserved. 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
-Module Name:\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
\r
- RuntimeService.c\r
+**/\r
\r
---*/\r
+#include "RuntimeLibInternal.h"\r
\r
-#include <PiDxe.h>\r
-#include <\r
\r
-#include <RuntimeLibInternal.h>\r
+/**\r
+ Resets the entire platform.\r
\r
+ @param ResetType The type of reset to perform.\r
+ @param ResetStatus The status code for reset.\r
+ @param DataSize The size in bytes of reset data.\r
+ @param ResetData Pointer to data buffer that includes\r
+ Null-Terminated Unicode string.\r
+\r
+**/\r
VOID\r
EFIAPI\r
EfiResetSystem (\r
IN UINTN DataSize,\r
IN CHAR16 *ResetData\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Resets the entire platform.\r
-\r
-Arguments:\r
+{\r
+ mRT->ResetSystem (ResetType, ResetStatus, DataSize, ResetData);\r
+}\r
\r
- ResetType - The type of reset to perform.\r
- ResetStatus - The status code for the reset.\r
- DataSize - The size, in bytes, of ResetData.\r
- ResetData - A data buffer that includes a Null-terminated Unicode string, optionally\r
- followed by additional binary data.\r
\r
-Returns:\r
+/**\r
+ Return current time and date information, and time-keeping\r
+ capabilities of hardware platform.\r
\r
- None\r
+ @param Time A pointer to storage to receive a snapshot of the current time.\r
+ @param Capabilities An optional pointer to a buffer to receive the real time clock device's\r
+ capabilities.\r
\r
---*/\r
-{\r
- mRT->ResetSystem (ResetType, ResetStatus, DataSize, ResetData);\r
-}\r
+ @retval EFI_SUCCESS Success to execute the function.\r
+ @retval !EFI_SUCCESS Failed to execute the function.\r
\r
-//\r
-// The following functions hide the mRT local global from the call to\r
-// runtime service in the EFI system table.\r
-//\r
+**/\r
EFI_STATUS\r
EFIAPI\r
EfiGetTime (\r
OUT EFI_TIME *Time,\r
OUT EFI_TIME_CAPABILITIES *Capabilities\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Returns the current time and date information, and the time-keeping\r
- capabilities of the hardware platform.\r
+{\r
+ return mRT->GetTime (Time, Capabilities);\r
+}\r
\r
-Arguments:\r
\r
- Time - A pointer to storage to receive a snapshot of the current time.\r
- Capabilities - An optional pointer to a buffer to receive the real time clock device's\r
- capabilities.\r
+/**\r
+ Set current time and date information.\r
\r
-Returns:\r
+ @param Time A pointer to cache of time setting.\r
\r
- Status code\r
-\r
---*/\r
-{\r
- return mRT->GetTime (Time, Capabilities);\r
-}\r
+ @retval EFI_SUCCESS Success to execute the function.\r
+ @retval !EFI_SUCCESS Failed to execute the function.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
EfiSetTime (\r
IN EFI_TIME *Time\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Sets the current local time and date information.\r
-\r
-Arguments:\r
+{\r
+ return mRT->SetTime (Time);\r
+}\r
\r
- Time - A pointer to the current time.\r
\r
-Returns:\r
+/**\r
+ Return current wakeup alarm clock setting.\r
\r
- Status code\r
+ @param Enabled Indicate if the alarm clock is enabled or disabled.\r
+ @param Pending Indicate if the alarm signal is pending and requires acknowledgement.\r
+ @param Time Current alarm clock setting.\r
\r
---*/\r
-{\r
- return mRT->SetTime (Time);\r
-}\r
+ @retval EFI_SUCCESS Success to execute the function.\r
+ @retval !EFI_SUCCESS Failed to execute the function.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
EfiGetWakeupTime (\r
OUT BOOLEAN *Pending,\r
OUT EFI_TIME *Time\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Returns the current wakeup alarm clock setting.\r
+{\r
+ return mRT->GetWakeupTime (Enabled, Pending, Time);\r
+}\r
\r
-Arguments:\r
\r
- Enabled - Indicates if the alarm is currently enabled or disabled.\r
- Pending - Indicates if the alarm signal is pending and requires acknowledgement.\r
- Time - The current alarm setting.\r
\r
-Returns:\r
+/**\r
+ Set current wakeup alarm clock.\r
\r
- Status code\r
+ @param Enable Enable or disable current alarm clock..\r
+ @param Time Point to alarm clock setting.\r
\r
---*/\r
-{\r
- return mRT->GetWakeupTime (Enabled, Pending, Time);\r
-}\r
+ @retval EFI_SUCCESS Success to execute the function.\r
+ @retval !EFI_SUCCESS Failed to execute the function.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
EfiSetWakeupTime (\r
IN BOOLEAN Enable,\r
IN EFI_TIME *Time\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Sets the system wakeup alarm clock time.\r
-\r
-Arguments:\r
-\r
- Enable - Enable or disable the wakeup alarm.\r
- Time - If Enable is TRUE, the time to set the wakeup alarm for.\r
- If Enable is FALSE, then this parameter is optional, and may be NULL.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
{\r
return mRT->SetWakeupTime (Enable, Time);\r
}\r
\r
\r
+/**\r
+ Return value of variable.\r
+\r
+ @param VariableName the name of the vendor's variable, it's a\r
+ Null-Terminated 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
+ is NULL, the parameter would be ignored.\r
+ @param DataSize As input, point to the maxinum size of return Data-Buffer.\r
+ As output, point to the actual size of the returned Data-Buffer.\r
+ @param Data Point to return Data-Buffer.\r
\r
+ @retval EFI_SUCCESS Success to execute the function.\r
+ @retval !EFI_SUCCESS Failed to execute the function.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
EfiGetVariable (\r
IN OUT UINTN *DataSize,\r
OUT VOID *Data\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Returns the value of a variable.\r
+{\r
+ return mRT->GetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);\r
+}\r
\r
-Arguments:\r
\r
- VariableName - A Null-terminated Unicode string that is the name of the\r
- vendor's variable.\r
- VendorGuid - A unique identifier for the vendor.\r
- Attributes - If not NULL, a pointer to the memory location to return the\r
- attributes bitmask for the variable.\r
- DataSize - On input, the size in bytes of the return Data buffer.\r
- On output the size of data returned in Data.\r
- Data - The buffer to return the contents of the variable.\r
+/**\r
+ Enumerates variable's name.\r
\r
-Returns:\r
+ @param VariableNameSize As input, point to maxinum size of variable name.\r
+ As output, point to actual size of varaible name.\r
+ @param VariableName As input, supplies the last VariableName that was returned by\r
+ GetNextVariableName().\r
+ As output, returns the name of variable. The name\r
+ string is Null-Terminated Unicode string.\r
+ @param VendorGuid As input, supplies the last VendorGuid that was returned by\r
+ GetNextVriableName().\r
+ As output, returns the VendorGuid of the current variable.\r
\r
- Status code\r
-\r
---*/\r
-{\r
- return mRT->GetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);\r
-}\r
+ @retval EFI_SUCCESS Success to execute the function.\r
+ @retval !EFI_SUCCESS Failed to execute the function.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
EfiGetNextVariableName (\r
IN OUT CHAR16 *VariableName,\r
IN OUT EFI_GUID *VendorGuid\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Enumerates the current variable names.\r
+{\r
+ return mRT->GetNextVariableName (VariableNameSize, VariableName, VendorGuid);\r
+}\r
\r
-Arguments:\r
\r
- VariableNameSize - The size of the VariableName buffer.\r
- VariableName - On input, supplies the last VariableName that was returned\r
- by GetNextVariableName().\r
- On output, returns the Nullterminated Unicode string of the\r
- current variable.\r
- VendorGuid - On input, supplies the last VendorGuid that was returned by\r
- GetNextVariableName().\r
- On output, returns the VendorGuid of the current variable.\r
+/**\r
+ Sets value of variable.\r
\r
-Returns:\r
+ @param VariableName the name of the vendor's variable, it's a\r
+ Null-Terminated 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
+ 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
\r
- Status code\r
-\r
---*/\r
-{\r
- return mRT->GetNextVariableName (VariableNameSize, VariableName, VendorGuid);\r
-}\r
+ @retval EFI_SUCCESS Success to execute the function.\r
+ @retval !EFI_SUCCESS Failed to execute the function.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
EfiSetVariable (\r
IN UINTN DataSize,\r
IN VOID *Data\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Sets the value of a variable.\r
-\r
-Arguments:\r
+{\r
+ return mRT->SetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);\r
+}\r
\r
- VariableName - A Null-terminated Unicode string that is the name of the\r
- vendor's variable.\r
- VendorGuid - A unique identifier for the vendor.\r
- Attributes - Attributes bitmask to set for the variable.\r
- DataSize - The size in bytes of the Data buffer.\r
- Data - The contents for the variable.\r
\r
-Returns:\r
+/**\r
+ Returns the next high 32 bits of platform's monotonic counter.\r
\r
- Status code\r
+ @param HighCount Pointer to returned value.\r
\r
---*/\r
-{\r
- return mRT->SetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);\r
-}\r
+ @retval EFI_SUCCESS Success to execute the function.\r
+ @retval !EFI_SUCCESS Failed to execute the function.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
EfiGetNextHighMonotonicCount (\r
OUT UINT32 *HighCount\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Returns the next high 32 bits of the platform's monotonic counter.\r
+{\r
+ return mRT->GetNextHighMonotonicCount (HighCount);\r
+}\r
\r
-Arguments:\r
\r
- HighCount - Pointer to returned value.\r
+/**\r
+ Determines the new virtual address that is to be used on subsequent memory accesses.\r
\r
-Returns:\r
+ @param DebugDisposition Supplies type information for the pointer being converted.\r
+ @param Address The pointer to a pointer that is to be fixed to be the\r
+ value needed for the new virtual address mapping being\r
+ applied.\r
\r
- Status code\r
-\r
---*/\r
-{\r
- return mRT->GetNextHighMonotonicCount (HighCount);\r
-}\r
+ @retval EFI_SUCCESS Success to execute the function.\r
+ @retval !EFI_SUCCESS Failed to execute the function.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
EfiConvertPointer (\r
IN UINTN DebugDisposition,\r
IN OUT VOID **Address\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Determines the new virtual address that is to be used on subsequent memory accesses.\r
-\r
-Arguments:\r
+{\r
+ return gRT->ConvertPointer (DebugDisposition, Address);\r
+}\r
\r
- DebugDisposition - Supplies type information for the pointer being converted.\r
- Address - A pointer to a pointer that is to be fixed to be the value needed\r
- for the new virtual address mappings being applied.\r
\r
-Returns:\r
+/**\r
+ Conver the standard Lib double linked list to a virtual mapping.\r
\r
- Status code\r
+ @param DebugDisposition Supplies type information for the pointer being converted.\r
+ @param ListHead Head of linked list to convert.\r
\r
---*/\r
-{\r
- return mRT->ConvertPointer (DebugDisposition, Address);\r
-}\r
+ @retval EFI_SUCCESS Success to execute the function.\r
+ @retval !EFI_SUCCESS Failed to execute the function.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
EfiConvertList (\r
IN UINTN DebugDisposition,\r
IN OUT LIST_ENTRY *ListHead\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Conver the standard Lib double linked list to a virtual mapping.\r
-\r
-Arguments:\r
-\r
- DebugDisposition - Argument to EfiConvertPointer (EFI 1.0 API)\r
-\r
- ListHead - Head of linked list to convert\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS\r
-\r
---*/\r
{\r
LIST_ENTRY *Link;\r
LIST_ENTRY *NextLink;\r
+ \r
+ //\r
+ // For NULL List, return EFI_SUCCESS\r
+ //\r
+ if (ListHead == NULL) {\r
+ return EFI_SUCCESS;\r
+ }\r
\r
//\r
// Convert all the ForwardLink & BackLink pointers in the list\r
}\r
\r
\r
+/**\r
+ Passes capsules to the firmware with both virtual and physical mapping.\r
+ Depending on the intended consumption, the firmware may\r
+ process the capsule immediately. If the payload should persist across a\r
+ system reset, the reset value returned from EFI_QueryCapsuleCapabilities must\r
+ be passed into ResetSystem() and will cause the capsule to be processed by\r
+ the firmware as part of the reset process.\r
+\r
+ @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules\r
+ being passed into update capsule. Each capsules is assumed to\r
+ stored in contiguous virtual memory. The capsules in the\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
+ CaspuleHeaderArray.\r
+ @param ScatterGatherList Physical pointer to a set of\r
+ EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the\r
+ location in physical memory of a set of capsules. See Related\r
+ Definitions for an explanation of how more than one capsule is\r
+ passed via this interface. The capsules in the\r
+ ScatterGatherList must be in the same order as the\r
+ CapsuleHeaderArray. This parameter is only referenced if\r
+ the capsules are defined to persist across system reset.\r
+\r
+ @retval EFI_SUCCESS Valid capsule was passed. I Valid capsule was passed. If\r
+ CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the\r
+ capsule has been successfully processed by the firmware.\r
+ @retval EFI_INVALID_PARAMETER CapsuleSize is NULL or ResetTye is NULL.\r
+ @retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
EfiUpdateCapsule (\r
- IN UEFI_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 mRT->UpdateCapsule (\r
);\r
}\r
\r
+\r
+/**\r
+ The QueryCapsuleCapabilities() function allows a caller to test to see if a capsule or\r
+ capsules can be updated via UpdateCapsule(). The Flags values in the capsule header and\r
+ size of the entire capsule is checked.\r
+ If the caller needs to query for generic capsule capability a fake EFI_CAPSULE_HEADER can be\r
+ constructed where CapsuleImageSize is equal to HeaderSize that is equal to sizeof\r
+ (EFI_CAPSULE_HEADER). To determine reset requirements,\r
+ CAPSULE_FLAGS_PERSIST_ACROSS_RESET should be set in the Flags field of the\r
+ EFI_CAPSULE_HEADER.\r
+ The firmware must support any capsule that has the\r
+ CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set in EFI_CAPSULE_HEADER. The\r
+ firmware sets the policy for what capsules are supported that do not have the\r
+ CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set.\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
+ CaspuleHeaderArray.\r
+ @param MaximumCapsuleSize On output the maximum size that UpdateCapsule() can\r
+ support as an argument to UpdateCapsule() via\r
+ CapsuleHeaderArray and ScatterGatherList.\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_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
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
EfiQueryCapsuleCapabilities (\r
- IN UEFI_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 mRT->QueryCapsuleCapabilities (\r
}\r
\r
\r
+/**\r
+ The QueryVariableInfo() function allows a caller to obtain the information about the\r
+ maximum size of the storage space available for the EFI variables, the remaining size of the storage\r
+ space available for the EFI variables and the maximum size of each individual EFI variable,\r
+ associated with the attributes specified.\r
+ The returned MaximumVariableStorageSize, RemainingVariableStorageSize,\r
+ MaximumVariableSize information may change immediately after the call based on other\r
+ runtime activities including asynchronous error events. Also, these values associated with different\r
+ attributes are not additive in nature.\r
+\r
+ @param Attributes Attributes bitmask to specify the type of variables on\r
+ which to return information. Refer to the\r
+ GetVariable() function description.\r
+ @param MaximumVariableStorageSize\r
+ On output the maximum size of the storage space\r
+ available for the EFI variables associated with the\r
+ attributes specified.\r
+ @param RemainingVariableStorageSize\r
+ Returns the remaining size of the storage space\r
+ available for the EFI variables associated with the\r
+ attributes specified..\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_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
+ RemainingVariableStorageSize, MaximumVariableSize\r
+ are undefined.\r
+**/\r
EFI_STATUS\r
EFIAPI\r
EfiQueryVariableInfo (\r
- IN UINT32 Attributes,\r
- OUT UINT64 *MaximumVariableStorageSize,\r
- OUT UINT64 *RemainingVariableStorageSize,\r
- OUT UINT64 *MaximumVariableSize\r
+ IN UINT32 Attributes,\r
+ OUT UINT64 *MaximumVariableStorageSize,\r
+ OUT UINT64 *RemainingVariableStorageSize,\r
+ OUT UINT64 *MaximumVariableSize\r
)\r
{\r
return mRT->QueryVariableInfo (\r