]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Clean up ExtendedHiiLib, HiiLib, IfrSupportLib, ExtendedIfrSupportLib for Doxygen...
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 14 Jul 2008 05:29:49 +0000 (05:29 +0000)
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 14 Jul 2008 05:29:49 +0000 (05:29 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5458 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/Library/HiiLib.h
MdePkg/Include/Library/IfrSupportLib.h
MdePkg/Library/HiiLib/HiiLanguage.c
MdePkg/Library/HiiLib/HiiLib.c
MdePkg/Library/HiiLib/HiiString.c
MdePkg/Library/HiiLib/InternalHiiLib.h
MdePkg/Library/IfrSupportLib/IfrSupportLib.inf
MdePkg/Library/IfrSupportLib/UefiIfrCommon.c
MdePkg/Library/IfrSupportLib/UefiIfrForm.c
MdePkg/Library/IfrSupportLib/UefiIfrLibraryInternal.h
MdePkg/Library/IfrSupportLib/UefiIfrOpCodeCreation.c

index 30c1fe043afc915095409c0a921e3ccd7f506355..ba22b01db7521f568896c17f3677a86f3dec3763 100644 (file)
@@ -178,7 +178,6 @@ HiiLibSetString (
   @retval EFI_INVALID_PARAMETER  The String or StringSize was NULL.\r
 \r
 **/\r
-\r
 EFI_STATUS\r
 EFIAPI\r
 HiiLibGetString (\r
index fbfb676f8972e747bd0ea02f0403120bbbf440ae..f4f7a1907b7c8c81c40e14431b5ea5e3ec306462 100644 (file)
@@ -224,8 +224,8 @@ CreateGotoOpCode (
 /**
   Create EFI_IFR_ONE_OF_OPTION_OP opcode.
 
-  @param  QuestionId             Question ID
-  @param  OptionList             The list of Options.
+  @param  OptionCount            The number of options.
+  @param  OptionsList            The list of Options.
   @param  Type                   The data type.
   @param  Data                   Destination for the created opcode binary
 
@@ -287,7 +287,7 @@ CreateOneOfOpCode (
   @param  Prompt                 String ID for Prompt
   @param  Help                   String ID for Help
   @param  QuestionFlags          Flags in Question Header
-  @param  Flags                  Flags for ordered list opcode
+  @param  OrderedListFlags       Flags for ordered list opcode
   @param  DataType               Type for option value
   @param  MaxContainers          Maximum count for options in this ordered list
   @param  OptionsList            List of options
@@ -308,7 +308,7 @@ CreateOrderedListOpCode (
   IN      EFI_STRING_ID       Prompt,
   IN      EFI_STRING_ID       Help,
   IN      UINT8               QuestionFlags,
-  IN      UINT8               Flags,
+  IN      UINT8               OrderedListFlags,
   IN      UINT8               DataType,
   IN      UINT8               MaxContainers,
   IN      IFR_OPTION          *OptionsList,
index cd2b66063bf6b0f97ebe73816d37dc01f2797eb1..f5c8f032a926bf6ac04eb54d5b538096fd0548b4 100644 (file)
 \r
 #include "InternalHiiLib.h"\r
 \r
+/**\r
+  Determine what is the current language setting. The space reserved for Lang\r
+  must be at least RFC_3066_ENTRY_SIZE bytes;\r
+\r
+  If Lang is NULL, then ASSERT.\r
+\r
+  @param  Lang                   Pointer of system language. Lang will always be filled with \r
+                                         a valid RFC 3066 language string. If "PlatformLang" is not\r
+                                         set in the system, the default language specifed by PcdUefiVariableDefaultPlatformLang\r
+                                         is returned.\r
+\r
+  @return  EFI_SUCCESS     If the EFI Variable with "PlatformLang" is set and return in Lang.\r
+  @return  EFI_NOT_FOUND If the EFI Variable with "PlatformLang" is not set, but a valid default language is return in Lang.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 HiiLibGetCurrentLanguage (\r
@@ -46,6 +61,18 @@ HiiLibGetCurrentLanguage (
 }\r
 \r
 \r
+/**\r
+  Get next language from language code list (with separator ';').\r
+\r
+  If LangCode is NULL, then ASSERT.\r
+  If Lang is NULL, then ASSERT.\r
+\r
+  @param  LangCode    On input: point to first language in the list. On\r
+                                 output: point to next language in the list, or\r
+                                 NULL if no more language in the list.\r
+  @param  Lang           The first language in the list.\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 HiiLibGetNextLanguage (\r
@@ -75,6 +102,18 @@ HiiLibGetNextLanguage (
 }\r
 \r
 \r
+/**\r
+  This function returns the list of supported languages, in the format specified\r
+  in UEFI specification Appendix M.\r
+\r
+  If HiiHandle is not a valid Handle in the default HII database, then ASSERT.\r
+\r
+  @param  HiiHandle              The HII package list handle.\r
+\r
+  @retval   !NULL  The supported languages.\r
+  @retval   NULL    If Supported Languages can not be retrived.\r
+\r
+**/\r
 CHAR8 *\r
 EFIAPI\r
 HiiLibGetSupportedLanguages (\r
@@ -118,6 +157,17 @@ HiiLibGetSupportedLanguages (
 }\r
 \r
 \r
+/**\r
+  This function returns the number of supported languages on HiiHandle.\r
+\r
+  If HiiHandle is not a valid Handle in the default HII database, then ASSERT.\r
+  If not enough resource to complete the operation, then ASSERT.\r
+\r
+  @param  HiiHandle              The HII package list handle.\r
+\r
+  @return The  number of supported languages.\r
+\r
+**/\r
 UINT16\r
 EFIAPI\r
 HiiLibGetSupportedLanguageNumber (\r
@@ -145,6 +195,19 @@ HiiLibGetSupportedLanguageNumber (
   return LangNumber;\r
 }\r
 \r
+/**\r
+  This function returns the list of supported 2nd languages, in the format specified\r
+  in UEFI specification Appendix M.\r
+\r
+  If HiiHandle is not a valid Handle in the default HII database, then ASSERT.\r
+  If not enough resource to complete the operation, then ASSERT.\r
+\r
+  @param  HiiHandle              The HII package list handle.\r
+  @param  FirstLanguage          Pointer to language name buffer.\r
+  \r
+  @return The supported languages.\r
+\r
+**/\r
 CHAR8 *\r
 EFIAPI\r
 HiiLibGetSupportedSecondaryLanguages (\r
index b0c28e2a805daf7ff77cdd88e8cd8ddddca3cb2d..749b004d9f641b7fdcda7dee71d1141401b1f22f 100644 (file)
@@ -23,10 +23,6 @@ BOOLEAN mHiiProtocolsInitialized = FALSE;
 \r
   This function locate Hii relative protocols for later usage.\r
 \r
-  @param VOID\r
-\r
-  @retval  VOID\r
-\r
 **/\r
 VOID\r
 LocateHiiProtocols (\r
@@ -50,10 +46,28 @@ LocateHiiProtocols (
 \r
 \r
 \r
+/**\r
+  This funciton build the package list based on the package number,\r
+  the GUID of the package list and the list of pointer which point to\r
+  package header that defined by UEFI VFR compiler and StringGather\r
+  tool.\r
+\r
+  If there is not enough resource for the new package list,\r
+  the function will ASSERT.\r
+\r
+  @param NumberOfPackages The number of packages be \r
+  @param GuidId          The GUID for the package list to be generated.\r
+  @param Marker          The variable argument list. Each entry represent a specific package header that is\r
+                         generated by VFR compiler and StrGather tool. The first 4 bytes is a UINT32 value\r
+                         that indicate the overall length of the package.\r
+\r
+  @return The pointer to the package list header.\r
+\r
+**/\r
 EFI_HII_PACKAGE_LIST_HEADER *\r
 InternalHiiLibPreparePackages (\r
   IN UINTN           NumberOfPackages,\r
-  IN CONST EFI_GUID  *GuidId, OPTIONAL\r
+  IN CONST EFI_GUID  *GuidId,\r
   VA_LIST            Marker\r
   )\r
 {\r
@@ -106,6 +120,20 @@ InternalHiiLibPreparePackages (
   return PackageListHeader;\r
 }\r
 \r
+/**\r
+  Assemble EFI_HII_PACKAGE_LIST according to the passed in packages.\r
+\r
+  If GuidId is NULL, then ASSERT.\r
+  If not enough resource to complete the operation, then ASSERT.\r
+\r
+  @param  NumberOfPackages       Number of packages.\r
+  @param  GuidId                          Package GUID.\r
+  @param  ...                                Variable argument list for packages to be assembled.\r
+\r
+  @return EFI_HII_PACKAGE_LIST_HEADER Pointer of EFI_HII_PACKAGE_LIST_HEADER. The function will ASSERT if system has\r
+                                                                not enough resource to complete the operation.\r
+\r
+**/\r
 EFI_HII_PACKAGE_LIST_HEADER *\r
 EFIAPI\r
 HiiLibPreparePackageList (\r
@@ -127,6 +155,30 @@ HiiLibPreparePackageList (
 }\r
 \r
 \r
+/**\r
+  This function allocates pool for an EFI_HII_PACKAGE_LIST structure\r
+  with additional space that is big enough to host all packages described by the variable \r
+  argument list of package pointers.  The allocated structure is initialized using NumberOfPackages, \r
+  GuidId,  and the variable length argument list of package pointers.\r
+\r
+  Then, EFI_HII_PACKAGE_LIST will be register to the default System HII Database. The\r
+  Handle to the newly registered Package List is returned throught HiiHandle.\r
+\r
+  If HiiHandle is NULL, then ASSERT.\r
+\r
+  @param  NumberOfPackages    The number of HII packages to register.\r
+  @param  GuidId              Package List GUID ID.\r
+  @param  DriverHandle        Optional. If not NULL, the DriverHandle on which an instance of DEVICE_PATH_PROTOCOL is installed.\r
+                              This DriverHandle uniquely defines the device that the added packages are associated with.\r
+  @param  HiiHandle           On output, the HiiHandle is update with the handle which can be used to retrieve the Package \r
+                              List later. If the functions failed to add the package to the default HII database, this value will\r
+                              be set to NULL.\r
+  @param  ...                 The variable argument list describing all HII Package.\r
+\r
+  @return  EFI_SUCCESS         If the packages are successfully added to the default HII database.\r
+  @return  EFI_OUT_OF_RESOURCE Not enough resource to complete the operation.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 HiiLibAddPackages (\r
@@ -161,6 +213,18 @@ HiiLibAddPackages (
   return Status;\r
 }\r
 \r
+/**\r
+  Removes a package list from the default HII database.\r
+\r
+  If HiiHandle is NULL, then ASSERT.\r
+  If HiiHandle is not a valid EFI_HII_HANDLE in the default HII database, then ASSERT.\r
+\r
+  @param  HiiHandle                The handle that was previously registered to the data base that is requested for removal.\r
+                                             List later.\r
+\r
+  @return  VOID\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 HiiLibRemovePackages (\r
@@ -177,6 +241,21 @@ HiiLibRemovePackages (
 }\r
 \r
 \r
+/**\r
+  Determines the handles that are currently active in the database.\r
+  It's the caller's responsibility to free handle buffer.\r
+\r
+  If HandleBufferLength is NULL, then ASSERT.\r
+  If HiiHandleBuffer is NULL, then ASSERT.\r
+\r
+  @param  HandleBufferLength     On input, a pointer to the length of the handle\r
+                                 buffer. On output, the length of the handle buffer\r
+                                 that is required for the handles found.\r
+  @param  HiiHandleBuffer        Pointer to an array of Hii Handles returned.\r
+\r
+  @retval EFI_SUCCESS            Get an array of Hii Handles successfully.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 HiiLibGetHiiHandles (\r
@@ -225,6 +304,18 @@ HiiLibGetHiiHandles (
   return Status;\r
 }\r
 \r
+/**\r
+  Extract Hii package list GUID for given HII handle.\r
+\r
+  If HiiHandle could not be found in the default HII database, then ASSERT.\r
+  If Guid is NULL, then ASSERT.\r
+\r
+  @param  Handle              Hii handle\r
+  @param  Guid                Package list GUID\r
+\r
+  @retval EFI_SUCCESS            Successfully extract GUID from Hii database.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 HiiLibExtractGuidFromHiiHandle (\r
@@ -269,6 +360,19 @@ HiiLibExtractGuidFromHiiHandle (
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Find HII Handle in the default HII database associated with given Device Path.\r
+\r
+  If DevicePath is NULL, then ASSERT.\r
+\r
+  @param  DevicePath             Device Path associated with the HII package list\r
+                                 handle.\r
+\r
+  @retval Handle                 HII package list Handle associated with the Device\r
+                                        Path.\r
+  @retval NULL                   Hii Package list handle is not found.\r
+\r
+**/\r
 EFI_HII_HANDLE\r
 EFIAPI\r
 HiiLibDevicePathToHiiHandle (\r
@@ -382,6 +486,15 @@ HiiLibDevicePathToHiiHandle (
   return HiiHandle;\r
 }\r
 \r
+/**\r
+  This function check if the Hii Handle is a valid handle registered\r
+  in the HII database.\r
+\r
+  @param HiiHandle The HII Handle.\r
+\r
+  @retval TRUE If it is a valid HII handle.\r
+  @retval FALSE If it is a invalid HII handle.\r
+**/\r
 BOOLEAN\r
 IsHiiHandleRegistered (\r
   EFI_HII_HANDLE    HiiHandle\r
index 7be7f168fab0f67dbdd0124c7fcf2617377ca07c..05e9aa8b6829b27bb9ed6ea575d7dabad9213d70 100644 (file)
 \r
 \r
 #include "InternalHiiLib.h"\r
+\r
+/**\r
+  This function adds the string into String Package of each language\r
+  supported by the package list.\r
+\r
+  If String is NULL, then ASSERT.\r
+  If StringId is NULL, the ASSERT.\r
+  If PackageList could not be found in the default HII database, then ASSERT.\r
+\r
+  @param  PackageList            Handle of the package list where this string will\r
+                                            be added.\r
+  @param  StringId               On return, contains the new strings id, which is\r
+                                          unique within PackageList.\r
+  @param  String                 Points to the new null-terminated string.\r
+\r
+  @retval EFI_SUCCESS             The new string was added successfully.\r
+  @retval EFI_OUT_OF_RESOURCES   Could not add the string due to lack of resources.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 HiiLibNewString (\r
@@ -58,6 +77,24 @@ HiiLibNewString (
   \r
 }\r
 \r
+\r
+/**\r
+  This function update the specified string in String Package of each language\r
+  supported by the package list.\r
+\r
+  If String is NULL, then ASSERT.\r
+  If PackageList could not be found in the default HII database, then ASSERT.\r
+  If StringId is not found in PackageList, then ASSERT.\r
+\r
+  @param  PackageList            Handle of the package list where this string will\r
+                                            be added.\r
+  @param  StringId               Ths String Id to be updated.\r
+  @param  String                 Points to the new null-terminated string.\r
+\r
+  @retval EFI_SUCCESS            The new string was added successfully.\r
+  @retval EFI_OUT_OF_RESOURCES   Could not add the string due to lack of resources.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 HiiLibSetString (\r
@@ -101,6 +138,22 @@ HiiLibSetString (
 }\r
 \r
 \r
+/**\r
+  Get the string given the StringId and String package Producer's Guid. The caller\r
+  is responsible to free the *String.\r
+\r
+  If PackageList with the matching ProducerGuid is not found, then ASSERT.\r
+  If PackageList with the matching ProducerGuid is found but no String is\r
+  specified by StringId is found, then ASSERT.\r
+\r
+  @param  ProducerGuid           The Guid of String package list.\r
+  @param  StringId               The String ID.\r
+  @param  String                 The output string.\r
+\r
+  @retval EFI_SUCCESS            Operation is successful.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enought memory in the system.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 HiiLibGetStringFromToken (\r
@@ -147,6 +200,31 @@ Out:
   return Status;\r
 }\r
 \r
+/**\r
+  This function try to retrieve string from String package of current language.\r
+  If fails, it try to retrieve string from String package of first language it support.\r
+\r
+  If String is NULL, then ASSERT.\r
+  If StringSize is NULL, then ASSERT.\r
+  If PackageList could not be found in the default HII database, then ASSERT.\r
+  If StringId is not found in PackageList, then ASSERT.\r
+\r
+  @param  PackageList     The package list in the HII database to search for\r
+                                     the specified string.\r
+  @param  StringId          The string's id, which is unique within\r
+                                      PackageList.\r
+  @param  String             Points to the new null-terminated string.\r
+  @param  StringSize       On entry, points to the size of the buffer pointed\r
+                                 to by String, in bytes. On return, points to the\r
+                                 length of the string, in bytes.\r
+\r
+  @retval EFI_SUCCESS            The string was returned successfully.\r
+  @retval EFI_NOT_FOUND          The string specified by StringId is not available.\r
+  @retval EFI_BUFFER_TOO_SMALL   The buffer specified by StringLength is too small\r
+                                 to hold the string.\r
+  @retval EFI_INVALID_PARAMETER  The String or StringSize was NULL.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 HiiLibGetString (\r
@@ -201,6 +279,24 @@ HiiLibGetString (
 }\r
 \r
 \r
+/**\r
+  Get string specified by StringId form the HiiHandle. The caller\r
+  is responsible to free the *String.\r
+\r
+  If String is NULL, then ASSERT.\r
+  If HiiHandle could not be found in the default HII database, then ASSERT.\r
+  If StringId is not found in PackageList, then ASSERT.\r
+\r
+  @param  HiiHandle              The HII handle of package list.\r
+  @param  StringId               The String ID.\r
+  @param  String                 The output string.\r
+\r
+  @retval EFI_NOT_FOUND          String is not found.\r
+  @retval EFI_SUCCESS            Operation is successful.\r
+  @retval EFI_OUT_OF_RESOURCES   There is not enought memory in the system.\r
+  @retval EFI_INVALID_PARAMETER  The String is NULL.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 HiiLibGetStringFromHandle (\r
index 5d03cd1b7873312d76fa4178e261a48e5f7093cb..c01e5b020a789137b3ab16b5d4d5beae177099a5 100644 (file)
@@ -41,12 +41,26 @@ extern CONST EFI_HII_STRING_PROTOCOL           *mHiiStringProt;
 extern BOOLEAN                           mHiiProtocolsInitialized;\r
 \r
 \r
+/**\r
+  This function check if the Hii Handle is a valid handle registered\r
+  in the HII database.\r
+\r
+  @param HiiHandle The HII Handle.\r
+\r
+  @retval TRUE If it is a valid HII handle.\r
+  @retval FALSE If it is a invalid HII handle.\r
+**/\r
 BOOLEAN\r
 IsHiiHandleRegistered (\r
   EFI_HII_HANDLE    HiiHandle\r
   )\r
 ;\r
 \r
+/**\r
+\r
+  This function locate Hii relative protocols for later usage.\r
+\r
+**/\r
 VOID\r
 LocateHiiProtocols (\r
   VOID\r
index cb5b53a5b72bd5c67af07e5633327a3657e7834d..32e1027ae30a1d30b68616ca3c5cb420e6534ef2 100644 (file)
@@ -1,7 +1,7 @@
 #/** @file\r
-# Component name for module UefiEfiIfrSupportLib\r
+#Utility functions which helps in opcode creation, HII configuration string manipulations, \r
+#pop up window creations, setup browser persistence data set and get.\r
 #\r
-# FIX ME!\r
 # Copyright (c) 2007, Intel Corporation. All rights reserved.\r
 #\r
 #  All rights reserved. This program and the accompanying materials\r
index 958400fc5195f7a60073ff2b32eedc79f863017b..18c594f45d77f3927762468673fb46b5b28d55f7 100644 (file)
@@ -1,6 +1,8 @@
 /** @file
+Utility functions which helps in opcode creation, HII configuration string manipulations, 
+pop up window creations, setup browser persistence data set and get.
 
-Copyright (c) 2007, Intel Corporation
+Copyright (c) 2007 - 2008, Intel Corporation
 All rights reserved. This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -9,15 +11,6 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
-Module Name:
-
-  UefiIfrCommon.c
-
-Abstract:
-
-  Common Library Routines to assist handle HII elements.
-
-
 **/
 
 #include "UefiIfrLibraryInternal.h"
@@ -26,6 +19,17 @@ EFI_HII_DATABASE_PROTOCOL *gIfrLibHiiDatabase;
 EFI_HII_STRING_PROTOCOL   *gIfrLibHiiString;
 
 
+/**
+  IfrSupportLib's constructor. It locates the required protocol:
+  gEfiHiiDatabaseProtocolGuid and gEfiHiiStringProtocolGuid.
+
+  @param ImageHandle     The firmware allocated handle for the EFI image.
+  
+  @param SystemTable     A pointer to the EFI System Table.
+
+  @retval EFI_SUCCESS    This function always completes successfully.
+
+**/
 EFI_STATUS
 EFIAPI
 IfrSupportLibConstructor (
index af43db0998428f819a04c96ae7ad066756bff729..d0da744240bdd493c39b1974194cd129d96d0094 100644 (file)
@@ -1,4 +1,6 @@
 /** @file
+Utility functions which helps in opcode creation, HII configuration string manipulations, 
+pop up window creations, setup browser persistence data set and get.
 
 Copyright (c) 2007- 2008, Intel Corporation
 All rights reserved. This program and the accompanying materials
@@ -9,15 +11,6 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
-Module Name:
-
-  UefiIfrForm.c
-
-Abstract:
-
-  Common Library Routines to assist handle HII elements.
-
-
 **/
 
 #include "UefiIfrLibraryInternal.h"
@@ -223,7 +216,7 @@ IfrLibCreatePopUp (
 
 
 /**
-  Swap bytes in the buffer.
+  Swap bytes in the buffer. This is a internal function.
 
   @param  Buffer                 Binary buffer.
   @param  BufferSize             Size of the buffer in bytes.
@@ -231,7 +224,6 @@ IfrLibCreatePopUp (
   @return None.
 
 **/
-STATIC
 VOID
 SwapBuffer (
   IN OUT UINT8     *Buffer,
@@ -252,11 +244,10 @@ SwapBuffer (
 
 /**
   Converts the unicode character of the string from uppercase to lowercase.
+  This is a internal function.
 
   @param Str     String to be converted
 
-  @retval VOID
-  
 **/
 VOID
 ToLower (
index dade8592f5248e64f229e5568fd9fff88bab4e7f..34a0cf1260b111532e766848b0b4dbed52363788 100644 (file)
@@ -1,4 +1,6 @@
 /** @file
+Utility functions which helps in opcode creation, HII configuration string manipulations, 
+pop up window creations, setup browser persistence data set and get.
 
 Copyright (c) 2007, Intel Corporation
 All rights reserved. This program and the accompanying materials
@@ -9,19 +11,11 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
-Module Name:
-
-  UefiIfrLibraryInternal
-
-Abstract:
-
-  The file contain all library function for Ifr Operations.
-
 
 **/
 
-#ifndef _IFRLIBRARY_INTERNAL_H
-#define _IFRLIBRARY_INTERNAL_H
+#ifndef _IFRLIBRARY_INTERNAL_H_
+#define _IFRLIBRARY_INTERNAL_H_
 
 
 #include <PiDxe.h>
@@ -41,3 +35,4 @@ Abstract:
 #include <Library/PcdLib.h>
 
 #endif
+
index f2f82e06db60f4abeab9e5aa44c6ac92ee4dd4f7..b4cba7843bc7b17d8a66df0c5cfc8fdf53f2430f 100644 (file)
@@ -1,4 +1,7 @@
 /** @file
+  Library Routines to create IFR independent of string data - assume tokens already exist
+  Primarily to be used for exporting op-codes at a label in pre-defined forms.
+
 
 Copyright (c) 2007, Intel Corporation
 All rights reserved. This program and the accompanying materials
@@ -9,32 +12,40 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
-Module Name:
-
-  UefiIfrOpCodeCreation.c
 
-Abstract:
+**/
 
-  Library Routines to create IFR independent of string data - assume tokens already exist
-  Primarily to be used for exporting op-codes at a label in pre-defined forms.
+#include "UefiIfrLibraryInternal.h"
 
-Revision History:
+/**
+  Check if the input question flags is a valid value.
+  The valid combination of question flags includes
+  EFI_IFR_FLAG_READ_ONLY | EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED | EFI_IFR_FLAG_OPTIONS_ONLY.
 
+  @param Flags The question flags to check.
 
+  @retval TRUE  If the question flag is a valid combination.
+  @retval FALSE If the question flag is an invalid combination.
+  
 **/
-
-#include "UefiIfrLibraryInternal.h"
-
-STATIC
 BOOLEAN
 IsValidQuestionFlags (
   IN UINT8                   Flags
   )
 {
-  return (BOOLEAN) ((Flags & (~QUESTION_FLAGS)) ? FALSE : TRUE);
+  return (BOOLEAN) (((Flags & (~QUESTION_FLAGS)) != 0) ? FALSE : TRUE);
 }
 
-STATIC
+/**
+  Check if the input value type is a valid type.
+  The valid value type is smaller or equal than EFI_IFR_TYPE_OTHER.
+
+  @param Type   The value type to check.
+
+  @retval TRUE  If the value type is valid.
+  @retval FALSE If the value type is invalid.
+  
+**/
 BOOLEAN
 IsValidValueType (
   IN UINT8                   Type
@@ -43,13 +54,21 @@ IsValidValueType (
   return (BOOLEAN) ((Type <= EFI_IFR_TYPE_OTHER) ? TRUE : FALSE);
 }
 
-STATIC
+/**
+  Check if the input numeric flags is a valid value.
+
+  @param Flags The numeric flags to check.
+
+  @retval TRUE  If the numeric flags is valid.
+  @retval FALSE If the numeric flags is invalid.
+  
+**/
 BOOLEAN
 IsValidNumricFlags (
   IN UINT8                   Flags
   )
 {
-  if (Flags & ~(EFI_IFR_NUMERIC_SIZE | EFI_IFR_DISPLAY)) {
+  if ((Flags & ~(EFI_IFR_NUMERIC_SIZE | EFI_IFR_DISPLAY)) != 0) {
     return FALSE;
   }
 
@@ -60,7 +79,15 @@ IsValidNumricFlags (
   return TRUE;
 }
 
-STATIC
+/**
+  Check if the checkbox flags is a valid value.
+
+  @param Flags The checkbox flags to check.
+
+  @retval TRUE  If the checkbox flags is valid.
+  @retval FALSE If the checkbox flags is invalid.
+  
+**/
 BOOLEAN
 IsValidCheckboxFlags (
   IN UINT8                   Flags
@@ -69,6 +96,17 @@ IsValidCheckboxFlags (
   return (BOOLEAN) ((Flags <= EFI_IFR_CHECKBOX_DEFAULT_MFG) ? TRUE : FALSE);
 }
 
+/**
+  Create EFI_IFR_END_OP opcode.
+
+  If Data is NULL or Data->Data is NULL, then ASSERT.
+
+  @param  Data                   Destination for the created opcode binary
+
+  @retval EFI_SUCCESS            Opcode create success
+  @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+
+**/
 EFI_STATUS
 EFIAPI
 CreateEndOpCode (
@@ -95,6 +133,18 @@ CreateEndOpCode (
   return EFI_SUCCESS;
 }
 
+/**
+  Create EFI_IFR_DEFAULT_OP opcode.
+
+  @param  Value                  Value for the default
+  @param  Type                   Type for the default
+  @param  Data                   Destination for the created opcode binary
+
+  @retval EFI_SUCCESS            Opcode create success
+  @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+  @retval EFI_INVALID_PARAMETER The type is not valid.
+
+**/
 EFI_STATUS
 EFIAPI
 CreateDefaultOpCode (
@@ -130,6 +180,21 @@ CreateDefaultOpCode (
   return EFI_SUCCESS;
 }
 
+/**
+  Create EFI_IFR_ACTION_OP opcode.
+
+  @param  QuestionId             Question ID
+  @param  Prompt                 String ID for Prompt
+  @param  Help                   String ID for Help
+  @param  QuestionFlags          Flags in Question Header
+  @param  QuestionConfig         String ID for configuration
+  @param  Data                   Destination for the created opcode binary
+
+  @retval EFI_SUCCESS            Opcode create success
+  @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+  @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
+
+**/
 EFI_STATUS
 EFIAPI
 CreateActionOpCode (
@@ -171,6 +236,19 @@ CreateActionOpCode (
   return EFI_SUCCESS;
 }
 
+/**
+  Create EFI_IFR_SUBTITLE_OP opcode.
+
+  @param  Prompt                 String ID for Prompt
+  @param  Help                   String ID for Help
+  @param  Flags                  Subtitle opcode flags
+  @param  Scope                  Subtitle Scope bit
+  @param  Data                   Destination for the created opcode binary
+
+  @retval EFI_SUCCESS            Opcode create success
+  @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+  
+**/
 EFI_STATUS
 EFIAPI
 CreateSubTitleOpCode (
@@ -205,6 +283,18 @@ CreateSubTitleOpCode (
 }
 
 
+/**
+  Create EFI_IFR_TEXT_OP opcode.
+
+  @param  Prompt                 String ID for Prompt
+  @param  Help                   String ID for Help
+  @param  TextTwo                String ID for text two
+  @param  Data                   Destination for the created opcode binary
+
+  @retval EFI_SUCCESS            Opcode create success
+  @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+
+**/
 EFI_STATUS
 EFIAPI
 CreateTextOpCode (
@@ -237,6 +327,21 @@ CreateTextOpCode (
   return EFI_SUCCESS;
 }
 
+/**
+  Create EFI_IFR_REF_OP opcode.
+
+  @param  FormId                 Destination Form ID
+  @param  Prompt                 String ID for Prompt
+  @param  Help                   String ID for Help
+  @param  QuestionFlags          Flags in Question Header
+  @param  QuestionId             Question ID
+  @param  Data                   Destination for the created opcode binary
+
+  @retval EFI_SUCCESS            Opcode create success
+  @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+  @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
+
+**/
 EFI_STATUS
 EFIAPI
 CreateGotoOpCode (
@@ -278,6 +383,18 @@ CreateGotoOpCode (
   return EFI_SUCCESS;
 }
 
+/**
+  Create EFI_IFR_ONE_OF_OPTION_OP opcode.
+
+  @param  OptionCount            The number of options.
+  @param  OptionsList            The list of Options.
+  @param  Type                   The data type.
+  @param  Data                   Destination for the created opcode binary
+
+  @retval EFI_SUCCESS            Opcode create success
+  @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+
+**/
 EFI_STATUS
 EFIAPI
 CreateOneOfOptionOpCode (
@@ -319,6 +436,25 @@ CreateOneOfOptionOpCode (
   return EFI_SUCCESS;
 }
 
+/**
+  Create EFI_IFR_ONE_OF_OP opcode.
+
+  @param  QuestionId             Question ID
+  @param  VarStoreId             Storage ID
+  @param  VarOffset              Offset in Storage
+  @param  Prompt                 String ID for Prompt
+  @param  Help                   String ID for Help
+  @param  QuestionFlags          Flags in Question Header
+  @param  OneOfFlags             Flags for oneof opcode
+  @param  OptionsList            List of options
+  @param  OptionCount            Number of options in option list
+  @param  Data                   Destination for the created opcode binary
+
+  @retval EFI_SUCCESS            Opcode create success
+  @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+  @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
+
+**/
 EFI_STATUS
 EFIAPI
 CreateOneOfOpCode (
@@ -374,6 +510,27 @@ CreateOneOfOpCode (
   return EFI_SUCCESS;
 }
 
+/**
+  Create EFI_IFR_ORDERED_LIST_OP opcode.
+
+  @param  QuestionId             Question ID
+  @param  VarStoreId             Storage ID
+  @param  VarOffset              Offset in Storage
+  @param  Prompt                 String ID for Prompt
+  @param  Help                   String ID for Help
+  @param  QuestionFlags          Flags in Question Header
+  @param  OrderedListFlags       Flags for ordered list opcode
+  @param  DataType               Type for option value
+  @param  MaxContainers          Maximum count for options in this ordered list
+  @param  OptionsList            List of options
+  @param  OptionCount            Number of options in option list
+  @param  Data                   Destination for the created opcode binary
+
+  @retval EFI_SUCCESS            Opcode create success
+  @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+  @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
+
+**/
 EFI_STATUS
 EFIAPI
 CreateOrderedListOpCode (
@@ -436,6 +593,23 @@ CreateOrderedListOpCode (
   return EFI_SUCCESS;
 }
 
+/**
+  Create EFI_IFR_CHECKBOX_OP opcode.
+
+  @param  QuestionId             Question ID
+  @param  VarStoreId             Storage ID
+  @param  VarOffset              Offset in Storage
+  @param  Prompt                 String ID for Prompt
+  @param  Help                   String ID for Help
+  @param  QuestionFlags          Flags in Question Header
+  @param  CheckBoxFlags          Flags for checkbox opcode
+  @param  Data                   Destination for the created opcode binary
+
+  @retval EFI_SUCCESS            Opcode create success
+  @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+  @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
+
+**/
 EFI_STATUS
 EFIAPI
 CreateCheckBoxOpCode (
@@ -480,6 +654,27 @@ CreateCheckBoxOpCode (
   return EFI_SUCCESS;
 }
 
+/**
+  Create EFI_IFR_NUMERIC_OP opcode.
+
+  @param  QuestionId             Question ID
+  @param  VarStoreId             Storage ID
+  @param  VarOffset              Offset in Storage
+  @param  Prompt                 String ID for Prompt
+  @param  Help                   String ID for Help
+  @param  QuestionFlags          Flags in Question Header
+  @param  NumericFlags           Flags for numeric opcode
+  @param  Minimum                Numeric minimum value
+  @param  Maximum                Numeric maximum value
+  @param  Step                   Numeric step for edit
+  @param  Default                Numeric default value
+  @param  Data                   Destination for the created opcode binary
+
+  @retval EFI_SUCCESS            Opcode create success
+  @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+  @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
+
+**/
 EFI_STATUS
 EFIAPI
 CreateNumericOpCode (
@@ -567,6 +762,25 @@ CreateNumericOpCode (
   return EFI_SUCCESS;
 }
 
+/**
+  Create EFI_IFR_STRING_OP opcode.
+
+  @param  QuestionId             Question ID
+  @param  VarStoreId             Storage ID
+  @param  VarOffset              Offset in Storage
+  @param  Prompt                 String ID for Prompt
+  @param  Help                   String ID for Help
+  @param  QuestionFlags          Flags in Question Header
+  @param  StringFlags            Flags for string opcode
+  @param  MinSize                String minimum length
+  @param  MaxSize                String maximum length
+  @param  Data                   Destination for the created opcode binary
+
+  @retval EFI_SUCCESS            Opcode create success
+  @retval EFI_BUFFER_TOO_SMALL The space reserved in Data field is too small.
+  @retval EFI_INVALID_PARAMETER If QuestionFlags is not valid.
+
+**/
 EFI_STATUS
 EFIAPI
 CreateStringOpCode (
@@ -587,7 +801,7 @@ CreateStringOpCode (
 
   ASSERT (Data != NULL && Data->Data != NULL);
 
-  if (!IsValidQuestionFlags (QuestionFlags) || (StringFlags & (~EFI_IFR_STRING_MULTI_LINE))) {
+  if (!IsValidQuestionFlags (QuestionFlags) || (StringFlags & ~EFI_IFR_STRING_MULTI_LINE) != 0) {
     return EFI_INVALID_PARAMETER;
   }