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:
@@ -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) {
|
||||
|
@@ -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
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
ASSERT (mHiiDatabaseProt != NULL);
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiHiiStringProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &mHiiStringProt
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
ASSERT (mHiiStringProt != NULL);
|
||||
if (mHiiProtocolsInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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,
|
||||
|
@@ -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
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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=");
|
||||
|
Reference in New Issue
Block a user