]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Variable/Pei/Variable.h
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / Pei / Variable.h
index 73e1b7afdb4fc00c36a8f3338047f6663f17b473..963a50b961175cabd03b0726e7daa74e7e93ba5d 100644 (file)
@@ -1,7 +1,10 @@
-/*++\r
+/** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+  The internal header file includes the common header files, defines\r
+  internal structure and functions used by PeiVariable module.\r
+\r
+Copyright (c) 2006 - 2008, 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
@@ -9,60 +12,23 @@ http://opensource.org/licenses/bsd-license.php
 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
-Module Name:\r
-\r
-  Variable.h\r
-\r
-Abstract:\r
-\r
-  Tiano PEIM to provide the variable functionality\r
-\r
---*/\r
+**/\r
 \r
-#ifndef _PEI_VARIABLE_H\r
-#define _PEI_VARIABLE_H\r
+#ifndef _PEI_VARIABLE_H_\r
+#define _PEI_VARIABLE_H_\r
 \r
 #include <PiPei.h>\r
 #include <Ppi/ReadOnlyVariable2.h>\r
+\r
 #include <Library/DebugLib.h>\r
 #include <Library/PeimEntryPoint.h>\r
 #include <Library/HobLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/PeiServicesTablePointerLib.h>\r
-#include <VariableFormat.h>\r
-\r
-//\r
-// Define GET_PAD_SIZE to optimize compiler\r
-//\r
-#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))\r
-#define GET_PAD_SIZE(a) (0)\r
-#else\r
-#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))\r
-#endif\r
-\r
-#define HEADER_ALIGN(Header)  (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))\r
-\r
-#define NAMESIZE_OF_VARIABLE(Variable)  \\r
-          ((((Variable)->DataSize == (UINT32) -1) || \\r
-          ((Variable)->Attributes == (UINT32) -1) || \\r
-          ((Variable)->NameSize == (UINT32) -1)) ? \\r
-          0 : \\r
-          (Variable)->NameSize \\r
-          )\r
-\r
-#define DATASIZE_OF_VARIABLE(Variable)  \\r
-          ((((Variable)->DataSize == (UINT32) -1) || \\r
-          ((Variable)->Attributes == (UINT32) -1) || \\r
-          ((Variable)->NameSize == (UINT32) -1)) ? \\r
-          0 : \\r
-          (Variable)->DataSize \\r
-          )\r
+#include <Library/PeiServicesLib.h>\r
 \r
-#define GET_VARIABLE_NAME_PTR(a)  (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r
-\r
-#define GET_VARIABLE_DATA_PTR(a) \\r
-          (UINT8 *) ((UINTN) GET_VARIABLE_NAME_PTR (a) + NAMESIZE_OF_VARIABLE(a) + GET_PAD_SIZE (NAMESIZE_OF_VARIABLE(a)))\r
+#include <Guid/VariableFormat.h>\r
 \r
 typedef struct {\r
   VARIABLE_HEADER *CurrPtr;\r
@@ -75,11 +41,18 @@ typedef struct {
 #define EFI_VARIABLE_INDEX_TABLE_GUID \\r
   { 0x8cfdb8c8, 0xd6b2, 0x40f3, { 0x8e, 0x97, 0x02, 0x30, 0x7c, 0xc9, 0x8b, 0x7c } }\r
 \r
+///\r
+/// Use this data structure to store variable-related info, which can decrease\r
+/// the cost of access to NV.\r
+///\r
 typedef struct {\r
   UINT16          Length;\r
   UINT16          GoneThrough;\r
   VARIABLE_HEADER *EndPtr;\r
   VARIABLE_HEADER *StartPtr;\r
+  ///\r
+  /// This field is used to store the distance of two neighbouring VAR_ADDED type variables.\r
+  /// The meaning of the field is implement-dependent.\r
   UINT16          Index[VARIABLE_INDEX_TABLE_VOLUME];\r
 } VARIABLE_INDEX_TABLE;\r
 \r
@@ -87,30 +60,50 @@ typedef struct {
 //\r
 // Functions\r
 //\r
+/**\r
+  Provide the functionality of the variable services.\r
+  \r
+  @param  FileHandle  Handle of the file being invoked. \r
+                      Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile().\r
+  @param  PeiServices  General purpose services available to every PEIM.\r
+\r
+  @retval EFI_SUCCESS  If the interface could be successfully installed\r
+  @retval Others       Returned from PeiServicesInstallPpi()\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
-  TODO: Add function description\r
-\r
-Arguments:\r
-\r
-  FfsHeader   - TODO: add argument description\r
-  PeiServices - TODO: add argument description\r
-\r
-Returns:\r
-\r
-  TODO: add return values\r
+  IN       EFI_PEI_FILE_HANDLE       FileHandle,\r
+  IN CONST EFI_PEI_SERVICES          **PeiServices\r
+  );\r
 \r
---*/\r
-;\r
+/**\r
+  This service retrieves a variable's value using its name and GUID.\r
+\r
+  Read the specified variable from the UEFI variable store. If the Data \r
+  buffer is too small to hold the contents of the variable, the error\r
+  EFI_BUFFER_TOO_SMALL is returned and DataSize is set to the required buffer\r
+  size to obtain the data.\r
+\r
+  @param  This                  A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.\r
+  @param  VariableName          A pointer to a null-terminated string that is the variable's name.\r
+  @param  VariableGuid          A pointer to an EFI_GUID that is the variable's GUID. The combination of\r
+                                VariableGuid and VariableName must be unique.\r
+  @param  Attributes            If non-NULL, on return, points to the variable's attributes.\r
+  @param  DataSize              On entry, points to the size in bytes of the Data buffer.\r
+                                On return, points to the size of the data returned in Data.\r
+  @param  Data                  Points to the buffer which will hold the returned variable value.\r
+\r
+  @retval EFI_SUCCESS           The variable was read successfully.\r
+  @retval EFI_NOT_FOUND         The variable could not be found.\r
+  @retval EFI_BUFFER_TOO_SMALL  The DataSize is too small for the resulting data. \r
+                                DataSize is updated with the size required for \r
+                                the specified variable.\r
+  @retval EFI_INVALID_PARAMETER VariableName, VariableGuid, DataSize or Data is NULL.\r
+  @retval EFI_DEVICE_ERROR      The variable could not be retrieved because of a device error.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiGetVariable (\r
@@ -120,29 +113,37 @@ PeiGetVariable (
   OUT       UINT32                          *Attributes,\r
   IN OUT    UINTN                           *DataSize,\r
   OUT       VOID                            *Data\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+  );\r
 \r
-  TODO: Add function description\r
+/**\r
+  Return the next variable name and GUID.\r
 \r
-Arguments:\r
+  This function is called multiple times to retrieve the VariableName \r
+  and VariableGuid of all variables currently available in the system. \r
+  On each call, the previous results are passed into the interface, \r
+  and, on return, the interface returns the data for the next \r
+  interface. When the entire variable list has been returned, \r
+  EFI_NOT_FOUND is returned.\r
 \r
-  PeiServices   - TODO: add argument description\r
-  VariableName  - TODO: add argument description\r
-  VendorGuid    - TODO: add argument description\r
-  Attributes    - TODO: add argument description\r
-  DataSize      - TODO: add argument description\r
-  Data          - TODO: add argument description\r
+  @param  This              A pointer to this instance of the EFI_PEI_READ_ONLY_VARIABLE2_PPI.\r
 \r
-Returns:\r
+  @param  VariableNameSize  On entry, points to the size of the buffer pointed to by VariableName.\r
+  @param  VariableName      On entry, a pointer to a null-terminated string that is the variable's name.\r
+                            On return, points to the next variable's null-terminated name string.\r
 \r
-  TODO: add return values\r
+  @param  VariableGuid      On entry, a pointer to an UEFI _GUID that is the variable's GUID. \r
+                            On return, a pointer to the next variable's GUID.\r
 \r
---*/\r
-;\r
+  @retval EFI_SUCCESS           The variable was read successfully.\r
+  @retval EFI_NOT_FOUND         The variable could not be found.\r
+  @retval EFI_BUFFER_TOO_SMALL  The VariableNameSize is too small for the resulting\r
+                                data. VariableNameSize is updated with the size\r
+                                required for the specified variable.\r
+  @retval EFI_INVALID_PARAMETER VariableName, VariableGuid or\r
+                                VariableNameSize is NULL.\r
+  @retval EFI_DEVICE_ERROR      The variable could not be retrieved because of a device error.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PeiGetNextVariableName (\r
@@ -150,57 +151,6 @@ PeiGetNextVariableName (
   IN OUT UINTN                              *VariableNameSize,\r
   IN OUT CHAR16                             *VariableName,\r
   IN OUT EFI_GUID                           *VariableGuid\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  TODO: Add function description\r
-\r
-Arguments:\r
-\r
-  PeiServices       - TODO: add argument description\r
-  VariableNameSize  - TODO: add argument description\r
-  VariableName      - TODO: add argument description\r
-  VendorGuid        - TODO: add argument description\r
-\r
-Returns:\r
-\r
-  TODO: add return values\r
-\r
---*/\r
-;\r
-\r
-/**\r
-  Get one variable by the index count.\r
-\r
-  @param  IndexTable  The pointer to variable index table.\r
-  @param  Count       The index count of variable in index table.\r
-\r
-  @return The pointer to variable header indexed by count.\r
-\r
-**/\r
-VARIABLE_HEADER *\r
-GetVariableByIndex (\r
-  IN VARIABLE_INDEX_TABLE        *IndexTable,\r
-  IN UINT32                      Count\r
   );\r
 \r
-/**\r
-  Record Variable in VariableIndex HOB.\r
-\r
-  Record Variable in VariableIndex HOB and update the length of variable index table.\r
-\r
-  @param  IndexTable  The pointer to variable index table.\r
-  @param  Variable    The pointer to the variable that will be recorded.\r
-\r
-  @retval VOID\r
-\r
-**/\r
-VOID\r
-VariableIndexTableUpdate (\r
-  IN OUT  VARIABLE_INDEX_TABLE   *IndexTable,\r
-  IN      VARIABLE_HEADER        *Variable\r
-  );\r
-\r
-#endif // _PEI_VARIABLE_H\r
+#endif\r