]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/VariablePei/Variable.c
Coding style modification.
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / VariablePei / Variable.c
index 8535a3fd0257b7fbb982b17bb10c0ffcced02ab7..f57e2002e262af50ea6d43e8f4a107ff0205e67c 100644 (file)
@@ -1,5 +1,6 @@
 /** @file\r
-\r
+  Framework PEIM to provide the Variable functionality\r
+  \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
@@ -10,12 +11,6 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 Module Name:\r
 \r
-  Variable.c\r
-\r
-Abstract:\r
-\r
-  Framework PEIM to provide the Variable functionality\r
-\r
 **/\r
 \r
 \r
@@ -49,29 +44,22 @@ static EFI_PEI_PPI_DESCRIPTOR     mPpiListVariable[] = {
 \r
 EFI_GUID mEfiVariableIndexTableGuid = EFI_VARIABLE_INDEX_TABLE_GUID;\r
 \r
+/**\r
+  Provide the functionality of the variable services.\r
+\r
+  @param FfsHeadher  - The FFS file header\r
+  @param PeiServices - General purpose services available to every PEIM.\r
+\r
+  @return Status -  EFI_SUCCESS if the interface could be successfully\r
+          installed\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeimInitializeVariableServices (\r
   IN EFI_FFS_FILE_HEADER       *FfsHeader,\r
   IN EFI_PEI_SERVICES          **PeiServices\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Provide the functionality of the variable services.\r
-\r
-Arguments:\r
-\r
-  FfsHeadher  - The FFS file header\r
-  PeiServices - General purpose services available to every PEIM.\r
-\r
-Returns:\r
-\r
-  Status -  EFI_SUCCESS if the interface could be successfully\r
-            installed\r
-\r
---*/\r
 {\r
   //\r
   // Publish the variable capability to other modules\r
@@ -80,25 +68,18 @@ Returns:
 \r
 }\r
 \r
-VARIABLE_HEADER *\r
-GetStartPointer (\r
-  IN VARIABLE_STORE_HEADER       *VarStoreHeader\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   This code gets the pointer to the first variable memory pointer byte\r
 \r
-Arguments:\r
-\r
-  VarStoreHeader        Pointer to the Variable Store Header.\r
-\r
-Returns:\r
+  @param VarStoreHeader        Pointer to the Variable Store Header.\r
 \r
-  VARIABLE_HEADER*      Pointer to last unavailable Variable Header\r
+  @Return VARIABLE_HEADER*      Pointer to last unavailable Variable Header\r
 \r
---*/\r
+**/\r
+VARIABLE_HEADER *\r
+GetStartPointer (\r
+  IN VARIABLE_STORE_HEADER       *VarStoreHeader\r
+  )\r
 {\r
   //\r
   // The end of variable store\r
@@ -106,25 +87,19 @@ Returns:
   return (VARIABLE_HEADER *) HEADER_ALIGN (VarStoreHeader + 1);\r
 }\r
 \r
-VARIABLE_HEADER *\r
-GetEndPointer (\r
-  IN VARIABLE_STORE_HEADER       *VarStoreHeader\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   This code gets the pointer to the last variable memory pointer byte\r
 \r
-Arguments:\r
+  @param VarStoreHeader        Pointer to the Variable Store Header.\r
 \r
-  VarStoreHeader        Pointer to the Variable Store Header.\r
+  @Return  VARIABLE_HEADER*      Pointer to last unavailable Variable Header\r
 \r
-Returns:\r
-\r
-  VARIABLE_HEADER*      Pointer to last unavailable Variable Header\r
+**/\r
+VARIABLE_HEADER *\r
+GetEndPointer (\r
+  IN VARIABLE_STORE_HEADER       *VarStoreHeader\r
+  )\r
 \r
---*/\r
 {\r
   //\r
   // The end of variable store\r
@@ -132,26 +107,22 @@ Returns:
   return (VARIABLE_HEADER *) HEADER_ALIGN ((UINTN) VarStoreHeader + VarStoreHeader->Size);\r
 }\r
 \r
+/**\r
+\r
+  This code checks if variable header is valid or not.\r
+\r
+  @param Variable              Pointer to the Variable Header.\r
+\r
+  @retval TRUE            Variable header is valid.\r
+  @retval FALSE           Variable header is not valid.\r
+\r
+**/\r
 STATIC\r
 BOOLEAN\r
 EFIAPI\r
 IsValidVariableHeader (\r
   IN  VARIABLE_HEADER   *Variable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This code checks if variable header is valid or not.\r
-\r
-Arguments:\r
-  Variable              Pointer to the Variable Header.\r
-\r
-Returns:\r
-  TRUE            Variable header is valid.\r
-  FALSE           Variable header is not valid.\r
-\r
---*/\r
 {\r
   if (Variable == NULL || Variable->StartId != VARIABLE_DATA ) {\r
     return FALSE;\r
@@ -160,26 +131,18 @@ Returns:
   return TRUE;\r
 }\r
 \r
+/**\r
+  This code gets the size of name of variable.\r
+\r
+  @param Variable            Pointer to the Variable Header.\r
 \r
+  @Return UINTN               Size of variable in bytes\r
+\r
+**/\r
 UINTN\r
 NameSizeOfVariable (\r
   IN  VARIABLE_HEADER   *Variable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This code gets the size of name of variable.\r
-\r
-Arguments:\r
-\r
-  Variable            Pointer to the Variable Header.\r
-\r
-Returns:\r
-\r
-  UINTN               Size of variable in bytes\r
-\r
---*/\r
 {\r
   if (Variable->State    == (UINT8) (-1) ||\r
       Variable->DataSize == (UINT32) -1 ||\r
@@ -190,25 +153,18 @@ Returns:
   return (UINTN) Variable->NameSize;\r
 }\r
 \r
-UINTN\r
-DataSizeOfVariable (\r
-  IN  VARIABLE_HEADER   *Variable\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   This code gets the size of name of variable.\r
 \r
-Arguments:\r
-\r
-  Variable            Pointer to the Variable Header.\r
+  @param Variable            Pointer to the Variable Header.\r
 \r
-Returns:\r
+  @Return  UINTN               Size of variable in bytes\r
 \r
-  UINTN               Size of variable in bytes\r
-\r
---*/\r
+**/\r
+UINTN\r
+DataSizeOfVariable (\r
+  IN  VARIABLE_HEADER   *Variable\r
+  )\r
 {\r
   if (Variable->State    == (UINT8)  -1 ||\r
       Variable->DataSize == (UINT32) -1 ||\r
@@ -219,50 +175,36 @@ Returns:
   return (UINTN) Variable->DataSize;\r
 }\r
 \r
-CHAR16 *\r
-GetVariableNamePtr (\r
-  IN  VARIABLE_HEADER   *Variable\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   This code gets the pointer to the variable name.\r
 \r
-Arguments:\r
+  @param Variable            Pointer to the Variable Header.\r
 \r
-  Variable            Pointer to the Variable Header.\r
+  @Return CHAR16*              Pointer to Variable Name\r
 \r
-Returns:\r
-\r
-  CHAR16*              Pointer to Variable Name\r
+**/\r
+CHAR16 *\r
+GetVariableNamePtr (\r
+  IN  VARIABLE_HEADER   *Variable\r
+  )\r
 \r
---*/\r
 {\r
 \r
   return (CHAR16 *) (Variable + 1);\r
 }\r
 \r
+/**\r
+  This code gets the pointer to the variable data.\r
+\r
+  @param Variable            Pointer to the Variable Header.\r
+\r
+  @Return  UINT8*              Pointer to Variable Data\r
 \r
+**/\r
 UINT8 *\r
 GetVariableDataPtr (\r
   IN  VARIABLE_HEADER   *Variable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This code gets the pointer to the variable data.\r
-\r
-Arguments:\r
-\r
-  Variable            Pointer to the Variable Header.\r
-\r
-Returns:\r
-\r
-  UINT8*              Pointer to Variable Data\r
-\r
---*/\r
 {\r
   UINTN Value;\r
   \r
@@ -276,25 +218,19 @@ Returns:
   return (UINT8 *) Value;\r
 }\r
 \r
-VARIABLE_HEADER *\r
-GetNextVariablePtr (\r
-  IN  VARIABLE_HEADER   *Variable\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   This code gets the pointer to the next variable header.\r
 \r
-Arguments:\r
+  @param Variable              Pointer to the Variable Header.\r
 \r
-  Variable              Pointer to the Variable Header.\r
+  @Return VARIABLE_HEADER*      Pointer to next variable header.\r
 \r
-Returns:\r
-\r
-  VARIABLE_HEADER*      Pointer to next variable header.\r
+**/\r
+VARIABLE_HEADER *\r
+GetNextVariablePtr (\r
+  IN  VARIABLE_HEADER   *Variable\r
+  )\r
 \r
---*/\r
 {\r
   UINTN Value;\r
 \r
@@ -312,30 +248,23 @@ Returns:
   return (VARIABLE_HEADER *) HEADER_ALIGN (Value);\r
 }\r
 \r
+/**\r
+  This code gets the pointer to the variable name.\r
+\r
+  @param VarStoreHeader  Pointer to the Variable Store Header.\r
 \r
+  @retval EfiRaw        Variable store is raw\r
+  @retval EfiValid      Variable store is valid\r
+  @retval EfiInvalid    Variable store is invalid\r
+\r
+**/\r
 STATIC\r
 VARIABLE_STORE_STATUS\r
 EFIAPI\r
 GetVariableStoreStatus (\r
   IN VARIABLE_STORE_HEADER *VarStoreHeader\r
   )\r
-/*++\r
-\r
-Routine Description:\r
 \r
-  This code gets the pointer to the variable name.\r
-\r
-Arguments:\r
-\r
-  VarStoreHeader  Pointer to the Variable Store Header.\r
-\r
-Returns:\r
-\r
-  EfiRaw        Variable store is raw\r
-  EfiValid      Variable store is valid\r
-  EfiInvalid    Variable store is invalid\r
-\r
---*/\r
 {\r
   if (VarStoreHeader->Signature == VARIABLE_STORE_SIGNATURE &&\r
       VarStoreHeader->Format == VARIABLE_STORE_FORMATTED &&\r
@@ -357,6 +286,19 @@ Returns:
   }\r
 }\r
 \r
+/**\r
+  This function compares a variable with variable entries in database\r
+\r
+  @param Variable       - Pointer to the variable in our database\r
+  @param VariableName   - Name of the variable to compare to 'Variable'\r
+  @param VendorGuid     - GUID of the variable to compare to 'Variable'\r
+  @param PtrTrack       - Variable Track Pointer structure that contains\r
+                   Variable Information.\r
+\r
+  @Retval  EFI_SUCCESS    - Found match variable\r
+  @retval EFI_NOT_FOUND  - Variable not found\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 CompareWithValidVariable (\r
@@ -365,26 +307,7 @@ CompareWithValidVariable (
   IN  CONST EFI_GUID                *VendorGuid,\r
   OUT VARIABLE_POINTER_TRACK        *PtrTrack\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This function compares a variable with variable entries in database\r
-\r
-Arguments:\r
 \r
-  Variable       - Pointer to the variable in our database\r
-  VariableName   - Name of the variable to compare to 'Variable'\r
-  VendorGuid     - GUID of the variable to compare to 'Variable'\r
-  PtrTrack       - Variable Track Pointer structure that contains\r
-                   Variable Information.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS    - Found match variable\r
-  EFI_NOT_FOUND  - Variable not found\r
-\r
---*/\r
 {\r
   VOID  *Point;\r
 \r
@@ -414,6 +337,20 @@ Returns:
   return EFI_NOT_FOUND;\r
 }\r
 \r
+/**\r
+  This code finds variable in storage blocks (Non-Volatile)\r
+\r
+  @param PeiServices    - General purpose services available to every PEIM.\r
+  @param VariableName   - Name of the variable to be found\r
+  @param VendorGuid     - Vendor GUID to be found.\r
+  @param PtrTrack       - Variable Track Pointer structure that contains\r
+                   Variable Information.\r
+\r
+  @retval EFI_SUCCESS      - Variable found successfully\r
+  @retval EFI_NOT_FOUND    - Variable not found\r
+  @retval EFI_INVALID_PARAMETER  - Invalid variable name\r
+\r
+**/\r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
@@ -423,27 +360,7 @@ FindVariable (
   IN CONST  EFI_GUID          *VendorGuid,\r
   OUT VARIABLE_POINTER_TRACK  *PtrTrack\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This code finds variable in storage blocks (Non-Volatile)\r
-\r
-Arguments:\r
-\r
-  PeiServices    - General purpose services available to every PEIM.\r
-  VariableName   - Name of the variable to be found\r
-  VendorGuid     - Vendor GUID to be found.\r
-  PtrTrack       - Variable Track Pointer structure that contains\r
-                   Variable Information.\r
-\r
-Returns:\r
 \r
-  EFI_SUCCESS      - Variable found successfully\r
-  EFI_NOT_FOUND    - Variable not found\r
-  EFI_INVALID_PARAMETER  - Invalid variable name\r
-\r
---*/\r
 {\r
   EFI_HOB_GUID_TYPE       *GuidHob;\r
   VARIABLE_STORE_HEADER   *VariableStoreHeader;\r
@@ -554,45 +471,39 @@ Returns:
   return EFI_NOT_FOUND;\r
 }\r
 \r
-EFI_STATUS\r
-EFIAPI\r
-PeiGetVariable (\r
-  IN EFI_PEI_SERVICES             **PeiServices,\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
-\r
-Routine Description:\r
-\r
+/**\r
   Provide the read variable functionality of the variable services.\r
 \r
-Arguments:\r
-\r
-  PeiServices - General purpose services available to every PEIM.\r
+  @param PeiServices - General purpose services available to every PEIM.\r
 \r
-  VariableName     - The variable name\r
+  @param VariableName     - The variable name\r
 \r
-  VendorGuid       - The vendor's GUID\r
+  @param VendorGuid       - The vendor's GUID\r
 \r
-  Attributes       - Pointer to the attribute\r
+  @param Attributes       - Pointer to the attribute\r
 \r
-  DataSize         - Size of data\r
+  @param DataSize         - Size of data\r
 \r
-  Data             - Pointer to data\r
+  @param Data             - Pointer to data\r
 \r
-Returns:\r
+  @retval EFI_SUCCESS           - The interface could be successfully installed\r
 \r
-  EFI_SUCCESS           - The interface could be successfully installed\r
+  @retval EFI_NOT_FOUND         - The variable could not be discovered\r
 \r
-  EFI_NOT_FOUND         - The variable could not be discovered\r
+  @retval EFI_BUFFER_TOO_SMALL  - The caller buffer is not large enough\r
 \r
-  EFI_BUFFER_TOO_SMALL  - The caller buffer is not large enough\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiGetVariable (\r
+  IN EFI_PEI_SERVICES             **PeiServices,\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
---*/\r
 {\r
   VARIABLE_POINTER_TRACK  Variable;\r
   UINTN                   VarDataSize;\r
@@ -635,46 +546,39 @@ Returns:
   }\r
 }\r
 \r
-\r
-EFI_STATUS\r
-EFIAPI\r
-PeiGetVariable2 (\r
-  IN CONST  EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
-  IN CONST  CHAR16                          *VariableName,\r
-  IN CONST  EFI_GUID                        *VariableGuid,\r
-  OUT       UINT32                          *Attributes,\r
-  IN OUT    UINTN                           *DataSize,\r
-  OUT       VOID                            *Data\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   Provide the read variable functionality of the variable services.\r
 \r
-Arguments:\r
-\r
-  PeiServices - General purpose services available to every PEIM.\r
+  @param PeiServices - General purpose services available to every PEIM.\r
 \r
-  VariableName     - The variable name\r
+  @param VariableName     - The variable name\r
 \r
-  VendorGuid       - The vendor's GUID\r
+  @param VendorGuid       - The vendor's GUID\r
 \r
-  Attributes       - Pointer to the attribute\r
+  @param Attributes       - Pointer to the attribute\r
 \r
-  DataSize         - Size of data\r
+  @param DataSize         - Size of data\r
 \r
-  Data             - Pointer to data\r
+  @param Data             - Pointer to data\r
 \r
-Returns:\r
+  @retval EFI_SUCCESS           - The interface could be successfully installed\r
 \r
-  EFI_SUCCESS           - The interface could be successfully installed\r
+  @retval EFI_NOT_FOUND         - The variable could not be discovered\r
 \r
-  EFI_NOT_FOUND         - The variable could not be discovered\r
+  @retval EFI_BUFFER_TOO_SMALL  - The caller buffer is not large enough\r
 \r
-  EFI_BUFFER_TOO_SMALL  - The caller buffer is not large enough\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiGetVariable2 (\r
+  IN CONST  EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
+  IN CONST  CHAR16                          *VariableName,\r
+  IN CONST  EFI_GUID                        *VariableGuid,\r
+  OUT       UINT32                          *Attributes,\r
+  IN OUT    UINTN                           *DataSize,\r
+  OUT       VOID                            *Data\r
+  )\r
 \r
---*/\r
 {\r
   return PeiGetVariable (\r
            GetPeiServicesTablePointer (),\r
@@ -686,40 +590,34 @@ Returns:
            );\r
 }\r
 \r
-EFI_STATUS\r
-EFIAPI\r
-PeiGetNextVariableName (\r
-  IN EFI_PEI_SERVICES             **PeiServices,\r
-  IN OUT UINTN                    *VariableNameSize,\r
-  IN OUT CHAR16                   *VariableName,\r
-  IN OUT EFI_GUID                 *VendorGuid\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   Provide the get next variable functionality of the variable services.\r
 \r
-Arguments:\r
+  @param PeiServices        - General purpose services available to every PEIM.\r
+  @param VariabvleNameSize  - The variable name's size.\r
+  @param VariableName       - A pointer to the variable's name.\r
+  @param VendorGuid         - A pointer to the EFI_GUID structure.\r
 \r
-  PeiServices        - General purpose services available to every PEIM.\r
-  VariabvleNameSize  - The variable name's size.\r
-  VariableName       - A pointer to the variable's name.\r
-  VendorGuid         - A pointer to the EFI_GUID structure.\r
+  @param VariableNameSize - Size of the variable name\r
 \r
-  VariableNameSize - Size of the variable name\r
+  @param VariableName     - The variable name\r
 \r
-  VariableName     - The variable name\r
+  @param VendorGuid       - The vendor's GUID\r
 \r
-  VendorGuid       - The vendor's GUID\r
+  @retval EFI_SUCCESS - The interface could be successfully installed\r
 \r
-Returns:\r
+  @retval EFI_NOT_FOUND - The variable could not be discovered\r
 \r
-  EFI_SUCCESS - The interface could be successfully installed\r
-\r
-  EFI_NOT_FOUND - The variable could not be discovered\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiGetNextVariableName (\r
+  IN EFI_PEI_SERVICES             **PeiServices,\r
+  IN OUT UINTN                    *VariableNameSize,\r
+  IN OUT CHAR16                   *VariableName,\r
+  IN OUT EFI_GUID                 *VendorGuid\r
+  )\r
 \r
---*/\r
 {\r
   VARIABLE_POINTER_TRACK  Variable;\r
   UINTN                   VarNameSize;\r
@@ -774,40 +672,35 @@ Returns:
   return EFI_NOT_FOUND;\r
 }\r
 \r
-EFI_STATUS\r
-EFIAPI\r
-PeiGetNextVariableName2 (\r
-  IN CONST  EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
-  IN OUT UINTN                              *VariableNameSize,\r
-  IN OUT CHAR16                             *VariableName,\r
-  IN OUT EFI_GUID                           *VariableGuid\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   Provide the get next variable functionality of the variable services.\r
 \r
-Arguments:\r
+  @param PeiServices        - General purpose services available to every PEIM.\r
+  @param VariabvleNameSize  - The variable name's size.\r
+  @param VariableName       - A pointer to the variable's name.\r
+  @param VariableGuid       - A pointer to the EFI_GUID structure.\r
 \r
-  PeiServices        - General purpose services available to every PEIM.\r
-  VariabvleNameSize  - The variable name's size.\r
-  VariableName       - A pointer to the variable's name.\r
-  VariableGuid       - A pointer to the EFI_GUID structure.\r
+  @param VariableNameSize - Size of the variable name\r
 \r
-  VariableNameSize - Size of the variable name\r
+  @param VariableName     - The variable name\r
 \r
-  VariableName     - The variable name\r
+  @param VendorGuid       - The vendor's GUID\r
 \r
-  VendorGuid       - The vendor's GUID\r
 \r
-Returns:\r
+  @retval EFI_SUCCESS - The interface could be successfully installed\r
 \r
-  EFI_SUCCESS - The interface could be successfully installed\r
+  @retval EFI_NOT_FOUND - The variable could not be discovered\r
 \r
-  EFI_NOT_FOUND - The variable could not be discovered\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiGetNextVariableName2 (\r
+  IN CONST  EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
+  IN OUT UINTN                              *VariableNameSize,\r
+  IN OUT CHAR16                             *VariableName,\r
+  IN OUT EFI_GUID                           *VariableGuid\r
+  )\r
 \r
---*/\r
 {\r
   return PeiGetNextVariableName (\r
            GetPeiServicesTablePointer (),\r
@@ -816,3 +709,4 @@ Returns:
            VariableGuid\r
            );\r
 }\r
+\r