summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r--MdeModulePkg/Universal/BdsDxe/FrontPage.c2
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c280
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/Database.c33
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/Font.c246
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h62
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf3
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c21
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/Image.c67
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/String.c195
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c10
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.c42
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Ui.c2
12 files changed, 502 insertions, 461 deletions
diff --git a/MdeModulePkg/Universal/BdsDxe/FrontPage.c b/MdeModulePkg/Universal/BdsDxe/FrontPage.c
index 7f3155b..47da390 100644
--- a/MdeModulePkg/Universal/BdsDxe/FrontPage.c
+++ b/MdeModulePkg/Universal/BdsDxe/FrontPage.c
@@ -931,6 +931,8 @@ Returns:
//
// Timeout or user press enter to continue
//
+ gST->ConOut->EnableCursor (gST->ConOut, TRUE);
+ gST->ConOut->ClearScreen (gST->ConOut);
goto Exit;
}
}
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
index 3f35ed9..8decc76 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
@@ -27,189 +27,6 @@ Revision History
#ifndef DISABLE_UNUSED_HII_PROTOCOLS
-STATIC
-CHAR16
-NibbleToHexCharPrivate (
- IN UINT8 Nibble
- )
-/*++
-
- Routine Description:
- Converts the low nibble of a byte to hex unicode character.
-
- Arguments:
- Nibble - lower nibble of a byte.
-
- Returns:
- Hex unicode character between L'0' to L'f'.
-
---*/
-{
- Nibble &= 0x0F;
-
- if (Nibble <= 0x9) {
- return (CHAR16)(Nibble + L'0');
- }
-
- return (CHAR16)(Nibble - 0xA + L'a');
-}
-
-
-/**
- Converts Unicode string to binary buffer.
- The conversion may be partial.
- The first character in the string that is not hex digit stops the conversion.
- At a minimum, any blob of data could be represented as a hex string.
-
- @param Buf Pointer to buffer that receives the data.
- @param Len Length in bytes of the buffer to hold converted
- data. If routine return with EFI_SUCCESS,
- containing length of converted data. If routine
- return with EFI_BUFFER_TOO_SMALL, containg length
- of buffer desired.
- @param Str String to be converted from.
- @param ConvertedStrLen Length of the Hex String consumed.
-
- @retval EFI_SUCCESS Routine Success.
- @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold converted data.
-
-**/
-STATIC
-EFI_STATUS
-HexStringToBufPrivate (
- IN OUT UINT8 *Buf,
- IN OUT UINTN *Len,
- IN CHAR16 *Str,
- OUT UINTN *ConvertedStrLen OPTIONAL
- )
-{
- UINTN HexCnt;
- UINTN Idx;
- UINTN BufferLength;
- UINT8 Digit;
- UINT8 Byte;
-
- //
- // Find out how many hex characters the string has.
- //
- for (Idx = 0, HexCnt = 0; IsHexDigit (&Digit, Str[Idx]); Idx++, HexCnt++);
-
- if (HexCnt == 0) {
- *Len = 0;
- return EFI_SUCCESS;
- }
- //
- // Two Unicode characters make up 1 buffer byte. Round up.
- //
- BufferLength = (HexCnt + 1) / 2;
-
- //
- // Test if buffer is passed enough.
- //
- if (BufferLength > (*Len)) {
- *Len = BufferLength;
- return EFI_BUFFER_TOO_SMALL;
- }
-
- *Len = BufferLength;
-
- for (Idx = 0; Idx < HexCnt; Idx++) {
-
- IsHexDigit (&Digit, Str[Idx]);
-
- //
- // For odd charaters, write the lower nibble for each buffer byte,
- // and for even characters, the upper nibble.
- //
- if ((Idx & 1) == 0) {
- Byte = (UINT8) (Digit << 4);
- } else {
- Byte = Buf[Idx / 2];
- Byte &= 0xF0;
- Byte = (UINT8) (Byte | Digit);
- }
-
- Buf[Idx / 2] = Byte;
- }
-
- if (ConvertedStrLen != NULL) {
- *ConvertedStrLen = HexCnt;
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Converts binary buffer to Unicode string.
- At a minimum, any blob of data could be represented as a hex string.
-
- @param Str Pointer to the string.
- @param HexStringBufferLength Length in bytes of buffer to hold the hex string.
- Includes tailing '\0' character. If routine return
- with EFI_SUCCESS, containing length of hex string
- buffer. If routine return with
- EFI_BUFFER_TOO_SMALL, containg length of hex
- string buffer desired.
- @param Buf Buffer to be converted from.
- @param Len Length in bytes of the buffer to be converted.
- @param Flag If TRUE, encode the data in the same order as the
- it resides in the Buf. Else encode it in the
- reverse direction.
-
- @retval EFI_SUCCESS Routine success.
- @retval EFI_BUFFER_TOO_SMALL The hex string buffer is too small.
-
-**/
-STATIC
-EFI_STATUS
-BufToHexStringPrivate (
- IN OUT CHAR16 *Str,
- IN OUT UINTN *HexStringBufferLength,
- IN UINT8 *Buf,
- IN UINTN Len,
- IN BOOLEAN Flag
- )
-{
- UINTN Idx;
- UINT8 Byte;
- UINTN StrLen;
-
- //
- // Make sure string is either passed or allocate enough.
- // It takes 2 Unicode characters (4 bytes) to represent 1 byte of the binary buffer.
- // Plus the Unicode termination character.
- //
- StrLen = Len * 2;
- if ((*HexStringBufferLength) < (StrLen + 1) * sizeof (CHAR16)) {
- *HexStringBufferLength = (StrLen + 1) * sizeof (CHAR16);
- return EFI_BUFFER_TOO_SMALL;
- }
-
- *HexStringBufferLength = (StrLen + 1) * sizeof (CHAR16);
-
- //
- // Ends the string.
- //
- Str[StrLen] = 0;
-
- for (Idx = 0; Idx < Len; Idx++) {
-
- Byte = Buf[Idx];
- if (Flag) {
- Str[Idx * 2] = NibbleToHexCharPrivate ((UINT8)(Byte >> 4));
- Str[Idx * 2 + 1] = NibbleToHexCharPrivate (Byte);
- } else {
- Str[StrLen - 1 - Idx * 2] = NibbleToHexCharPrivate (Byte);
- Str[StrLen - 2 - Idx * 2] = NibbleToHexCharPrivate ((UINT8)(Byte >> 4));
- }
- }
-
- return EFI_SUCCESS;
-}
-
-
-
/**
Calculate the number of Unicode characters of the incoming Configuration string,
not including NULL terminator.
@@ -306,7 +123,6 @@ GetDevicePath (
// The data in <PathHdr> is encoded as hex UNICODE %02x bytes in the same order
// as the device path resides in RAM memory.
// Translate the data into binary.
- // Two Unicode characters make up 1 buffer byte.
//
Length /= 2;
*DevicePath = (UINT8 *) AllocateZeroPool (Length);
@@ -315,7 +131,7 @@ GetDevicePath (
return EFI_OUT_OF_RESOURCES;
}
- HexStringToBufPrivate (*DevicePath, &Length, DevicePathString, NULL);
+ HexStringToBuffer (*DevicePath, &Length, DevicePathString);
SafeFreePool (DevicePathString);
@@ -503,12 +319,11 @@ ExportAllStorage (
@param String A constant string which is the prefix of the to be
generated string, e.g. GUID=
@param BufferLen The length of the Buffer in bytes.
- @param Buffer Points to a buffer which will be converted to hex
- string and to be the content of the generated
- string.
- @param Flag If TRUE, convert the buffer data in the same order
- as the it resides in the Buffer. Else convert it
- in the reverse direction.
+ @param Buffer Points to a buffer which will be converted to be the
+ content of the generated string.
+ @param Flag If 1, the buffer contains data for the value of GUID or PATH stored in
+ UINT8 *; if 2, the buffer contains unicode string for the value of NAME;
+ if 3, the buffer contains other data.
@param SubStr Points to the output string. It's caller's
responsibility to free this buffer.
@@ -519,14 +334,15 @@ VOID
GenerateSubStr (
IN CONST EFI_STRING String,
IN UINTN BufferLen,
- IN UINT8 *Buffer,
- IN BOOLEAN Flag,
+ IN VOID *Buffer,
+ IN UINT8 Flag,
OUT EFI_STRING *SubStr
)
{
UINTN Length;
EFI_STRING Str;
EFI_STATUS Status;
+ EFI_STRING StringHeader;
ASSERT (String != NULL && SubStr != NULL);
@@ -536,20 +352,33 @@ GenerateSubStr (
return ;
}
- Length = BufferLen * 2 + 1 + StrLen (String) + 1;
+ Length = StrLen (String) + BufferLen * 2 + 1 + 1;
Str = AllocateZeroPool (Length * sizeof (CHAR16));
ASSERT (Str != NULL);
StrCpy (Str, String);
Length = (BufferLen * 2 + 1) * sizeof (CHAR16);
- Status = BufToHexStringPrivate (
- Str + StrLen (String),
- &Length,
- Buffer,
- BufferLen,
- Flag
- );
+ Status = EFI_SUCCESS;
+ StringHeader = Str + StrLen (String);
+
+ switch (Flag) {
+ case 1:
+ Status = BufferToHexString (StringHeader, (UINT8 *) Buffer, BufferLen);
+ break;
+ case 2:
+ Status = UnicodeToConfigString (StringHeader, &Length, (CHAR16 *) Buffer);
+ break;
+ case 3:
+ Status = BufToHexString (StringHeader, &Length, (UINT8 *) Buffer, BufferLen);
+ //
+ // Convert the uppercase to lowercase since <HexAf> is defined in lowercase format.
+ //
+ ToLower (StringHeader);
+ break;
+ default:
+ break;
+ }
ASSERT_EFI_ERROR (Status);
StrCat (Str, L"&");
@@ -1096,7 +925,7 @@ HiiConfigRoutingExportConfig (
if (PathHdr == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- Status = BufToHexStringPrivate (PathHdr, &PathHdrSize, (UINT8 *) DevicePath, Length, TRUE);
+ Status = BufferToHexString (PathHdr, (UINT8 *) DevicePath, Length);
ASSERT_EFI_ERROR (Status);
//
@@ -1104,7 +933,7 @@ HiiConfigRoutingExportConfig (
// It means extract all possible configurations from this specific driver.
//
TmpSize = StrLen (L"GUID=&NAME=&PATH=");
- RequestSize = (TmpSize + sizeof (EFI_GUID) * 2 + StrLen (Storage->Name))
+ RequestSize = (TmpSize + 32 + StrLen (Storage->Name) * 4)
* sizeof (CHAR16) + PathHdrSize;
ConfigRequest = (EFI_STRING) AllocateZeroPool (RequestSize);
if (ConfigRequest == NULL) {
@@ -1115,20 +944,16 @@ HiiConfigRoutingExportConfig (
//
// Add <GuidHdr>
// <GuidHdr> ::= 'GUID='<Guid>
+ // Convert <Guid> in the same order as it resides in RAM memory.
//
StringPtr = ConfigRequest;
StrnCpy (StringPtr, L"GUID=", StrLen (L"GUID="));
StringPtr += StrLen (L"GUID=");
- Status = BufToHexStringPrivate (
- StringPtr,
- &RequestSize,
- (UINT8 *) (&Storage->Guid),
- sizeof (EFI_GUID),
- FALSE
- );
+ Status = BufferToHexString (StringPtr, (UINT8 *) (&Storage->Guid), sizeof (EFI_GUID));
ASSERT_EFI_ERROR (Status);
- StringPtr += RequestSize / 2 - 1;
+
+ StringPtr += 32;
ASSERT (*StringPtr == 0);
*StringPtr = L'&';
StringPtr++;
@@ -1139,8 +964,12 @@ HiiConfigRoutingExportConfig (
//
StrnCpy (StringPtr, L"NAME=", StrLen (L"NAME="));
StringPtr += StrLen (L"NAME=");
- StrnCpy (StringPtr, Storage->Name, StrLen (Storage->Name));
- StringPtr += StrLen (Storage->Name);
+
+ Length = (StrLen (Storage->Name) * 4 + 1) * sizeof (CHAR16);
+ Status = UnicodeToConfigString (StringPtr, &Length, Storage->Name);
+ ASSERT_EFI_ERROR (Status);
+ StringPtr += StrLen (Storage->Name) * 4;
+
*StringPtr = L'&';
StringPtr++;
@@ -1250,7 +1079,7 @@ HiiConfigRoutingExportConfig (
**/
EFI_STATUS
EFIAPI
-HiiConfigRoutingRoutConfig (
+HiiConfigRoutingRouteConfig (
IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
IN CONST EFI_STRING Configuration,
OUT EFI_STRING *Progress
@@ -1609,6 +1438,8 @@ HiiBlockToConfig (
Status = BufToHexString (ValueStr, &Length, Value, Width);
ASSERT_EFI_ERROR (Status);
+ ToLower (ValueStr);
+
SafeFreePool (Value);
Value = NULL;
@@ -1955,30 +1786,21 @@ HiiGetAltCfg (
//
// Generate the sub string for later matching.
//
- GenerateSubStr (L"GUID=", sizeof (EFI_GUID), (UINT8 *) Guid, FALSE, &GuidStr);
+ GenerateSubStr (L"GUID=", sizeof (EFI_GUID), (VOID *) Guid, 1, &GuidStr);
GenerateSubStr (
L"PATH=",
GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) DevicePath),
- (UINT8 *) DevicePath,
- TRUE,
+ (VOID *) DevicePath,
+ 1,
&PathStr
);
if (AltCfgId != NULL) {
- GenerateSubStr (L"ALTCFG=", sizeof (UINT16), (UINT8 *) AltCfgId, FALSE, &AltIdStr);
+ GenerateSubStr (L"ALTCFG=", sizeof (UINT16), (VOID *) AltCfgId, 3, &AltIdStr);
}
if (Name != NULL) {
- Length = StrLen (Name);
- Length += StrLen (L"NAME=&") + 1;
- NameStr = AllocateZeroPool (Length * sizeof (CHAR16));
- if (NameStr == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Exit;
- }
- StrCpy (NameStr, L"NAME=");
- StrCat (NameStr, Name);
- StrCat (NameStr, L"&");
+ GenerateSubStr (L"NAME=", StrLen (Name) * sizeof (CHAR16), (VOID *) Name, 2, &NameStr);
} else {
- GenerateSubStr (L"NAME=", 0, NULL, FALSE, &NameStr);
+ GenerateSubStr (L"NAME=", 0, NULL, 2, &NameStr);
}
while (*StringPtr != 0) {
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
index 3ee8b4c..b5a5c43 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.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
@@ -2771,8 +2771,7 @@ HiiNewPackageList (
@retval EFI_SUCCESS The data associated with the Handle was removed
from the HII database.
- @retval EFI_NOT_FOUND The specified PackageList could not be found in
- database.
+ @retval EFI_NOT_FOUND The specified andle is not in database.
@retval EFI_INVALID_PARAMETER The Handle was not valid.
**/
@@ -2790,10 +2789,14 @@ HiiRemovePackageList (
HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList;
HII_HANDLE *HiiHandle;
- if (This == NULL || !IsHiiHandleValid (Handle)) {
+ if (This == NULL) {
return EFI_INVALID_PARAMETER;
}
+ if (!IsHiiHandleValid (Handle)) {
+ return EFI_NOT_FOUND;
+ }
+
Private = HII_DATABASE_DATABASE_PRIVATE_DATA_FROM_THIS (This);
//
@@ -2879,9 +2882,8 @@ HiiRemovePackageList (
@retval EFI_SUCCESS The HII database was successfully updated.
@retval EFI_OUT_OF_RESOURCES Unable to allocate enough memory for the updated
database.
- @retval EFI_INVALID_PARAMETER Handle or PackageList was NULL.
- @retval EFI_NOT_FOUND The Handle was not valid or could not be found in
- database.
+ @retval EFI_INVALID_PARAMETER PackageList was NULL.
+ @retval EFI_NOT_FOUND The specified Handle is not in database.
**/
EFI_STATUS
@@ -2900,7 +2902,7 @@ HiiUpdatePackageList (
HII_DATABASE_PACKAGE_LIST_INSTANCE *OldPackageList;
EFI_HII_PACKAGE_HEADER PackageHeader;
- if (This == NULL || PackageList == NULL || Handle == NULL) {
+ if (This == NULL || PackageList == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -2993,12 +2995,17 @@ HiiUpdatePackageList (
@param Handle An array of EFI_HII_HANDLE instances returned.
@retval EFI_SUCCESS The matching handles are outputed successfully.
+ HandleBufferLength is updated with the actual length.
@retval EFI_BUFFER_TO_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.
**/
EFI_STATUS
@@ -3350,10 +3357,14 @@ HiiUnregisterPackageNotify (
LIST_ENTRY *Link;
EFI_STATUS Status;
- if (This == NULL || NotificationHandle == NULL) {
+ if (This == NULL) {
return EFI_INVALID_PARAMETER;
}
+ if (NotificationHandle == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
Status = gBS->OpenProtocol (
NotificationHandle,
&mHiiDatabaseNotifyGuid,
@@ -3363,7 +3374,7 @@ HiiUnregisterPackageNotify (
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
);
if (EFI_ERROR (Status)) {
- return EFI_INVALID_PARAMETER;
+ return EFI_NOT_FOUND;
}
Private = HII_DATABASE_DATABASE_PRIVATE_DATA_FROM_THIS (This);
@@ -3474,7 +3485,7 @@ HiiFindKeyboardLayouts (
for (Index = 0; Index < LayoutCount; Index++) {
ResultSize += sizeof (EFI_GUID);
if (ResultSize <= *KeyGuidBufferLength) {
- CopyMem (KeyGuidBuffer + Index, Layout + sizeof (UINT16), sizeof (EFI_GUID));
+ CopyMem (KeyGuidBuffer + (ResultSize / sizeof (EFI_GUID) - 1), Layout + sizeof (UINT16), sizeof (EFI_GUID));
CopyMem (&LayoutLength, Layout, sizeof (UINT16));
Layout = Layout + LayoutLength;
}
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
index f605061..9e99a12 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
@@ -905,15 +905,14 @@ GetSystemFont (
/**
- Check whether EFI_FONT_DISPLAY_INFO points to system default font and color.
+ Check whether EFI_FONT_DISPLAY_INFO points to system default font and color or
+ returns the system default according to the optional inputs.
@param Private HII database driver private data.
@param StringInfo Points to the string output information,
including the color and font.
- @param SystemInfo If not NULL, points to system default font and
- color when incoming StringInfo does not match the
- default. Points to NULL if matches. It's
- caller's reponsibility to free this buffer.
+ @param SystemInfo If not NULL, points to system default font and color.
+
@param SystemInfoLen If not NULL, output the length of default system
info.
@@ -933,6 +932,7 @@ IsSystemFontInfo (
EFI_STATUS Status;
EFI_FONT_DISPLAY_INFO *SystemDefault;
UINTN DefaultLen;
+ BOOLEAN Flag;
ASSERT (Private != NULL && Private->Signature == HII_DATABASE_PRIVATE_DATA_SIGNATURE);
@@ -940,28 +940,69 @@ IsSystemFontInfo (
return TRUE;
}
- //
- // Check whether incoming string font and color matches system default.
- //
Status = GetSystemFont (Private, &SystemDefault, &DefaultLen);
ASSERT_EFI_ERROR (Status);
+ //
+ // Record the system default info.
+ //
if (SystemInfo != NULL) {
*SystemInfo = SystemDefault;
- } else {
- SafeFreePool (SystemDefault);
}
if (SystemInfoLen != NULL) {
*SystemInfoLen = DefaultLen;
}
- if (StringInfo == NULL ||
- (StringInfo != NULL && CompareMem (SystemDefault, StringInfo, DefaultLen) == 0)) {
+ if (StringInfo == NULL) {
return TRUE;
}
- return FALSE;
+ Flag = FALSE;
+ //
+ // Check the FontInfoMask to see whether it is retrieving system info.
+ //
+ if ((StringInfo->FontInfoMask & (EFI_FONT_INFO_SYS_FONT | EFI_FONT_INFO_ANY_FONT)) == 0) {
+ if (StrCmp (StringInfo->FontInfo.FontName, SystemDefault->FontInfo.FontName) != 0) {
+ goto Exit;
+ }
+ }
+ if ((StringInfo->FontInfoMask & (EFI_FONT_INFO_SYS_SIZE | EFI_FONT_INFO_ANY_SIZE)) == 0) {
+ if (StringInfo->FontInfo.FontSize != SystemDefault->FontInfo.FontSize) {
+ goto Exit;
+ }
+ }
+ if ((StringInfo->FontInfoMask & (EFI_FONT_INFO_SYS_STYLE | EFI_FONT_INFO_ANY_STYLE)) == 0) {
+ if (StringInfo->FontInfo.FontStyle != SystemDefault->FontInfo.FontStyle) {
+ goto Exit;
+ }
+ }
+ if ((StringInfo->FontInfoMask & EFI_FONT_INFO_SYS_FORE_COLOR) == 0) {
+ if (CompareMem (
+ &StringInfo->ForegroundColor,
+ &SystemDefault->ForegroundColor,
+ sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ ) != 0) {
+ goto Exit;
+ }
+ }
+ if ((StringInfo->FontInfoMask & EFI_FONT_INFO_SYS_BACK_COLOR) == 0) {
+ if (CompareMem (
+ &StringInfo->BackgroundColor,
+ &SystemDefault->BackgroundColor,
+ sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+ ) != 0) {
+ goto Exit;
+ }
+ }
+
+ Flag = TRUE;
+
+Exit:
+ if (SystemInfo == NULL) {
+ SafeFreePool (SystemDefault);
+ }
+ return Flag;
}
@@ -1400,6 +1441,7 @@ IsLineBreak (
@retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for
RowInfoArray or Blt.
@retval EFI_INVALID_PARAMETER The String or Blt was NULL.
+ @retval EFI_INVALID_PARAMETER Flags were invalid combination..
**/
EFI_STATUS
@@ -1470,16 +1512,16 @@ HiiStringToImage (
//
// These two flags require that EFI_HII_OUT_FLAG_CLIP be also set.
//
- if ((Flags & (EFI_HII_OUT_FLAG_CLIP | EFI_HII_OUT_FLAG_CLEAN_X)) == EFI_HII_OUT_FLAG_CLEAN_X) {
+ if ((Flags & (EFI_HII_OUT_FLAG_CLIP | EFI_HII_OUT_FLAG_CLIP_CLEAN_X)) == EFI_HII_OUT_FLAG_CLIP_CLEAN_X) {
return EFI_INVALID_PARAMETER;
}
- if ((Flags & (EFI_HII_OUT_FLAG_CLIP | EFI_HII_OUT_FLAG_CLEAN_Y)) == EFI_HII_OUT_FLAG_CLEAN_Y) {
+ if ((Flags & (EFI_HII_OUT_FLAG_CLIP | EFI_HII_OUT_FLAG_CLIP_CLEAN_Y)) == EFI_HII_OUT_FLAG_CLIP_CLEAN_Y) {
return EFI_INVALID_PARAMETER;
}
//
// This flag cannot be used with EFI_HII_OUT_FLAG_CLEAN_X.
//
- if ((Flags & (EFI_HII_OUT_FLAG_WRAP | EFI_HII_OUT_FLAG_CLEAN_X)) == (EFI_HII_OUT_FLAG_WRAP | EFI_HII_OUT_FLAG_CLEAN_X)) {
+ if ((Flags & (EFI_HII_OUT_FLAG_WRAP | EFI_HII_OUT_FLAG_CLIP_CLEAN_X)) == (EFI_HII_OUT_FLAG_WRAP | EFI_HII_OUT_FLAG_CLIP_CLEAN_X)) {
return EFI_INVALID_PARAMETER;
}
@@ -1633,7 +1675,7 @@ HiiStringToImage (
//
Transparent = (BOOLEAN) ((Flags & EFI_HII_OUT_FLAG_TRANSPARENT) == EFI_HII_OUT_FLAG_TRANSPARENT ? TRUE : FALSE);
- if ((Flags & EFI_HII_OUT_FLAG_CLEAN_Y) == EFI_HII_OUT_FLAG_CLEAN_Y) {
+ if ((Flags & EFI_HII_OUT_FLAG_CLIP_CLEAN_Y) == EFI_HII_OUT_FLAG_CLIP_CLEAN_Y) {
//
// Don't draw at all if there is only one row and
// the row's bottom-most on pixel cannot fit.
@@ -1705,7 +1747,7 @@ HiiStringToImage (
//
if (!LineBreak) {
Flags &= (~ (EFI_HII_OUT_FLAGS) EFI_HII_OUT_FLAG_WRAP);
- Flags |= EFI_HII_OUT_FLAG_CLEAN_X;
+ Flags |= EFI_HII_OUT_FLAG_CLIP_CLEAN_X;
}
}
@@ -1713,7 +1755,7 @@ HiiStringToImage (
// Clip the right-most character if cannot fit when EFI_HII_OUT_FLAG_CLEAN_X is set.
//
if (LineWidth + BltX <= Image->Width ||
- (LineWidth + BltX > Image->Width && (Flags & EFI_HII_OUT_FLAG_CLEAN_X) == 0)) {
+ (LineWidth + BltX > Image->Width && (Flags & EFI_HII_OUT_FLAG_CLIP_CLEAN_X) == 0)) {
//
// Record right-most character in RowInfo even if it is partially displayed.
//
@@ -1749,7 +1791,7 @@ HiiStringToImage (
//
if (RowIndex == MaxRowNum - 1 && Image->Height < LineHeight) {
LineHeight = Image->Height;
- if ((Flags & EFI_HII_OUT_FLAG_CLEAN_Y) == EFI_HII_OUT_FLAG_CLEAN_Y) {
+ if ((Flags & EFI_HII_OUT_FLAG_CLIP_CLEAN_Y) == EFI_HII_OUT_FLAG_CLIP_CLEAN_Y) {
//
// Don't draw at all if the row's bottom-most on pixel cannot fit.
//
@@ -1968,7 +2010,10 @@ Exit:
@retval EFI_SUCCESS The string was successfully rendered.
@retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for
RowInfoArray or Blt.
- @retval EFI_INVALID_PARAMETER The PackageList 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.
**/
EFI_STATUS
@@ -1992,6 +2037,10 @@ HiiStringIdToImage (
HII_DATABASE_PRIVATE_DATA *Private;
EFI_STRING String;
UINTN StringSize;
+ UINTN FontLen;
+ EFI_FONT_INFO *StringFontInfo;
+ EFI_FONT_DISPLAY_INFO *NewStringInfo;
+ CHAR8 CurrentLang[RFC_3066_ENTRY_SIZE];
if (This == NULL || PackageList == NULL || Blt == NULL || PackageList == NULL) {
return EFI_INVALID_PARAMETER;
@@ -2001,7 +2050,14 @@ HiiStringIdToImage (
return EFI_NOT_FOUND;
}
- Private = HII_FONT_DATABASE_PRIVATE_DATA_FROM_THIS (This);
+ //
+ // When Language points to NULL, current system language is used.
+ //
+ if (Language != NULL) {
+ AsciiStrCpy (CurrentLang, (CHAR8 *) Language);
+ } else {
+ HiiLibGetCurrentLanguage (CurrentLang);
+ }
//
// Get the string to be displayed.
@@ -2013,14 +2069,18 @@ HiiStringIdToImage (
return EFI_OUT_OF_RESOURCES;
}
+ Private = HII_FONT_DATABASE_PRIVATE_DATA_FROM_THIS (This);
+ StringFontInfo = NULL;
+ NewStringInfo = NULL;
+
Status = Private->HiiString.GetString (
&Private->HiiString,
- Language,
+ CurrentLang,
PackageList,
StringId,
String,
&StringSize,
- NULL
+ &StringFontInfo
);
if (Status == EFI_BUFFER_TOO_SMALL) {
SafeFreePool (String);
@@ -2041,11 +2101,42 @@ HiiStringIdToImage (
}
if (EFI_ERROR (Status)) {
- SafeFreePool (String);
- return Status;
+ goto Exit;
+ }
+
+ //
+ // When StringInfo specifies that string will be output in the system default font and color,
+ // use particular stringfontinfo described in string package instead if exists.
+ // StringFontInfo equals NULL means system default font attaches with the string block.
+ //
+ if (StringFontInfo != NULL && IsSystemFontInfo (Private, (EFI_FONT_DISPLAY_INFO *) StringInfo, NULL, NULL)) {
+ FontLen = sizeof (EFI_FONT_DISPLAY_INFO) - sizeof (CHAR16) + StrSize (StringFontInfo->FontName);
+ NewStringInfo = AllocateZeroPool (FontLen);
+ if (NewStringInfo == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Exit;
+ }
+ NewStringInfo->FontInfoMask = EFI_FONT_INFO_SYS_FORE_COLOR | EFI_FONT_INFO_SYS_BACK_COLOR;
+ NewStringInfo->FontInfo.FontStyle = StringFontInfo->FontStyle;
+ NewStringInfo->FontInfo.FontSize = StringFontInfo->FontSize;
+ StrCpy (NewStringInfo->FontInfo.FontName, StringFontInfo->FontName);
+
+ Status = HiiStringToImage (
+ This,
+ Flags,
+ String,
+ NewStringInfo,
+ Blt,
+ BltX,
+ BltY,
+ RowInfoArray,
+ RowInfoArraySize,
+ ColumnInfoArray
+ );
+ goto Exit;
}
- return HiiStringToImage (
+ Status = HiiStringToImage (
This,
Flags,
String,
@@ -2058,6 +2149,12 @@ HiiStringIdToImage (
ColumnInfoArray
);
+Exit:
+ SafeFreePool (String);
+ SafeFreePool (StringFontInfo);
+ SafeFreePool (NewStringInfo);
+
+ return Status;
}
@@ -2231,7 +2328,9 @@ Exit:
returned font handle or points 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 information is
returned. It's caller's responsibility to free
@@ -2242,7 +2341,7 @@ Exit:
@retval EFI_SUCCESS Matching font returned successfully.
@retval EFI_NOT_FOUND No matching font was found.
- @retval EFI_INVALID_PARAMETER 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.
@@ -2252,7 +2351,7 @@ EFIAPI
HiiGetFontInfo (
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
)
@@ -2267,51 +2366,71 @@ HiiGetFontInfo (
EFI_STRING StringIn;
EFI_FONT_HANDLE LocalFontHandle;
- if (This == NULL || StringInfoIn == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Check the font information mask to make sure it is valid.
- //
- if (((StringInfoIn->FontInfoMask & (EFI_FONT_INFO_SYS_FONT | EFI_FONT_INFO_ANY_FONT)) ==
- (EFI_FONT_INFO_SYS_FONT | EFI_FONT_INFO_ANY_FONT)) ||
- ((StringInfoIn->FontInfoMask & (EFI_FONT_INFO_SYS_SIZE | EFI_FONT_INFO_ANY_SIZE)) ==
- (EFI_FONT_INFO_SYS_SIZE | EFI_FONT_INFO_ANY_SIZE)) ||
- ((StringInfoIn->FontInfoMask & (EFI_FONT_INFO_SYS_STYLE | EFI_FONT_INFO_ANY_STYLE)) ==
- (EFI_FONT_INFO_SYS_STYLE | EFI_FONT_INFO_ANY_STYLE)) ||
- ((StringInfoIn->FontInfoMask & (EFI_FONT_INFO_RESIZE | EFI_FONT_INFO_ANY_SIZE)) ==
- (EFI_FONT_INFO_RESIZE | EFI_FONT_INFO_ANY_SIZE)) ||
- ((StringInfoIn->FontInfoMask & (EFI_FONT_INFO_RESTYLE | EFI_FONT_INFO_ANY_STYLE)) ==
- (EFI_FONT_INFO_RESTYLE | EFI_FONT_INFO_ANY_STYLE))) {
+ if (This == NULL) {
return EFI_INVALID_PARAMETER;
}
FontInfo = NULL;
+ SystemDefault = NULL;
LocalFontHandle = NULL;
if (FontHandle != NULL) {
LocalFontHandle = *FontHandle;
}
+ Private = HII_FONT_DATABASE_PRIVATE_DATA_FROM_THIS (This);
+
+ //
+ // Already searched to the end of the whole list, return directly.
+ //
+ if (LocalFontHandle == &Private->FontInfoList) {
+ LocalFontHandle = NULL;
+ Status = EFI_NOT_FOUND;
+ goto Exit;
+ }
+
//
// Get default system display info, if StringInfoIn points to
// system display info, return it directly.
//
- Private = HII_FONT_DATABASE_PRIVATE_DATA_FROM_THIS (This);
-
if (IsSystemFontInfo (Private, (EFI_FONT_DISPLAY_INFO *) StringInfoIn, &SystemDefault, &StringInfoOutLen)) {
- if (StringInfoOut != NULL) {
- *StringInfoOut = AllocateCopyPool (StringInfoOutLen, (EFI_FONT_DISPLAY_INFO *) StringInfoIn);
- if (*StringInfoOut == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- LocalFontHandle = NULL;
- goto Exit;
+ //
+ // System font is the first node. When handle is not NULL, system font can not
+ // be found any more.
+ //
+ if (LocalFontHandle == NULL) {
+ if (StringInfoOut != NULL) {
+ *StringInfoOut = AllocateCopyPool (StringInfoOutLen, SystemDefault);
+ if (*StringInfoOut == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ LocalFontHandle = NULL;
+ goto Exit;
+ }
}
+
+ LocalFontHandle = Private->FontInfoList.ForwardLink;
+ Status = EFI_SUCCESS;
+ goto Exit;
+ } else {
+ LocalFontHandle = NULL;
+ Status = EFI_NOT_FOUND;
+ goto Exit;
}
+ }
- LocalFontHandle = Private->FontInfoList.ForwardLink;
- Status = EFI_SUCCESS;
- goto Exit;
+ //
+ // Check the font information mask to make sure it is valid.
+ //
+ if (((StringInfoIn->FontInfoMask & (EFI_FONT_INFO_SYS_FONT | EFI_FONT_INFO_ANY_FONT)) ==
+ (EFI_FONT_INFO_SYS_FONT | EFI_FONT_INFO_ANY_FONT)) ||
+ ((StringInfoIn->FontInfoMask & (EFI_FONT_INFO_SYS_SIZE | EFI_FONT_INFO_ANY_SIZE)) ==
+ (EFI_FONT_INFO_SYS_SIZE | EFI_FONT_INFO_ANY_SIZE)) ||
+ ((StringInfoIn->FontInfoMask & (EFI_FONT_INFO_SYS_STYLE | EFI_FONT_INFO_ANY_STYLE)) ==
+ (EFI_FONT_INFO_SYS_STYLE | EFI_FONT_INFO_ANY_STYLE)) ||
+ ((StringInfoIn->FontInfoMask & (EFI_FONT_INFO_RESIZE | EFI_FONT_INFO_ANY_SIZE)) ==
+ (EFI_FONT_INFO_RESIZE | EFI_FONT_INFO_ANY_SIZE)) ||
+ ((StringInfoIn->FontInfoMask & (EFI_FONT_INFO_RESTYLE | EFI_FONT_INFO_ANY_STYLE)) ==
+ (EFI_FONT_INFO_RESTYLE | EFI_FONT_INFO_ANY_STYLE))) {
+ return EFI_INVALID_PARAMETER;
}
//
@@ -2331,13 +2450,17 @@ HiiGetFontInfo (
if ((StringInfoIn->FontInfoMask & EFI_FONT_INFO_SYS_SIZE) == EFI_FONT_INFO_SYS_SIZE) {
InfoOut.FontInfo.FontSize = SystemDefault->FontInfo.FontSize;
- } else if ((StringInfoIn->FontInfoMask & EFI_FONT_INFO_SYS_STYLE) == EFI_FONT_INFO_SYS_STYLE) {
+ }
+ if ((StringInfoIn->FontInfoMask & EFI_FONT_INFO_SYS_STYLE) == EFI_FONT_INFO_SYS_STYLE) {
InfoOut.FontInfo.FontStyle = SystemDefault->FontInfo.FontStyle;
- } else if ((StringInfoIn->FontInfoMask & EFI_FONT_INFO_SYS_FORE_COLOR) == EFI_FONT_INFO_SYS_FORE_COLOR) {
+ }
+ if ((StringInfoIn->FontInfoMask & EFI_FONT_INFO_SYS_FORE_COLOR) == EFI_FONT_INFO_SYS_FORE_COLOR) {
InfoOut.ForegroundColor = SystemDefault->ForegroundColor;
- } else if ((StringInfoIn->FontInfoMask & EFI_FONT_INFO_SYS_BACK_COLOR) == EFI_FONT_INFO_SYS_BACK_COLOR) {
+ }
+ if ((StringInfoIn->FontInfoMask & EFI_FONT_INFO_SYS_BACK_COLOR) == EFI_FONT_INFO_SYS_BACK_COLOR) {
InfoOut.BackgroundColor = SystemDefault->BackgroundColor;
}
+
FontInfo->FontSize = InfoOut.FontInfo.FontSize;
FontInfo->FontStyle = InfoOut.FontInfo.FontStyle;
@@ -2393,3 +2516,4 @@ Exit:
return Status;
}
+
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
index f198132..bbd366e 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
@@ -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
@@ -47,6 +47,8 @@ Revision History
#include <Library/BaseLib.h>
#include <Library/DevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
+#include <Library/IfrSupportLib.h>
+#include <Library/HiiLib.h>
#define HII_DATABASE_NOTIFY_GUID \
{ \
@@ -495,7 +497,8 @@ FindGlyphBlock (
@retval EFI_SUCCESS The string was successfully rendered.
@retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for
RowInfoArray or Blt.
- @retval EFI_INVALID_PARAMETER The String was NULL.
+ @retval EFI_INVALID_PARAMETER The String or Blt.
+ @retval EFI_INVALID_PARAMETER Flags were invalid combination..
**/
EFI_STATUS
@@ -567,7 +570,10 @@ HiiStringToImage (
@retval EFI_SUCCESS The string was successfully rendered.
@retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for
RowInfoArray or Blt.
- @retval EFI_INVALID_PARAMETER The String 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.
**/
EFI_STATUS
@@ -616,7 +622,7 @@ EFIAPI
HiiGetGlyph (
IN CONST EFI_HII_FONT_PROTOCOL *This,
IN CHAR16 Char,
- IN CONST EFI_FONT_DISPLAY_INFO *StringInfo,
+ IN CONST EFI_FONT_DISPLAY_INFO *StringInfo, OPTIONAL
OUT EFI_IMAGE_OUTPUT **Blt,
OUT UINTN *Baseline OPTIONAL
)
@@ -635,7 +641,8 @@ HiiGetGlyph (
returned font handle or points 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 information is
returned. It's caller's responsibility to free
@@ -647,9 +654,9 @@ HiiGetGlyph (
@retval EFI_SUCCESS Matching font returned successfully.
@retval EFI_NOT_FOUND No matching font was found.
@retval EFI_INVALID_PARAMETER 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.
-
**/
EFI_STATUS
EFIAPI
@@ -706,15 +713,15 @@ HiiNewImage (
@param ImageId The image's id,, which is unique within
PackageList.
@param Image Points to the 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 new image was returned successfully.
@retval EFI_NOT_FOUND The image specified by ImageId is not available.
+ The specified PackageList is not in the database.
@retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to
hold the image.
@retval EFI_INVALID_PARAMETER The Image or ImageSize was NULL.
+ @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not
+ enough memory.
**/
EFI_STATUS
@@ -723,8 +730,7 @@ HiiGetImage (
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
)
;
@@ -741,7 +747,7 @@ HiiGetImage (
@retval EFI_SUCCESS The new image was updated successfully.
@retval EFI_NOT_FOUND The image specified by ImageId is not in the
- database.
+ database. The specified PackageList is not in the database.
@retval EFI_INVALID_PARAMETER The Image was NULL.
**/
@@ -821,9 +827,9 @@ HiiDrawImage (
@retval EFI_SUCCESS The image was successfully drawn.
@retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for Blt.
- @retval EFI_INVALID_PARAMETER The Image was NULL.
- @retval EFI_NOT_FOUND The specified packagelist could not be found in
- current database.
+ @retval EFI_INVALID_PARAMETER The Blt was NULL.
+ @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.
+ The specified PackageList is not in the database.
**/
EFI_STATUS
@@ -914,7 +920,9 @@ HiiNewString (
@retval EFI_NOT_FOUND The string specified by StringId is not
available.
@retval EFI_NOT_FOUND The string specified by StringId is available but
- not in the specified language.
+ not in the specified language.
+ The specified PackageList is not in the database.
+ @retval EFI_INVALID_LANGUAGE - The string specified by StringId is available but
@retval EFI_BUFFER_TOO_SMALL The buffer specified by StringSize is too small
to hold the string.
@retval EFI_INVALID_PARAMETER The String or Language or StringSize was NULL.
@@ -1029,8 +1037,9 @@ HiiGetLanguages (
too small to hold the returned information.
SecondLanguageSize is updated to hold the size of
the buffer required.
- @retval EFI_NOT_FOUND The language specified by FirstLanguage is not
+ @retval EFI_INVALID_LANGUAGE The language specified by FirstLanguage is not
present in the specified package list.
+ @retval EFI_NOT_FOUND The specified PackageList is not in the Database.
**/
EFI_STATUS
@@ -1091,9 +1100,7 @@ HiiNewPackageList (
@retval EFI_SUCCESS The data associated with the Handle was removed
from the HII database.
- @retval EFI_NOT_FOUND The specified PackageList could not be found in
- database.
- @retval EFI_INVALID_PARAMETER The Handle was not valid.
+ @retval EFI_NOT_FOUND The specified Handle is not in database.
**/
EFI_STATUS
@@ -1119,9 +1126,8 @@ HiiRemovePackageList (
@retval EFI_SUCCESS The HII database was successfully updated.
@retval EFI_OUT_OF_RESOURCES Unable to allocate enough memory for the updated
database.
- @retval EFI_INVALID_PARAMETER Handle or PackageList was NULL.
- @retval EFI_NOT_FOUND The Handle was not valid or could not be found in
- database.
+ @retval EFI_INVALID_PARAMETER PackageList was NULL.
+ @retval EFI_NOT_FOUND The specified Handle is not in database.
**/
EFI_STATUS
@@ -1154,6 +1160,7 @@ HiiUpdatePackageList (
@param Handle An array of EFI_HII_HANDLE instances returned.
@retval EFI_SUCCESS The matching handles are outputed successfully.
+ HandleBufferLength is updated with the actual length.
@retval EFI_BUFFER_TO_SMALL The HandleBufferLength parameter indicates that
Handle is too small to support the number of
handles. HandleBufferLength is updated with a
@@ -1161,6 +1168,10 @@ HiiUpdatePackageList (
@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.
+
**/
EFI_STATUS
@@ -1271,7 +1282,8 @@ HiiRegisterPackageNotify (
unregistered.
@retval EFI_SUCCESS Notification is unregistered successfully.
- @retval EFI_INVALID_PARAMETER The Handle is invalid.
+ @retval EFI_NOT_FOUND The incoming notification handle does not exist
+ in current hii database.
**/
EFI_STATUS
@@ -1511,7 +1523,7 @@ HiiConfigRoutingExportConfig (
**/
EFI_STATUS
EFIAPI
-HiiConfigRoutingRoutConfig (
+HiiConfigRoutingRouteConfig (
IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
IN CONST EFI_STRING Configuration,
OUT EFI_STRING *Progress
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
index 2bafb25..5bdc604 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
@@ -57,7 +57,8 @@
UefiDriverEntryPoint
BaseMemoryLib
DebugLib
-
+ IfrSupportLib
+ HiiLib
[Protocols]
gEfiConsoleControlProtocolGuid
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c
index 6583f6b..4bba8af 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.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
@@ -80,7 +80,7 @@ STATIC HII_DATABASE_PRIVATE_DATA mPrivate = {
{
HiiConfigRoutingExtractConfig,
HiiConfigRoutingExportConfig,
- HiiConfigRoutingRoutConfig,
+ HiiConfigRoutingRouteConfig,
HiiBlockToConfig,
HiiConfigToBlock,
HiiGetAltCfg
@@ -104,6 +104,17 @@ STATIC HII_DATABASE_PRIVATE_DATA mPrivate = {
NULL
};
+STATIC
+VOID
+EFIAPI
+KeyboardLayoutChangeNullEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ return;
+}
+
EFI_STATUS
EFIAPI
InitializeHiiDatabase (
@@ -161,9 +172,9 @@ Returns:
// Create a event with EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID group type.
//
Status = gBS->CreateEventEx (
- 0,
- 0,
- NULL,
+ EFI_EVENT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ KeyboardLayoutChangeNullEvent,
NULL,
&gHiiSetKbdLayoutEventGuid,
&gHiiKeyboardLayoutChanged
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
index 341a50a..6b6a720 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.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
@@ -610,7 +610,7 @@ HiiNewImage (
UINTN NewBlockSize;
EFI_IMAGE_INPUT *ImageIn;
- if (This == NULL || ImageId == NULL || Image == NULL || PackageList == NULL) {
+ if (This == NULL || ImageId == NULL || Image == NULL || Image->Bitmap == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -798,10 +798,13 @@ HiiNewImage (
length of the image, in bytes.
@retval EFI_SUCCESS The new image was returned successfully.
- @retval EFI_NOT_FOUND The image specified by ImageId is not available.
+ @retval EFI_NOT_FOUND The image specified by ImageId is not in the
+ database. The specified PackageList is not in the database.
@retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to
hold the image.
@retval EFI_INVALID_PARAMETER The Image or ImageSize was NULL.
+ @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not
+ enough memory.
**/
EFI_STATUS
@@ -810,8 +813,7 @@ HiiGetImage (
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
)
{
HII_DATABASE_PRIVATE_DATA *Private;
@@ -831,7 +833,7 @@ HiiGetImage (
UINT8 PaletteIndex;
UINT16 PaletteSize;
- if (This == NULL || ImageSize == NULL || Image == NULL || ImageId < 1 || PackageList == NULL) {
+ if (This == NULL || Image == NULL || ImageId < 1) {
return EFI_INVALID_PARAMETER;
}
@@ -897,13 +899,12 @@ HiiGetImage (
// Use the common block code since the definition of these structures is the same.
//
CopyMem (&Iibt1bit, ImageBlock, sizeof (EFI_HII_IIBT_IMAGE_1BIT_BLOCK));
- ImageLength = sizeof (EFI_IMAGE_INPUT) + sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) *
- (Iibt1bit.Bitmap.Width * Iibt1bit.Bitmap.Height - 1);
- if (*ImageSize < ImageLength) {
- *ImageSize = ImageLength;
- return EFI_BUFFER_TOO_SMALL;
+ ImageLength = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) *
+ (Iibt1bit.Bitmap.Width * Iibt1bit.Bitmap.Height);
+ Image->Bitmap = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) AllocateZeroPool (ImageLength);
+ if (Image->Bitmap == NULL) {
+ return EFI_OUT_OF_RESOURCES;
}
- ZeroMem (Image, ImageLength);
if (Flag) {
Image->Flags = EFI_IMAGE_TRANSPARENT;
@@ -956,13 +957,11 @@ HiiGetImage (
ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT16),
sizeof (UINT16)
);
- ImageLength = sizeof (EFI_IMAGE_INPUT) +
- sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * (Width * Height - 1);
- if (*ImageSize < ImageLength) {
- *ImageSize = ImageLength;
- return EFI_BUFFER_TOO_SMALL;
+ ImageLength = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * (Width * Height);
+ Image->Bitmap = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) AllocateZeroPool (ImageLength);
+ if (Image->Bitmap == NULL) {
+ return EFI_OUT_OF_RESOURCES;
}
- ZeroMem (Image, ImageLength);
if (Flag) {
Image->Flags = EFI_IMAGE_TRANSPARENT;
@@ -999,7 +998,7 @@ HiiGetImage (
@retval EFI_SUCCESS The new image was updated successfully.
@retval EFI_NOT_FOUND The image specified by ImageId is not in the
- database.
+ database. The specified PackageList is not in the database.
@retval EFI_INVALID_PARAMETER The Image was NULL.
**/
@@ -1036,7 +1035,7 @@ HiiSetImage (
UINT32 Part1Size;
UINT32 Part2Size;
- if (This == NULL || Image == NULL || ImageId < 1 || PackageList == NULL) {
+ if (This == NULL || Image == NULL || ImageId < 1 || Image->Bitmap == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -1448,9 +1447,9 @@ HiiDrawImage (
@retval EFI_SUCCESS The image was successfully drawn.
@retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for Blt.
- @retval EFI_INVALID_PARAMETER The Image was NULL.
- @retval EFI_NOT_FOUND The specified packagelist could not be found in
- current database.
+ @retval EFI_INVALID_PARAMETER The Blt was NULL.
+ @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.
+ The specified PackageList is not in the database.
**/
EFI_STATUS
@@ -1466,14 +1465,12 @@ HiiDrawImageId (
)
{
EFI_STATUS Status;
- EFI_IMAGE_INPUT ImageTemp;
- EFI_IMAGE_INPUT *Image;
- UINTN ImageSize;
+ EFI_IMAGE_INPUT Image;
//
// Check input parameter.
//
- if (This == NULL || PackageList == NULL || Blt == NULL || PackageList == NULL) {
+ if (This == NULL || Blt == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -1484,24 +1481,16 @@ HiiDrawImageId (
//
// Get the specified Image.
//
- ImageSize = 0;
- Status = HiiGetImage (This, PackageList, ImageId, &ImageTemp, &ImageSize);
- if (Status != EFI_BUFFER_TOO_SMALL) {
+ Status = HiiGetImage (This, PackageList, ImageId, &Image);
+ if (EFI_ERROR (Status)) {
return Status;
}
- Image = (EFI_IMAGE_INPUT *) AllocateZeroPool (ImageSize);
- if (Image == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- Status = HiiGetImage (This, PackageList, ImageId, Image, &ImageSize);
- ASSERT_EFI_ERROR (Status);
-
//
// Draw this image.
//
- Status = HiiDrawImage (This, Flags, Image, Blt, BltX, BltY);
- SafeFreePool (Image);
+ Status = HiiDrawImage (This, Flags, &Image, Blt, BltX, BltY);
+ SafeFreePool (Image.Bitmap);
return Status;
}
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
index 0d83010..f6a4cdf 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
@@ -40,6 +40,7 @@ CHAR16 mLanguageWindow[16] = {
@param Private Hii database private structure.
@param StringPackage HII string package instance.
+ @param FontId Font identifer, which must be unique within the string package.
@param DuplicateEnable If true, duplicate HII_FONT_INFO which refers to
the same EFI_FONT_INFO is permitted. Otherwise it
is not allowed.
@@ -57,6 +58,7 @@ BOOLEAN
ReferFontInfoLocally (
IN HII_DATABASE_PRIVATE_DATA *Private,
IN HII_STRING_PACKAGE_INSTANCE *StringPackage,
+ IN UINT8 FontId,
IN BOOLEAN DuplicateEnable,
IN HII_GLOBAL_FONT_INFO *GlobalFontInfo,
OUT HII_FONT_INFO **LocalFontInfo
@@ -82,11 +84,6 @@ ReferFontInfoLocally (
}
}
}
- //
- // Since string package tool set FontId initially to 0 and increases it
- // progressively by one, StringPackage->FondId always represents an unique
- // and available FontId.
- //
// FontId identifies EFI_FONT_INFO in local string package uniquely.
// GlobalEntry points to a HII_GLOBAL_FONT_INFO which identifies
// EFI_FONT_INFO uniquely in whole hii database.
@@ -95,12 +92,10 @@ ReferFontInfoLocally (
ASSERT (LocalFont != NULL);
LocalFont->Signature = HII_FONT_INFO_SIGNATURE;
- LocalFont->FontId = StringPackage->FontId;
+ LocalFont->FontId = FontId;
LocalFont->GlobalEntry = &GlobalFontInfo->Entry;
InsertTailList (&StringPackage->FontInfoList, &LocalFont->Entry);
- StringPackage->FontId++;
-
*LocalFontInfo = LocalFont;
return FALSE;
}
@@ -183,13 +178,12 @@ GetUnicodeStringTextOrSize (
StringPtr += sizeof (CHAR16);
}
+ if (*BufferSize < StringSize) {
+ *BufferSize = StringSize;
+ return EFI_BUFFER_TOO_SMALL;
+ }
if (StringDest != NULL) {
- if (*BufferSize < StringSize) {
- *BufferSize = StringSize;
- return EFI_BUFFER_TOO_SMALL;
- }
CopyMem (StringDest, StringSrc, StringSize);
- return EFI_SUCCESS;
}
*BufferSize = StringSize;
@@ -292,6 +286,7 @@ FindStringBlock (
UINT16 FontSize;
UINT8 Length8;
EFI_HII_SIBT_EXT2_BLOCK Ext2;
+ UINT8 FontId;
UINT32 Length32;
UINTN StringSize;
CHAR16 Zero;
@@ -486,7 +481,9 @@ FindStringBlock (
// Find the relationship between global font info and the font info of
// this EFI_HII_SIBT_FONT block then backup its information in local package.
//
- BlockHdr += sizeof (EFI_HII_SIBT_EXT2_BLOCK) + sizeof (UINT8);
+ BlockHdr += sizeof (EFI_HII_SIBT_EXT2_BLOCK);
+ CopyMem (&FontId, BlockHdr, sizeof (UINT8));
+ BlockHdr += sizeof (UINT8);
CopyMem (&FontSize, BlockHdr, sizeof (UINT16));
BlockHdr += sizeof (UINT16);
CopyMem (&FontStyle, BlockHdr, sizeof (EFI_HII_FONT_STYLE));
@@ -502,16 +499,21 @@ FindStringBlock (
FontInfo->FontSize = FontSize;
CopyMem (FontInfo->FontName, BlockHdr, StringSize);
+ //
+ // If find the corresponding global font info, save the relationship.
+ // Otherwise ignore this EFI_HII_SIBT_FONT block.
+ //
if (IsFontInfoExisted (Private, FontInfo, NULL, NULL, &GlobalFont)) {
- //
- // If find the corresponding global font info, save the relationship.
- //
- ReferFontInfoLocally (Private, StringPackage, TRUE, GlobalFont, &LocalFont);
+ ReferFontInfoLocally (Private, StringPackage, FontId, TRUE, GlobalFont, &LocalFont);
}
//
- // If can not find, ignore this EFI_HII_SIBT_FONT block.
- //
+ // Since string package tool set FontId initially to 0 and increases it
+ // progressively by one, StringPackage->FondId always represents an unique
+ // and available FontId.
+ //
+ StringPackage->FontId++;
+
SafeFreePool (FontInfo);
}
@@ -647,7 +649,8 @@ GetStringWorker (
}
//
- // Get the string font.
+ // Get the string font. The FontId 0 is the default font for those string blocks which
+ // do not specify a font identifier. If default font is not specified, return NULL.
//
if (StringFontInfo != NULL) {
switch (BlockType) {
@@ -656,10 +659,13 @@ GetStringWorker (
case EFI_HII_SIBT_STRING_UCS2_FONT:
case EFI_HII_SIBT_STRINGS_UCS2_FONT:
FontId = *(StringBlockAddr + sizeof (EFI_HII_STRING_BLOCK));
- return GetStringFontInfo (StringPackage, FontId, StringFontInfo);
break;
default:
- break;
+ FontId = 0;
+ }
+ Status = GetStringFontInfo (StringPackage, FontId, StringFontInfo);
+ if (Status == EFI_NOT_FOUND) {
+ *StringFontInfo = NULL;
}
}
@@ -737,38 +743,48 @@ SetStringWorker (
Referred = FALSE;
//
- // Set the string font according to input font information.
+ // The input StringFontInfo should exist in current database if specified.
//
if (StringFontInfo != NULL) {
- //
- // The input StringFontInfo should exist in current database
- //
if (!IsFontInfoExisted (Private, StringFontInfo, NULL, NULL, &GlobalFont)) {
return EFI_INVALID_PARAMETER;
} else {
- Referred = ReferFontInfoLocally (Private, StringPackage, FALSE, GlobalFont, &LocalFont);
+ Referred = ReferFontInfoLocally (
+ Private,
+ StringPackage,
+ StringPackage->FontId,
+ FALSE,
+ GlobalFont,
+ &LocalFont
+ );
+ if (!Referred) {
+ StringPackage->FontId++;
+ }
}
-
//
- // Update the FontId of the specified string block
+ // Update the FontId of the specified string block to input font info.
//
switch (BlockType) {
- case EFI_HII_SIBT_STRING_SCSU_FONT:
+ case EFI_HII_SIBT_STRING_SCSU_FONT:
case EFI_HII_SIBT_STRINGS_SCSU_FONT:
case EFI_HII_SIBT_STRING_UCS2_FONT:
case EFI_HII_SIBT_STRINGS_UCS2_FONT:
*(StringBlockAddr + sizeof (EFI_HII_STRING_BLOCK)) = LocalFont->FontId;
break;
default:
- return EFI_NOT_FOUND;
+ //
+ // When modify the font info of these blocks, the block type should be updated
+ // to contain font info thus the whole structure should be revised.
+ // It is recommended to use tool to modify the block type not in the code.
+ //
+ return EFI_UNSUPPORTED;
}
-
}
OldBlockSize = StringPackage->StringPkgHdr->Header.Length - StringPackage->StringPkgHdr->HdrSize;
//
- // Set the string text.
+ // Set the string text and font.
//
StringTextPtr = StringBlockAddr + StringTextOffset;
switch (BlockType) {
@@ -1138,7 +1154,7 @@ HiiNewString (
//
Ucs2FontBlockSize = (UINT32) (StrSize (String) + sizeof (EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK) -
sizeof (CHAR16));
- if (ReferFontInfoLocally (Private, StringPackage, FALSE, GlobalFont, &LocalFont)) {
+ if (ReferFontInfoLocally (Private, StringPackage, StringPackage->FontId, FALSE, GlobalFont, &LocalFont)) {
//
// Create a EFI_HII_SIBT_STRING_UCS2_FONT block only.
//
@@ -1229,6 +1245,12 @@ HiiNewString (
StringPackage->StringBlock = StringBlock;
StringPackage->StringPkgHdr->Header.Length += FontBlockSize + Ucs2FontBlockSize;
PackageListNode->PackageListHdr.PackageLength += FontBlockSize + Ucs2FontBlockSize;
+
+ //
+ // Increase the FontId to make it unique since we already add
+ // a EFI_HII_SIBT_FONT block to this string package.
+ //
+ StringPackage->FontId++;
}
}
@@ -1258,7 +1280,9 @@ HiiNewString (
@retval EFI_SUCCESS The string was returned successfully.
@retval EFI_NOT_FOUND The string specified by StringId is not available.
@retval EFI_NOT_FOUND The string specified by StringId is available but
- not in the specified language.
+ not in the specified language.
+ The specified PackageList is not in the database.
+ @retval EFI_INVALID_LANGUAGE - The string specified by StringId is available but
@retval EFI_BUFFER_TOO_SMALL The buffer specified by StringSize is too small to
hold the string.
@retval EFI_INVALID_PARAMETER The String or Language or StringSize was NULL.
@@ -1309,18 +1333,34 @@ HiiGetString (
}
if (PackageListNode != NULL) {
+ //
+ // First search: to match the StringId in the specified language.
+ //
for (Link = PackageListNode->StringPkgHdr.ForwardLink;
Link != &PackageListNode->StringPkgHdr;
Link = Link->ForwardLink
) {
- StringPackage = CR (Link, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE);
- if (R8_EfiLibCompareLanguage (StringPackage->StringPkgHdr->Language, (CHAR8 *) Language)) {
- Status = GetStringWorker (Private, StringPackage, StringId, String, StringSize, StringFontInfo);
- if (Status != EFI_NOT_FOUND) {
- return Status;
+ StringPackage = CR (Link, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE);
+ if (R8_EfiLibCompareLanguage (StringPackage->StringPkgHdr->Language, (CHAR8 *) Language)) {
+ Status = GetStringWorker (Private, StringPackage, StringId, String, StringSize, StringFontInfo);
+ if (Status != EFI_NOT_FOUND) {
+ return Status;
+ }
}
}
- }
+ //
+ // Second search: to match the StringId in other available languages if exist.
+ //
+ for (Link = PackageListNode->StringPkgHdr.ForwardLink;
+ Link != &PackageListNode->StringPkgHdr;
+ Link = Link->ForwardLink
+ ) {
+ StringPackage = CR (Link, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE);
+ Status = GetStringWorker (Private, StringPackage, StringId, String, StringSize, StringFontInfo);
+ if (!EFI_ERROR (Status)) {
+ return EFI_INVALID_LANGUAGE;
+ }
+ }
}
return EFI_NOT_FOUND;
@@ -1528,8 +1568,9 @@ HiiGetLanguages (
too small to hold the returned information.
SecondLanguageSize is updated to hold the size of
the buffer required.
- @retval EFI_NOT_FOUND The language specified by FirstLanguage is not
- present in the specified package list.
+ @retval EFI_INVALID_LANGUAGE The language specified by FirstLanguage is not
+ present in the specified package list.
+ @retval EFI_NOT_FOUND The specified PackageList is not in the Database.
**/
EFI_STATUS
@@ -1562,45 +1603,51 @@ HiiGetSecondaryLanguages (
}
Private = HII_STRING_DATABASE_PRIVATE_DATA_FROM_THIS (This);
- Languages = NULL;
- ResultSize = 0;
+ PackageListNode = NULL;
for (Link = Private->DatabaseList.ForwardLink; Link != &Private->DatabaseList; Link = Link->ForwardLink) {
DatabaseRecord = CR (Link, HII_DATABASE_RECORD, DatabaseEntry, HII_DATABASE_RECORD_SIGNATURE);
if (DatabaseRecord->Handle == PackageList) {
PackageListNode = (HII_DATABASE_PACKAGE_LIST_INSTANCE *) (DatabaseRecord->PackageList);
- for (Link1 = PackageListNode->StringPkgHdr.ForwardLink;
- Link1 != &PackageListNode->StringPkgHdr;
- Link1 = Link1->ForwardLink
- ) {
- StringPackage = CR (Link1, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE);
- if (R8_EfiLibCompareLanguage (StringPackage->StringPkgHdr->Language, (CHAR8 *) FirstLanguage)) {
- Languages = StringPackage->StringPkgHdr->Language;
- //
- // Language is a series of ';' terminated strings, first one is primary
- // language and following with other secondary languages or NULL if no
- // secondary languages any more.
- //
- Languages = AsciiStrStr (Languages, ";");
- if (Languages == NULL) {
- break;
- }
- Languages++;
-
- ResultSize = AsciiStrSize (Languages);
- if (ResultSize <= *SecondLanguagesSize) {
- AsciiStrCpy (SecondLanguages, Languages);
- } else {
- *SecondLanguagesSize = ResultSize;
- return EFI_BUFFER_TOO_SMALL;
- }
+ break;
+ }
+ }
+ if (PackageListNode == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ Languages = NULL;
+ ResultSize = 0;
+ for (Link1 = PackageListNode->StringPkgHdr.ForwardLink;
+ Link1 != &PackageListNode->StringPkgHdr;
+ Link1 = Link1->ForwardLink
+ ) {
+ StringPackage = CR (Link1, HII_STRING_PACKAGE_INSTANCE, StringEntry, HII_STRING_PACKAGE_SIGNATURE);
+ if (R8_EfiLibCompareLanguage (StringPackage->StringPkgHdr->Language, (CHAR8 *) FirstLanguage)) {
+ Languages = StringPackage->StringPkgHdr->Language;
+ //
+ // Language is a series of ';' terminated strings, first one is primary
+ // language and following with other secondary languages or NULL if no
+ // secondary languages any more.
+ //
+ Languages = AsciiStrStr (Languages, ";");
+ if (Languages == NULL) {
+ break;
+ }
+ Languages++;
- return EFI_SUCCESS;
- }
+ ResultSize = AsciiStrSize (Languages);
+ if (ResultSize <= *SecondLanguagesSize) {
+ AsciiStrCpy (SecondLanguages, Languages);
+ } else {
+ *SecondLanguagesSize = ResultSize;
+ return EFI_BUFFER_TOO_SMALL;
}
+
+ return EFI_SUCCESS;
}
}
- return EFI_NOT_FOUND;
+ return EFI_INVALID_LANGUAGE;
}
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
index c813081..9108acb 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
@@ -1,5 +1,5 @@
/** @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
@@ -1233,11 +1233,11 @@ ParseOpCodes (
//
CurrentStatement->Minimum = ((EFI_IFR_STRING *) OpCodeData)->MinSize;
CurrentStatement->Maximum = ((EFI_IFR_STRING *) OpCodeData)->MaxSize;
- CurrentStatement->StorageWidth = (UINT16)((UINTN) CurrentStatement->Maximum * sizeof (UINT16));
+ CurrentStatement->StorageWidth = (UINT16)((UINTN) CurrentStatement->Maximum * sizeof (CHAR16));
CurrentStatement->Flags = ((EFI_IFR_STRING *) OpCodeData)->Flags;
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_STRING;
- CurrentStatement->BufferValue = AllocateZeroPool (CurrentStatement->StorageWidth);
+ CurrentStatement->BufferValue = AllocateZeroPool (CurrentStatement->StorageWidth + sizeof (CHAR16));
InitializeRequestElement (FormSet, CurrentStatement);
break;
@@ -1252,10 +1252,10 @@ ParseOpCodes (
//
CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_PASSWORD *) OpCodeData)->MinSize, sizeof (UINT16));
CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_PASSWORD *) OpCodeData)->MaxSize, sizeof (UINT16));
- CurrentStatement->StorageWidth = (UINT16)((UINTN) CurrentStatement->Maximum * sizeof (UINT16));
+ CurrentStatement->StorageWidth = (UINT16)((UINTN) CurrentStatement->Maximum * sizeof (CHAR16));
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_STRING;
- CurrentStatement->BufferValue = AllocateZeroPool (CurrentStatement->StorageWidth);
+ CurrentStatement->BufferValue = AllocateZeroPool ((CurrentStatement->StorageWidth + sizeof (CHAR16)));
InitializeRequestElement (FormSet, CurrentStatement);
break;
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 8203531..ff85775 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -1,5 +1,5 @@
/** @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
@@ -1173,7 +1173,11 @@ GetQuestionValue (
}
if (IsString) {
- StrCpy ((CHAR16 *) Dst, Value);
+ //
+ // Convert Config String to Unicode String, e.g "0041004200430044" => "ABCD"
+ //
+ Length = StorageWidth + sizeof (CHAR16);
+ Status = ConfigStringToUnicode ((CHAR16 *) Dst, &Length, Value);
} else {
Status = HexStringToBuf (Dst, &StorageWidth, Value, NULL);
}
@@ -1239,7 +1243,11 @@ GetQuestionValue (
//
Value = Value + 1;
if (!IsBufferStorage && IsString) {
- StrCpy ((CHAR16 *) Dst, Value);
+ //
+ // Convert Config String to Unicode String, e.g "0041004200430044" => "ABCD"
+ //
+ Length = StorageWidth + sizeof (CHAR16);
+ Status = ConfigStringToUnicode ((CHAR16 *) Dst, &Length, Value);
} else {
Status = HexStringToBuf (Dst, &StorageWidth, Value, NULL);
if (EFI_ERROR (Status)) {
@@ -1408,13 +1416,21 @@ SetQuestionValue (
CopyMem (Storage->EditBuffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
} else {
if (IsString) {
+ //
+ // Convert Unicode String to Config String, e.g. "ABCD" => "0041004200430044"
+ //
Value = NULL;
- NewStringCpy (&Value, (CHAR16 *) Src);
- } else {
- BufferLen = (StorageWidth * 2 + 1) * sizeof (CHAR16);
+ BufferLen = ((StrLen ((CHAR16 *) Src) * 4) + 1) * sizeof (CHAR16);
Value = AllocateZeroPool (BufferLen);
ASSERT (Value != NULL);
+ Status = UnicodeToConfigString (Value, &BufferLen, (CHAR16 *) Src);
+ ASSERT_EFI_ERROR (Status);
+ } else {
+ BufferLen = StorageWidth * 2 + 1;
+ Value = AllocateZeroPool (BufferLen * sizeof (CHAR16));
+ ASSERT (Value != NULL);
BufToHexString (Value, &BufferLen, Src, StorageWidth);
+ ToLower (Value);
}
Status = SetValueByName (Storage, Question->VariableName, Value);
@@ -1424,7 +1440,7 @@ SetQuestionValue (
if (!Cached) {
//
// <ConfigResp> ::= <ConfigHdr> + <BlockName> + "&VALUE=" + "<HexCh>StorageWidth * 2" ||
- // <ConfigHdr> + "&" + <VariableName> + "=" + "<HexCh>StorageWidth * 2"
+ // <ConfigHdr> + "&" + <VariableName> + "=" + "<string>"
//
if (IsBufferStorage) {
Length = StrLen (Question->BlockName) + 7;
@@ -1432,7 +1448,7 @@ SetQuestionValue (
Length = StrLen (Question->VariableName) + 2;
}
if (!IsBufferStorage && IsString) {
- Length += StrLen ((CHAR16 *) Src);
+ Length += (StrLen ((CHAR16 *) Src) * 4);
} else {
Length += (StorageWidth * 2);
}
@@ -1451,10 +1467,16 @@ SetQuestionValue (
Value = ConfigResp + StrLen (ConfigResp);
if (!IsBufferStorage && IsString) {
- StrCpy (Value, (CHAR16 *) Src);
+ //
+ // Convert Unicode String to Config String, e.g. "ABCD" => "0041004200430044"
+ //
+ BufferLen = ((StrLen ((CHAR16 *) Src) * 4) + 1) * sizeof (CHAR16);
+ Status = UnicodeToConfigString (Value, &BufferLen, (CHAR16 *) Src);
+ ASSERT_EFI_ERROR (Status);
} else {
- BufferLen = (StorageWidth * 2 + 1) * sizeof (CHAR16);
+ BufferLen = StorageWidth * 2 + 1;
BufToHexString (Value, &BufferLen, Src, StorageWidth);
+ ToLower (Value);
}
//
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
index 064a8d9..04b9f69 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
@@ -2299,7 +2299,7 @@ UiDisplayMenu (
Selection->Statement = NULL;
break;
}
- BufferSize = StrLen (StringPtr) / 4;
+ BufferSize = StrLen (StringPtr) / 2;
DevicePath = AllocatePool (BufferSize);
HexStringToBuffer ((UINT8 *) DevicePath, &BufferSize, StringPtr);