]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add NewHii and UefiHiiServiceLib library header file
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 9 Apr 2009 15:11:04 +0000 (15:11 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 9 Apr 2009 15:11:04 +0000 (15:11 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8048 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Include/Library/NewHiiLib.h [new file with mode: 0644]
MdeModulePkg/Include/Library/UefiHiiServicesLib.h [new file with mode: 0644]

diff --git a/MdeModulePkg/Include/Library/NewHiiLib.h b/MdeModulePkg/Include/Library/NewHiiLib.h
new file mode 100644 (file)
index 0000000..dfa76b0
--- /dev/null
@@ -0,0 +1,926 @@
+/** @file\r
+  Public include file for the HII Library\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
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\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
+**/\r
+\r
+#ifndef __NEWHII_LIB_H__\r
+#define __NEWHII_LIB_H__\r
+\r
+////////////////////////////////////////////////////////\r
+////////////////////////////////////////////////////////\r
+// HiiLib Functions\r
+////////////////////////////////////////////////////////\r
+////////////////////////////////////////////////////////\r
+\r
+/**\r
+  Registers a list of packages in the HII Database and returns the HII Handle\r
+  associated with that registration.  If an HII Handle has already been registered\r
+  with the same PackageListGuid, then NULL is returned.  If there are not enough \r
+  resources to perform the registration, then NULL is returned.  If an empty list \r
+  of packages is passed in, then NULL is returned.  If the size of the list of \r
+  package is 0, then NULL is returned.\r
+\r
+  @param[in]  PackageListGuid  An optional parameter that is used to identify \r
+                               the GUID of the package list.  If this parameter \r
+                               is NULL, then gEfiCallerIdGuid is used.\r
+  @param[in]  DeviceHandle     Optional. If not NULL, the Device Handle on which \r
+                               an instance of DEVICE_PATH_PROTOCOL is installed.\r
+                               This Device Handle uniquely defines the device that \r
+                               the added packages are associated with.\r
+  @param[in]  ...              The variable argument list that contains pointers \r
+                               to packages terminated by a NULL.\r
+\r
+  @retval NULL   A HII Handle has already been registered in the HII Database with\r
+                 the same PackageListGuid.\r
+  @retval NULL   The HII Handle could not be created.\r
+  @retval Other  The HII Handle associated with the newly registered package list.\r
+\r
+**/\r
+EFI_HII_HANDLE\r
+EFIAPI\r
+HiiAddPackages (\r
+  IN CONST EFI_GUID    *PackageListGuid,  OPTIONAL\r
+  IN       EFI_HANDLE  DeviceHandle,      OPTIONAL\r
+  ...\r
+  );\r
+\r
+/**\r
+  Removes a package list from the HII Database.\r
+\r
+  If HiiHandle is NULL, then ASSERT().\r
+  If HiiHandle is not a valid EFI_HII_HANDLE in the HII Database, then ASSERT().\r
+\r
+  @param[in]  HiiHandle  A handle that was previously registered in the HII Database.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+HiiRemovePackages (\r
+  IN EFI_HII_HANDLE  HiiHandle\r
+  );\r
+\r
+/**\r
+  Retrieves the array of all the HII Handles in the HII Database.\r
+  This array is terminated with a NULL HII Handle.\r
+  This function allocates the returned array using AllocatePool().\r
+  The caller is responsible for freeing the array with FreePool().\r
+\r
+  @param[in]  PackageListGuid  An optional parameter that is used to request \r
+                               an HII Handle that is associatd with a specific\r
+                               Package List GUID.  If this parameter is NULL\r
+                               then all the HII Handles in the HII Database\r
+                               are returned.  If this parameter is not NULL\r
+                               then at most 1 HII Handle is returned.\r
+\r
+  @retval NULL   There are no HII handles in the HII database\r
+  @retval NULL   The array of HII Handles could not be retrieved\r
+  @retval Other  A pointer to the NULL terminated array of HII Handles\r
+\r
+**/\r
+EFI_HII_HANDLE *\r
+EFIAPI\r
+HiiGetHiiHandles (\r
+  IN CONST EFI_GUID  *PackageListGuid  OPTIONAL\r
+  );\r
+\r
+/**\r
+  Retrieves a pointer to the a Null-terminated ASCII string containing the list \r
+  of languages that an HII handle in the HII Database supports.  The returned \r
+  string is allocated using AllocatePool().  The caller is responsible for freeing\r
+  the returned string using FreePool().  The format of the returned string follows\r
+  the language format assumed the HII Database.\r
+  \r
+  If HiiHandle is NULL, then ASSERT().\r
+\r
+  @param[in]  HiiHandle  A handle that was previously registered in the HII Database.\r
+\r
+  @retval NULL   HiiHandle is not registered in the HII database\r
+  @retval NULL   There are not enough resources available to retrieve the suported \r
+                 languages.\r
+  @retval NULL   The list of suported languages could not be retrieved.\r
+  @retval Other  A pointer to the Null-terminated ASCII string of supported languages.\r
+\r
+**/\r
+CHAR8 *\r
+EFIAPI\r
+HiiGetSupportedLanguages (\r
+  IN EFI_HII_HANDLE  HiiHandle\r
+  );\r
+\r
+/**\r
+  Retrieves a string from a string package in a specific language.  If the language\r
+  is not specified, then a string from a string package in the current platform \r
+  language is retrieved.  If the string can not be retrieved using the specified \r
+  language or the current platform language, then the string is retrieved from \r
+  the string package in the first language the string package supports.  The \r
+  returned string is allocated using AllocatePool().  The caller is responsible \r
+  for freeing the allocated buffer using FreePool().\r
+  \r
+  If HiiHandle is NULL, then ASSERT().\r
+  If StringId is 0, then ASSET.\r
+\r
+  @param[in]  HiiHandle  A handle that was previously registered in the HII Database.\r
+  @param[in]  StringId   The identifier of the string to retrieved from the string \r
+                         package associated with HiiHandle.\r
+  @param[in]  Language   The language of the string to retrieve.  If this parameter \r
+                         is NULL, then the current platform language is used.  The \r
+                         format of Language must follow the language format assumed \r
+                         the HII Database.\r
+\r
+  @retval NULL   The string specified by StringId is not present in the string package.\r
+  @retval Other  The string was returned.\r
+\r
+**/\r
+EFI_STRING\r
+EFIAPI\r
+HiiGetString (\r
+  IN EFI_HII_HANDLE  HiiHandle,\r
+  IN EFI_STRING_ID   StringId,\r
+  IN CONST CHAR8     *Language  OPTIONAL\r
+  );\r
+\r
+/**\r
+  Retrieves a string from a string package names by GUID in a specific language.  \r
+  If the language is not specified, then a string from a string package in the \r
+  current platform  language is retrieved.  If the string can not be retrieved \r
+  using the specified language or the current platform language, then the string \r
+  is retrieved from the string package in the first language the string package \r
+  supports.  The returned string is allocated using AllocatePool().  The caller \r
+  is responsible for freeing the allocated buffer using FreePool().\r
+  \r
+  If PackageListGuid is NULL, then ASSERT().\r
+  If StringId is 0, then ASSET.\r
+\r
+  @param[in]  PackageListGuid  The GUID of a package list that was previously \r
+                               registered in the HII Database.\r
+  @param[in]  StringId         The identifier of the string to retrieved from the \r
+                               string package associated with PackageListGuid.\r
+  @param[in]  Language         The language of the string to retrieve.  If this \r
+                               parameter is NULL, then the current platform \r
+                               language is used.  The format of Language must \r
+                               follow the language format assumed the HII Database.\r
+\r
+  @retval NULL   The package list specified by PackageListGuid is not present in the\r
+                 HII Database.\r
+  @retval NULL   The string specified by StringId is not present in the string package.\r
+  @retval Other  The string was returned.\r
+\r
+**/\r
+EFI_STRING\r
+EFIAPI\r
+HiiGetPackageString (\r
+  IN CONST EFI_GUID  *PackageListGuid,\r
+  IN EFI_STRING_ID   StringId,\r
+  IN CONST CHAR8     *Language  OPTIONAL\r
+  );\r
+\r
+/**\r
+  This function create a new string in String Package or updates an existing \r
+  string in a String Package.  If StringId is 0, then a new string is added to\r
+  a String Package.  If StringId is not zero, then a string in String Package is\r
+  updated.  If SupportedLanguages is NULL, then the string is added or updated\r
+  for all the languages that the String Package supports.  If SupportedLanguages\r
+  is not NULL, then the string is added or updated for the set of languages \r
+  specified by SupportedLanguages.\r
+    \r
+  If HiiHandle is NULL, then ASSERT().\r
+  If String is NULL, then ASSERT().\r
+\r
+  @param[in]  HiiHandle           A handle that was previously registered in the \r
+                                  HII Database.\r
+  @param[in]  StringId            If zero, then a new string is created in the \r
+                                  String Package associated with HiiHandle.  If \r
+                                  non-zero, then the string specified by StringId \r
+                                  is updated in the String Package  associated \r
+                                  with HiiHandle. \r
+  @param[in]  String              A pointer to the Null-terminated Unicode string \r
+                                  to add or update in the String Package associated \r
+                                  with HiiHandle.\r
+  @param[in]  SupportedLanguages  A pointer to a Null-terminated ASCII string of \r
+                                  language codes.  If this parameter is NULL, then \r
+                                  String is added or updated in the String Package \r
+                                  associated with HiiHandle for all the languages \r
+                                  that the String Package supports.  If this \r
+                                  parameter is not NULL, then then String is added \r
+                                  or updated in the String Package associated with \r
+                                  HiiHandle for the set oflanguages specified by \r
+                                  SupportedLanguages.  The format of \r
+                                  SupportedLanguages must follow the language \r
+                                  format assumed the HII Database.\r
+\r
+  @retval 0      The string could not be added or updated in the String Package.\r
+  @retval Other  The EFI_STRING_ID of the newly added or updated string.\r
+\r
+**/\r
+EFI_STRING_ID\r
+EFIAPI\r
+HiiSetString (\r
+  IN EFI_HII_HANDLE    HiiHandle,\r
+  IN EFI_STRING_ID     StringId,            OPTIONAL\r
+  IN CONST EFI_STRING  String,\r
+  IN CONST CHAR8       *SupportedLanguages  OPTIONAL\r
+  );\r
+\r
+/**\r
+  Validates the config data associated with an HII handle in the HII Database.\r
+    \r
+  If HiiHandle is NULL, then ASSERT().\r
+\r
+  @param[in]  HiiHandle  A handle that was previously registered in the HII Database.\r
+\r
+  @retval TRUE   The config data associated with HiiHandle passes all validation\r
+                 checks.\r
+  @retval FALSE  The config data associated with HiiHandle failed one or more \r
+                 validation checks.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+HiiValidateDataFromHiiHandle (\r
+  IN EFI_HII_HANDLE  HiiHandle\r
+  );\r
+\r
+/**\r
+  Allocates and returns a Null-terminated Unicode <ConfigHdr> string using routing \r
+  information that includes a GUID, an optional Unicode string name, and a device\r
+  path.  The string returned is allocated with AllocatePool().  The caller is \r
+  responsible for freeing the allocated string with FreePool().\r
+  \r
+  The format of a <ConfigHdr> is as follows:\r
+\r
+    GUID=<HexCh>32&NAME=<Char>NameLength&PATH=<HexChar>DevicePathSize<Null>\r
+\r
+  @param[in]  Guid          Pointer to an EFI_GUID that is the routing information\r
+                            GUID.  Each of the 16 bytes in Guid is converted to \r
+                            a 2 Unicode character hexidecimal string.  This is \r
+                            an optional parameter that may be NULL.\r
+  @param[in]  Name          Pointer to a Null-terminated Unicode string that is \r
+                            the routing information NAME.  This is an optional \r
+                            parameter that may be NULL.  Each 16-bit Unicode \r
+                            character in Name is converted to a 4 character Unicode \r
+                            hexidecimal string.                        \r
+  @param[in]  DriverHandle  The driver handle which supports a Device Path Protocol\r
+                            that is the routing information PATH.  Each byte of\r
+                            the Device Path associated with DriverHandle is converted\r
+                            to a 2 Unicode character hexidecimal string.\r
+\r
+  @retval NULL   DriverHandle does not support the Device Path Protocol.\r
+  @retval NULL   DriverHandle does not support the Device Path Protocol.\r
+  @retval Other  A pointer to the Null-terminate Unicode <ConfigHdr> string\r
+\r
+**/\r
+EFI_STRING\r
+EFIAPI\r
+HiiConstructConfigHdr (\r
+  IN CONST EFI_GUID  *Guid,  OPTIONAL\r
+  IN CONST CHAR16    *Name,  OPTIONAL\r
+  IN EFI_HANDLE      DriverHandle\r
+  );\r
+\r
+/**\r
+  Allocates and returns a Null-terminated Unicode <ConfigAltResp> string.\r
+\r
+  If Guid is NULL, then ASSERT().\r
+  If Name is NULL, then ASSERT().\r
+  If BlockNameArray is NULL, then ASSERT().\r
+\r
+  @param[in] Guid               GUID of the buffer storage.\r
+  @param[in] Name               Name of the buffer storage.\r
+  @param[in] DriverHandle       The DriverHandle that support a Device Path\r
+                                Protocol.    \r
+  @param[in] BufferStorage      Content of the buffer storage.\r
+  @param[in] BufferStorageSize  Length in bytes of the buffer storage.\r
+  @param[in] BlockNameArray     Array generated by VFR compiler.  This array\r
+                                contains a UINT32 value that is the length\r
+                                of BlockNameArray in bytes, followed by pairs\r
+                                of 16-bit values that are the offset and length\r
+                                values used to contruct a <ConfigRequest> string.\r
+  @param[in]  ...               A variable argument list that contains pairs of 16-bit\r
+                                ALTCFG identifiers and pointers to DefaultValueArrays.\r
+                                The variable argument list is terminated by a NULL \r
+                                DefaultValueArray pointer.  A DefaultValueArray \r
+                                contains a UINT32 value that is the length, in bytes,\r
+                                of the DefaultValueArray.  The UINT32 length value \r
+                                is followed by a series of records that contain\r
+                                a 16-bit WIDTH value followed by a byte array with \r
+                                WIDTH entries.  The records must be parsed from\r
+                                beginning to end until the UINT32 length limit\r
+                                is reached.  \r
+\r
+  @retval NULL          There are not enough resources to process the request.\r
+  @retval NULL          A <ConfigResp> could not be retrieved from the Config \r
+                        Routing Protocol.\r
+  @retval Other         A pointer to the Null-terminate Unicode <ConfigAltResp>\r
+                        string.\r
+\r
+**/\r
+EFI_STRING\r
+EFIAPI\r
+HiiConstructConfigAltResp (\r
+  IN CONST EFI_GUID  *Guid,\r
+  IN CONST CHAR16    *Name,\r
+  IN EFI_HANDLE      DriverHandle,\r
+  IN CONST VOID      *BufferStorage,\r
+  IN UINTN           BufferStorageSize,\r
+  IN CONST VOID      *BlockNameArray, \r
+  ...\r
+  );\r
+\r
+/**\r
+  Determines if the routing data specified by GUID and NAME match a <ConfigHdr>.\r
+\r
+  If ConfigHdr is NULL, then ASSERT().\r
+\r
+  @param[in] ConfigHdr  Either <ConfigRequest> or <ConfigResp>.\r
+  @param[in] Guid       GUID of the storage.\r
+  @param[in] Name       NAME of the storage.\r
+\r
+  @retval TRUE   Routing information matches <ConfigHdr>.\r
+  @retval FALSE  Routing information does not match <ConfigHdr>.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+HiiIsConfigHdrMatch (\r
+  IN CONST EFI_STRING  ConfigHdr,\r
+  IN CONST EFI_GUID    *Guid,     OPTIONAL\r
+  IN CONST CHAR16      *Name      OPTIONAL\r
+  );\r
+\r
+/**\r
+  Retrieves uncommited data from the Form Browser and converts it to a binary\r
+  buffer.  The returned buffer is allocated using AllocatePool().  The caller\r
+  is responsible for freeing the returned buffer using FreePool().\r
+\r
+  @param[in]  VariableName  Pointer to a Null-terminated Unicode string.  This \r
+                            is an optional parameter that may be NULL.\r
+  @param[in]  VariableGuid  Pointer to an EFI_GUID structure.  This is an optional \r
+                            parameter that may be NULL.\r
+\r
+  @retval NULL   The uncommitted data could not be retrieved.\r
+  @retval Other  A pointer to a buffer containing the uncommitted data.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+HiiGetBrowserData (\r
+  IN CONST EFI_GUID  *VariableGuid,  OPTIONAL\r
+  IN CONST CHAR16    *VariableName   OPTIONAL\r
+  );\r
+\r
+/**\r
+  Updates uncommitted data in the Form Browser.\r
+\r
+  If Buffer is NULL, then ASSERT().\r
+\r
+  @param[in]  VariableName    Pointer to a Null-terminated Unicode string.  This\r
+                              is an optional parameter that may be NULL.\r
+  @param[in]  VariableGuid    Pointer to an EFI_GUID structure.  This is an optional\r
+                              parameter that may be NULL.\r
+  @param[in]  BufferSize      Length, in bytes, of Buffer.\r
+  @param[in]  Buffer          Buffer of data to commit.\r
+  @param[in]  RequestElement  An optional field to specify which part of the\r
+                              buffer data will be send back to Browser. If NULL,\r
+                              the whole buffer of data will be committed to\r
+                              Browser. \r
+                              <RequestElement> ::= &OFFSET=<Number>&WIDTH=<Number>*\r
+\r
+  @retval FALSE  The uncommitted data could not be updated.\r
+  @retval TRUE   The uncommitted data was updated.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+HiiSetBrowserData (\r
+  IN CONST EFI_GUID  *VariableGuid, OPTIONAL\r
+  IN CONST CHAR16    *VariableName, OPTIONAL\r
+  IN UINTN           BufferSize,\r
+  IN CONST UINT8     *Buffer,\r
+  IN CONST CHAR16    *RequestElement  OPTIONAL\r
+  );\r
+\r
+/////////////////////////////////////////\r
+/////////////////////////////////////////\r
+/// IFR Functions\r
+/////////////////////////////////////////\r
+/////////////////////////////////////////\r
+\r
+/**\r
+  Returns a UINT64 value that contains bitfields for Hour, Minute, and Second.\r
+  The lower 8-bits of Hour are placed in bits 0..7.  The lower 8-bits of Minute \r
+  are placed in bits 8..15, and the lower 8-bits of Second are placed in bits \r
+  16..23.  This format is selected because it can be easily translated to \r
+  an EFI_HII_TIME structure in an EFI_IFR_TYPE_VALUE union.\r
+\r
+  @param  Hour    The hour value to be encoded.\r
+  @param  Minute  The miniute value to be encoded.\r
+  @param  Second  The second value to be encoded.\r
+\r
+  @return A 64-bit containing Hour, Minute, and Second.\r
+**/\r
+#define EFI_HII_TIME_UINT64(Hour, Minute, Second) \\r
+  (UINT64)((Hour & 0xff) | ((Minute & 0xff) << 8) | ((Second & 0xff) << 16))\r
+\r
+/**\r
+  Returns a UINT64 value that contains bitfields for Year, Month, and Day.\r
+  The lower 16-bits of Year are placed in bits 0..15.  The lower 8-bits of Month \r
+  are placed in bits 16..23, and the lower 8-bits of Day are placed in bits \r
+  24..31.  This format is selected because it can be easily translated to \r
+  an EFI_HII_DATE structure in an EFI_IFR_TYPE_VALUE union.\r
+\r
+  @param  Year   The year value to be encoded.\r
+  @param  Month  The month value to be encoded.\r
+  @param  Day    The day value to be encoded.\r
+\r
+  @return A 64-bit containing Year, Month, and Day.\r
+**/\r
+#define EFI_HII_DATE_UINT64(Year, Month, Day) \\r
+  (UINT64)((Year & 0xffff) | ((Month & 0xff) << 16) | ((Day & 0xff) << 24))\r
+\r
+/**\r
+  Allocates and returns a new OpCode Handle.  OpCode Handles must be freed with \r
+  HiiFreeOpCodeHandle().\r
+\r
+  @retval NULL   There are not enough resources to allocate a new OpCode Handle.\r
+  @retval Other  A new OpCode handle.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+HiiAllocateOpCodeHandle (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Frees an OpCode Handle that was peviously allocated with HiiAllocateOpCodeHandle().\r
+  When an OpCode Handle is freed, all of the opcodes associated with the OpCode\r
+  Handle are also freed.\r
+\r
+  If OpCodeHandle is NULL, then ASSERT().\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+HiiFreeOpCodeHandle (\r
+  VOID  *OpCodeHandle\r
+  );\r
+\r
+/**\r
+  Create EFI_IFR_END_OP opcode.\r
+\r
+  If OpCodeHandle is NULL, then ASSERT().\r
+\r
+  @param[in]  OpCodeHandle  Handle to the buffer of opcodes.\r
+\r
+  @retval NULL   There is not enough space left in Buffer to add the opcode.\r
+  @retval Other  A pointer to the created opcode.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+HiiCreateEndOpCode (\r
+  IN VOID  *OpCodeHandle\r
+  );\r
+\r
+/**\r
+  Create EFI_IFR_ONE_OF_OPTION_OP opcode.\r
+\r
+  If OpCodeHandle is NULL, then ASSERT().\r
+  If Type is invalid, then ASSERT().\r
+  If Flags is invalid, then ASSERT().\r
+\r
+  @param[in]  OpCodeHandle  Handle to the buffer of opcodes.\r
+  @param[in]  StringId      StringId for the option\r
+  @param[in]  Flags         Flags for the option\r
+  @param[in]  Type          Type for the option\r
+  @param[in]  Value         Value for the option\r
+\r
+  @retval NULL   There is not enough space left in Buffer to add the opcode.\r
+  @retval Other  A pointer to the created opcode.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+HiiCreateOneOfOptionOpCode (\r
+  IN VOID    *OpCodeHandle,\r
+  IN UINT16  StringId,\r
+  IN UINT8   Flags,\r
+  IN UINT8   Type,\r
+  IN UINT64  Value\r
+  );\r
+\r
+/**\r
+  Create EFI_IFR_DEFAULT_OP opcode.\r
+\r
+  If OpCodeHandle is NULL, then ASSERT().\r
+  If Type is invalid, then ASSERT().\r
+\r
+  @param[in]  OpCodeHandle  Handle to the buffer of opcodes.\r
+  @param[in]  DefaultId     DefaultId for the default\r
+  @param[in]  Type          Type for the default\r
+  @param[in]  Value         Value for the default\r
+\r
+  @retval NULL   There is not enough space left in Buffer to add the opcode.\r
+  @retval Other  A pointer to the created opcode.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+HiiCreateDefaultOpCode (\r
+  IN VOID    *OpCodeHandle,\r
+  IN UINT16  DefaultId,\r
+  IN UINT8   Type,\r
+  IN UINT64  Value\r
+  );\r
+\r
+/**\r
+  Create EFI_IFR_GUID opcode.\r
+\r
+  If OpCodeHandle is NULL, then ASSERT().\r
+  If Guid is NULL, then ASSERT().\r
+  If OpCodeSize < sizeof (EFI_IFR_GUID), then ASSERT().\r
+\r
+  @param[in]  OpCodeHandle  Handle to the buffer of opcodes.\r
+  @param[in]  Guid          Pointer to EFI_GUID of this guided opcode.\r
+  @param[in]  GuidOpCode    Pointer to an EFI_IFR_GUID opcode.  This is an \r
+                            optional parameter that may be NULL.  If this\r
+                            parameter is NULL, then the GUID extension \r
+                            region of the created opcode is filled with zeros.\r
+                            If this parameter is not NULL, then the GUID \r
+                            extension region of GuidData will be copied to \r
+                            the GUID extension region of the created opcode.\r
+  @param[in]  OpCodeSize    The size, in bytes, of created opcode.  This value \r
+                            must be >= sizeof(EFI_IFR_GUID).\r
+\r
+  @retval NULL   There is not enough space left in Buffer to add the opcode.\r
+  @retval Other  A pointer to the created opcode.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+HiiCreateGuidOpCode (\r
+  IN VOID            *OpCodeHandle,\r
+  IN CONST EFI_GUID  *Guid,\r
+  IN CONST VOID      *GuidOpCode,    OPTIONAL\r
+  IN UINTN           OpCodeSize\r
+  );\r
+\r
+/**\r
+  Create EFI_IFR_ACTION_OP opcode.\r
+\r
+  If OpCodeHandle is NULL, then ASSERT().\r
+  If any reserved bits are set in QuestionFlags, then ASSERT().\r
+\r
+  @param[in]  OpCodeHandle  Handle to the buffer of opcodes.\r
+  @param[in]  QuestionId      Question ID\r
+  @param[in]  Prompt          String ID for Prompt\r
+  @param[in]  Help            String ID for Help\r
+  @param[in]  QuestionFlags   Flags in Question Header\r
+  @param[in]  QuestionConfig  String ID for configuration\r
+\r
+  @retval NULL   There is not enough space left in Buffer to add the opcode.\r
+  @retval Other  A pointer to the created opcode.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+HiiCreateActionOpCode (\r
+  IN VOID             *OpCodeHandle,\r
+  IN EFI_QUESTION_ID  QuestionId,\r
+  IN EFI_STRING_ID    Prompt,\r
+  IN EFI_STRING_ID    Help,\r
+  IN UINT8            QuestionFlags,\r
+  IN EFI_STRING_ID    QuestionConfig\r
+  );\r
+\r
+/**\r
+  Create EFI_IFR_SUBTITLE_OP opcode.\r
+\r
+  If OpCodeHandle is NULL, then ASSERT().\r
+  If any reserved bits are set in Flags, then ASSERT().\r
+  If Scope > 1, then ASSERT().\r
+\r
+  @param[in]  OpCodeHandle  Handle to the buffer of opcodes.\r
+  @param[in]  Prompt      String ID for Prompt\r
+  @param[in]  Help        String ID for Help\r
+  @param[in]  Flags       Subtitle opcode flags\r
+  @param[in]  Scope       1 if this opcpde is the beginning of a new scope.\r
+                          0 if this opcode is within the current scope.\r
+\r
+  @retval NULL   There is not enough space left in Buffer to add the opcode.\r
+  @retval Other  A pointer to the created opcode.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+HiiCreateSubTitleOpCode (\r
+  IN VOID           *OpCodeHandle,\r
+  IN EFI_STRING_ID  Prompt,\r
+  IN EFI_STRING_ID  Help,\r
+  IN UINT8          Flags,\r
+  IN UINT8          Scope\r
+  );\r
+\r
+/**\r
+  Create EFI_IFR_REF_OP opcode.\r
+\r
+  If OpCodeHandle is NULL, then ASSERT().\r
+  If any reserved bits are set in QuestionFlags, then ASSERT().\r
+\r
+  @param[in]  OpCodeHandle   Handle to the buffer of opcodes.\r
+  @param[in]  FormId         Destination Form ID\r
+  @param[in]  Prompt         String ID for Prompt\r
+  @param[in]  Help           String ID for Help\r
+  @param[in]  QuestionFlags  Flags in Question Header\r
+  @param[in]  QuestionId     Question ID\r
+\r
+  @retval NULL   There is not enough space left in Buffer to add the opcode.\r
+  @retval Other  A pointer to the created opcode.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+HiiCreateGotoOpCode (\r
+  IN VOID             *OpCodeHandle,\r
+  IN EFI_FORM_ID      FormId,\r
+  IN EFI_STRING_ID    Prompt,\r
+  IN EFI_STRING_ID    Help,\r
+  IN UINT8            QuestionFlags,\r
+  IN EFI_QUESTION_ID  QuestionId\r
+  );\r
+\r
+/**\r
+  Create EFI_IFR_CHECKBOX_OP opcode.\r
+\r
+  If OpCodeHandle is NULL, then ASSERT().\r
+  If any reserved bits are set in QuestionFlags, then ASSERT().\r
+  If any reserved bits are set in CheckBoxFlags, then ASSERT().\r
+\r
+  @param[in]  OpCodeHandle          Handle to the buffer of opcodes.\r
+  @param[in]  QuestionId            Question ID\r
+  @param[in]  VarStoreId            Storage ID\r
+  @param[in]  VarOffset             Offset in Storage\r
+  @param[in]  Prompt                String ID for Prompt\r
+  @param[in]  Help                  String ID for Help\r
+  @param[in]  QuestionFlags         Flags in Question Header\r
+  @param[in]  CheckBoxFlags         Flags for checkbox opcode\r
+  @param[in]  DefaultsOpCodeHandle  Handle for a buffer of DEFAULT opcodes.  This\r
+                                    is an optional parameter that may be NULL.\r
+\r
+  @retval NULL   There is not enough space left in Buffer to add the opcode.\r
+  @retval Other  A pointer to the created opcode.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+HiiCreateCheckBoxOpCode (\r
+  IN VOID             *OpCodeHandle,\r
+  IN EFI_QUESTION_ID  QuestionId,\r
+  IN EFI_VARSTORE_ID  VarStoreId,\r
+  IN UINT16           VarOffset,\r
+  IN EFI_STRING_ID    Prompt,\r
+  IN EFI_STRING_ID    Help,\r
+  IN UINT8            QuestionFlags,\r
+  IN UINT8            CheckBoxFlags,\r
+  IN VOID             *DefaultsOpCodeHandle  OPTIONAL\r
+  );\r
+\r
+/**\r
+  Create EFI_IFR_NUMERIC_OP opcode.\r
+\r
+  If OpCodeHandle is NULL, then ASSERT().\r
+  If any reserved bits are set in QuestionFlags, then ASSERT().\r
+  If any reserved bits are set in NumericFlags, then ASSERT().\r
+\r
+  @param[in]  OpCodeHandle          Handle to the buffer of opcodes.\r
+  @param[in]  QuestionId            Question ID\r
+  @param[in]  VarStoreId            Storage ID\r
+  @param[in]  VarOffset             Offset in Storage\r
+  @param[in]  Prompt                String ID for Prompt\r
+  @param[in]  Help                  String ID for Help\r
+  @param[in]  QuestionFlags         Flags in Question Header\r
+  @param[in]  NumericFlags          Flags for numeric opcode\r
+  @param[in]  Minimum               Numeric minimum value\r
+  @param[in]  Maximum               Numeric maximum value\r
+  @param[in]  Step                  Numeric step for edit\r
+  @param[in]  DefaultsOpCodeHandle  Handle for a buffer of DEFAULT opcodes.  This\r
+                                    is an optional parameter that may be NULL.\r
+\r
+  @retval NULL   There is not enough space left in Buffer to add the opcode.\r
+  @retval Other  A pointer to the created opcode.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+HiiCreateNumericOpCode (\r
+  IN VOID             *OpCodeHandle,\r
+  IN EFI_QUESTION_ID  QuestionId,\r
+  IN EFI_VARSTORE_ID  VarStoreId,\r
+  IN UINT16           VarOffset,\r
+  IN EFI_STRING_ID    Prompt,\r
+  IN EFI_STRING_ID    Help,\r
+  IN UINT8            QuestionFlags,\r
+  IN UINT8            NumericFlags,\r
+  IN UINT64           Minimum,\r
+  IN UINT64           Maximum,\r
+  IN UINT64           Step,\r
+  IN VOID             *DefaultsOpCodeHandle  OPTIONAL\r
+  );\r
+\r
+/**\r
+  Create EFI_IFR_STRING_OP opcode.\r
+\r
+  If OpCodeHandle is NULL, then ASSERT().\r
+  If any reserved bits are set in QuestionFlags, then ASSERT().\r
+  If any reserved bits are set in StringFlags, then ASSERT().\r
+\r
+  @param[in]  OpCodeHandle          Handle to the buffer of opcodes.\r
+  @param[in]  QuestionId            Question ID\r
+  @param[in]  VarStoreId            Storage ID\r
+  @param[in]  VarOffset             Offset in Storage\r
+  @param[in]  Prompt                String ID for Prompt\r
+  @param[in]  Help                  String ID for Help\r
+  @param[in]  QuestionFlags         Flags in Question Header\r
+  @param[in]  StringFlags           Flags for string opcode\r
+  @param[in]  MinSize               String minimum length\r
+  @param[in]  MaxSize               String maximum length\r
+  @param[in]  DefaultsOpCodeHandle  Handle for a buffer of DEFAULT opcodes.  This\r
+                                    is an optional parameter that may be NULL.\r
+\r
+  @retval NULL   There is not enough space left in Buffer to add the opcode.\r
+  @retval Other  A pointer to the created opcode.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+HiiCreateStringOpCode (\r
+  IN VOID             *OpCodeHandle,\r
+  IN EFI_QUESTION_ID  QuestionId,\r
+  IN EFI_VARSTORE_ID  VarStoreId,\r
+  IN UINT16           VarOffset,\r
+  IN EFI_STRING_ID    Prompt,\r
+  IN EFI_STRING_ID    Help,\r
+  IN UINT8            QuestionFlags,\r
+  IN UINT8            StringFlags,\r
+  IN UINT8            MinSize,\r
+  IN UINT8            MaxSize,\r
+  IN VOID             *DefaultsOpCodeHandle  OPTIONAL\r
+  );\r
+\r
+/**\r
+  Create EFI_IFR_ONE_OF_OP opcode.\r
+\r
+  If OpCodeHandle is NULL, then ASSERT().\r
+  If any reserved bits are set in QuestionFlags, then ASSERT().\r
+  If any reserved bits are set in OneOfFlags, then ASSERT().\r
+\r
+  @param[in]  OpCodeHandle          Handle to the buffer of opcodes.\r
+  @param[in]  QuestionId            Question ID\r
+  @param[in]  VarStoreId            Storage ID\r
+  @param[in]  VarOffset             Offset in Storage\r
+  @param[in]  Prompt                String ID for Prompt\r
+  @param[in]  Help                  String ID for Help\r
+  @param[in]  QuestionFlags         Flags in Question Header\r
+  @param[in]  OneOfFlags            Flags for oneof opcode\r
+  @param[in]  OptionsOpCodeHandle   Handle for a buffer of ONE_OF_OPTION opcodes.\r
+  @param[in]  DefaultsOpCodeHandle  Handle for a buffer of DEFAULT opcodes.  This\r
+                                    is an optional parameter that may be NULL.\r
+\r
+  @retval NULL   There is not enough space left in Buffer to add the opcode.\r
+  @retval Other  A pointer to the created opcode.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+HiiCreateOneOfOpCode (\r
+  IN VOID             *OpCodeHandle,\r
+  IN EFI_QUESTION_ID  QuestionId,\r
+  IN EFI_VARSTORE_ID  VarStoreId,\r
+  IN UINT16           VarOffset,\r
+  IN EFI_STRING_ID    Prompt,\r
+  IN EFI_STRING_ID    Help,\r
+  IN UINT8            QuestionFlags,\r
+  IN UINT8            OneOfFlags,\r
+  IN VOID             *OptionsOpCodeHandle,\r
+  IN VOID             *DefaultsOpCodeHandle  OPTIONAL\r
+  );\r
+\r
+/**\r
+  Create EFI_IFR_ORDERED_LIST_OP opcode.\r
+\r
+  If OpCodeHandle is NULL, then ASSERT().\r
+  If any reserved bits are set in QuestionFlags, then ASSERT().\r
+  If any reserved bits are set in OrderedListFlags, then ASSERT().\r
+\r
+  @param[in]  OpCodeHandle          Handle to the buffer of opcodes.\r
+  @param[in]  QuestionId            Question ID\r
+  @param[in]  VarStoreId            Storage ID\r
+  @param[in]  VarOffset             Offset in Storage\r
+  @param[in]  Prompt                String ID for Prompt\r
+  @param[in]  Help                  String ID for Help\r
+  @param[in]  QuestionFlags         Flags in Question Header\r
+  @param[in]  OrderedListFlags      Flags for ordered list opcode\r
+  @param[in]  DataType              Type for option value\r
+  @param[in]  MaxContainers         Maximum count for options in this ordered list\r
+  @param[in]  OptionsOpCodeHandle   Handle for a buffer of ONE_OF_OPTION opcodes.\r
+  @param[in]  DefaultsOpCodeHandle  Handle for a buffer of DEFAULT opcodes.  This\r
+                                    is an optional parameter that may be NULL.\r
+\r
+  @retval NULL   There is not enough space left in Buffer to add the opcode.\r
+  @retval Other  A pointer to the created opcode.\r
+\r
+**/\r
+UINT8 *\r
+EFIAPI\r
+HiiCreateOrderedListOpCode (\r
+  IN VOID             *OpCodeHandle,\r
+  IN EFI_QUESTION_ID  QuestionId,\r
+  IN EFI_VARSTORE_ID  VarStoreId,\r
+  IN UINT16           VarOffset,\r
+  IN EFI_STRING_ID    Prompt,\r
+  IN EFI_STRING_ID    Help,\r
+  IN UINT8            QuestionFlags,\r
+  IN UINT8            OrderedListFlags,\r
+  IN UINT8            DataType,\r
+  IN UINT8            MaxContainers,\r
+  IN VOID             *OptionsOpCodeHandle,\r
+  IN VOID             *DefaultsOpCodeHandle  OPTIONAL\r
+  );\r
+\r
+/**\r
+  This function updates a form that has previously been registered with the HII \r
+  Database.  This function will perform at most one update operation.\r
+    \r
+  The form to update is specified by Handle, FormSetGuid, and FormId.  Binary \r
+  comparisons of IFR opcodes are performed from the beginning of the form being \r
+  updated until an IFR opcode is found that exactly matches the first IFR opcode \r
+  specifed by StartOpCodeHandle.  The following rules are used to determine if\r
+  an insert, replace, or delete operation is performed.\r
+  \r
+  1) If no matches are found, then NULL is returned.  \r
+  2) If a match is found, and EndOpCodeHandle is NULL, then all of the IFR opcodes\r
+     from StartOpcodeHandle except the first opcode are inserted immediately after \r
+     the matching IFR opcode in the form beng updated.\r
+  3) If a match is found, and EndOpCodeHandle is not NULL, then a search is made \r
+     from the matching IFR opcode until an IFR opcode exatly matches the first \r
+     IFR opcode specified by EndOpCodeHandle.  If no match is found for the first\r
+     IFR opcode specified by EndOpCodeHandle, then NULL is returned.  If a match\r
+     is found, then all of the IFR opcodes between the start match and the end \r
+     match are deleted from the form being updated and all of the IFR opcodes\r
+     from StartOpcodeHandle except the first opcode are inserted immediately after \r
+     the matching start IFR opcode.  If StartOpCcodeHandle only contains one\r
+     IFR instruction, then the result of ths operation will delete all of the IFR\r
+     opcodes between the start end matches.\r
+\r
+  If HiiHandle is NULL, then ASSERT().\r
+  If StartOpCodeHandle is NULL, then ASSERT().\r
+\r
+  @param[in]  HiiHandle          The HII Handle of the form to update.\r
+  @param[in]  FormSetGuid        The Formset GUID of the form to update.  This\r
+                                 is an optional parameter that may be NULL.\r
+                                 If it is NULL, all FormSet will be updated.\r
+  @param[in]  FormId             The ID of the form to update.\r
+  @param[in]  StartOpCodeHandle  An OpCode Handle that contains the set of IFR \r
+                                 opcodes to be inserted or replaced in the form.\r
+                                 The first IFR instruction in StartOpCodeHandle \r
+                                 is used to find matching IFR opcode in the \r
+                                 form. \r
+  @param[in]  EndOpCodeHandle    An OpCcode Handle that contains the IFR opcode\r
+                                 that marks the end of a replace operation in\r
+                                 the form.  This is an optional parameter that\r
+                                 may be NULL.  If it is NULL, then an the IFR\r
+                                 opcodes specified by StartOpCodeHandle are \r
+                                 inserted into the form.\r
+  \r
+  @retval EFI_OUT_OF_RESOURCES   No enough memory resource is allocated.\r
+  @retval EFI_NOT_FOUND          The following cases will return EFI_NOT_FOUND.\r
+                                 1) The form specified by HiiHandle, FormSetGuid, \r
+                                 and FormId could not be found in the HII Database.\r
+                                 2) No IFR opcodes in the target form match the first\r
+                                 IFR opcode in StartOpCodeHandle.\r
+                                 3) EndOpCOde is not NULL, and no IFR opcodes in the \r
+                                 target form following a matching start opcode match \r
+                                 the first IFR opcode in EndOpCodeHandle.\r
+  @retval EFI_SUCCESS            The matched form is updated by StartOpcode.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+HiiUpdateForm (\r
+  IN EFI_HII_HANDLE  HiiHandle,\r
+  IN EFI_GUID        *FormSetGuid,        OPTIONAL\r
+  IN EFI_FORM_ID     FormId,\r
+  IN VOID            *StartOpcodeHandle,\r
+  IN VOID            *EndOpcodeHandle     OPTIONAL\r
+  );\r
+\r
+#endif\r
diff --git a/MdeModulePkg/Include/Library/UefiHiiServicesLib.h b/MdeModulePkg/Include/Library/UefiHiiServicesLib.h
new file mode 100644 (file)
index 0000000..bd49038
--- /dev/null
@@ -0,0 +1,52 @@
+/** @file\r
+  Provides global variables that are pointers to the UEFI HII related protocols.\r
+  All of the UEFI HII related protocols are optional, so the consumers of this\r
+  library class must verify that the global variable pointers are not NULL before\r
+  use.   \r
+\r
+  Copyright (c) 2006 - 2009, 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
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\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
+**/\r
+\r
+#ifndef __UEFI_HII_SERVICES_LIB_H__\r
+#define __UEFI_HII_SERVICES_LIB_H__\r
+\r
+#include <Protocol/HiiFont.h>\r
+#include <Protocol/HiiString.h>\r
+#include <Protocol/HiiImage.h>\r
+#include <Protocol/HiiDatabase.h>\r
+#include <Protocol/HiiConfigRouting.h>\r
+\r
+///\r
+/// Pointer to the UEFI HII Font Protocol\r
+///\r
+extern EFI_HII_FONT_PROTOCOL  *gHiiFont;\r
+\r
+///\r
+/// Pointer to the UEFI HII String Protocol\r
+///\r
+extern EFI_HII_STRING_PROTOCOL  *gHiiString;\r
+\r
+///\r
+/// Pointer to the UEFI HII Image Protocol\r
+///\r
+extern EFI_HII_IMAGE_PROTOCOL  *gHiiImage;\r
+\r
+///\r
+/// Pointer to the UEFI HII Database Protocol\r
+///\r
+extern EFI_HII_DATABASE_PROTOCOL  *gHiiDatabase;\r
+\r
+///\r
+/// Pointer to the UEFI HII Config Rounting Protocol\r
+///\r
+extern EFI_HII_CONFIG_ROUTING_PROTOCOL  *gHiiConfigRouting;\r
+\r
+#endif\r