]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Variable/EmuRuntimeDxe/InitVariable.c
code scrub update
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / EmuRuntimeDxe / InitVariable.c
index 0f9b6fdb6182167f40cc520e350d5312ae22a167..c43b7a4776412f1341819e8d6edff8e381789da5 100644 (file)
@@ -16,31 +16,34 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "Variable.h"\r
 \r
-//\r
-// Don't use module globals after the SetVirtualAddress map is signaled\r
-//\r
-extern ESAL_VARIABLE_GLOBAL *mVariableModuleGlobal;\r
-\r
 EFI_EVENT   mVirtualAddressChangeEvent = NULL;\r
 \r
+/**\r
+\r
+  This code finds variable in storage blocks (Volatile or Non-Volatile).\r
+\r
+  @param VariableName               Name of Variable to be found.\r
+  @param VendorGuid                 Variable vendor GUID.\r
+  @param Attributes                 Attribute value of the variable found.\r
+  @param DataSize                   Size of Data found. If size is less than the\r
+                                    data, this value contains the required size.\r
+  @param Data                       Data pointer.\r
+                      \r
+  @return EFI_INVALID_PARAMETER     Invalid parameter\r
+  @return EFI_SUCCESS               Find the specified variable\r
+  @return EFI_NOT_FOUND             Not found\r
+  @return EFI_BUFFER_TO_SMALL       DataSize is too small for the result\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 RuntimeServiceGetVariable (\r
   IN CHAR16        *VariableName,\r
-  IN EFI_GUID      * VendorGuid,\r
+  IN EFI_GUID      *VendorGuid,\r
   OUT UINT32       *Attributes OPTIONAL,\r
   IN OUT UINTN     *DataSize,\r
   OUT VOID         *Data\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   return GetVariable (\r
           VariableName,\r
@@ -53,6 +56,20 @@ Returns:
           );\r
 }\r
 \r
+/**\r
+\r
+  This code Finds the Next available variable.\r
+\r
+  @param VariableNameSize           Size of the variable name\r
+  @param VariableName               Pointer to variable name\r
+  @param VendorGuid                 Variable Vendor Guid\r
+\r
+  @return EFI_INVALID_PARAMETER     Invalid parameter\r
+  @return EFI_SUCCESS               Find the specified variable\r
+  @return EFI_NOT_FOUND             Not found\r
+  @return EFI_BUFFER_TO_SMALL       DataSize is too small for the result\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 RuntimeServiceGetNextVariableName (\r
@@ -60,15 +77,6 @@ RuntimeServiceGetNextVariableName (
   IN OUT CHAR16    *VariableName,\r
   IN OUT EFI_GUID  *VendorGuid\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   return GetNextVariableName (\r
           VariableNameSize,\r
@@ -79,6 +87,24 @@ Returns:
           );\r
 }\r
 \r
+/**\r
+\r
+  This code sets variable in storage blocks (Volatile or Non-Volatile).\r
+\r
+  @param VariableName                     Name of Variable to be found\r
+  @param VendorGuid                       Variable vendor GUID\r
+  @param Attributes                       Attribute value of the variable found\r
+  @param DataSize                         Size of Data found. If size is less than the\r
+                                          data, this value contains the required size.\r
+  @param Data                             Data pointer\r
+\r
+  @return EFI_INVALID_PARAMETER           Invalid parameter\r
+  @return EFI_SUCCESS                     Set successfully\r
+  @return EFI_OUT_OF_RESOURCES            Resource not enough to set variable\r
+  @return EFI_NOT_FOUND                   Not found\r
+  @return EFI_WRITE_PROTECTED             Variable is read-only\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 RuntimeServiceSetVariable (\r
@@ -88,15 +114,6 @@ RuntimeServiceSetVariable (
   IN UINTN         DataSize,\r
   IN VOID          *Data\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   return SetVariable (\r
           VariableName,\r
@@ -111,6 +128,24 @@ Returns:
           );\r
 }\r
 \r
+/**\r
+\r
+  This code returns information about the EFI variables.\r
+\r
+  @param Attributes                     Attributes bitmask to specify the type of variables\r
+                                        on which to return information.\r
+  @param MaximumVariableStorageSize     Pointer to the maximum size of the storage space available\r
+                                        for the EFI variables associated with the attributes specified.\r
+  @param RemainingVariableStorageSize   Pointer to the remaining size of the storage space available\r
+                                        for EFI variables associated with the attributes specified.\r
+  @param MaximumVariableSize            Pointer to the maximum size of an individual EFI variables\r
+                                        associated with the attributes specified.\r
+\r
+  @return EFI_INVALID_PARAMETER         An invalid combination of attribute bits was supplied.\r
+  @return EFI_SUCCESS                   Query successfully.\r
+  @return EFI_UNSUPPORTED               The attribute is not supported on this platform.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 RuntimeServiceQueryVariableInfo (\r
@@ -119,15 +154,6 @@ RuntimeServiceQueryVariableInfo (
   OUT UINT64                 *RemainingVariableStorageSize,\r
   OUT UINT64                 *MaximumVariableSize\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   return QueryVariableInfo (\r
           Attributes,\r
@@ -139,21 +165,22 @@ Returns:
           );\r
 }\r
 \r
+/**\r
+  Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE.\r
+\r
+  This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.\r
+  It convers pointer to new virtual address.\r
+\r
+  @param  Event        Event whose notification function is being invoked.\r
+  @param  Context      Pointer to the notification function's context.\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 VariableClassAddressChangeEvent (\r
   IN EFI_EVENT        Event,\r
   IN VOID             *Context\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   EfiConvertPointer (\r
     0x0,\r
@@ -166,21 +193,26 @@ Returns:
   EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal);\r
 }\r
 \r
+/**\r
+  Entry point of EmuVariable service module.\r
+\r
+  This function is the entry point of EmuVariable service module.\r
+  It registers all interfaces of Variable Services, initializes\r
+  variable store for non-volatile and volatile variables, and registers\r
+  notification function for EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.\r
+\r
+  @param  ImageHandle   The Image handle of this driver.\r
+  @param  SystemTable   The pointer of EFI_SYSTEM_TABLE.\r
+\r
+  @retval EFI_SUCCESS   Variable service successfully initialized.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 VariableServiceInitialize (\r
   IN EFI_HANDLE         ImageHandle,\r
   IN EFI_SYSTEM_TABLE   *SystemTable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   EFI_HANDLE  NewHandle;\r
   EFI_STATUS  Status;\r