]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
Roll back changes to apply GetBestLanguage() in HiiDataBase. Exact language match...
[mirror_edk2.git] / MdeModulePkg / Universal / HiiDatabaseDxe / HiiDatabase.h
index f19813298edfff2d11d0d7639751db57c448d4fd..81f42c5bf2b96e69178e7d0a26775ad1ef0076b1 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
+Private structures definitions in HiiDatabase.\r
 \r
-Copyright (c) 2007, Intel Corporation\r
+Copyright (c) 2007 - 2009, 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
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -9,25 +10,13 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-Module Name:\r
-\r
-    HiiDatabase.h\r
-\r
-Abstract:\r
-\r
-    Private structures definitions in HiiDatabase.\r
-\r
-Revision History\r
-\r
-\r
 **/\r
 \r
 #ifndef __HII_DATABASE_PRIVATE_H__\r
 #define __HII_DATABASE_PRIVATE_H__\r
 \r
-#include <PiDxe.h>\r
+#include <Uefi.h>\r
 \r
-#include <Protocol/ConsoleControl.h>\r
 #include <Protocol/DevicePath.h>\r
 #include <Protocol/HiiFont.h>\r
 #include <Protocol/HiiImage.h>\r
@@ -38,6 +27,7 @@ Revision History
 #include <Protocol/SimpleTextOut.h>\r
 \r
 #include <Guid/HiiKeyBoardLayout.h>\r
+#include <Guid/GlobalVariable.h>\r
 \r
 \r
 #include <Library/DebugLib.h>\r
@@ -47,6 +37,11 @@ Revision History
 #include <Library/BaseLib.h>\r
 #include <Library/DevicePathLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
+#include <Library/PrintLib.h>\r
+\r
 \r
 #define HII_DATABASE_NOTIFY_GUID \\r
   { \\r
@@ -67,6 +62,38 @@ Revision History
 #define BITMAP_LEN_8_BIT(Width, Height)  ((Width) * (Height))\r
 #define BITMAP_LEN_24_BIT(Width, Height) ((Width) * (Height) * 3)\r
 \r
+//\r
+// IFR data structure\r
+//\r
+// BASE_CR (a, IFR_DEFAULT_VALUE_DATA, Entry) to get the whole structure.\r
+\r
+typedef struct {\r
+  LIST_ENTRY          Entry;             // Link to VarStorage\r
+  EFI_GUID            Guid;\r
+  CHAR16              *Name;\r
+  EFI_VARSTORE_ID     VarStoreId;\r
+  UINT16              Size;\r
+  LIST_ENTRY          BlockEntry;        // Link to its Block array\r
+} IFR_VARSTORAGE_DATA;\r
+\r
+typedef struct {\r
+  LIST_ENTRY          Entry;             // Link to Block array\r
+  UINT16              Offset;\r
+  UINT16              Width;\r
+  EFI_QUESTION_ID     QuestionId;\r
+  UINT8               OpCode;\r
+  UINT8               Scope;\r
+  LIST_ENTRY          DefaultValueEntry; // Link to its default value array\r
+} IFR_BLOCK_DATA;\r
+\r
+typedef struct {\r
+  LIST_ENTRY          Entry;\r
+  UINT8               OpCode;\r
+  EFI_STRING_ID       DefaultName;\r
+  UINT16              DefaultId;\r
+  UINT64              Value;\r
+} IFR_DEFAULT_DATA;\r
+\r
 //\r
 // Storage types\r
 //\r
@@ -74,7 +101,7 @@ Revision History
 #define EFI_HII_VARSTORE_NAME_VALUE        1\r
 #define EFI_HII_VARSTORE_EFI_VARIABLE      2\r
 \r
-#define HII_FORMSET_STORAGE_SIGNATURE           EFI_SIGNATURE_32 ('H', 'S', 'T', 'G')\r
+#define HII_FORMSET_STORAGE_SIGNATURE           SIGNATURE_32 ('H', 'S', 'T', 'G')\r
 typedef struct {\r
   UINTN               Signature;\r
   LIST_ENTRY          Entry;\r
@@ -88,13 +115,11 @@ typedef struct {
   UINT16              Size;\r
 } HII_FORMSET_STORAGE;\r
 \r
-#define HII_FORMSET_STORAGE_FROM_LINK(a)  CR (a, HII_FORMSET_STORAGE, Link, HII_FORMSET_STORAGE_SIGNATURE)\r
-\r
 \r
 //\r
 // String Package definitions\r
 //\r
-#define HII_STRING_PACKAGE_SIGNATURE    EFI_SIGNATURE_32 ('h','i','s','p')\r
+#define HII_STRING_PACKAGE_SIGNATURE    SIGNATURE_32 ('h','i','s','p')\r
 typedef struct _HII_STRING_PACKAGE_INSTANCE {\r
   UINTN                                 Signature;\r
   EFI_HII_STRING_PACKAGE_HDR            *StringPkgHdr;\r
@@ -107,7 +132,7 @@ typedef struct _HII_STRING_PACKAGE_INSTANCE {
 //\r
 // Form Package definitions\r
 //\r
-#define HII_IFR_PACKAGE_SIGNATURE       EFI_SIGNATURE_32 ('h','f','r','p')\r
+#define HII_IFR_PACKAGE_SIGNATURE       SIGNATURE_32 ('h','f','r','p')\r
 typedef struct _HII_IFR_PACKAGE_INSTANCE {\r
   UINTN                                 Signature;\r
   EFI_HII_PACKAGE_HEADER                FormPkgHdr;\r
@@ -118,7 +143,7 @@ typedef struct _HII_IFR_PACKAGE_INSTANCE {
 //\r
 // Simple Font Package definitions\r
 //\r
-#define HII_S_FONT_PACKAGE_SIGNATURE    EFI_SIGNATURE_32 ('h','s','f','p')\r
+#define HII_S_FONT_PACKAGE_SIGNATURE    SIGNATURE_32 ('h','s','f','p')\r
 typedef struct _HII_SIMPLE_FONT_PACKAGE_INSTANCE {\r
   UINTN                                 Signature;\r
   EFI_HII_SIMPLE_FONT_PACKAGE_HDR       *SimpleFontPkgHdr;\r
@@ -128,7 +153,7 @@ typedef struct _HII_SIMPLE_FONT_PACKAGE_INSTANCE {
 //\r
 // Font Package definitions\r
 //\r
-#define HII_FONT_PACKAGE_SIGNATURE      EFI_SIGNATURE_32 ('h','i','f','p')\r
+#define HII_FONT_PACKAGE_SIGNATURE      SIGNATURE_32 ('h','i','f','p')\r
 typedef struct _HII_FONT_PACKAGE_INSTANCE {\r
   UINTN                                 Signature;\r
   EFI_HII_FONT_PACKAGE_HDR              *FontPkgHdr;\r
@@ -137,7 +162,7 @@ typedef struct _HII_FONT_PACKAGE_INSTANCE {
   LIST_ENTRY                            GlyphInfoList;\r
 } HII_FONT_PACKAGE_INSTANCE;\r
 \r
-#define HII_GLYPH_INFO_SIGNATURE        EFI_SIGNATURE_32 ('h','g','i','s')\r
+#define HII_GLYPH_INFO_SIGNATURE        SIGNATURE_32 ('h','g','i','s')\r
 typedef struct _HII_GLYPH_INFO {\r
   UINTN                                 Signature;\r
   LIST_ENTRY                            Entry;\r
@@ -145,7 +170,7 @@ typedef struct _HII_GLYPH_INFO {
   EFI_HII_GLYPH_INFO                    Cell;\r
 } HII_GLYPH_INFO;\r
 \r
-#define HII_FONT_INFO_SIGNATURE         EFI_SIGNATURE_32 ('h','l','f','i')\r
+#define HII_FONT_INFO_SIGNATURE         SIGNATURE_32 ('h','l','f','i')\r
 typedef struct _HII_FONT_INFO {\r
   UINTN                                 Signature;\r
   LIST_ENTRY                            Entry;\r
@@ -153,7 +178,7 @@ typedef struct _HII_FONT_INFO {
   UINT8                                 FontId;\r
 } HII_FONT_INFO;\r
 \r
-#define HII_GLOBAL_FONT_INFO_SIGNATURE  EFI_SIGNATURE_32 ('h','g','f','i')\r
+#define HII_GLOBAL_FONT_INFO_SIGNATURE  SIGNATURE_32 ('h','g','f','i')\r
 typedef struct _HII_GLOBAL_FONT_INFO {\r
   UINTN                                 Signature;\r
   LIST_ENTRY                            Entry;\r
@@ -179,7 +204,7 @@ typedef struct _HII_IMAGE_PACKAGE_INSTANCE {
 //\r
 // Keyboard Layout Pacakge definitions\r
 //\r
-#define HII_KB_LAYOUT_PACKAGE_SIGNATURE EFI_SIGNATURE_32 ('h','k','l','p')\r
+#define HII_KB_LAYOUT_PACKAGE_SIGNATURE SIGNATURE_32 ('h','k','l','p')\r
 typedef struct _HII_KEYBOARD_LAYOUT_PACKAGE_INSTANCE {\r
   UINTN                                 Signature;\r
   UINT8                                 *KeyboardPkg;\r
@@ -189,7 +214,7 @@ typedef struct _HII_KEYBOARD_LAYOUT_PACKAGE_INSTANCE {
 //\r
 // Guid Package definitions\r
 //\r
-#define HII_GUID_PACKAGE_SIGNATURE      EFI_SIGNATURE_32 ('h','i','g','p')\r
+#define HII_GUID_PACKAGE_SIGNATURE      SIGNATURE_32 ('h','i','g','p')\r
 typedef struct _HII_GUID_PACKAGE_INSTANCE {\r
   UINTN                                 Signature;\r
   UINT8                                 *GuidPkg;\r
@@ -212,7 +237,7 @@ typedef struct _HII_DATABASE_PACKAGE_LIST_INSTANCE {
   UINT8                                 *DevicePathPkg;\r
 } HII_DATABASE_PACKAGE_LIST_INSTANCE;\r
 \r
-#define HII_HANDLE_SIGNATURE            EFI_SIGNATURE_32 ('h','i','h','l')\r
+#define HII_HANDLE_SIGNATURE            SIGNATURE_32 ('h','i','h','l')\r
 \r
 typedef struct {\r
   UINTN               Signature;\r
@@ -220,7 +245,7 @@ typedef struct {
   UINTN               Key;\r
 } HII_HANDLE;\r
 \r
-#define HII_DATABASE_RECORD_SIGNATURE   EFI_SIGNATURE_32 ('h','i','d','r')\r
+#define HII_DATABASE_RECORD_SIGNATURE   SIGNATURE_32 ('h','i','d','r')\r
 \r
 typedef struct _HII_DATABASE_RECORD {\r
   UINTN                                 Signature;\r
@@ -230,7 +255,7 @@ typedef struct _HII_DATABASE_RECORD {
   LIST_ENTRY                            DatabaseEntry;\r
 } HII_DATABASE_RECORD;\r
 \r
-#define HII_DATABASE_NOTIFY_SIGNATURE   EFI_SIGNATURE_32 ('h','i','d','n')\r
+#define HII_DATABASE_NOTIFY_SIGNATURE   SIGNATURE_32 ('h','i','d','n')\r
 \r
 typedef struct _HII_DATABASE_NOTIFY {\r
   UINTN                                 Signature;\r
@@ -242,16 +267,14 @@ typedef struct _HII_DATABASE_NOTIFY {
   LIST_ENTRY                            DatabaseNotifyEntry;\r
 } HII_DATABASE_NOTIFY;\r
 \r
-#define HII_DATABASE_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('H', 'i', 'D', 'p')\r
+#define HII_DATABASE_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('H', 'i', 'D', 'p')\r
 \r
 typedef struct _HII_DATABASE_PRIVATE_DATA {\r
   UINTN                                 Signature;\r
   LIST_ENTRY                            DatabaseList;\r
   LIST_ENTRY                            DatabaseNotifyList;\r
   EFI_HII_FONT_PROTOCOL                 HiiFont;\r
-#ifndef DISABLE_UNUSED_HII_PROTOCOLS\r
   EFI_HII_IMAGE_PROTOCOL                HiiImage;\r
-#endif\r
   EFI_HII_STRING_PROTOCOL               HiiString;\r
   EFI_HII_DATABASE_PROTOCOL             HiiDatabase;\r
   EFI_HII_CONFIG_ROUTING_PROTOCOL       ConfigRouting;\r
@@ -303,7 +326,7 @@ typedef struct _HII_DATABASE_PRIVATE_DATA {
 //\r
 \r
 /**\r
-  This function checks whether a handle is a valid EFI_HII_HANDLE\r
+  This function checks whether a handle is a valid EFI_HII_HANDLE.\r
 \r
   @param  Handle                  Pointer to a EFI_HII_HANDLE\r
 \r
@@ -314,8 +337,7 @@ typedef struct _HII_DATABASE_PRIVATE_DATA {
 BOOLEAN\r
 IsHiiHandleValid (\r
   EFI_HII_HANDLE Handle\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -347,10 +369,33 @@ IsFontInfoExisted (
   IN  EFI_FONT_INFO_MASK        *FontInfoMask,   OPTIONAL\r
   IN  EFI_FONT_HANDLE           FontHandle,      OPTIONAL\r
   OUT HII_GLOBAL_FONT_INFO      **GlobalFontInfo OPTIONAL\r
+  );\r
+\r
+/**\r
+\r
+   This function invokes the matching registered function.\r
+    \r
+   @param  Private           HII Database driver private structure.\r
+   @param  NotifyType        The type of change concerning the database.\r
+   @param  PackageInstance   Points to the package referred to by the notification.\r
+   @param  PackageType       Package type\r
+   @param  Handle            The handle of the package list which contains the specified package.\r
+    \r
+   @retval EFI_SUCCESS            Already checked all registered function and invoked \r
+                                  if matched.\r
+   @retval EFI_INVALID_PARAMETER  Any input parameter is not valid.\r
+     \r
+**/\r
+EFI_STATUS\r
+InvokeRegisteredFunction (\r
+  IN HII_DATABASE_PRIVATE_DATA    *Private, \r
+  IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType,\r
+  IN VOID                         *PackageInstance,\r
+  IN UINT8                        PackageType,\r
+  IN EFI_HII_HANDLE               Handle\r
   )\r
 ;\r
 \r
-\r
 /**\r
   Retrieve system default font and color.\r
 \r
@@ -371,8 +416,7 @@ GetSystemFont (
   IN  HII_DATABASE_PRIVATE_DATA      *Private,\r
   OUT EFI_FONT_DISPLAY_INFO          **FontInfo,\r
   OUT UINTN                          *FontInfoSize OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -408,8 +452,7 @@ FindStringBlock (
   OUT UINT8                           **StringBlockAddr, OPTIONAL\r
   OUT UINTN                           *StringTextOffset, OPTIONAL\r
   OUT EFI_STRING_ID                   *LastStringId OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -440,8 +483,35 @@ FindGlyphBlock (
   OUT UINT8                          **GlyphBuffer, OPTIONAL\r
   OUT EFI_HII_GLYPH_INFO             *Cell, OPTIONAL\r
   OUT UINTN                          *GlyphBufferLen OPTIONAL\r
-  )\r
-;\r
+  );\r
+\r
+/**\r
+  This function exports Form packages to a buffer.\r
+  This is a internal function.\r
+\r
+  @param  Private                Hii database private structure.\r
+  @param  Handle                 Identification of a package list.\r
+  @param  PackageList            Pointer to a package list which will be exported.\r
+  @param  UsedSize               The length of buffer be used.\r
+  @param  BufferSize             Length of the Buffer.\r
+  @param  Buffer                 Allocated space for storing exported data.\r
+  @param  ResultSize             The size of the already exported content of  this\r
+                                 package list.\r
+\r
+  @retval EFI_SUCCESS            Form Packages are exported successfully.\r
+  @retval EFI_INVALID_PARAMETER  Any input parameter is invalid.\r
+\r
+**/\r
+EFI_STATUS\r
+ExportFormPackages (\r
+  IN HII_DATABASE_PRIVATE_DATA          *Private,\r
+  IN EFI_HII_HANDLE                     Handle,\r
+  IN HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList,\r
+  IN UINTN                              UsedSize,\r
+  IN UINTN                              BufferSize,\r
+  IN OUT VOID                           *Buffer,\r
+  IN OUT UINTN                          *ResultSize\r
+  );\r
 \r
 //\r
 // EFI_HII_FONT_PROTOCOL protocol interfaces\r
@@ -468,7 +538,10 @@ FindGlyphBlock (
                                   will be allocated to hold the generated image and\r
                                   the pointer updated on exit. It is the caller's\r
                                   responsibility to free this buffer.\r
-  @param  BltX,BLTY               Specifies the offset from the left and top edge\r
+  @param  BltX                    Together with BltX, Specifies the offset from the left and top edge\r
+                                  of the image of the first character cell in the\r
+                                  image.\r
+  @param  BltY                    Together with BltY, Specifies the offset from the left and top edge\r
                                   of the image of the first character cell in the\r
                                   image.\r
   @param  RowInfoArray            If this is non-NULL on entry, then on exit, this\r
@@ -495,7 +568,8 @@ FindGlyphBlock (
   @retval EFI_SUCCESS             The string was successfully rendered.\r
   @retval EFI_OUT_OF_RESOURCES    Unable to allocate an output buffer for\r
                                   RowInfoArray or Blt.\r
-  @retval EFI_INVALID_PARAMETER   The String was NULL.\r
+  @retval EFI_INVALID_PARAMETER The String or Blt.\r
+  @retval EFI_INVALID_PARAMETER Flags were invalid combination..\r
 \r
 **/\r
 EFI_STATUS\r
@@ -511,8 +585,7 @@ HiiStringToImage (
   OUT EFI_HII_ROW_INFO               **RowInfoArray    OPTIONAL,\r
   OUT UINTN                          *RowInfoArraySize OPTIONAL,\r
   OUT UINTN                          *ColumnInfoArray  OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -540,7 +613,10 @@ HiiStringToImage (
                                   will be allocated to hold the generated image and\r
                                   the pointer updated on exit. It is the caller's\r
                                   responsibility to free this buffer.\r
-  @param  BltX,BLTY               Specifies the offset from the left and top edge\r
+  @param  BltX                    Together with BltX, Specifies the offset from the left and top edge\r
+                                  of the image of the first character cell in the\r
+                                  image.\r
+  @param  BltY                    Together with BltY, Specifies the offset from the left and top edge\r
                                   of the image of the first character cell in the\r
                                   image.\r
   @param  RowInfoArray            If this is non-NULL on entry, then on exit, this\r
@@ -567,7 +643,10 @@ HiiStringToImage (
   @retval EFI_SUCCESS             The string was successfully rendered.\r
   @retval EFI_OUT_OF_RESOURCES    Unable to allocate an output buffer for\r
                                   RowInfoArray or Blt.\r
-  @retval EFI_INVALID_PARAMETER   The String was NULL.\r
+  @retval EFI_INVALID_PARAMETER The Blt or PackageList was NULL.\r
+  @retval EFI_INVALID_PARAMETER Flags were invalid combination.\r
+  @retval EFI_NOT_FOUND         The specified PackageList is not in the Database or the stringid is not \r
+                          in the specified PackageList. \r
 \r
 **/\r
 EFI_STATUS\r
@@ -585,8 +664,7 @@ HiiStringIdToImage (
   OUT EFI_HII_ROW_INFO               **RowInfoArray    OPTIONAL,\r
   OUT UINTN                          *RowInfoArraySize OPTIONAL,\r
   OUT UINTN                          *ColumnInfoArray  OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -619,8 +697,7 @@ HiiGetGlyph (
   IN  CONST EFI_FONT_DISPLAY_INFO    *StringInfo,\r
   OUT EFI_IMAGE_OUTPUT               **Blt,\r
   OUT UINTN                          *Baseline OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -635,7 +712,8 @@ HiiGetGlyph (
                                   returned font handle or points to NULL if there\r
                                   are no more matching fonts.\r
   @param  StringInfoIn            Upon entry, points to the font to return\r
-                                  information about.\r
+                                  information about. If NULL, then the information about the system default \r
+                                  font will be returned.\r
   @param  StringInfoOut           Upon return, contains the matching font's\r
                                   information.  If NULL, then no information is\r
                                   returned. It's caller's responsibility to free\r
@@ -647,20 +725,19 @@ HiiGetGlyph (
   @retval EFI_SUCCESS             Matching font returned successfully.\r
   @retval EFI_NOT_FOUND           No matching font was found.\r
   @retval EFI_INVALID_PARAMETER   StringInfoIn is NULL.\r
+  @retval EFI_INVALID_PARAMETER  StringInfoIn->FontInfoMask is an invalid combination.\r
   @retval EFI_OUT_OF_RESOURCES    There were insufficient resources to complete the\r
                                   request.\r
-\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 HiiGetFontInfo (\r
   IN  CONST EFI_HII_FONT_PROTOCOL    *This,\r
   IN  OUT   EFI_FONT_HANDLE          *FontHandle,\r
-  IN  CONST EFI_FONT_DISPLAY_INFO    *StringInfoIn,\r
+  IN  CONST EFI_FONT_DISPLAY_INFO    *StringInfoIn, OPTIONAL\r
   OUT       EFI_FONT_DISPLAY_INFO    **StringInfoOut,\r
   IN  CONST EFI_STRING               String OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 //\r
 // EFI_HII_IMAGE_PROTOCOL interfaces\r
@@ -692,8 +769,7 @@ HiiNewImage (
   IN  EFI_HII_HANDLE                 PackageList,\r
   OUT EFI_IMAGE_ID                   *ImageId,\r
   IN  CONST EFI_IMAGE_INPUT          *Image\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -706,15 +782,15 @@ HiiNewImage (
   @param  ImageId                 The image's id,, which is unique within\r
                                   PackageList.\r
   @param  Image                   Points to the image.\r
-  @param  ImageSize               On entry, points to the size of the buffer\r
-                                  pointed to by Image, in bytes. On return, points\r
-                                  to the length of the image, in bytes.\r
 \r
   @retval EFI_SUCCESS             The new image was returned successfully.\r
   @retval EFI_NOT_FOUND           The image specified by ImageId is not available.\r
+                                                 The specified PackageList is not in the database.\r
   @retval EFI_BUFFER_TOO_SMALL    The buffer specified by ImageSize is too small to\r
                                   hold the image.\r
   @retval EFI_INVALID_PARAMETER   The Image or ImageSize was NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   The bitmap could not be retrieved because there was not\r
+                                                       enough memory.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -723,10 +799,8 @@ HiiGetImage (
   IN  CONST EFI_HII_IMAGE_PROTOCOL   *This,\r
   IN  EFI_HII_HANDLE                 PackageList,\r
   IN  EFI_IMAGE_ID                   ImageId,\r
-  OUT EFI_IMAGE_INPUT                *Image,\r
-  OUT UINTN                          *ImageSize\r
-  )\r
-;\r
+  OUT EFI_IMAGE_INPUT                *Image\r
+  );\r
 \r
 \r
 /**\r
@@ -741,7 +815,7 @@ HiiGetImage (
 \r
   @retval EFI_SUCCESS             The new image was updated successfully.\r
   @retval EFI_NOT_FOUND           The image specified by ImageId is not in the\r
-                                  database.\r
+                                                database. The specified PackageList is not in the database.\r
   @retval EFI_INVALID_PARAMETER   The Image was NULL.\r
 \r
 **/\r
@@ -752,8 +826,7 @@ HiiSetImage (
   IN EFI_HII_HANDLE                  PackageList,\r
   IN EFI_IMAGE_ID                    ImageId,\r
   IN CONST EFI_IMAGE_INPUT           *Image\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -772,6 +845,9 @@ HiiSetImage (
                                   a buffer will be allocated to hold  the generated\r
                                   image and the pointer updated on exit. It is the\r
                                   caller's responsibility to free this buffer.\r
+  @param  BltX                    Specifies the offset from the left and top edge\r
+                                  of the  output image of the first pixel in the\r
+                                  image.\r
   @param  BltY                    Specifies the offset from the left and top edge\r
                                   of the  output image of the first pixel in the\r
                                   image.\r
@@ -791,8 +867,7 @@ HiiDrawImage (
   IN OUT EFI_IMAGE_OUTPUT            **Blt,\r
   IN UINTN                           BltX,\r
   IN UINTN                           BltY\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -815,15 +890,18 @@ HiiDrawImage (
                                   allocated to hold  the generated image and the\r
                                   pointer updated on exit. It is the caller's\r
                                   responsibility to free this buffer.\r
+  @param  BltX                    Specifies the offset from the left and top edge\r
+                                  of the  output image of the first pixel in the\r
+                                  image.\r
   @param  BltY                    Specifies the offset from the left and top edge\r
                                   of the  output image of the first pixel in the\r
                                   image.\r
 \r
   @retval EFI_SUCCESS             The image was successfully drawn.\r
   @retval EFI_OUT_OF_RESOURCES    Unable to allocate an output buffer for Blt.\r
-  @retval EFI_INVALID_PARAMETER   The Image was NULL.\r
-  @retval EFI_NOT_FOUND           The specified packagelist could not be found in\r
-                                  current database.\r
+  @retval EFI_INVALID_PARAMETER  The Blt was NULL.\r
+  @retval EFI_NOT_FOUND          The image specified by ImageId is not in the database. \r
+                           The specified PackageList is not in the database.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -886,8 +964,7 @@ HiiNewString (
   IN  CONST CHAR16                    *LanguageName, OPTIONAL\r
   IN  CONST EFI_STRING                String,\r
   IN  CONST EFI_FONT_INFO             *StringFontInfo OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -914,7 +991,9 @@ HiiNewString (
   @retval EFI_NOT_FOUND           The string specified by StringId is not\r
                                   available.\r
   @retval EFI_NOT_FOUND           The string specified by StringId is available but\r
-                                  not in the specified language.\r
+                                                not in the specified language.\r
+                                                The specified PackageList is not in the database.\r
+  @retval EFI_INVALID_LANGUAGE   - The string specified by StringId is available but\r
   @retval EFI_BUFFER_TOO_SMALL    The buffer specified by StringSize is too small\r
                                   to  hold the string.\r
   @retval EFI_INVALID_PARAMETER   The String or Language or StringSize was NULL.\r
@@ -932,8 +1011,7 @@ HiiGetString (
   OUT EFI_STRING                      String,\r
   IN  OUT UINTN                       *StringSize,\r
   OUT EFI_FONT_INFO                   **StringFontInfo OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -967,8 +1045,7 @@ HiiSetString (
   IN CONST CHAR8                      *Language,\r
   IN CONST EFI_STRING                 String,\r
   IN CONST EFI_FONT_INFO              *StringFontInfo OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -999,8 +1076,7 @@ HiiGetLanguages (
   IN EFI_HII_HANDLE                   PackageList,\r
   IN OUT CHAR8                        *Languages,\r
   IN OUT UINTN                        *LanguagesSize\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -1017,7 +1093,7 @@ HiiGetLanguages (
                                   FirstLanguage. If there are no secondary\r
                                   languages, the function  returns successfully,\r
                                   but this is set to NULL.\r
-  @param  SecondaryLanguageSize   On entry, points to the size of the buffer\r
+  @param  SecondaryLanguagesSize  On entry, points to the size of the buffer\r
                                   pointed to  by SecondLanguages, in bytes. On\r
                                   return, points to the length of SecondLanguages\r
                                   in bytes.\r
@@ -1029,8 +1105,9 @@ HiiGetLanguages (
                                   too small to hold the returned information.\r
                                   SecondLanguageSize is updated to hold the size of\r
                                   the buffer required.\r
-  @retval EFI_NOT_FOUND           The language specified by FirstLanguage is not\r
+  @retval EFI_INVALID_LANGUAGE           The language specified by FirstLanguage is not\r
                                   present in the specified package list.\r
+  @retval EFI_NOT_FOUND          The specified PackageList is not in the Database.                                \r
 \r
 **/\r
 EFI_STATUS\r
@@ -1039,10 +1116,9 @@ HiiGetSecondaryLanguages (
   IN CONST EFI_HII_STRING_PROTOCOL   *This,\r
   IN EFI_HII_HANDLE                  PackageList,\r
   IN CONST CHAR8                     *FirstLanguage,\r
-  IN OUT CHAR8                       *SecondLanguages,\r
-  IN OUT UINTN                       *SecondLanguagesSize\r
-  )\r
-;\r
+  IN OUT CHAR8                       *SecondaryLanguages,\r
+  IN OUT UINTN                       *SecondaryLanguagesSize\r
+  );\r
 \r
 //\r
 // EFI_HII_DATABASE_PROTOCOL protocol interfaces\r
@@ -1075,8 +1151,7 @@ HiiNewPackageList (
   IN CONST EFI_HII_PACKAGE_LIST_HEADER  *PackageList,\r
   IN CONST EFI_HANDLE                   DriverHandle,\r
   OUT EFI_HII_HANDLE                    *Handle\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -1091,9 +1166,7 @@ HiiNewPackageList (
 \r
   @retval EFI_SUCCESS             The data associated with the Handle was removed\r
                                   from  the HII database.\r
-  @retval EFI_NOT_FOUND           The specified PackageList could not be found in\r
-                                  database.\r
-  @retval EFI_INVALID_PARAMETER   The Handle was not valid.\r
+  @retval EFI_NOT_FOUND           The specified Handle is not in database.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1101,8 +1174,7 @@ EFIAPI
 HiiRemovePackageList (\r
   IN CONST EFI_HII_DATABASE_PROTOCOL    *This,\r
   IN EFI_HII_HANDLE                     Handle\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -1119,9 +1191,8 @@ HiiRemovePackageList (
   @retval EFI_SUCCESS             The HII database was successfully updated.\r
   @retval EFI_OUT_OF_RESOURCES    Unable to allocate enough memory for the updated\r
                                   database.\r
-  @retval EFI_INVALID_PARAMETER   Handle or PackageList was NULL.\r
-  @retval EFI_NOT_FOUND           The Handle was not valid or could not be found in\r
-                                  database.\r
+  @retval EFI_INVALID_PARAMETER  PackageList was NULL.\r
+  @retval EFI_NOT_FOUND          The specified Handle is not in database.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1130,8 +1201,7 @@ HiiUpdatePackageList (
   IN CONST EFI_HII_DATABASE_PROTOCOL    *This,\r
   IN EFI_HII_HANDLE                     Handle,\r
   IN CONST EFI_HII_PACKAGE_LIST_HEADER  *PackageList\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -1154,6 +1224,7 @@ HiiUpdatePackageList (
   @param  Handle                  An array of EFI_HII_HANDLE instances returned.\r
 \r
   @retval EFI_SUCCESS             The matching handles are outputed successfully.\r
+                                                HandleBufferLength is updated with the actual length.\r
   @retval EFI_BUFFER_TO_SMALL     The HandleBufferLength parameter indicates that\r
                                   Handle is too small to support the number of\r
                                   handles. HandleBufferLength is updated with a\r
@@ -1161,6 +1232,10 @@ HiiUpdatePackageList (
   @retval EFI_NOT_FOUND           No matching handle could not be found in\r
                                   database.\r
   @retval EFI_INVALID_PARAMETER   Handle or HandleBufferLength was NULL.\r
+  @retval EFI_INVALID_PARAMETER  PackageType is not a EFI_HII_PACKAGE_TYPE_GUID but\r
+                         PackageGuid is not NULL, PackageType is a EFI_HII_\r
+                         PACKAGE_TYPE_GUID but PackageGuid is NULL.\r
+  \r
 \r
 **/\r
 EFI_STATUS\r
@@ -1171,8 +1246,7 @@ HiiListPackageLists (
   IN  CONST EFI_GUID                    *PackageGuid,\r
   IN  OUT UINTN                         *HandleBufferLength,\r
   OUT EFI_HII_HANDLE                    *Handle\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -1209,8 +1283,7 @@ HiiExportPackageLists (
   IN  EFI_HII_HANDLE                    Handle,\r
   IN  OUT UINTN                         *BufferSize,\r
   OUT EFI_HII_PACKAGE_LIST_HEADER       *Buffer\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -1258,8 +1331,7 @@ HiiRegisterPackageNotify (
   IN  CONST EFI_HII_DATABASE_NOTIFY     PackageNotifyFn,\r
   IN  EFI_HII_DATABASE_NOTIFY_TYPE      NotifyType,\r
   OUT EFI_HANDLE                        *NotifyHandle\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -1267,11 +1339,12 @@ HiiRegisterPackageNotify (
 \r
   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL\r
                                   instance.\r
-  @param  NotifyHandle            The handle of the notification function being\r
+  @param  NotificationHandle      The handle of the notification function being\r
                                   unregistered.\r
 \r
   @retval EFI_SUCCESS             Notification is unregistered successfully.\r
-  @retval EFI_INVALID_PARAMETER   The Handle is invalid.\r
+  @retval EFI_NOT_FOUND          The incoming notification handle does not exist \r
+                           in current hii database.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1279,8 +1352,7 @@ EFIAPI
 HiiUnregisterPackageNotify (\r
   IN CONST EFI_HII_DATABASE_PROTOCOL    *This,\r
   IN EFI_HANDLE                         NotificationHandle\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -1312,8 +1384,7 @@ HiiFindKeyboardLayouts (
   IN  CONST EFI_HII_DATABASE_PROTOCOL   *This,\r
   IN  OUT UINT16                        *KeyGuidBufferLength,\r
   OUT EFI_GUID                          *KeyGuidBuffer\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -1344,8 +1415,7 @@ HiiGetKeyboardLayout (
   IN  CONST EFI_GUID                          *KeyGuid,\r
   IN OUT UINT16                         *KeyboardLayoutLength,\r
   OUT EFI_HII_KEYBOARD_LAYOUT           *KeyboardLayout\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -1370,8 +1440,7 @@ EFIAPI
 HiiSetKeyboardLayout (\r
   IN CONST EFI_HII_DATABASE_PROTOCOL          *This,\r
   IN CONST EFI_GUID                           *KeyGuid\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -1396,8 +1465,7 @@ HiiGetPackageListHandle (
   IN  CONST EFI_HII_DATABASE_PROTOCOL         *This,\r
   IN  EFI_HII_HANDLE                    PackageListHandle,\r
   OUT EFI_HANDLE                        *DriverHandle\r
-  )\r
-;\r
+  );\r
 \r
 //\r
 // EFI_HII_CONFIG_ROUTING_PROTOCOL interfaces\r
@@ -1450,8 +1518,7 @@ HiiConfigRoutingExtractConfig (
   IN  CONST EFI_STRING                       Request,\r
   OUT EFI_STRING                             *Progress,\r
   OUT EFI_STRING                             *Results\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -1480,8 +1547,7 @@ EFIAPI
 HiiConfigRoutingExportConfig (\r
   IN  CONST EFI_HII_CONFIG_ROUTING_PROTOCOL  *This,\r
   OUT EFI_STRING                             *Results\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -1511,12 +1577,11 @@ HiiConfigRoutingExportConfig (
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-HiiConfigRoutingRoutConfig (\r
+HiiConfigRoutingRouteConfig (\r
   IN  CONST EFI_HII_CONFIG_ROUTING_PROTOCOL  *This,\r
   IN  CONST EFI_STRING                       Configuration,\r
   OUT EFI_STRING                             *Progress\r
-  )\r
-;\r
+  );\r
 \r
 \r
 \r
@@ -1568,8 +1633,7 @@ HiiBlockToConfig (
   IN  CONST UINTN                            BlockSize,\r
   OUT EFI_STRING                             *Config,\r
   OUT EFI_STRING                             *Progress\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -1626,8 +1690,7 @@ HiiConfigToBlock (
   IN OUT UINT8                                 *Block,\r
   IN OUT UINTN                                 *BlockSize,\r
   OUT    EFI_STRING                            *Progress\r
-  )\r
-;\r
+  );\r
 \r
 \r
 /**\r
@@ -1680,15 +1743,28 @@ HiiGetAltCfg (
   IN  CONST EFI_DEVICE_PATH_PROTOCOL           *DevicePath,\r
   IN  CONST UINT16                             *AltCfgId,\r
   OUT EFI_STRING                               *AltCfgResp\r
+  );\r
+\r
+\r
+/**\r
+  Compare whether two names of languages are identical.\r
+\r
+  @param  Language1              Name of language 1\r
+  @param  Language2              Name of language 2\r
+\r
+  @retval TRUE                   same\r
+  @retval FALSE                  not same\r
+\r
+**/\r
+BOOLEAN\r
+HiiCompareLanguage (\r
+  IN  CHAR8  *Language1,\r
+  IN  CHAR8  *Language2\r
   )\r
 ;\r
 \r
-\r
 //\r
 // Global variables\r
 //\r
 extern EFI_EVENT gHiiKeyboardLayoutChanged;\r
-\r
-#include "R8Lib.h"\r
-\r
 #endif\r