/** @file\r
+ Common Library Routines to assist in IFR creation on-the-fly\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
- IfrCommon.c\r
-\r
-Abstract:\r
-\r
- Common Library Routines to assist in IFR creation on-the-fly\r
-\r
-Revision History:\r
-\r
**/\r
\r
//\r
//\r
#include "IfrSupportLibInternal.h"\r
\r
-EFI_STATUS\r
-EFIAPI\r
-IfrLibConstruct (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-{\r
- return EFI_SUCCESS;\r
-}\r
-\r
+/**\r
+ Determine what is the current language setting\r
+ The setting is stored in language variable in flash. This routine\r
+ will get setting by accesssing that variable. If failed to access\r
+ language variable, then use default setting that 'eng' as current\r
+ language setting.\r
+ \r
+ @param Lang Pointer of system language\r
+ \r
+ @return whether sucess to get setting from variable\r
+**/\r
EFI_STATUS\r
GetCurrentLanguage (\r
OUT CHAR16 *Lang\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Determine what is the current language setting\r
-\r
-Arguments:\r
-\r
- Lang - Pointer of system language\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINTN Size;\r
return Status;\r
}\r
\r
-\r
+/**\r
+ Add a string to the incoming buffer and return the token and offset data\r
+ \r
+ @param StringBuffer The incoming buffer\r
+ @param Language Currrent language\r
+ @param String The string to be added\r
+ @param StringToken The index where the string placed \r
+ \r
+ @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
+ @retval EFI_SUCCESS String successfully added to the incoming buffer\r
+**/\r
EFI_STATUS\r
AddString (\r
IN VOID *StringBuffer,\r
IN CHAR16 *String,\r
IN OUT STRING_REF *StringToken\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Add a string to the incoming buffer and return the token and offset data\r
-\r
-Arguments:\r
-\r
- StringBuffer - The incoming buffer\r
-\r
- Language - Currrent language\r
-\r
- String - The string to be added\r
-\r
- StringToken - The index where the string placed\r
-\r
-Returns:\r
-\r
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
-\r
- EFI_SUCCESS - String successfully added to the incoming buffer\r
-\r
---*/\r
{\r
EFI_HII_STRING_PACK *StringPack;\r
EFI_HII_STRING_PACK *StringPackBuffer;\r
return EFI_SUCCESS;\r
}\r
\r
-\r
+/**\r
+ Add op-code data to the FormBuffer\r
+ \r
+ @param FormBuffer Form buffer to be inserted to\r
+ @param OpCodeData Op-code data to be inserted \r
+ \r
+ @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
+ @retval EFI_SUCCESS Op-code data successfully inserted \r
+**/\r
EFI_STATUS\r
AddOpCode (\r
IN VOID *FormBuffer,\r
IN OUT VOID *OpCodeData\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Add op-code data to the FormBuffer\r
-\r
-Arguments:\r
-\r
- FormBuffer - Form buffer to be inserted to\r
-\r
- OpCodeData - Op-code data to be inserted\r
-\r
-Returns:\r
-\r
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
-\r
- EFI_SUCCESS - Op-code data successfully inserted\r
-\r
---*/\r
{\r
EFI_HII_PACK_HEADER *NewBuffer;\r
UINT8 *Source;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Get the HII protocol interface\r
+ \r
+ @param Hii HII protocol interface\r
+ \r
+ @return the statue of locating HII protocol\r
+**/\r
STATIC\r
EFI_STATUS\r
GetHiiInterface (\r
OUT EFI_HII_PROTOCOL **Hii\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Get the HII protocol interface\r
-\r
-Arguments:\r
-\r
- Hii - HII protocol interface\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
\r
return Status;;\r
}\r
\r
-\r
+/**\r
+ Extract information pertaining to the HiiHandle\r
+ \r
+ @param HiiHandle Hii handle\r
+ @param ImageLength For input, length of DefaultImage;\r
+ For output, length of actually required\r
+ @param DefaultImage Image buffer prepared by caller\r
+ @param Guid Guid information about the form \r
+ \r
+ @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
+ @retval EFI_BUFFER_TOO_SMALL DefualtImage has no enough ImageLength\r
+ @retval EFI_SUCCESS Successfully extract data from Hii database.\r
+**/\r
EFI_STATUS\r
ExtractDataFromHiiHandle (\r
IN FRAMEWORK_EFI_HII_HANDLE HiiHandle,\r
OUT UINT8 *DefaultImage,\r
OUT EFI_GUID *Guid\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Extract information pertaining to the HiiHandle\r
-\r
-Arguments:\r
-\r
- HiiHandle - Hii handle\r
-\r
- ImageLength - For input, length of DefaultImage;\r
- For output, length of actually required\r
-\r
- DefaultImage - Image buffer prepared by caller\r
-\r
- Guid - Guid information about the form\r
-\r
-Returns:\r
-\r
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
-\r
- EFI_BUFFER_TOO_SMALL - DefualtImage has no enough ImageLength\r
-\r
- EFI_SUCCESS - Successfully extract data from Hii database.\r
-\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
EFI_HII_PROTOCOL *Hii;\r
return EFI_SUCCESS;\r
}\r
\r
-\r
+/**\r
+ Finds HII handle for given pack GUID previously registered with the HII.\r
+ \r
+ @param HiiProtocol pointer to pointer to HII protocol interface.\r
+ If NULL, the interface will be found but not returned.\r
+ If it points to NULL, the interface will be found and\r
+ written back to the pointer that is pointed to.\r
+ @param Guid The GUID of the pack that registered with the HII.\r
+\r
+ @return Handle to the HII pack previously registered by the memory driver.\r
+**/\r
FRAMEWORK_EFI_HII_HANDLE \r
FindHiiHandle (\r
IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL\r
IN EFI_GUID *Guid\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Finds HII handle for given pack GUID previously registered with the HII.\r
-\r
-Arguments:\r
- HiiProtocol - pointer to pointer to HII protocol interface.\r
- If NULL, the interface will be found but not returned.\r
- If it points to NULL, the interface will be found and\r
- written back to the pointer that is pointed to.\r
- Guid - The GUID of the pack that registered with the HII.\r
-\r
-Returns:\r
- Handle to the HII pack previously registered by the memory driver.\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
\r
return HiiHandle;\r
}\r
\r
+/**\r
+ Validate that the data associated with the HiiHandle in NVRAM is within\r
+ the reasonable parameters for that FormSet. Values for strings and passwords\r
+ are not verified due to their not having the equivalent of valid range settings.\r
+\r
+ @param HiiHandle Handle of the HII database entry to query\r
\r
+ @param Results If return Status is EFI_SUCCESS, Results provides valid data\r
+ TRUE = NVRAM Data is within parameters\r
+ FALSE = NVRAM Data is NOT within parameters\r
+ @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
+ @retval EFI_SUCCESS Data successfully validated\r
+**/\r
EFI_STATUS\r
ValidateDataFromHiiHandle (\r
IN FRAMEWORK_EFI_HII_HANDLE HiiHandle,\r
OUT BOOLEAN *Results\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Validate that the data associated with the HiiHandle in NVRAM is within\r
- the reasonable parameters for that FormSet. Values for strings and passwords\r
- are not verified due to their not having the equivalent of valid range settings.\r
-\r
-Arguments:\r
-\r
- HiiHandle - Handle of the HII database entry to query\r
-\r
- Results - If return Status is EFI_SUCCESS, Results provides valid data\r
- TRUE = NVRAM Data is within parameters\r
- FALSE = NVRAM Data is NOT within parameters\r
-\r
-Returns:\r
-\r
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate\r
-\r
- EFI_SUCCESS - Data successfully validated\r
---*/\r
{\r
EFI_STATUS Status;\r
EFI_HII_PROTOCOL *Hii;\r