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
This commit is contained in:
qwang12 2008-06-23 09:38:38 +00:00
parent 9a2d4fe9a7
commit 54cf87805f
14 changed files with 350 additions and 115 deletions

View File

@ -7,7 +7,7 @@
environment. There are a set of base libraries in the Mde Package that can environment. There are a set of base libraries in the Mde Package that can
be used to implement base modules. 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 All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 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_CRC_ERROR ENCODE_ERROR (27)
#define RETURN_END_OF_MEDIA ENCODE_ERROR (28) #define RETURN_END_OF_MEDIA ENCODE_ERROR (28)
#define RETURN_END_OF_FILE ENCODE_ERROR (31) #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_UNKNOWN_GLYPH ENCODE_WARNING (1)
#define RETURN_WARN_DELETE_FAILURE ENCODE_WARNING (2) #define RETURN_WARN_DELETE_FAILURE ENCODE_WARNING (2)

View File

@ -2,7 +2,7 @@
The file contain all library functions and definitions for IFR opcode creation and The file contain all library functions and definitions for IFR opcode creation and
related Form Browser utility Operations. 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 All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 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(). 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. Construct <ConfigHdr> using routing information GUID/NAME/PATH.

View File

@ -2,7 +2,7 @@
The file provides Database manager for HII-related data The file provides Database manager for HII-related data
structures. structures.
Copyright (c) 2006 - 2007, Intel Corporation Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 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 @retval EFI_SUCCESS The data associated with the Handle was
removed from the HII database. removed from the HII database.
@retval EFI_NOT_FOUND The specified Handle is not in database.
@retval EFI_INVALID_PARAMETER The Handle was not valid.
**/ **/
typedef typedef
@ -177,7 +176,8 @@ EFI_STATUS
@retval EFI_OUT_OF_RESOURCES Unable to allocate enough memory @retval EFI_OUT_OF_RESOURCES Unable to allocate enough memory
for the updated database. 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 typedef
@ -219,14 +219,20 @@ EFI_STATUS
@param Handle An array of EFI_HII_HANDLE instances returned. @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 indicates that Handle is too
small to support the number of small to support the number of
handles. HandleBufferLength is handles. HandleBufferLength is
updated with a value that will updated with a value that will
enable the data to fit. 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 @retval EFI_SUCCESS Unregister the notification
Successsfully 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 typedef
EFI_STATUS EFI_STATUS

View File

@ -1,7 +1,7 @@
/** @file /** @file
The file provides services to retrieve font information. 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 All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 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; typedef UINT32 EFI_HII_OUT_FLAGS;
#define EFI_HII_OUT_FLAG_CLIP 0x00000001 #define EFI_HII_OUT_FLAG_CLIP 0x00000001
#define EFI_HII_OUT_FLAG_WRAP 0x00000002 #define EFI_HII_OUT_FLAG_WRAP 0x00000002
#define EFI_HII_OUT_FLAG_CLEAN_Y 0x00000004 #define EFI_HII_OUT_FLAG_CLIP_CLEAN_Y 0x00000004
#define EFI_HII_OUT_FLAG_CLEAN_X 0x00000008 #define EFI_HII_OUT_FLAG_CLIP_CLEAN_X 0x00000008
#define EFI_HII_OUT_FLAG_TRANSPARENT 0x00000010 #define EFI_HII_OUT_FLAG_TRANSPARENT 0x00000010
#define EFI_HII_IGNORE_IF_NO_GLYPH 0x00000020 #define EFI_HII_IGNORE_IF_NO_GLYPH 0x00000020
#define EFI_HII_IGNORE_LINE_BREAK 0x00000040 #define EFI_HII_IGNORE_LINE_BREAK 0x00000040
@ -87,9 +87,9 @@ typedef UINT32 EFI_FONT_INFO_MASK;
// EFI_FONT_INFO // EFI_FONT_INFO
// //
typedef struct { typedef struct {
UINT32 FontStyle; EFI_HII_FONT_STYLE FontStyle;
UINT16 FontSize; UINT16 FontSize; // character cell height in pixels
CHAR16 FontName[1]; CHAR16 FontName[1];
} EFI_FONT_INFO; } EFI_FONT_INFO;
/** /**
@ -253,10 +253,9 @@ typedef struct _EFI_FONT_DISPLAY_INFO {
@retval EFI_OUT_OF_RESOURCES Unable to allocate an output @retval EFI_OUT_OF_RESOURCES Unable to allocate an output
buffer for RowInfoArray or Blt. buffer for RowInfoArray or Blt.
@retval EFI_INVALID_PARAMETER The String or Blt or Height or @retval EFI_INVALID_PARAMETER The String or Blt.
Width was NULL. @retval EFI_INVALID_PARAMETER Flags were invalid combination..
**/ **/
typedef typedef
EFI_STATUS EFI_STATUS
@ -388,6 +387,10 @@ EFI_STATUS
@retval EFI_INVALID_PARAMETER The String or Blt or Height or @retval EFI_INVALID_PARAMETER The String or Blt or Height or
Width was NULL. 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 typedef
@ -469,7 +472,8 @@ EFI_STATUS
to NULL if there are no more matching fonts. to NULL if there are no more matching fonts.
@param StringInfoIn Upon entry, points to the font to return @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 @param StringInfoOut Upon return, contains the matching
font's information. If NULL, then no font's information. If NULL, then no
@ -483,8 +487,9 @@ EFI_STATUS
@retval EFI_NOT_FOUND No matching font was found. @retval EFI_NOT_FOUND No matching font was found.
@retval EFI_INVALID_PARAMETER FontHandle is NULL or @retval EFI_INVALID_PARAMETER StringInfoIn->FontInfoMask is an invalid combination.
StringInfoIn is NULL
@retval EFI_OUT_OF_RESOURCES There were insufficient resources to complete the request.
**/ **/
typedef typedef
@ -492,7 +497,7 @@ EFI_STATUS
(EFIAPI *EFI_HII_GET_FONT_INFO) ( (EFIAPI *EFI_HII_GET_FONT_INFO) (
IN CONST EFI_HII_FONT_PROTOCOL *This, IN CONST EFI_HII_FONT_PROTOCOL *This,
IN OUT EFI_FONT_HANDLE *FontHandle, 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, OUT EFI_FONT_DISPLAY_INFO **StringInfoOut,
IN CONST EFI_STRING String OPTIONAL IN CONST EFI_STRING String OPTIONAL
); );

View File

@ -1,7 +1,7 @@
/** @file /** @file
The file provides services to access to images in the images database. 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 All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 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; UINT32 Flags;
UINT16 Width; UINT16 Width;
UINT16 Height; UINT16 Height;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Bitmap[1]; EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Bitmap;
} EFI_IMAGE_INPUT; } EFI_IMAGE_INPUT;
@ -109,21 +109,14 @@ EFI_STATUS
@param Image Points to the new image. @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. @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 @retval EFI_NOT_FOUND The image specified by ImageId is not
available. 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_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 CONST EFI_HII_IMAGE_PROTOCOL *This,
IN EFI_HII_HANDLE PackageList, IN EFI_HII_HANDLE PackageList,
IN EFI_IMAGE_ID ImageId, IN EFI_IMAGE_ID ImageId,
OUT EFI_IMAGE_INPUT *Image, OUT EFI_IMAGE_INPUT *Image
OUT UINTN *ImageSize
); );
/** /**
@ -156,7 +148,8 @@ EFI_STATUS
@retval EFI_SUCCESS The image was successfully updated. @retval EFI_SUCCESS The image was successfully updated.
@retval EFI_NOT_FOUND The image specified by ImageId is not @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 @retval EFI_INVALID_PARAMETER The Image or Language was
NULL. NULL.
@ -180,8 +173,8 @@ typedef UINT32 EFI_HII_DRAW_FLAGS;
#define EFI_HII_DRAW_FLAG_CLIP 0x00000001 #define EFI_HII_DRAW_FLAG_CLIP 0x00000001
#define EFI_HII_DRAW_FLAG_TRANSPARENT 0x00000030 #define EFI_HII_DRAW_FLAG_TRANSPARENT 0x00000030
#define EFI_HII_DRAW_FLAG_DEFAULT 0x00000000 #define EFI_HII_DRAW_FLAG_DEFAULT 0x00000000
#define EFI_HII_DRAW_FLAG_FORCE_TRANS 0x00000001 #define EFI_HII_DRAW_FLAG_FORCE_TRANS 0x00000010
#define EFI_HII_DRAW_FLAG_FORCE_OPAQUE 0x00000002 #define EFI_HII_DRAW_FLAG_FORCE_OPAQUE 0x00000020
#define EFI_HII_DIRECT_TO_SCREEN 0x00000080 #define EFI_HII_DIRECT_TO_SCREEN 0x00000080
@ -332,8 +325,9 @@ EFI_STATUS
@retval EFI_OUT_OF_RESOURCES Unable to allocate an output @retval EFI_OUT_OF_RESOURCES Unable to allocate an output
buffer for RowInfoArray or Blt. buffer for RowInfoArray or Blt.
@retval EFI_INVALID_PARAMETER The Image or Blt or Height or @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.
Width was NULL. The specified PackageList is not in the database.
@retval EFI_INVALID_PARAMETER The Blt was NULL.
**/ **/
typedef typedef

View File

@ -1,7 +1,7 @@
/** @file /** @file
The file provides services to manipulate string data. 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 All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 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 points to the length of the string, in
bytes. bytes.
@param StringFontInfo Points to the string's font @param StringFontInfo Points to a buffer that will be callee allocated and will
information or NULL if the string font have the string's font information into this buffer.
information is not desired. 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_SUCCESS The string was returned successfully.
@retval EFI_NOT_FOUND The string specified by StringId is not @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 @retval EFI_INVALID_LANGUAGE The string specified by StringId
is available but not in the is available but not in the
@ -158,7 +160,7 @@ EFI_STATUS
@retval EFI_SUCCESS The string was successfully updated. @retval EFI_SUCCESS The string was successfully updated.
@retval EFI_NOT_FOUND The string specified by StringId is not @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. @retval EFI_INVALID_PARAMETER The String or Language was NULL.
@ -203,7 +205,8 @@ EFI_STATUS
updated to contain the required updated to contain the required
size. 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 @retval EFI_INVALID_PARAMETER FirstLanguage is NULL or
SecondLanguage is NULL. SecondLanguage is NULL.
@retval EFI_NOT_FOUND The specified PackageList is not in the database.
**/ **/
typedef typedef

View File

@ -2,7 +2,7 @@
Defines data types and constants introduced in UEFI. 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 All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 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_CRC_ERROR RETURN_CRC_ERROR
#define EFI_END_OF_MEDIA RETURN_END_OF_MEDIA #define EFI_END_OF_MEDIA RETURN_END_OF_MEDIA
#define EFI_END_OF_FILE RETURN_END_OF_FILE #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_UNKNOWN_GLYPH RETURN_WARN_UNKNOWN_GLYPH
#define EFI_WARN_DELETE_FAILURE RETURN_WARN_DELETE_FAILURE #define EFI_WARN_DELETE_FAILURE RETURN_WARN_DELETE_FAILURE

View File

@ -4,7 +4,7 @@
IFR is primarily consumed by the EFI presentation engine, and produced by EFI 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 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 All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 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 // Font Package
// //
#define EFI_HII_FONT_STYLE_NORMAL 0x00000000
#define EFI_HII_FONT_STYLE_BOLD 0x00000001 #define EFI_HII_FONT_STYLE_BOLD 0x00000001
#define EFI_HII_FONT_STYLE_ITALIC 0x00000002 #define EFI_HII_FONT_STYLE_ITALIC 0x00000002
#define EFI_HII_FONT_STYLE_EMBOSS 0x00010000 #define EFI_HII_FONT_STYLE_EMBOSS 0x00010000
@ -723,14 +724,14 @@ typedef struct _EFI_IFR_VARSTORE {
typedef struct _EFI_IFR_VARSTORE_EFI { typedef struct _EFI_IFR_VARSTORE_EFI {
EFI_IFR_OP_HEADER Header; EFI_IFR_OP_HEADER Header;
UINT16 VarStoreId; EFI_VARSTORE_ID VarStoreId;
EFI_GUID Guid; EFI_GUID Guid;
UINT32 Attributes; UINT32 Attributes;
} EFI_IFR_VARSTORE_EFI; } EFI_IFR_VARSTORE_EFI;
typedef struct _EFI_IFR_VARSTORE_NAME_VALUE { typedef struct _EFI_IFR_VARSTORE_NAME_VALUE {
EFI_IFR_OP_HEADER Header; EFI_IFR_OP_HEADER Header;
UINT16 VarStoreId; EFI_VARSTORE_ID VarStoreId;
EFI_GUID Guid; EFI_GUID Guid;
} EFI_IFR_VARSTORE_NAME_VALUE; } EFI_IFR_VARSTORE_NAME_VALUE;
@ -1299,7 +1300,7 @@ typedef enum {
EfiKeyB8, EfiKeyB8,
EfiKeyB9, EfiKeyB9,
EfiKeyB10, EfiKeyB10,
EfiKeyRshift, EfiKeyRShift,
EfiKeyUpArrow, EfiKeyUpArrow,
EfiKeyOne, EfiKeyOne,
EfiKeyTwo, EfiKeyTwo,
@ -1422,16 +1423,16 @@ typedef struct {
// EFI_HII_KEYBOARD_LAYOUT Layout[]; // EFI_HII_KEYBOARD_LAYOUT Layout[];
} EFI_HII_KEYBOARD_PACKAGE_HDR; } EFI_HII_KEYBOARD_PACKAGE_HDR;
typedef struct { //typedef struct {
CHAR16 Language[3]; // CHAR16 Language[]; // RFC4646 Language Code
CHAR16 Space; // CHAR16 Space;
CHAR16 DescriptionString[1]; // CHAR16 DescriptionString[];
} EFI_DESCRIPTION_STRING; //} EFI_DESCRIPTION_STRING;
typedef struct { //typedef struct {
UINT16 DescriptionCount; // UINT16 DescriptionCount;
EFI_DESCRIPTION_STRING DescriptionString[1]; // EFI_DESCRIPTION_STRING DescriptionString[];
} EFI_DESCRIPTION_STRING_BUNDLE; //} EFI_DESCRIPTION_STRING_BUNDLE;
// //
// Modifier values // Modifier values
@ -1451,7 +1452,7 @@ typedef struct {
#define EFI_LEFT_SHIFT_MODIFIER 0x000C #define EFI_LEFT_SHIFT_MODIFIER 0x000C
#define EFI_RIGHT_SHIFT_MODIFIER 0x000D #define EFI_RIGHT_SHIFT_MODIFIER 0x000D
#define EFI_CAPS_LOCK_MODIFIER 0x000E #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_LEFT_ARROW_MODIFIER 0x0010
#define EFI_RIGHT_ARROW_MODIFIER 0x0011 #define EFI_RIGHT_ARROW_MODIFIER 0x0011
#define EFI_DOWN_ARROW_MODIFIER 0x0012 #define EFI_DOWN_ARROW_MODIFIER 0x0012
@ -1484,6 +1485,10 @@ typedef struct {
#define EFI_PAUSE_MODIFIER 0x0025 #define EFI_PAUSE_MODIFIER 0x0025
#define EFI_BREAK_MODIFIER 0x0026 #define EFI_BREAK_MODIFIER 0x0026
#define EFI_LEFT_LOGO_MODIFIER 0x0027
#define EFI_RIGHT_LOGO_MODIFIER 0x0028
#define EFI_MENU_MODIFIER 0x0029
#pragma pack() #pragma pack()

View File

@ -95,6 +95,8 @@ HiiLibGetSupportedLanguages (
if (LanguageString == NULL) { if (LanguageString == NULL) {
return NULL; return NULL;
} }
LocateHiiProtocols ();
Status = mHiiStringProt->GetLanguages (mHiiStringProt, HiiHandle, LanguageString, &BufferSize); Status = mHiiStringProt->GetLanguages (mHiiStringProt, HiiHandle, LanguageString, &BufferSize);
@ -164,6 +166,9 @@ HiiLibGetSupportedSecondaryLanguages (
if (LanguageString == NULL) { if (LanguageString == NULL) {
return NULL; return NULL;
} }
LocateHiiProtocols ();
Status = mHiiStringProt->GetSecondaryLanguages (mHiiStringProt, HiiHandle, FirstLanguage, LanguageString, &BufferSize); Status = mHiiStringProt->GetSecondaryLanguages (mHiiStringProt, HiiHandle, FirstLanguage, LanguageString, &BufferSize);
if (Status == EFI_BUFFER_TOO_SMALL) { if (Status == EFI_BUFFER_TOO_SMALL) {

View File

@ -16,44 +16,36 @@
CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt; CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt;
CONST EFI_HII_STRING_PROTOCOL *mHiiStringProt; 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. This function locate Hii relative protocols for later usage.
@param SystemTable A pointer to the EFI System Table.
@param VOID
@retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
@retval VOID
**/ **/
EFI_STATUS VOID
EFIAPI LocateHiiProtocols (
UefiHiiLibConstructor ( VOID
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = gBS->LocateProtocol (
&gEfiHiiDatabaseProtocolGuid,
NULL,
(VOID **) &mHiiDatabaseProt
);
ASSERT_EFI_ERROR (Status);
ASSERT (mHiiDatabaseProt != NULL);
Status = gBS->LocateProtocol ( if (mHiiProtocolsInitialized) {
&gEfiHiiStringProtocolGuid, return;
NULL, }
(VOID **) &mHiiStringProt
);
ASSERT_EFI_ERROR (Status);
ASSERT (mHiiStringProt != NULL);
return EFI_SUCCESS; Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &mHiiDatabaseProt);
ASSERT_EFI_ERROR (Status);
Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &mHiiStringProt);
ASSERT_EFI_ERROR (Status);
mHiiProtocolsInitialized = TRUE;
} }
@ -151,6 +143,8 @@ HiiLibAddPackages (
ASSERT (HiiHandle != NULL); ASSERT (HiiHandle != NULL);
LocateHiiProtocols ();
VA_START (Args, HiiHandle); VA_START (Args, HiiHandle);
PackageListHeader = InternalHiiLibPreparePackages (NumberOfPackages, GuidId, Args); PackageListHeader = InternalHiiLibPreparePackages (NumberOfPackages, GuidId, Args);
@ -174,8 +168,10 @@ HiiLibRemovePackages (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
ASSERT (HiiHandle != NULL); ASSERT (HiiHandle != NULL);
LocateHiiProtocols ();
Status = mHiiDatabaseProt->RemovePackageList (mHiiDatabaseProt, HiiHandle); Status = mHiiDatabaseProt->RemovePackageList (mHiiDatabaseProt, HiiHandle);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
} }
@ -196,6 +192,8 @@ HiiLibGetHiiHandles (
BufferLength = 0; BufferLength = 0;
LocateHiiProtocols ();
// //
// Try to find the actual buffer size for HiiHandle Buffer. // Try to find the actual buffer size for HiiHandle Buffer.
// //
@ -245,6 +243,9 @@ HiiLibExtractGuidFromHiiHandle (
// //
BufferSize = 0; BufferSize = 0;
HiiPackageList = NULL; HiiPackageList = NULL;
LocateHiiProtocols ();
Status = mHiiDatabaseProt->ExportPackageLists (mHiiDatabaseProt, Handle, &BufferSize, HiiPackageList); Status = mHiiDatabaseProt->ExportPackageLists (mHiiDatabaseProt, Handle, &BufferSize, HiiPackageList);
ASSERT (Status != EFI_NOT_FOUND); ASSERT (Status != EFI_NOT_FOUND);
@ -326,6 +327,8 @@ HiiLibDevicePathToHiiHandle (
return NULL; return NULL;
} }
LocateHiiProtocols ();
// //
// Retrieve all Hii Handles from HII database // Retrieve all Hii Handles from HII database
// //
@ -392,6 +395,9 @@ IsHiiHandleRegistered (
HiiPackageList = NULL; HiiPackageList = NULL;
BufferSize = 0; BufferSize = 0;
LocateHiiProtocols ();
Status = mHiiDatabaseProt->ExportPackageLists ( Status = mHiiDatabaseProt->ExportPackageLists (
mHiiDatabaseProt, mHiiDatabaseProt,
HiiHandle, HiiHandle,

View File

@ -24,8 +24,6 @@
EDK_RELEASE_VERSION = 0x00020000 EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x0002000A EFI_SPECIFICATION_VERSION = 0x0002000A
CONSTRUCTOR = UefiHiiLibConstructor
# #
# VALID_ARCHITECTURES = IA32 X64 IPF EBC # VALID_ARCHITECTURES = IA32 X64 IPF EBC
# #
@ -54,8 +52,5 @@
[Guids] [Guids]
gEfiGlobalVariableGuid gEfiGlobalVariableGuid
[Depex]
gEfiHiiDatabaseProtocolGuid AND gEfiHiiStringProtocolGuid
[Pcd] [Pcd]
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang

View File

@ -36,8 +36,10 @@
#define HII_LIB_DEFAULT_STRING_SIZE 0x200 #define HII_LIB_DEFAULT_STRING_SIZE 0x200
extern CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt; extern CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt;
extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProt; extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProt;
extern BOOLEAN mHiiProtocolsInitialized;
BOOLEAN BOOLEAN
IsHiiHandleRegistered ( IsHiiHandleRegistered (
@ -45,4 +47,10 @@ IsHiiHandleRegistered (
) )
; ;
VOID
LocateHiiProtocols (
VOID
)
;
#endif #endif

View File

@ -25,8 +25,6 @@
EDK_RELEASE_VERSION = 0x00020000 EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000 EFI_SPECIFICATION_VERSION = 0x00020000
CONSTRUCTOR = IfrSupportLibConstructor
# #
# The following information is for reference only and not required by the build tools. # The following information is for reference only and not required by the build tools.
# #
@ -34,7 +32,6 @@
# #
[Sources.common] [Sources.common]
UefiIfrCommon.c
UefiIfrForm.c UefiIfrForm.c
UefiIfrLibraryInternal.h UefiIfrLibraryInternal.h
UefiIfrOpCodeCreation.c UefiIfrOpCodeCreation.c
@ -64,8 +61,5 @@
gEfiHiiConfigRoutingProtocolGuid gEfiHiiConfigRoutingProtocolGuid
gEfiFormBrowser2ProtocolGuid gEfiFormBrowser2ProtocolGuid
[Depex]
gEfiHiiDatabaseProtocolGuid AND gEfiHiiStringProtocolGuid
[Pcd] [Pcd]
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2007, Intel Corporation Copyright (c) 2007- 2008, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -242,7 +242,7 @@ SwapBuffer (
UINT8 Temp; UINT8 Temp;
UINTN SwapCount; UINTN SwapCount;
SwapCount = (BufferSize - 1) / 2; SwapCount = BufferSize / 2;
for (Index = 0; Index < SwapCount; Index++) { for (Index = 0; Index < SwapCount; Index++) {
Temp = Buffer[Index]; Temp = Buffer[Index];
Buffer[Index] = Buffer[BufferSize - 1 - 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(). Converts binary buffer to Unicode string in reversed byte order from BufToHexString().
@ -276,10 +298,14 @@ BufferToHexString (
NewBuffer = AllocateCopyPool (BufferSize, Buffer); NewBuffer = AllocateCopyPool (BufferSize, Buffer);
SwapBuffer (NewBuffer, BufferSize); SwapBuffer (NewBuffer, BufferSize);
StrBufferLen = (BufferSize + 1) * sizeof (CHAR16); StrBufferLen = BufferSize * sizeof (CHAR16) + 1;
Status = BufToHexString (Str, &StrBufferLen, NewBuffer, BufferSize); Status = BufToHexString (Str, &StrBufferLen, NewBuffer, BufferSize);
gBS->FreePool (NewBuffer); gBS->FreePool (NewBuffer);
//
// Convert the uppercase to lowercase since <HexAf> is defined in lowercase format.
//
ToLower (Str);
return Status; return Status;
} }
@ -319,6 +345,123 @@ HexStringToBuffer (
return Status; 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. Construct <ConfigHdr> using routing information GUID/NAME/PATH.
@ -383,10 +526,10 @@ ConstructConfigHdr (
DevicePathSize = GetDevicePathSize (DevicePath); DevicePathSize = GetDevicePathSize (DevicePath);
// //
// GUID=<HexCh>32&NAME=<Alpha>NameStrLen&PATH=<HexChar>DevicePathStrLen <NULL> // GUID=<HexCh>32&NAME=<Char>NameStrLen&PATH=<HexChar>DevicePathStrLen <NULL>
// | 5 | 32 | 6 | NameStrLen | 6 | DevicePathStrLen | // | 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) { if (*StrBufferLen < BufferSize) {
*StrBufferLen = BufferSize; *StrBufferLen = BufferSize;
return EFI_BUFFER_TOO_SMALL; return EFI_BUFFER_TOO_SMALL;
@ -401,11 +544,15 @@ ConstructConfigHdr (
BufferToHexString (StrPtr, (UINT8 *) Guid, sizeof (EFI_GUID)); BufferToHexString (StrPtr, (UINT8 *) Guid, sizeof (EFI_GUID));
StrPtr += 32; StrPtr += 32;
//
// Convert name string, e.g. name "ABCD" => "&NAME=0041004200430044"
//
StrCpy (StrPtr, L"&NAME="); StrCpy (StrPtr, L"&NAME=");
StrPtr += 6; StrPtr += 6;
if (Name != NULL) { if (Name != NULL) {
StrCpy (StrPtr, Name); BufferSize = (NameStrLen * 4 + 1) * sizeof (CHAR16);
StrPtr += NameStrLen; UnicodeToConfigString (StrPtr, &BufferSize, Name);
StrPtr += (NameStrLen * 4);
} }
StrCpy (StrPtr, L"&PATH="); StrCpy (StrPtr, L"&PATH=");