/** @file\r
-\r
+ Variable/Map manipulations routines\r
+ \r
Copyright (c) 2006, 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
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
- IfrVariable.c\r
-\r
-Abstract:\r
- Variable/Map manipulations routines\r
-\r
**/\r
\r
//\r
//\r
#include "IfrSupportLibInternal.h"\r
\r
+/**\r
+ Extracts a variable form a Pack.\r
+\r
+ @param Pack - List of variables\r
+ @param Name - Name of the variable/map\r
+ @param Guid - GUID of the variable/map\r
+ @param Var - Pointer to the variable/map\r
+ @param Size - Size of the variable/map in bytes\r
+**/\r
VOID\r
EfiLibHiiVariablePackGetMap (\r
IN EFI_HII_VARIABLE_PACK *Pack, \r
OUT VOID **Var, OPTIONAL\r
OUT UINTN *Size OPTIONAL\r
)\r
-/*++\r
\r
-Routine Description:\r
-\r
- Extracts a variable form a Pack.\r
-\r
-Arguments:\r
-\r
- Pack - List of variables\r
- Name - Name of the variable/map\r
- Guid - GUID of the variable/map\r
- Var - Pointer to the variable/map\r
- Size - Size of the variable/map in bytes\r
-\r
-Returns: \r
-\r
- VOID\r
- \r
---*/\r
{\r
if (NULL != Name) {\r
*Name = (VOID *) (Pack + 1);\r
}\r
}\r
\r
+/**\r
+ Finds a count of the variables/maps in the List.\r
+\r
+ @param List - List of variables\r
\r
+ @return The number of map count.\r
+**/\r
UINTN\r
EfiLibHiiVariablePackListGetMapCnt (\r
IN EFI_HII_VARIABLE_PACK_LIST *List\r
)\r
- \r
-/*++\r
-\r
-Routine Description:\r
-\r
- Finds a count of the variables/maps in the List.\r
-\r
-Arguments:\r
-\r
- List - List of variables\r
-\r
-Returns: \r
-\r
- UINTN - The number of map count.\r
-\r
---*/\r
-\r
{\r
UINTN Cnt = 0;\r
while (NULL != List) {\r
return Cnt;\r
}\r
\r
+/**\r
+ Will iterate all variable/maps as appearing \r
+ in List and for each, it will call the Callback.\r
+\r
+ @param List - List of variables\r
+ @param Callback - Routine to be called for each iterated variable.\r
\r
+**/\r
VOID\r
EfiLibHiiVariablePackListForEachVar (\r
IN EFI_HII_VARIABLE_PACK_LIST *List,\r
IN EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK *Callback\r
)\r
-/*++\r
-\r
-Routine Description:\r
\r
- Will iterate all variable/maps as appearing \r
- in List and for each, it will call the Callback.\r
-\r
-Arguments:\r
-\r
- List - List of variables\r
- Callback - Routine to be called for each iterated variable.\r
-\r
-Returns: \r
-\r
- VOID\r
- \r
---*/\r
\r
{\r
CHAR16 *MapName;\r
}\r
}\r
\r
+/**\r
+ Finds a variable form List given \r
+ the order number as appears in the List.\r
+\r
+ @param Idx - The index of the variable/map to retrieve\r
+ @param List - List of variables\r
+ @param Name - Name of the variable/map\r
+ @param Guid - GUID of the variable/map\r
+ @param Var - Pointer to the variable/map\r
+ @param Size - Size of the variable/map in bytes\r
\r
+ @param EFI_SUCCESS - Variable is found, OUT parameters are valid\r
+ @param EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid\r
+**/\r
EFI_STATUS\r
EfiLibHiiVariablePackListGetMapByIdx (\r
IN UINTN Idx, \r
OUT UINTN *Size\r
)\r
\r
-/*++\r
\r
-Routine Description:\r
-\r
- Finds a variable form List given \r
- the order number as appears in the List.\r
-\r
-Arguments:\r
-\r
- Idx - The index of the variable/map to retrieve\r
- List - List of variables\r
- Name - Name of the variable/map\r
- Guid - GUID of the variable/map\r
- Var - Pointer to the variable/map\r
- Size - Size of the variable/map in bytes\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - Variable is found, OUT parameters are valid\r
- EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid\r
-\r
---*/\r
{\r
CHAR16 *MapName;\r
EFI_GUID *MapGuid;\r
return EFI_NOT_FOUND; \r
}\r
\r
+/**\r
+ Finds a variable form List given the \r
+ order number as appears in the List.\r
+\r
+ @param Id - The ID of the variable/map to retrieve\r
+ @param List - List of variables\r
+ @param Name - Name of the variable/map\r
+ @param Guid - GUID of the variable/map\r
+ @param Var - Pointer to the variable/map\r
+ @param Size - Size of the variable/map in bytes\r
\r
+ @retval EFI_SUCCESS - Variable is found, OUT parameters are valid\r
+ @retval EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid\r
+\r
+**/\r
EFI_STATUS\r
EfiLibHiiVariablePackListGetMapById (\r
IN UINT16 Id, \r
OUT VOID **Var,\r
OUT UINTN *Size\r
)\r
- \r
-/*++\r
-\r
-Routine Description:\r
-\r
- Finds a variable form List given the \r
- order number as appears in the List.\r
-\r
-Arguments:\r
-\r
- Id - The ID of the variable/map to retrieve\r
- List - List of variables\r
- Name - Name of the variable/map\r
- Guid - GUID of the variable/map\r
- Var - Pointer to the variable/map\r
- Size - Size of the variable/map in bytes\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - Variable is found, OUT parameters are valid\r
- EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid\r
-\r
---*/\r
-\r
{ \r
CHAR16 *MapName;\r
EFI_GUID *MapGuid;\r
return EFI_NOT_FOUND; \r
}\r
\r
+/**\r
+ Finds a variable form EFI_HII_VARIABLE_PACK_LIST given name and GUID.\r
\r
+ @param List - List of variables\r
+ @param Name - Name of the variable/map to be found\r
+ @param Guid - GUID of the variable/map to be found\r
+ @param Var - Pointer to the variable/map found\r
+ @param Size - Size of the variable/map in bytes found\r
+\r
+ @retval EFI_SUCCESS - variable is found, OUT parameters are valid\r
+ @retval EFI_NOT_FOUND - variable is not found, OUT parameters are not valid\r
+**/\r
EFI_STATUS\r
EfiLibHiiVariablePackListGetMap (\r
IN EFI_HII_VARIABLE_PACK_LIST *List,\r
OUT VOID **Var, \r
OUT UINTN *Size\r
)\r
-\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Finds a variable form EFI_HII_VARIABLE_PACK_LIST given name and GUID.\r
-\r
-Arguments:\r
-\r
- List - List of variables\r
- Name - Name of the variable/map to be found\r
- Guid - GUID of the variable/map to be found\r
- Var - Pointer to the variable/map found\r
- Size - Size of the variable/map in bytes found\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - variable is found, OUT parameters are valid\r
- EFI_NOT_FOUND - variable is not found, OUT parameters are not valid\r
-\r
---*/\r
-\r
{ \r
VOID *Map;\r
UINTN MapSize;\r
return EFI_NOT_FOUND;\r
}\r
\r
+/**\r
+ Finds out if a variable of specific Name/Guid/Size exists in NV. \r
+ If it does, it will retrieve it into the Var. \r
+\r
+ @param Name Parameters of the variable to retrieve. Must match exactly.\r
+ @param Guid Parameters of the variable to retrieve. Must match exactly.\r
+ @param Size Parameters of the variable to retrieve. Must match exactly.\r
+ @param Var Variable will be retrieved into buffer pointed by this pointer.\r
+ If pointing to NULL, the buffer will be allocated. Caller is responsible for releasing the buffer.\r
+\r
+ @retval EFI_SUCCESS - The variable of exact Name/Guid/Size parameters was retrieved and written to Var.\r
+ @retval EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.\r
+ @retval EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.\r
+\r
+**/\r
EFI_STATUS\r
EfiLibHiiVariableRetrieveFromNv (\r
IN CHAR16 *Name,\r
IN UINTN Size,\r
OUT VOID **Var\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Finds out if a variable of specific Name/Guid/Size exists in NV. \r
- If it does, it will retrieve it into the Var. \r
\r
-Arguments:\r
- Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.\r
- Var - Variable will be retrieved into buffer pointed by this pointer.\r
- If pointing to NULL, the buffer will be allocated. Caller is responsible for releasing the buffer.\r
-Returns:\r
- EFI_SUCCESS - The variable of exact Name/Guid/Size parameters was retrieved and written to Var.\r
- EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.\r
- EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINTN SizeNv;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Overrrides the variable with NV data if found.\r
+ But it only does it if the Name ends with specified Suffix.\r
+ For example, if Suffix="MyOverride" and the Name="XyzSetupMyOverride",\r
+ the Suffix matches the end of Name, so the variable will be loaded from NV\r
+ provided the variable exists and the GUID and Size matches.\r
\r
+ @param Suffix Suffix the Name should end with.\r
+ @param Name, Guid, Size Parameters of the variable to retrieve. Must match exactly.\r
+ @param Var Variable will be retrieved into this buffer.\r
+ Caller is responsible for providing storage of exactly Size size in bytes.\r
\r
+ @retval EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.\r
+ @retval EFI_INVALID_PARAMETER - The name of the variable does not end with <Suffix>.\r
+ @retval EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.\r
+ @retval EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.\r
+**/\r
EFI_STATUS\r
EfiLibHiiVariableOverrideIfSuffix (\r
IN CHAR16 *Suffix,\r
IN UINTN Size,\r
OUT VOID *Var\r
) \r
-/*++\r
-\r
-Routine Description:\r
- Overrrides the variable with NV data if found.\r
- But it only does it if the Name ends with specified Suffix.\r
- For example, if Suffix="MyOverride" and the Name="XyzSetupMyOverride",\r
- the Suffix matches the end of Name, so the variable will be loaded from NV\r
- provided the variable exists and the GUID and Size matches.\r
-\r
-Arguments:\r
- Suffix - Suffix the Name should end with.\r
- Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.\r
- Var - Variable will be retrieved into this buffer.\r
- Caller is responsible for providing storage of exactly Size size in bytes.\r
-Returns:\r
- EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.\r
- EFI_INVALID_PARAMETER - The name of the variable does not end with <Suffix>.\r
- EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.\r
- EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.\r
-\r
---*/\r
{\r
UINTN StrLength;\r
UINTN StrLenSuffix;\r
return EfiLibHiiVariableRetrieveFromNv (Name, Guid, Size, &Var);\r
}\r
\r
-EFI_STATUS\r
-EfiLibHiiVariableOverrideBySuffix (\r
- IN CHAR16 *Suffix,\r
- IN CHAR16 *Name,\r
- IN EFI_GUID *Guid,\r
- IN UINTN Size,\r
- OUT VOID *Var\r
- ) \r
-/*++\r
-\r
-Routine Description:\r
+/**\r
Overrrides the variable with NV data if found.\r
But it only does it if the NV contains the same variable with Name is appended with Suffix. \r
For example, if Suffix="MyOverride" and the Name="XyzSetup",\r
the Suffix will be appended to the end of Name, and the variable with Name="XyzSetupMyOverride"\r
will be loaded from NV provided the variable exists and the GUID and Size matches.\r
\r
-Arguments:\r
- Suffix - Suffix the variable will be appended with.\r
- Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.\r
- Var - Variable will be retrieved into this buffer.\r
- Caller is responsible for providing storage of exactly Size size in bytes.\r
+ @param Suffix Suffix the variable will be appended with.\r
+ @param Name, Guid, Size Parameters of the variable to retrieve. Must match exactly.\r
+ @param Var Variable will be retrieved into this buffer.\r
+ Caller is responsible for providing storage of exactly Size size in bytes.\r
\r
-Returns:\r
- EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.\r
- EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.\r
- EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.\r
+ @retval EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.\r
+ @retval EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.\r
+ @retval EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.\r
\r
--*/\r
+EFI_STATUS\r
+EfiLibHiiVariableOverrideBySuffix (\r
+ IN CHAR16 *Suffix,\r
+ IN CHAR16 *Name,\r
+ IN EFI_GUID *Guid,\r
+ IN UINTN Size,\r
+ OUT VOID *Var\r
+ ) \r
+\r
{\r
EFI_STATUS Status;\r
CHAR16 *NameSuffixed;\r