diff options
author | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-06-23 09:38:38 +0000 |
---|---|---|
committer | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-06-23 09:38:38 +0000 |
commit | 54cf87805f9ad61a316ce9e4eb9c67154c87cf0b (patch) | |
tree | 9a1aabb960f1530e0371bd18ef4391cfdffb0a55 /MdePkg | |
parent | 9a2d4fe9a7650097e5ef27366efbf3a14326f5b5 (diff) | |
download | edk2-54cf87805f9ad61a316ce9e4eb9c67154c87cf0b.tar.gz edk2-54cf87805f9ad61a316ce9e4eb9c67154c87cf0b.tar.bz2 edk2-54cf87805f9ad61a316ce9e4eb9c67154c87cf0b.zip |
Merged in the following trackers from EDK:
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
Diffstat (limited to 'MdePkg')
-rw-r--r-- | MdePkg/Include/Base.h | 4 | ||||
-rw-r--r-- | MdePkg/Include/Library/IfrSupportLib.h | 64 | ||||
-rw-r--r-- | MdePkg/Include/Protocol/HiiDatabase.h | 23 | ||||
-rw-r--r-- | MdePkg/Include/Protocol/HiiFont.h | 31 | ||||
-rw-r--r-- | MdePkg/Include/Protocol/HiiImage.h | 32 | ||||
-rw-r--r-- | MdePkg/Include/Protocol/HiiString.h | 18 | ||||
-rw-r--r-- | MdePkg/Include/Uefi/UefiBaseType.h | 3 | ||||
-rw-r--r-- | MdePkg/Include/Uefi/UefiInternalFormRepresentation.h | 33 | ||||
-rw-r--r-- | MdePkg/Library/HiiLib/HiiLanguage.c | 5 | ||||
-rw-r--r-- | MdePkg/Library/HiiLib/HiiLib.c | 62 | ||||
-rw-r--r-- | MdePkg/Library/HiiLib/HiiLib.inf | 5 | ||||
-rw-r--r-- | MdePkg/Library/HiiLib/InternalHiiLib.h | 12 | ||||
-rw-r--r-- | MdePkg/Library/IfrSupportLib/IfrSupportLib.inf | 6 | ||||
-rw-r--r-- | MdePkg/Library/IfrSupportLib/UefiIfrForm.c | 163 |
14 files changed, 348 insertions, 113 deletions
diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h index c5cf6f38d5..a08ea34e90 100644 --- a/MdePkg/Include/Base.h +++ b/MdePkg/Include/Base.h @@ -7,7 +7,7 @@ environment. There are a set of base libraries in the Mde Package that can
be used to implement base modules.
-Copyright (c) 2006 - 2007, Intel Corporation
+Copyright (c) 2006 - 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
@@ -293,6 +293,8 @@ typedef INTN RETURN_STATUS; #define RETURN_CRC_ERROR ENCODE_ERROR (27)
#define RETURN_END_OF_MEDIA ENCODE_ERROR (28)
#define RETURN_END_OF_FILE ENCODE_ERROR (31)
+#define RETURN_INVALID_LANGUAGE ENCODE_ERROR (32)
+
#define RETURN_WARN_UNKNOWN_GLYPH ENCODE_WARNING (1)
#define RETURN_WARN_DELETE_FAILURE ENCODE_WARNING (2)
diff --git a/MdePkg/Include/Library/IfrSupportLib.h b/MdePkg/Include/Library/IfrSupportLib.h index b8d3183e87..fbfb676f89 100644 --- a/MdePkg/Include/Library/IfrSupportLib.h +++ b/MdePkg/Include/Library/IfrSupportLib.h @@ -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 @@ -423,6 +423,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(). @param Str String for output @@ -465,6 +479,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. @param ConfigHdr Pointer to the ConfigHdr string. diff --git a/MdePkg/Include/Protocol/HiiDatabase.h b/MdePkg/Include/Protocol/HiiDatabase.h index 75245c11cd..57cc6d92f6 100644 --- a/MdePkg/Include/Protocol/HiiDatabase.h +++ b/MdePkg/Include/Protocol/HiiDatabase.h @@ -2,7 +2,7 @@ The file provides Database manager for HII-related data
structures.
- Copyright (c) 2006 - 2007, Intel Corporation
+ Copyright (c) 2006 - 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
@@ -127,8 +127,7 @@ EFI_STATUS @retval EFI_SUCCESS The data associated with the Handle was
removed from the HII database.
-
- @retval EFI_INVALID_PARAMETER The Handle was not valid.
+ @retval EFI_NOT_FOUND The specified Handle is not in database.
**/
typedef
@@ -177,7 +176,8 @@ EFI_STATUS @retval EFI_OUT_OF_RESOURCES Unable to allocate enough memory
for the updated database.
- @retval EFI_INVALID_PARAMETER The Handle was not valid.
+ @retval EFI_INVALID_PARAMETER PackageList was NULL.
+ @retval EFI_NOT_FOUND The specified Handle is not in database.
**/
typedef
@@ -219,14 +219,20 @@ EFI_STATUS @param Handle An array of EFI_HII_HANDLE instances returned.
- @retval EFI_SUCCESS Handle was updated successfully.
+ @retval EFI_SUCCESS The matching handles are outputed successfully.
+ HandleBufferLength is updated with the actual length.
- @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter
+ @retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter
indicates that Handle is too
small to support the number of
handles. HandleBufferLength is
updated with a value that will
enable the data to fit.
+ @retval EFI_NOT_FOUND No matching handle could not be found in database.
+ @retval EFI_INVALID_PARAMETER Handle or HandleBufferLength was NULL.
+ @retval EFI_INVALID_PARAMETER PackageType is not a EFI_HII_PACKAGE_TYPE_GUID but
+ PackageGuid is not NULL, PackageType is a EFI_HII_
+ PACKAGE_TYPE_GUID but PackageGuid is NULL.
**/
@@ -368,8 +374,9 @@ EFI_STATUS @retval EFI_SUCCESS Unregister the notification
Successsfully
- @retval EFI_INVALID_PARAMETER The Handle is invalid.
-
+ @retval EFI_NOT_FOUND The incoming notification handle does not exist
+ in current hii database.
+
**/
typedef
EFI_STATUS
diff --git a/MdePkg/Include/Protocol/HiiFont.h b/MdePkg/Include/Protocol/HiiFont.h index df9bbac93f..a4e56b278a 100644 --- a/MdePkg/Include/Protocol/HiiFont.h +++ b/MdePkg/Include/Protocol/HiiFont.h @@ -1,7 +1,7 @@ /** @file
The file provides services to retrieve font information.
- Copyright (c) 2006 - 2007, Intel Corporation
+ Copyright (c) 2006 - 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
@@ -31,8 +31,8 @@ typedef VOID *EFI_FONT_HANDLE; typedef UINT32 EFI_HII_OUT_FLAGS;
#define EFI_HII_OUT_FLAG_CLIP 0x00000001
#define EFI_HII_OUT_FLAG_WRAP 0x00000002
-#define EFI_HII_OUT_FLAG_CLEAN_Y 0x00000004
-#define EFI_HII_OUT_FLAG_CLEAN_X 0x00000008
+#define EFI_HII_OUT_FLAG_CLIP_CLEAN_Y 0x00000004
+#define EFI_HII_OUT_FLAG_CLIP_CLEAN_X 0x00000008
#define EFI_HII_OUT_FLAG_TRANSPARENT 0x00000010
#define EFI_HII_IGNORE_IF_NO_GLYPH 0x00000020
#define EFI_HII_IGNORE_LINE_BREAK 0x00000040
@@ -87,9 +87,9 @@ typedef UINT32 EFI_FONT_INFO_MASK; // EFI_FONT_INFO
//
typedef struct {
- UINT32 FontStyle;
- UINT16 FontSize;
- CHAR16 FontName[1];
+ EFI_HII_FONT_STYLE FontStyle;
+ UINT16 FontSize; // character cell height in pixels
+ CHAR16 FontName[1];
} EFI_FONT_INFO;
/**
@@ -253,10 +253,9 @@ typedef struct _EFI_FONT_DISPLAY_INFO { @retval EFI_OUT_OF_RESOURCES Unable to allocate an output
buffer for RowInfoArray or Blt.
- @retval EFI_INVALID_PARAMETER The String or Blt or Height or
- Width was NULL.
+ @retval EFI_INVALID_PARAMETER The String or Blt.
+ @retval EFI_INVALID_PARAMETER Flags were invalid combination..
-
**/
typedef
EFI_STATUS
@@ -388,6 +387,10 @@ EFI_STATUS @retval EFI_INVALID_PARAMETER The String or Blt or Height or
Width was NULL.
+ @retval EFI_INVALID_PARAMETER The Blt or PackageList was NULL.
+ @retval EFI_INVALID_PARAMETER Flags were invalid combination.
+ @retval EFI_NOT_FOUND The specified PackageList is not in the Database or the stringid is not
+ in the specified PackageList.
**/
typedef
@@ -469,7 +472,8 @@ EFI_STATUS to NULL if there are no more matching fonts.
@param StringInfoIn Upon entry, points to the font to return
- information about.
+ information about. If NULL, then the information about the system default
+ font will be returned.
@param StringInfoOut Upon return, contains the matching
font's information. If NULL, then no
@@ -483,8 +487,9 @@ EFI_STATUS @retval EFI_NOT_FOUND No matching font was found.
- @retval EFI_INVALID_PARAMETER FontHandle is NULL or
- StringInfoIn is NULL
+ @retval EFI_INVALID_PARAMETER StringInfoIn->FontInfoMask is an invalid combination.
+
+ @retval EFI_OUT_OF_RESOURCES There were insufficient resources to complete the request.
**/
typedef
@@ -492,7 +497,7 @@ EFI_STATUS (EFIAPI *EFI_HII_GET_FONT_INFO) (
IN CONST EFI_HII_FONT_PROTOCOL *This,
IN OUT EFI_FONT_HANDLE *FontHandle,
- IN CONST EFI_FONT_DISPLAY_INFO *StringInfoIn,
+ IN CONST EFI_FONT_DISPLAY_INFO *StringInfoIn, OPTIONAL
OUT EFI_FONT_DISPLAY_INFO **StringInfoOut,
IN CONST EFI_STRING String OPTIONAL
);
diff --git a/MdePkg/Include/Protocol/HiiImage.h b/MdePkg/Include/Protocol/HiiImage.h index 5bd84905c2..ca3d3e1ece 100644 --- a/MdePkg/Include/Protocol/HiiImage.h +++ b/MdePkg/Include/Protocol/HiiImage.h @@ -1,7 +1,7 @@ /** @file
The file provides services to access to images in the images database.
- Copyright (c) 2006 - 2007, Intel Corporation
+ Copyright (c) 2006 - 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
@@ -48,7 +48,7 @@ typedef struct _EFI_IMAGE_INPUT { UINT32 Flags;
UINT16 Width;
UINT16 Height;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Bitmap[1];
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap;
} EFI_IMAGE_INPUT;
@@ -109,21 +109,14 @@ EFI_STATUS @param Image Points to the new image.
- @param ImageSize On entry, points to the size of the buffer
- pointed to by Image, in bytes. On return,
- points to the length of the image, in bytes.
-
-
@retval EFI_SUCCESS The image was returned successfully.
-
+ The specified PackageList is not in the database.
@retval EFI_NOT_FOUND The image specified by ImageId is not
available.
- @retval EFI_BUFFER_TOO_SMALL The buffer specified by
- ImageLength is too small to hold
- the image.
-
@retval EFI_INVALID_PARAMETER The Image or Langugae was NULL.
+ @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not
+ enough memory.
**/
@@ -133,8 +126,7 @@ EFI_STATUS IN CONST EFI_HII_IMAGE_PROTOCOL *This,
IN EFI_HII_HANDLE PackageList,
IN EFI_IMAGE_ID ImageId,
- OUT EFI_IMAGE_INPUT *Image,
- OUT UINTN *ImageSize
+ OUT EFI_IMAGE_INPUT *Image
);
/**
@@ -156,7 +148,8 @@ EFI_STATUS @retval EFI_SUCCESS The image was successfully updated.
@retval EFI_NOT_FOUND The image specified by ImageId is not
- in the database.
+ in the database.
+ The specified PackageList is not in the database.
@retval EFI_INVALID_PARAMETER The Image or Language was
NULL.
@@ -180,8 +173,8 @@ typedef UINT32 EFI_HII_DRAW_FLAGS; #define EFI_HII_DRAW_FLAG_CLIP 0x00000001
#define EFI_HII_DRAW_FLAG_TRANSPARENT 0x00000030
#define EFI_HII_DRAW_FLAG_DEFAULT 0x00000000
-#define EFI_HII_DRAW_FLAG_FORCE_TRANS 0x00000001
-#define EFI_HII_DRAW_FLAG_FORCE_OPAQUE 0x00000002
+#define EFI_HII_DRAW_FLAG_FORCE_TRANS 0x00000010
+#define EFI_HII_DRAW_FLAG_FORCE_OPAQUE 0x00000020
#define EFI_HII_DIRECT_TO_SCREEN 0x00000080
@@ -332,8 +325,9 @@ EFI_STATUS @retval EFI_OUT_OF_RESOURCES Unable to allocate an output
buffer for RowInfoArray or Blt.
- @retval EFI_INVALID_PARAMETER The Image or Blt or Height or
- Width was NULL.
+ @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.
+ The specified PackageList is not in the database.
+ @retval EFI_INVALID_PARAMETER The Blt was NULL.
**/
typedef
diff --git a/MdePkg/Include/Protocol/HiiString.h b/MdePkg/Include/Protocol/HiiString.h index e120e9e470..0a522c2785 100644 --- a/MdePkg/Include/Protocol/HiiString.h +++ b/MdePkg/Include/Protocol/HiiString.h @@ -1,7 +1,7 @@ /** @file
The file provides services to manipulate string data.
- Copyright (c) 2006 - 2007, Intel Corporation
+ Copyright (c) 2006 - 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
@@ -101,14 +101,16 @@ EFI_STATUS points to the length of the string, in
bytes.
- @param StringFontInfo Points to the string's font
- information or NULL if the string font
- information is not desired.
+ @param StringFontInfo Points to a buffer that will be callee allocated and will
+ have the string's font information into this buffer.
+ The caller is responsible for freeing this buffer.
+ If the parameter is NULL a buffer will not be allocated
+ and the string font information will not be returned.
@retval EFI_SUCCESS The string was returned successfully.
@retval EFI_NOT_FOUND The string specified by StringId is not
- available.
+ available. The specified PackageList is not in the database.
@retval EFI_INVALID_LANGUAGE The string specified by StringId
is available but not in the
@@ -158,7 +160,7 @@ EFI_STATUS @retval EFI_SUCCESS The string was successfully updated.
@retval EFI_NOT_FOUND The string specified by StringId is not
- in the database.
+ in the database. The specified PackageList is not in the database.
@retval EFI_INVALID_PARAMETER The String or Language was NULL.
@@ -203,7 +205,8 @@ EFI_STATUS updated to contain the required
size.
- @retval EFI_INVALID_PARAMETER Languages is NULL.
+ @retval EFI_INVALID_PARAMETER Languages or LanguagesSize is NULL.
+ @retval EFI_NOT_FOUND The specified PackageList is not in the database.
**/
@@ -261,6 +264,7 @@ EFI_STATUS @retval EFI_INVALID_PARAMETER FirstLanguage is NULL or
SecondLanguage is NULL.
+ @retval EFI_NOT_FOUND The specified PackageList is not in the database.
**/
typedef
diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiBaseType.h index 4dfb273cef..c27dd99945 100644 --- a/MdePkg/Include/Uefi/UefiBaseType.h +++ b/MdePkg/Include/Uefi/UefiBaseType.h @@ -2,7 +2,7 @@ Defines data types and constants introduced in UEFI.
- Copyright (c) 2006 - 2007, Intel Corporation
+ Copyright (c) 2006 - 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
@@ -122,6 +122,7 @@ typedef union { #define EFI_CRC_ERROR RETURN_CRC_ERROR
#define EFI_END_OF_MEDIA RETURN_END_OF_MEDIA
#define EFI_END_OF_FILE RETURN_END_OF_FILE
+#define EFI_INVALID_LANGUAGE RETURN_INVALID_LANGUAGE
#define EFI_WARN_UNKNOWN_GLYPH RETURN_WARN_UNKNOWN_GLYPH
#define EFI_WARN_DELETE_FAILURE RETURN_WARN_DELETE_FAILURE
diff --git a/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h b/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h index d30a096893..a0dc166753 100644 --- a/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h +++ b/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h @@ -4,7 +4,7 @@ IFR is primarily consumed by the EFI presentation engine, and produced by EFI
internal application and drivers as well as all add-in card option-ROM drivers
- Copyright (c) 2006 - 2007, Intel Corporation
+ Copyright (c) 2006 - 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
@@ -133,6 +133,7 @@ typedef struct _EFI_HII_SIMPLE_FONT_PACKAGE_HDR { // Font Package
//
+#define EFI_HII_FONT_STYLE_NORMAL 0x00000000
#define EFI_HII_FONT_STYLE_BOLD 0x00000001
#define EFI_HII_FONT_STYLE_ITALIC 0x00000002
#define EFI_HII_FONT_STYLE_EMBOSS 0x00010000
@@ -723,14 +724,14 @@ typedef struct _EFI_IFR_VARSTORE { typedef struct _EFI_IFR_VARSTORE_EFI {
EFI_IFR_OP_HEADER Header;
- UINT16 VarStoreId;
+ EFI_VARSTORE_ID VarStoreId;
EFI_GUID Guid;
UINT32 Attributes;
} EFI_IFR_VARSTORE_EFI;
typedef struct _EFI_IFR_VARSTORE_NAME_VALUE {
EFI_IFR_OP_HEADER Header;
- UINT16 VarStoreId;
+ EFI_VARSTORE_ID VarStoreId;
EFI_GUID Guid;
} EFI_IFR_VARSTORE_NAME_VALUE;
@@ -1299,7 +1300,7 @@ typedef enum { EfiKeyB8,
EfiKeyB9,
EfiKeyB10,
- EfiKeyRshift,
+ EfiKeyRShift,
EfiKeyUpArrow,
EfiKeyOne,
EfiKeyTwo,
@@ -1422,16 +1423,16 @@ typedef struct { // EFI_HII_KEYBOARD_LAYOUT Layout[];
} EFI_HII_KEYBOARD_PACKAGE_HDR;
-typedef struct {
- CHAR16 Language[3];
- CHAR16 Space;
- CHAR16 DescriptionString[1];
-} EFI_DESCRIPTION_STRING;
+//typedef struct {
+// CHAR16 Language[]; // RFC4646 Language Code
+// CHAR16 Space;
+// CHAR16 DescriptionString[];
+//} EFI_DESCRIPTION_STRING;
-typedef struct {
- UINT16 DescriptionCount;
- EFI_DESCRIPTION_STRING DescriptionString[1];
-} EFI_DESCRIPTION_STRING_BUNDLE;
+//typedef struct {
+// UINT16 DescriptionCount;
+// EFI_DESCRIPTION_STRING DescriptionString[];
+//} EFI_DESCRIPTION_STRING_BUNDLE;
//
// Modifier values
@@ -1451,7 +1452,7 @@ typedef struct { #define EFI_LEFT_SHIFT_MODIFIER 0x000C
#define EFI_RIGHT_SHIFT_MODIFIER 0x000D
#define EFI_CAPS_LOCK_MODIFIER 0x000E
-#define EFI_NUM_LOCK _MODIFIER 0x000F
+#define EFI_NUM_LOCK_MODIFIER 0x000F
#define EFI_LEFT_ARROW_MODIFIER 0x0010
#define EFI_RIGHT_ARROW_MODIFIER 0x0011
#define EFI_DOWN_ARROW_MODIFIER 0x0012
@@ -1484,6 +1485,10 @@ typedef struct { #define EFI_PAUSE_MODIFIER 0x0025
#define EFI_BREAK_MODIFIER 0x0026
+#define EFI_LEFT_LOGO_MODIFIER 0x0027
+#define EFI_RIGHT_LOGO_MODIFIER 0x0028
+#define EFI_MENU_MODIFIER 0x0029
+
#pragma pack()
diff --git a/MdePkg/Library/HiiLib/HiiLanguage.c b/MdePkg/Library/HiiLib/HiiLanguage.c index 14a9313507..cd2b66063b 100644 --- a/MdePkg/Library/HiiLib/HiiLanguage.c +++ b/MdePkg/Library/HiiLib/HiiLanguage.c @@ -95,6 +95,8 @@ HiiLibGetSupportedLanguages ( if (LanguageString == NULL) {
return NULL;
}
+
+ LocateHiiProtocols ();
Status = mHiiStringProt->GetLanguages (mHiiStringProt, HiiHandle, LanguageString, &BufferSize);
@@ -164,6 +166,9 @@ HiiLibGetSupportedSecondaryLanguages ( if (LanguageString == NULL) {
return NULL;
}
+
+ LocateHiiProtocols ();
+
Status = mHiiStringProt->GetSecondaryLanguages (mHiiStringProt, HiiHandle, FirstLanguage, LanguageString, &BufferSize);
if (Status == EFI_BUFFER_TOO_SMALL) {
diff --git a/MdePkg/Library/HiiLib/HiiLib.c b/MdePkg/Library/HiiLib/HiiLib.c index 1f59fa4fa5..940536620c 100644 --- a/MdePkg/Library/HiiLib/HiiLib.c +++ b/MdePkg/Library/HiiLib/HiiLib.c @@ -16,44 +16,36 @@ CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt;
CONST EFI_HII_STRING_PROTOCOL *mHiiStringProt;
+BOOLEAN mHiiProtocolsInitialized = FALSE;
+
/**
- The constructor function of Hii Library.
-
- The constructor function caches the value of default HII protocol instances.
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
+ This function locate Hii relative protocols for later usage.
+
+ @param VOID
+
+ @retval VOID
**/
-EFI_STATUS
-EFIAPI
-UefiHiiLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+VOID
+LocateHiiProtocols (
+ VOID
)
{
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol (
- &gEfiHiiDatabaseProtocolGuid,
- NULL,
- (VOID **) &mHiiDatabaseProt
- );
+ EFI_STATUS Status;
+
+ if (mHiiProtocolsInitialized) {
+ return;
+ }
+
+ Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &mHiiDatabaseProt);
ASSERT_EFI_ERROR (Status);
- ASSERT (mHiiDatabaseProt != NULL);
- Status = gBS->LocateProtocol (
- &gEfiHiiStringProtocolGuid,
- NULL,
- (VOID **) &mHiiStringProt
- );
+ Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &mHiiStringProt);
ASSERT_EFI_ERROR (Status);
- ASSERT (mHiiStringProt != NULL);
- return EFI_SUCCESS;
+ mHiiProtocolsInitialized = TRUE;
}
@@ -151,6 +143,8 @@ HiiLibAddPackages ( ASSERT (HiiHandle != NULL);
+ LocateHiiProtocols ();
+
VA_START (Args, HiiHandle);
PackageListHeader = InternalHiiLibPreparePackages (NumberOfPackages, GuidId, Args);
@@ -174,8 +168,10 @@ HiiLibRemovePackages ( )
{
EFI_STATUS Status;
-
ASSERT (HiiHandle != NULL);
+
+ LocateHiiProtocols ();
+
Status = mHiiDatabaseProt->RemovePackageList (mHiiDatabaseProt, HiiHandle);
ASSERT_EFI_ERROR (Status);
}
@@ -196,6 +192,8 @@ HiiLibGetHiiHandles ( BufferLength = 0;
+ LocateHiiProtocols ();
+
//
// Try to find the actual buffer size for HiiHandle Buffer.
//
@@ -245,6 +243,9 @@ HiiLibExtractGuidFromHiiHandle ( //
BufferSize = 0;
HiiPackageList = NULL;
+
+ LocateHiiProtocols ();
+
Status = mHiiDatabaseProt->ExportPackageLists (mHiiDatabaseProt, Handle, &BufferSize, HiiPackageList);
ASSERT (Status != EFI_NOT_FOUND);
@@ -326,6 +327,8 @@ HiiLibDevicePathToHiiHandle ( return NULL;
}
+ LocateHiiProtocols ();
+
//
// Retrieve all Hii Handles from HII database
//
@@ -392,6 +395,9 @@ IsHiiHandleRegistered ( HiiPackageList = NULL;
BufferSize = 0;
+
+ LocateHiiProtocols ();
+
Status = mHiiDatabaseProt->ExportPackageLists (
mHiiDatabaseProt,
HiiHandle,
diff --git a/MdePkg/Library/HiiLib/HiiLib.inf b/MdePkg/Library/HiiLib/HiiLib.inf index 30a1657984..f9ff028942 100644 --- a/MdePkg/Library/HiiLib/HiiLib.inf +++ b/MdePkg/Library/HiiLib/HiiLib.inf @@ -24,8 +24,6 @@ EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x0002000A
- CONSTRUCTOR = UefiHiiLibConstructor
-
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
@@ -54,8 +52,5 @@ [Guids]
gEfiGlobalVariableGuid
-[Depex]
- gEfiHiiDatabaseProtocolGuid AND gEfiHiiStringProtocolGuid
-
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang
\ No newline at end of file diff --git a/MdePkg/Library/HiiLib/InternalHiiLib.h b/MdePkg/Library/HiiLib/InternalHiiLib.h index b2c8b87707..5d03cd1b78 100644 --- a/MdePkg/Library/HiiLib/InternalHiiLib.h +++ b/MdePkg/Library/HiiLib/InternalHiiLib.h @@ -36,8 +36,10 @@ #define HII_LIB_DEFAULT_STRING_SIZE 0x200
-extern CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt;
-extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProt;
+extern CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt;
+extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProt;
+extern BOOLEAN mHiiProtocolsInitialized;
+
BOOLEAN
IsHiiHandleRegistered (
@@ -45,4 +47,10 @@ IsHiiHandleRegistered ( )
;
+VOID
+LocateHiiProtocols (
+ VOID
+ )
+;
+
#endif
diff --git a/MdePkg/Library/IfrSupportLib/IfrSupportLib.inf b/MdePkg/Library/IfrSupportLib/IfrSupportLib.inf index 98ac18c07c..cb5b53a5b7 100644 --- a/MdePkg/Library/IfrSupportLib/IfrSupportLib.inf +++ b/MdePkg/Library/IfrSupportLib/IfrSupportLib.inf @@ -25,8 +25,6 @@ EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
- CONSTRUCTOR = IfrSupportLibConstructor
-
#
# The following information is for reference only and not required by the build tools.
#
@@ -34,7 +32,6 @@ #
[Sources.common]
- UefiIfrCommon.c
UefiIfrForm.c
UefiIfrLibraryInternal.h
UefiIfrOpCodeCreation.c
@@ -64,8 +61,5 @@ gEfiHiiConfigRoutingProtocolGuid
gEfiFormBrowser2ProtocolGuid
-[Depex]
- gEfiHiiDatabaseProtocolGuid AND gEfiHiiStringProtocolGuid
-
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang
diff --git a/MdePkg/Library/IfrSupportLib/UefiIfrForm.c b/MdePkg/Library/IfrSupportLib/UefiIfrForm.c index 8963789423..af43db0998 100644 --- a/MdePkg/Library/IfrSupportLib/UefiIfrForm.c +++ b/MdePkg/Library/IfrSupportLib/UefiIfrForm.c @@ -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="); |