]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Merged in the following trackers from EDK:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Jun 2008 09:38:38 +0000 (09:38 +0000)
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Jun 2008 09:38:38 +0000 (09:38 +0000)
EDK1145 Cursor mising in shell in some case
EDK1099: Dell - [HII] HiiGetFontInfo() not retrieve the system font by FoFontInfoMask
EDK1127: [UEFI 2.10] Keyboard layout support
EDK1129: [UEFI HII] GUID is represented wrongly in Config String
And some other fixes such as
*[UEFI HII] HiiGetAltCfg is generating "Name=" sub string in the wrong format
*UEFI HII: GetUnicodeStringTextOrSize() doesn't handle NULL StringDest properly
*GetFontInfo() need be updated to avoid iteration
*HIIStringProtocolTest failed on multiple platform
*[Uefi 2.1] Comply with latest Hii ECR
* GetFontInfo() need be updated to avoid iteration

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5360 6f19259b-4bc3-4df7-8a09-765794883524

14 files changed:
MdePkg/Include/Base.h
MdePkg/Include/Library/IfrSupportLib.h
MdePkg/Include/Protocol/HiiDatabase.h
MdePkg/Include/Protocol/HiiFont.h
MdePkg/Include/Protocol/HiiImage.h
MdePkg/Include/Protocol/HiiString.h
MdePkg/Include/Uefi/UefiBaseType.h
MdePkg/Include/Uefi/UefiInternalFormRepresentation.h
MdePkg/Library/HiiLib/HiiLanguage.c
MdePkg/Library/HiiLib/HiiLib.c
MdePkg/Library/HiiLib/HiiLib.inf
MdePkg/Library/HiiLib/InternalHiiLib.h
MdePkg/Library/IfrSupportLib/IfrSupportLib.inf
MdePkg/Library/IfrSupportLib/UefiIfrForm.c

index c5cf6f38d5ed1ae75f441e6ecd169d4e38169498..a08ea34e9044da65b1971cd36d0884f5cca7fd03 100644 (file)
@@ -7,7 +7,7 @@
   environment. There are a set of base libraries in the Mde Package that can\r
   be used to implement base modules.\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2008, 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
@@ -293,6 +293,8 @@ typedef INTN RETURN_STATUS;
 #define RETURN_CRC_ERROR             ENCODE_ERROR (27)\r
 #define RETURN_END_OF_MEDIA          ENCODE_ERROR (28)\r
 #define RETURN_END_OF_FILE           ENCODE_ERROR (31)\r
+#define RETURN_INVALID_LANGUAGE      ENCODE_ERROR (32)\r
+\r
 \r
 #define RETURN_WARN_UNKNOWN_GLYPH    ENCODE_WARNING (1)\r
 #define RETURN_WARN_DELETE_FAILURE   ENCODE_WARNING (2)\r
index b8d3183e878ef51deadfcec5bf818e7c5334dc4f..fbfb676f8972e747bd0ea02f0403120bbbf440ae 100644 (file)
@@ -2,7 +2,7 @@
   The file contain all library functions and definitions for IFR opcode creation and 
   related Form Browser utility Operations.
 
-  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
@@ -422,6 +422,20 @@ CreateStringOpCode (
   )
 ;
 
+/**
+  Converts the unicode character of the string from uppercase to lowercase.
+
+  @param Str     String to be converted
+
+  @retval VOID
+  
+**/
+VOID
+ToLower (
+  IN OUT CHAR16    *Str
+  )
+;
+
 /**
   Converts binary buffer to Unicode string in reversed byte order to BufToHexString().
 
@@ -464,6 +478,54 @@ HexStringToBuffer (
   )
 ;
 
+/**
+  Convert binary representation Config string (e.g. "0041004200430044") to the
+  original string (e.g. "ABCD"). Config string appears in <ConfigHdr> (i.e.
+  "&NAME=<string>"), or Name/Value pair in <ConfigBody> (i.e. "label=<string>").
+
+  @param UnicodeString  Original Unicode string.
+  @param StrBufferLen   On input: Length in bytes of buffer to hold the Unicode string.
+                                    Includes tailing '\0' character.
+                                    On output:
+                                      If return EFI_SUCCESS, containing length of Unicode string buffer.
+                                      If return EFI_BUFFER_TOO_SMALL, containg length of string buffer desired.
+  @param ConfigString   Binary representation of Unicode String, <string> := (<HexCh>4)+
+
+  @retval EFI_SUCCESS          Routine success.
+  @retval EFI_BUFFER_TOO_SMALL The string buffer is too small.
+
+**/EFI_STATUS
+ConfigStringToUnicode (
+  IN OUT CHAR16                *UnicodeString,
+  IN OUT UINTN                 *StrBufferLen,
+  IN CHAR16                    *ConfigString
+  )
+;
+
+/**
+  Convert Unicode string to binary representation Config string, e.g.
+  "ABCD" => "0041004200430044". Config string appears in <ConfigHdr> (i.e.
+  "&NAME=<string>"), or Name/Value pair in <ConfigBody> (i.e. "label=<string>").
+
+  @param ConfigString   Binary representation of Unicode String, <string> := (<HexCh>4)+
+  @param  StrBufferLen  On input: Length in bytes of buffer to hold the Unicode string.
+                                    Includes tailing '\0' character.
+                                    On output:
+                                      If return EFI_SUCCESS, containing length of Unicode string buffer.
+                                      If return EFI_BUFFER_TOO_SMALL, containg length of string buffer desired.
+  @param  UnicodeString  Original Unicode string.
+
+  @retval EFI_SUCCESS           Routine success.
+  @retval EFI_BUFFER_TOO_SMALL  The string buffer is too small.
+
+**/EFI_STATUS
+UnicodeToConfigString (
+  IN OUT CHAR16                *ConfigString,
+  IN OUT UINTN                 *StrBufferLen,
+  IN CHAR16                    *UnicodeString
+  )
+;
+
 /**
   Construct <ConfigHdr> using routing information GUID/NAME/PATH.
 
index 75245c11cd6560943dd65265cdcf75bd3302de76..57cc6d92f6aa78bf1d993e374911f0d9d44b0c33 100644 (file)
@@ -2,7 +2,7 @@
   The file provides Database manager for HII-related data\r
   structures.\r
   \r
-  Copyright (c) 2006 - 2007, Intel Corporation\r
+  Copyright (c) 2006 - 2008, 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
@@ -127,8 +127,7 @@ EFI_STATUS
   \r
   @retval EFI_SUCCESS   The data associated with the Handle was\r
                         removed from the HII database.\r
-  \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
 typedef\r
@@ -177,7 +176,8 @@ EFI_STATUS
   @retval EFI_OUT_OF_RESOURCES  Unable to allocate enough memory\r
                                 for the updated database.\r
   \r
-  @retval EFI_INVALID_PARAMETER   The Handle was not valid.\r
+  @retval EFI_INVALID_PARAMETER  PackageList was NULL.\r
+  @retval EFI_NOT_FOUND          The specified Handle is not in database.\r
 \r
 **/\r
 typedef\r
@@ -219,14 +219,20 @@ EFI_STATUS
   @param Handle   An array of EFI_HII_HANDLE  instances returned.\r
 \r
 \r
-  @retval EFI_SUCCESS   Handle was updated successfully.\r
+  @retval EFI_SUCCESS The matching handles are outputed successfully.\r
+                           HandleBufferLength is updated with the actual length.\r
 \r
-  @retval EFI_BUFFER_TOO_SMALL  The HandleBufferLength parameter\r
+  @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter\r
                                 indicates that Handle is too\r
                                 small to support the number of\r
                                 handles. HandleBufferLength is\r
                                 updated with a value that will\r
                                 enable the data to fit.\r
+  @retval EFI_NOT_FOUND No matching handle could not be found in 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
@@ -368,8 +374,9 @@ EFI_STATUS
   @retval EFI_SUCCESS   Unregister the notification\r
                         Successsfully\r
   \r
-  @retval EFI_INVALID_PARAMETER   The Handle is invalid.\r
-\r
+  @retval EFI_NOT_FOUND The incoming notification handle does not exist \r
+                         in current hii database.\r
+  \r
 **/\r
 typedef\r
 EFI_STATUS\r
index df9bbac93fc82192bb78486d7fd6997ebb50418a..a4e56b278aa616dfababd75bdc425c731e4213d8 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The file provides services to retrieve font information.\r
   \r
-  Copyright (c) 2006 - 2007, Intel Corporation\r
+  Copyright (c) 2006 - 2008, 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
@@ -31,8 +31,8 @@ typedef VOID    *EFI_FONT_HANDLE;
 typedef UINT32  EFI_HII_OUT_FLAGS;\r
 #define EFI_HII_OUT_FLAG_CLIP         0x00000001\r
 #define EFI_HII_OUT_FLAG_WRAP         0x00000002\r
-#define EFI_HII_OUT_FLAG_CLEAN_Y      0x00000004\r
-#define EFI_HII_OUT_FLAG_CLEAN_X      0x00000008\r
+#define EFI_HII_OUT_FLAG_CLIP_CLEAN_Y 0x00000004\r
+#define EFI_HII_OUT_FLAG_CLIP_CLEAN_X 0x00000008\r
 #define EFI_HII_OUT_FLAG_TRANSPARENT  0x00000010\r
 #define EFI_HII_IGNORE_IF_NO_GLYPH    0x00000020\r
 #define EFI_HII_IGNORE_LINE_BREAK     0x00000040\r
@@ -87,9 +87,9 @@ typedef UINT32  EFI_FONT_INFO_MASK;
 // EFI_FONT_INFO\r
 // \r
 typedef struct {\r
-  UINT32  FontStyle;\r
-  UINT16  FontSize;\r
-  CHAR16  FontName[1];\r
+  EFI_HII_FONT_STYLE FontStyle;\r
+  UINT16             FontSize; // character cell height in pixels\r
+  CHAR16             FontName[1];\r
 } EFI_FONT_INFO;\r
 \r
 /**\r
@@ -253,10 +253,9 @@ typedef struct _EFI_FONT_DISPLAY_INFO {
   @retval EFI_OUT_OF_RESOURCES  Unable to allocate an output\r
                                 buffer for RowInfoArray or Blt.\r
   \r
-  @retval EFI_INVALID_PARAMETER The String or Blt or Height or\r
-                                Width was NULL.\r
+  @retval EFI_INVALID_PARAMETER The String or Blt.\r
+  @retval EFI_INVALID_PARAMETER Flags were invalid combination..\r
 \r
-  \r
 **/\r
 typedef\r
 EFI_STATUS\r
@@ -388,6 +387,10 @@ EFI_STATUS
 \r
   @retval EFI_INVALID_PARAMETER The String or Blt or Height or\r
                                 Width 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
 typedef\r
@@ -469,7 +472,8 @@ EFI_STATUS
                     to NULL if there are no more matching fonts.\r
 \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
 \r
   @param StringInfoOut  Upon return, contains the matching\r
                         font's information. If NULL, then no\r
@@ -483,8 +487,9 @@ EFI_STATUS
   \r
   @retval EFI_NOT_FOUND No matching font was found.\r
   \r
-  @retval EFI_INVALID_PARAMETER FontHandle is NULL or\r
-                                StringInfoIn is NULL\r
+  @retval EFI_INVALID_PARAMETER  StringInfoIn->FontInfoMask is an invalid combination.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES   There were insufficient resources to complete the request.\r
   \r
 **/\r
 typedef\r
@@ -492,7 +497,7 @@ EFI_STATUS
 (EFIAPI *EFI_HII_GET_FONT_INFO) (\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
index 5bd84905c2298df093f8b6262a80d28f861e6fff..ca3d3e1ecea8c0f27b8dab446e14488ad168fffe 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The file provides services to access to images in the images database.\r
   \r
-  Copyright (c) 2006 - 2007, Intel Corporation\r
+  Copyright (c) 2006 - 2008, 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
@@ -48,7 +48,7 @@ typedef struct _EFI_IMAGE_INPUT {
   UINT32                          Flags;\r
   UINT16                          Width;\r
   UINT16                          Height;\r
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL   Bitmap[1];\r
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL   *Bitmap;\r
 } EFI_IMAGE_INPUT;\r
 \r
 \r
@@ -109,21 +109,14 @@ EFI_STATUS
   \r
   @param Image  Points to the new image.\r
   \r
-  @param ImageSize  On entry, points to the size of the buffer\r
-                    pointed to by Image, in bytes. On return,\r
-                    points to the length of the image, in bytes.\r
-  \r
-  \r
   @retval EFI_SUCCESS   The image was returned successfully.\r
-  \r
+                                     The specified PackageList is not in the database.\r
   @retval EFI_NOT_FOUND The image specified by ImageId is not\r
                         available.\r
   \r
-  @retval EFI_BUFFER_TOO_SMALL  The buffer specified by\r
-                                ImageLength is too small to hold\r
-                                the image.\r
-  \r
   @retval EFI_INVALID_PARAMETER The Image or Langugae was NULL.\r
+  @retval EFI_OUT_OF_RESOURCES   The bitmap could not be retrieved because there was not\r
+                         enough memory.\r
 \r
 \r
 **/\r
@@ -133,8 +126,7 @@ EFI_STATUS
   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
+  OUT       EFI_IMAGE_INPUT         *Image\r
 );\r
 \r
 /**\r
@@ -156,7 +148,8 @@ EFI_STATUS
   @retval EFI_SUCCESS The image was successfully updated.\r
   \r
   @retval EFI_NOT_FOUND   The image specified by ImageId is not\r
-                          in the database.\r
+                                        in the database.\r
+                                        The specified PackageList is not in the database. \r
   \r
   @retval EFI_INVALID_PARAMETER   The Image or Language was\r
                                   NULL.\r
@@ -180,8 +173,8 @@ typedef UINT32  EFI_HII_DRAW_FLAGS;
 #define EFI_HII_DRAW_FLAG_CLIP          0x00000001\r
 #define EFI_HII_DRAW_FLAG_TRANSPARENT   0x00000030\r
 #define EFI_HII_DRAW_FLAG_DEFAULT       0x00000000\r
-#define EFI_HII_DRAW_FLAG_FORCE_TRANS   0x00000001\r
-#define EFI_HII_DRAW_FLAG_FORCE_OPAQUE  0x00000002\r
+#define EFI_HII_DRAW_FLAG_FORCE_TRANS   0x00000010\r
+#define EFI_HII_DRAW_FLAG_FORCE_OPAQUE  0x00000020\r
 #define EFI_HII_DIRECT_TO_SCREEN        0x00000080\r
 \r
 \r
@@ -332,8 +325,9 @@ EFI_STATUS
   @retval EFI_OUT_OF_RESOURCES  Unable to allocate an output\r
                                 buffer for RowInfoArray or Blt.\r
   \r
-  @retval EFI_INVALID_PARAMETER The Image or Blt or Height or\r
-                                Width 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
+  @retval EFI_INVALID_PARAMETER  The Blt was NULL.    \r
 \r
 **/\r
 typedef\r
index e120e9e470e0fc43c813d63d35d8d0621249fd78..0a522c2785d7b27b24658943e6039566ba20fb8d 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The file provides services to manipulate string data.\r
   \r
-  Copyright (c) 2006 - 2007, Intel Corporation\r
+  Copyright (c) 2006 - 2008, 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
@@ -101,14 +101,16 @@ EFI_STATUS
                     points to the length of the string, in\r
                     bytes.\r
   \r
-  @param StringFontInfo   Points to the string's font\r
-                          information or NULL if the string font\r
-                          information is not desired.\r
+  @param StringFontInfo  Points to a buffer that will be callee allocated and will \r
+                      have the string's font information into this buffer.  \r
+                      The caller is responsible for freeing this buffer.  \r
+                      If the parameter is NULL a buffer will not be allocated \r
+                      and the string font information will not be returned.\r
   \r
   @retval EFI_SUCCESS The string was returned successfully.\r
   \r
   @retval EFI_NOT_FOUND The string specified by StringId is not\r
-                        available.\r
+                        available. The specified PackageList is not in the database.\r
   \r
   @retval EFI_INVALID_LANGUAGE  The string specified by StringId\r
                                 is available but not in the\r
@@ -158,7 +160,7 @@ EFI_STATUS
   @retval EFI_SUCCESS   The string was successfully updated.\r
   \r
   @retval EFI_NOT_FOUND The string specified by StringId is not\r
-                        in the database.\r
+                        in the database. The specified PackageList is not in the database.\r
   \r
   @retval EFI_INVALID_PARAMETER The String or Language was NULL.\r
   \r
@@ -203,7 +205,8 @@ EFI_STATUS
                                 updated to contain the required\r
                                 size.\r
   \r
-  @retval EFI_INVALID_PARAMETER Languages is NULL.\r
+  @retval EFI_INVALID_PARAMETER Languages or LanguagesSize is NULL.\r
+  @retval EFI_NOT_FOUND The specified PackageList is not in the database.\r
 \r
 \r
 **/\r
@@ -261,6 +264,7 @@ EFI_STATUS
 \r
   @retval EFI_INVALID_PARAMETER FirstLanguage is NULL or\r
                                 SecondLanguage is NULL.\r
+  @retval EFI_NOT_FOUND The specified PackageList is not in the database.\r
 \r
 **/\r
 typedef\r
index 4dfb273ceffe1101dd5854e97292a32ae73dfda3..c27dd999459b29c150a789faf1b31e89732e3722 100644 (file)
@@ -2,7 +2,7 @@
 \r
   Defines data types and constants introduced in UEFI.\r
 \r
-  Copyright (c) 2006 - 2007, Intel Corporation\r
+  Copyright (c) 2006 - 2008, 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
@@ -122,6 +122,7 @@ typedef union {
 #define EFI_CRC_ERROR             RETURN_CRC_ERROR   \r
 #define EFI_END_OF_MEDIA          RETURN_END_OF_MEDIA\r
 #define EFI_END_OF_FILE           RETURN_END_OF_FILE\r
+#define EFI_INVALID_LANGUAGE      RETURN_INVALID_LANGUAGE\r
 \r
 #define EFI_WARN_UNKNOWN_GLYPH    RETURN_WARN_UNKNOWN_GLYPH   \r
 #define EFI_WARN_DELETE_FAILURE   RETURN_WARN_DELETE_FAILURE  \r
index d30a0968939c4ab73ededf5612c4fe57bde71115..a0dc1667534ae7363cf2d959367a348b3addb7ac 100644 (file)
@@ -4,7 +4,7 @@
   IFR is primarily consumed by the EFI presentation engine, and produced by EFI\r
   internal application and drivers as well as all add-in card option-ROM drivers\r
 \r
-  Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
+  Copyright (c) 2006 - 2008, 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
@@ -133,6 +133,7 @@ typedef struct _EFI_HII_SIMPLE_FONT_PACKAGE_HDR {
 // Font Package\r
 //\r
 \r
+#define EFI_HII_FONT_STYLE_NORMAL            0x00000000\r
 #define EFI_HII_FONT_STYLE_BOLD              0x00000001\r
 #define EFI_HII_FONT_STYLE_ITALIC            0x00000002\r
 #define EFI_HII_FONT_STYLE_EMBOSS            0x00010000\r
@@ -723,14 +724,14 @@ typedef struct _EFI_IFR_VARSTORE {
 \r
 typedef struct _EFI_IFR_VARSTORE_EFI {\r
   EFI_IFR_OP_HEADER        Header;\r
-  UINT16                   VarStoreId;\r
+  EFI_VARSTORE_ID          VarStoreId;\r
   EFI_GUID                 Guid;\r
   UINT32                   Attributes;\r
 } EFI_IFR_VARSTORE_EFI;\r
 \r
 typedef struct _EFI_IFR_VARSTORE_NAME_VALUE {\r
   EFI_IFR_OP_HEADER        Header;\r
-  UINT16                   VarStoreId;\r
+  EFI_VARSTORE_ID          VarStoreId;\r
   EFI_GUID                 Guid;\r
 } EFI_IFR_VARSTORE_NAME_VALUE;\r
 \r
@@ -1299,7 +1300,7 @@ typedef enum {
   EfiKeyB8,\r
   EfiKeyB9,\r
   EfiKeyB10,\r
-  EfiKeyRshift,\r
+  EfiKeyRShift,\r
   EfiKeyUpArrow,\r
   EfiKeyOne,\r
   EfiKeyTwo,\r
@@ -1422,16 +1423,16 @@ typedef struct {
   // EFI_HII_KEYBOARD_LAYOUT Layout[];\r
 } EFI_HII_KEYBOARD_PACKAGE_HDR;\r
 \r
-typedef struct {\r
-  CHAR16                  Language[3];\r
-  CHAR16                  Space;\r
-  CHAR16                  DescriptionString[1];\r
-} EFI_DESCRIPTION_STRING;\r
+//typedef struct {\r
+//  CHAR16                  Language[];           // RFC4646 Language Code\r
+//  CHAR16                  Space;\r
+//  CHAR16                  DescriptionString[];\r
+//} EFI_DESCRIPTION_STRING;\r
 \r
-typedef struct {\r
-  UINT16                  DescriptionCount;\r
-  EFI_DESCRIPTION_STRING  DescriptionString[1];\r
-} EFI_DESCRIPTION_STRING_BUNDLE;\r
+//typedef struct {\r
+//  UINT16                  DescriptionCount;\r
+//  EFI_DESCRIPTION_STRING  DescriptionString[];\r
+//} EFI_DESCRIPTION_STRING_BUNDLE;\r
 \r
 //\r
 // Modifier values\r
@@ -1451,7 +1452,7 @@ typedef struct {
 #define EFI_LEFT_SHIFT_MODIFIER          0x000C\r
 #define EFI_RIGHT_SHIFT_MODIFIER         0x000D\r
 #define EFI_CAPS_LOCK_MODIFIER           0x000E\r
-#define EFI_NUM_LOCK _MODIFIER           0x000F\r
+#define EFI_NUM_LOCK_MODIFIER            0x000F\r
 #define EFI_LEFT_ARROW_MODIFIER          0x0010\r
 #define EFI_RIGHT_ARROW_MODIFIER         0x0011\r
 #define EFI_DOWN_ARROW_MODIFIER          0x0012\r
@@ -1484,6 +1485,10 @@ typedef struct {
 #define EFI_PAUSE_MODIFIER               0x0025\r
 #define EFI_BREAK_MODIFIER               0x0026\r
 \r
+#define EFI_LEFT_LOGO_MODIFIER           0x0027\r
+#define EFI_RIGHT_LOGO_MODIFIER          0x0028\r
+#define EFI_MENU_MODIFIER                0x0029\r
+\r
 #pragma pack()\r
 \r
 \r
index 14a9313507e5e5bb76623a372d089f7864cda99a..cd2b66063bf6b0f97ebe73816d37dc01f2797eb1 100644 (file)
@@ -95,6 +95,8 @@ HiiLibGetSupportedLanguages (
   if (LanguageString == NULL) {\r
     return NULL;\r
   }\r
+\r
+  LocateHiiProtocols ();\r
   \r
   Status = mHiiStringProt->GetLanguages (mHiiStringProt, HiiHandle, LanguageString, &BufferSize);\r
   \r
@@ -164,6 +166,9 @@ HiiLibGetSupportedSecondaryLanguages (
   if (LanguageString == NULL) {\r
     return NULL;\r
   }\r
+\r
+  LocateHiiProtocols ();\r
+  \r
   Status = mHiiStringProt->GetSecondaryLanguages (mHiiStringProt, HiiHandle, FirstLanguage, LanguageString, &BufferSize);\r
   \r
   if (Status == EFI_BUFFER_TOO_SMALL) {\r
index 1f59fa4fa5a447566cb6c47eaafbee00aaf9ed10..940536620cfc69b683afb856c2af2915769eb8ee 100644 (file)
 \r
 CONST EFI_HII_DATABASE_PROTOCOL   *mHiiDatabaseProt;\r
 CONST EFI_HII_STRING_PROTOCOL     *mHiiStringProt;\r
+BOOLEAN mHiiProtocolsInitialized = FALSE;\r
+\r
 \r
 /**\r
-  The constructor function of Hii Library.\r
-  \r
-  The constructor function caches the value of default HII protocol instances.\r
 \r
-  @param  ImageHandle   The firmware allocated handle for the EFI image.\r
-  @param  SystemTable   A pointer to the EFI System Table.\r
-  \r
-  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.\r
+  This function locate Hii relative protocols for later usage.\r
+\r
+  @param VOID\r
+\r
+  @retval  VOID\r
 \r
 **/\r
-EFI_STATUS\r
-EFIAPI\r
-UefiHiiLibConstructor (\r
-  IN EFI_HANDLE           ImageHandle,\r
-  IN EFI_SYSTEM_TABLE     *SystemTable\r
+VOID\r
+LocateHiiProtocols (\r
+  VOID\r
   )\r
 {\r
-  EFI_STATUS Status;\r
-  \r
-  Status = gBS->LocateProtocol (\r
-      &gEfiHiiDatabaseProtocolGuid,\r
-      NULL,\r
-      (VOID **) &mHiiDatabaseProt\r
-    );\r
+  EFI_STATUS  Status;\r
+\r
+  if (mHiiProtocolsInitialized) {\r
+    return;\r
+  }\r
+\r
+  Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &mHiiDatabaseProt);\r
   ASSERT_EFI_ERROR (Status);\r
-  ASSERT (mHiiDatabaseProt != NULL);\r
 \r
-  Status = gBS->LocateProtocol (\r
-      &gEfiHiiStringProtocolGuid,\r
-      NULL,\r
-      (VOID **) &mHiiStringProt\r
-    );\r
+  Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &mHiiStringProt);\r
   ASSERT_EFI_ERROR (Status);\r
-  ASSERT (mHiiStringProt != NULL);\r
 \r
-  return EFI_SUCCESS;\r
+  mHiiProtocolsInitialized = TRUE;\r
 }\r
 \r
 \r
@@ -151,6 +143,8 @@ HiiLibAddPackages (
 \r
   ASSERT (HiiHandle != NULL);\r
 \r
+  LocateHiiProtocols ();\r
+\r
   VA_START (Args, HiiHandle);\r
   PackageListHeader = InternalHiiLibPreparePackages (NumberOfPackages, GuidId, Args);\r
 \r
@@ -174,8 +168,10 @@ HiiLibRemovePackages (
   )\r
 {\r
   EFI_STATUS Status;\r
-\r
   ASSERT (HiiHandle != NULL);\r
+\r
+  LocateHiiProtocols ();\r
+\r
   Status = mHiiDatabaseProt->RemovePackageList (mHiiDatabaseProt, HiiHandle);\r
   ASSERT_EFI_ERROR (Status);\r
 }\r
@@ -196,6 +192,8 @@ HiiLibGetHiiHandles (
 \r
   BufferLength = 0;\r
 \r
+  LocateHiiProtocols ();\r
+\r
   //\r
   // Try to find the actual buffer size for HiiHandle Buffer.\r
   //\r
@@ -245,6 +243,9 @@ HiiLibExtractGuidFromHiiHandle (
   //\r
   BufferSize = 0;\r
   HiiPackageList = NULL;\r
+\r
+  LocateHiiProtocols ();\r
+\r
   Status = mHiiDatabaseProt->ExportPackageLists (mHiiDatabaseProt, Handle, &BufferSize, HiiPackageList);\r
   ASSERT (Status != EFI_NOT_FOUND);\r
   \r
@@ -326,6 +327,8 @@ HiiLibDevicePathToHiiHandle (
     return NULL;\r
   }\r
 \r
+  LocateHiiProtocols ();\r
+\r
   //\r
   // Retrieve all Hii Handles from HII database\r
   //\r
@@ -392,6 +395,9 @@ IsHiiHandleRegistered (
 \r
   HiiPackageList = NULL;\r
   BufferSize = 0;\r
+\r
+  LocateHiiProtocols ();\r
+\r
   Status = mHiiDatabaseProt->ExportPackageLists (\r
              mHiiDatabaseProt,\r
              HiiHandle,\r
index 30a1657984694ee7009eb72e1d728092d5d04c66..f9ff028942cfe246f61cc7794e8e64632e8ef83b 100644 (file)
@@ -24,8 +24,6 @@
   EDK_RELEASE_VERSION            = 0x00020000\r
   EFI_SPECIFICATION_VERSION      = 0x0002000A\r
 \r
-  CONSTRUCTOR                    = UefiHiiLibConstructor\r
-\r
 #\r
 #  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
 #\r
@@ -54,8 +52,5 @@
 [Guids]  \r
   gEfiGlobalVariableGuid \r
 \r
-[Depex]\r
-  gEfiHiiDatabaseProtocolGuid AND gEfiHiiStringProtocolGuid\r
-\r
 [Pcd]\r
   gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang
\ No newline at end of file
index b2c8b877075057a4d4f940526d305c3cfbabe1e1..5d03cd1b7873312d76fa4178e261a48e5f7093cb 100644 (file)
 #define HII_LIB_DEFAULT_STRING_SIZE     0x200\r
 \r
 \r
-extern CONST EFI_HII_DATABASE_PROTOCOL   *mHiiDatabaseProt;\r
-extern CONST EFI_HII_STRING_PROTOCOL     *mHiiStringProt;\r
+extern CONST EFI_HII_DATABASE_PROTOCOL         *mHiiDatabaseProt;\r
+extern CONST EFI_HII_STRING_PROTOCOL           *mHiiStringProt;\r
+extern BOOLEAN                           mHiiProtocolsInitialized;\r
+\r
 \r
 BOOLEAN\r
 IsHiiHandleRegistered (\r
@@ -45,4 +47,10 @@ IsHiiHandleRegistered (
   )\r
 ;\r
 \r
+VOID\r
+LocateHiiProtocols (\r
+  VOID\r
+  )\r
+;\r
+\r
 #endif\r
index 98ac18c07ca88eb6a3f840f2cacd4d68d83f408f..cb5b53a5b72bd5c67af07e5633327a3657e7834d 100644 (file)
@@ -25,8 +25,6 @@
   EDK_RELEASE_VERSION            = 0x00020000\r
   EFI_SPECIFICATION_VERSION      = 0x00020000\r
 \r
-  CONSTRUCTOR                    = IfrSupportLibConstructor\r
-\r
 #\r
 # The following information is for reference only and not required by the build tools.\r
 #\r
@@ -34,7 +32,6 @@
 #\r
 \r
 [Sources.common]\r
-  UefiIfrCommon.c\r
   UefiIfrForm.c\r
   UefiIfrLibraryInternal.h\r
   UefiIfrOpCodeCreation.c\r
@@ -64,8 +61,5 @@
   gEfiHiiConfigRoutingProtocolGuid\r
   gEfiFormBrowser2ProtocolGuid   \r
 \r
-[Depex]\r
-  gEfiHiiDatabaseProtocolGuid AND gEfiHiiStringProtocolGuid\r
-\r
 [Pcd]\r
   gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang\r
index 8963789423f63a3beca4e83612ca764f0e647731..af43db0998428f819a04c96ae7ad066756bff729 100644 (file)
@@ -1,6 +1,6 @@
 /** @file
 
-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
@@ -242,7 +242,7 @@ SwapBuffer (
   UINT8  Temp;
   UINTN  SwapCount;
 
-  SwapCount = (BufferSize - 1) / 2;
+  SwapCount = BufferSize / 2;
   for (Index = 0; Index < SwapCount; Index++) {
     Temp = Buffer[Index];
     Buffer[Index] = Buffer[BufferSize - 1 - Index];
@@ -250,6 +250,28 @@ SwapBuffer (
   }
 }
 
+/**
+  Converts the unicode character of the string from uppercase to lowercase.
+
+  @param Str     String to be converted
+
+  @retval VOID
+  
+**/
+VOID
+ToLower (
+  IN OUT CHAR16    *Str
+  )
+{
+  CHAR16      *Ptr;
+  
+  for (Ptr = Str; *Ptr != L'\0'; Ptr++) {
+    if (*Ptr >= L'A' && *Ptr <= L'Z') {
+      *Ptr = (CHAR16) (*Ptr - L'A' + L'a');
+    }
+  }
+}
+
 
 /**
   Converts binary buffer to Unicode string in reversed byte order from BufToHexString().
@@ -276,10 +298,14 @@ BufferToHexString (
   NewBuffer = AllocateCopyPool (BufferSize, Buffer);
   SwapBuffer (NewBuffer, BufferSize);
 
-  StrBufferLen = (BufferSize + 1) * sizeof (CHAR16);
+  StrBufferLen = BufferSize * sizeof (CHAR16) + 1;
   Status = BufToHexString (Str, &StrBufferLen, NewBuffer, BufferSize);
 
   gBS->FreePool (NewBuffer);
+  //
+  // Convert the uppercase to lowercase since <HexAf> is defined in lowercase format.
+  //
+  ToLower (Str);
 
   return Status;
 }
@@ -319,6 +345,123 @@ HexStringToBuffer (
   return Status;
 }
 
+/**
+  Convert binary representation Config string (e.g. "0041004200430044") to the
+  original string (e.g. "ABCD"). Config string appears in <ConfigHdr> (i.e.
+  "&NAME=<string>"), or Name/Value pair in <ConfigBody> (i.e. "label=<string>").
+
+  @param UnicodeString  Original Unicode string.
+  @param StrBufferLen   On input: Length in bytes of buffer to hold the Unicode string.
+                                    Includes tailing '\0' character.
+                                    On output:
+                                      If return EFI_SUCCESS, containing length of Unicode string buffer.
+                                      If return EFI_BUFFER_TOO_SMALL, containg length of string buffer desired.
+  @param ConfigString   Binary representation of Unicode String, <string> := (<HexCh>4)+
+
+  @retval EFI_SUCCESS          Routine success.
+  @retval EFI_BUFFER_TOO_SMALL The string buffer is too small.
+
+**/
+EFI_STATUS
+ConfigStringToUnicode (
+  IN OUT CHAR16                *UnicodeString,
+  IN OUT UINTN                 *StrBufferLen,
+  IN CHAR16                    *ConfigString
+  )
+{
+  UINTN       Index;
+  UINTN       Len;
+  UINTN       BufferSize;
+  CHAR16      BackupChar;
+
+  Len = StrLen (ConfigString) / 4;
+  BufferSize = (Len + 1) * sizeof (CHAR16);
+
+  if (*StrBufferLen < BufferSize) {
+    *StrBufferLen = BufferSize;
+    return EFI_BUFFER_TOO_SMALL;
+  }
+
+  *StrBufferLen = BufferSize;
+
+  for (Index = 0; Index < Len; Index++) {
+    BackupChar = ConfigString[4];
+    ConfigString[4] = L'\0';
+
+    HexStringToBuf ((UINT8 *) UnicodeString, &BufferSize, ConfigString, NULL);
+
+    ConfigString[4] = BackupChar;
+
+    ConfigString += 4;
+    UnicodeString += 1;
+  }
+
+  //
+  // Add tailing '\0' character
+  //
+  *UnicodeString = L'\0';
+
+  return EFI_SUCCESS;
+}
+
+/**
+  Convert Unicode string to binary representation Config string, e.g.
+  "ABCD" => "0041004200430044". Config string appears in <ConfigHdr> (i.e.
+  "&NAME=<string>"), or Name/Value pair in <ConfigBody> (i.e. "label=<string>").
+
+  @param ConfigString   Binary representation of Unicode String, <string> := (<HexCh>4)+
+  @param  StrBufferLen  On input: Length in bytes of buffer to hold the Unicode string.
+                                    Includes tailing '\0' character.
+                                    On output:
+                                      If return EFI_SUCCESS, containing length of Unicode string buffer.
+                                      If return EFI_BUFFER_TOO_SMALL, containg length of string buffer desired.
+  @param  UnicodeString  Original Unicode string.
+
+  @retval EFI_SUCCESS           Routine success.
+  @retval EFI_BUFFER_TOO_SMALL  The string buffer is too small.
+
+**/
+EFI_STATUS
+UnicodeToConfigString (
+  IN OUT CHAR16                *ConfigString,
+  IN OUT UINTN                 *StrBufferLen,
+  IN CHAR16                    *UnicodeString
+  )
+{
+  UINTN       Index;
+  UINTN       Len;
+  UINTN       BufferSize;
+  CHAR16      *String;
+
+  Len = StrLen (UnicodeString);
+  BufferSize = (Len * 4 + 1) * sizeof (CHAR16);
+
+  if (*StrBufferLen < BufferSize) {
+    *StrBufferLen = BufferSize;
+    return EFI_BUFFER_TOO_SMALL;
+  }
+
+  *StrBufferLen = BufferSize;
+  String        = ConfigString;
+
+  for (Index = 0; Index < Len; Index++) {
+    BufToHexString (ConfigString, &BufferSize, (UINT8 *) UnicodeString, 2);
+
+    ConfigString += 4;
+    UnicodeString += 1;
+  }
+
+  //
+  // Add tailing '\0' character
+  //
+  *ConfigString = L'\0';
+
+  //
+  // Convert the uppercase to lowercase since <HexAf> is defined in lowercase format.
+  //
+  ToLower (String);  
+  return EFI_SUCCESS;
+}
 
 /**
   Construct <ConfigHdr> using routing information GUID/NAME/PATH.
@@ -383,10 +526,10 @@ ConstructConfigHdr (
   DevicePathSize = GetDevicePathSize (DevicePath);
 
   //
-  // GUID=<HexCh>32&NAME=<Alpha>NameStrLen&PATH=<HexChar>DevicePathStrLen <NULL>
-  // | 5  |   32   |  6  |   NameStrLen   |  6  |    DevicePathStrLen   |
+  // GUID=<HexCh>32&NAME=<Char>NameStrLen&PATH=<HexChar>DevicePathStrLen <NULL>
+  // | 5  |   32   |  6  |  NameStrLen*4 |  6  |    DevicePathStrLen    | 1 |
   //
-  BufferSize = (5 + 32 + 6 + NameStrLen + 6 + DevicePathSize * 2 + 1) * sizeof (CHAR16);
+  BufferSize = (5 + 32 + 6 + NameStrLen * 4 + 6 + DevicePathSize * 2 + 1) * sizeof (CHAR16);
   if (*StrBufferLen < BufferSize) {
     *StrBufferLen = BufferSize;
     return EFI_BUFFER_TOO_SMALL;
@@ -401,11 +544,15 @@ ConstructConfigHdr (
   BufferToHexString (StrPtr, (UINT8 *) Guid, sizeof (EFI_GUID));
   StrPtr += 32;
 
+  //
+  // Convert name string, e.g. name "ABCD" => "&NAME=0041004200430044"
+  //
   StrCpy (StrPtr, L"&NAME=");
   StrPtr += 6;
   if (Name != NULL) {
-    StrCpy (StrPtr, Name);
-    StrPtr += NameStrLen;
+    BufferSize = (NameStrLen * 4 + 1) * sizeof (CHAR16);
+    UnicodeToConfigString (StrPtr, &BufferSize, Name);
+    StrPtr += (NameStrLen * 4);
   }
 
   StrCpy (StrPtr, L"&PATH=");