EFI_STATUS Status;\r
CONFIG_ACCESS_PRIVATE *ConfigAccess;\r
LIST_ENTRY *Link;\r
- BUFFER_STORAGE_ENTRY *BufferStorage;\r
+ BUFFER_STORAGE_ENTRY *BufferStorage;\r
VOID *Data;\r
UINTN DataSize;\r
\r
\r
BufferStorage = BUFFER_STORAGE_ENTRY_FROM_LINK (Link);\r
\r
- if (ConfigAccess->FormCallbackProtocol == NULL ||\r
- ConfigAccess->FormCallbackProtocol->NvRead == NULL) {\r
- Status = GetUefiVariable (\r
- BufferStorage,\r
- &Data,\r
- &DataSize\r
- );\r
+ if (ConfigAccess->ThunkContext->NvMapOverride == NULL) {\r
+ if (ConfigAccess->FormCallbackProtocol == NULL ||\r
+ ConfigAccess->FormCallbackProtocol->NvRead == NULL) {\r
+ Status = GetUefiVariable (\r
+ BufferStorage,\r
+ &Data,\r
+ &DataSize\r
+ );\r
+ } else {\r
+ Status = CallFormCallBack (\r
+ BufferStorage,\r
+ ConfigAccess->FormCallbackProtocol,\r
+ &Data,\r
+ &DataSize\r
+ );\r
+ }\r
} else {\r
- Status = CallFormCallBack (\r
- BufferStorage,\r
- ConfigAccess->FormCallbackProtocol,\r
- &Data,\r
- &DataSize\r
- );\r
+ DataSize = BufferStorage->Size;\r
+ Data = AllocateCopyPool (DataSize, ConfigAccess->ThunkContext->NvMapOverride);\r
+ \r
+ if (Data != NULL) {\r
+ Status = EFI_SUCCESS;\r
+ } else {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ }\r
}\r
\r
if (!EFI_ERROR (Status)) {\r
BOOLEAN DataAllocated;\r
\r
Data = NULL;\r
- DataAllocated = TRUE;\r
ConfigAccess = CONFIG_ACCESS_PRIVATE_FROM_PROTOCOL (This);\r
\r
//\r
BufferStorage = BUFFER_STORAGE_ENTRY_FROM_LINK (Link);\r
DataSize2 = BufferStorage->Size;\r
if (ConfigAccess->ThunkContext->NvMapOverride == NULL) {\r
+ DataAllocated = TRUE;\r
if (ConfigAccess->FormCallbackProtocol == NULL ||\r
ConfigAccess->FormCallbackProtocol->NvRead == NULL) {\r
Status = GetUefiVariable (\r
&Data,\r
&DataSize\r
);\r
- ASSERT (DataSize == DataSize2);\r
- \r
} else {\r
Status = CallFormCallBack (\r
BufferStorage,\r
&Data,\r
&DataSize\r
);\r
- ASSERT (DataSize == DataSize2);\r
- \r
}\r
} else {\r
+ //\r
+ // ConfigToBlock will convert the Config String and update the NvMapOverride accordingly.\r
+ //\r
Status = EFI_SUCCESS;\r
Data = ConfigAccess->ThunkContext->NvMapOverride;\r
DataSize = DataSize2;\r
DataAllocated = FALSE;\r
} \r
- if (EFI_ERROR (Status)) {\r
- goto Done;\r
+ if (EFI_ERROR (Status) || (DataSize2 != DataSize)) {\r
+ if (Data == NULL) {\r
+ Data = AllocateZeroPool (DataSize2);\r
+ }\r
}\r
\r
Status = mHiiConfigRoutingProtocol->ConfigToBlock (\r
goto Done;\r
}\r
\r
- if (ConfigAccess->FormCallbackProtocol == NULL ||\r
- ConfigAccess->FormCallbackProtocol->NvWrite == NULL) {\r
- Status = gRT->SetVariable (\r
- BufferStorage->Name,\r
- &BufferStorage->Guid,\r
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
- DataSize,\r
- Data\r
- );\r
- } else {\r
- Status = ConfigAccess->FormCallbackProtocol->NvWrite (\r
- ConfigAccess->FormCallbackProtocol, \r
- BufferStorage->Name,\r
- &BufferStorage->Guid,\r
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
- DataSize,\r
- Data,\r
- &ResetRequired\r
- );\r
- \r
+ if (ConfigAccess->ThunkContext->NvMapOverride == NULL) {\r
+ if (ConfigAccess->FormCallbackProtocol == NULL ||\r
+ ConfigAccess->FormCallbackProtocol->NvWrite == NULL) {\r
+ Status = gRT->SetVariable (\r
+ BufferStorage->Name,\r
+ &BufferStorage->Guid,\r
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+ DataSize2,\r
+ Data\r
+ );\r
+ } else {\r
+ Status = ConfigAccess->FormCallbackProtocol->NvWrite (\r
+ ConfigAccess->FormCallbackProtocol, \r
+ BufferStorage->Name,\r
+ &BufferStorage->Guid,\r
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+ DataSize2,\r
+ Data,\r
+ &ResetRequired\r
+ );\r
+ \r
+ }\r
}\r
\r
Done: \r
UINTN BrowserDataSize;\r
BUFFER_STORAGE_ENTRY *BufferStorageEntry;\r
LIST_ENTRY *Link;\r
+ EFI_STATUS Status;\r
\r
IfrDataArray = AllocateZeroPool (0x100);\r
ASSERT (IfrDataArray != NULL);\r
\r
- if (ConfigAccess->ThunkContext->NvMapOverride == NULL) {\r
- Link = GetFirstNode (&ConfigAccess->BufferStorageListHead);\r
-\r
- ASSERT (!IsNull (&ConfigAccess->BufferStorageListHead, Link));\r
-\r
- BufferStorageEntry = BUFFER_STORAGE_ENTRY_FROM_LINK(Link);\r
+ Link = GetFirstNode (&ConfigAccess->BufferStorageListHead);\r
+ ASSERT (!IsNull (&ConfigAccess->BufferStorageListHead, Link));\r
+ \r
+ BufferStorageEntry = BUFFER_STORAGE_ENTRY_FROM_LINK(Link);\r
+ BrowserDataSize = BufferStorageEntry->Size;\r
\r
- BrowserDataSize = BufferStorageEntry->Size;\r
+ if (ConfigAccess->ThunkContext->NvMapOverride == NULL) {\r
*NvMapAllocated = TRUE;\r
IfrDataArray->NvRamMap = AllocateZeroPool (BrowserDataSize);\r
- GetBrowserData (NULL, NULL, &BrowserDataSize, IfrDataArray->NvRamMap);\r
} else {\r
*NvMapAllocated = FALSE;\r
IfrDataArray->NvRamMap = ConfigAccess->ThunkContext->NvMapOverride;\r
}\r
+ \r
+ Status = GetBrowserData (NULL, NULL, &BrowserDataSize, IfrDataArray->NvRamMap);\r
+ ASSERT_EFI_ERROR (Status);\r
\r
IfrDataEntry = (FRAMEWORK_EFI_IFR_DATA_ENTRY *) (IfrDataArray + 1);\r
\r
return IfrDataArray;\r
}\r
\r
+VOID\r
+SyncBrowserDataForNvMapOverride (\r
+ IN CONFIG_ACCESS_PRIVATE *ConfigAccess\r
+ )\r
+{\r
+ BUFFER_STORAGE_ENTRY *BufferStorageEntry;\r
+ LIST_ENTRY *Link;\r
+ EFI_STATUS Status;\r
+ UINTN BrowserDataSize;\r
+\r
+ if (ConfigAccess->ThunkContext->NvMapOverride != NULL) {\r
+ \r
+ Link = GetFirstNode (&ConfigAccess->BufferStorageListHead);\r
+ ASSERT (!IsNull (&ConfigAccess->BufferStorageListHead, Link));\r
+ \r
+ BufferStorageEntry = BUFFER_STORAGE_ENTRY_FROM_LINK(Link);\r
+ BrowserDataSize = BufferStorageEntry->Size;\r
+\r
+ Status = SetBrowserData (NULL, NULL, BrowserDataSize, ConfigAccess->ThunkContext->NvMapOverride, NULL);\r
+ ASSERT_EFI_ERROR (Status);\r
+ }\r
+\r
+}\r
+\r
VOID\r
DestroyIfrDataArray (\r
IN FRAMEWORK_EFI_IFR_DATA_ARRAY *Array,\r
Data,\r
&Packet\r
);\r
+ SyncBrowserDataForNvMapOverride (ConfigAccess);\r
\r
//\r
// Callback require browser to perform action\r
\r
#include "HiiDatabase.h"\r
\r
+EFI_NARROW_GLYPH mNarrowGlyphBuffer = {0, 0, {0}};\r
+\r
+BOOLEAN mSysFontColorCached = FALSE;\r
+EFI_GRAPHICS_OUTPUT_BLT_PIXEL mSysFGColor = {0};\r
\r
-UINT8 mGlyphBuffer[EFI_GLYPH_WIDTH * 2 * EFI_GLYPH_HEIGHT];\r
\r
/**\r
This function is only called by Graphics Console module and GraphicsLib. \r
IN OUT UINT32 *InternalStatus\r
)\r
{\r
- ASSERT (FALSE);\r
- return EFI_UNSUPPORTED;\r
+ EFI_STATUS Status;\r
+ EFI_IMAGE_OUTPUT *Blt;\r
+ EFI_FONT_DISPLAY_INFO *FontInfo;\r
+ UINTN Xpos;\r
+ UINTN Ypos;\r
+ UINTN BaseLine;\r
+\r
+ if (!mSysFontColorCached) {\r
+ //\r
+ // Cache the system font's foreground color.\r
+ //\r
+ Status = mHiiFontProtocol->GetFontInfo (\r
+ mHiiFontProtocol,\r
+ NULL,\r
+ NULL,\r
+ &FontInfo,\r
+ NULL\r
+ );\r
+\r
+ if (!EFI_ERROR (Status)) {\r
+ ASSERT (StrCmp (FontInfo->FontInfo.FontName, L"sysdefault") == 0);\r
+ mSysFGColor = FontInfo->ForegroundColor;\r
+ FreePool (FontInfo);\r
+\r
+ mSysFontColorCached = TRUE;\r
+ }\r
+ \r
+ }\r
+\r
+ Blt = NULL;\r
+ Status = mHiiFontProtocol->GetGlyph (\r
+ mHiiFontProtocol,\r
+ Source[*Index],\r
+ NULL,\r
+ &Blt,\r
+ &BaseLine\r
+ );\r
+\r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // For simplicity, we only handle Narrow Glyph.\r
+ //\r
+ ASSERT (Blt->Height == EFI_GLYPH_HEIGHT);\r
+ ASSERT (Blt->Width == EFI_GLYPH_WIDTH);\r
+\r
+ if (Blt->Height == EFI_GLYPH_HEIGHT && Blt->Width == EFI_GLYPH_WIDTH) {\r
+\r
+ ZeroMem (&mNarrowGlyphBuffer, sizeof (mNarrowGlyphBuffer));\r
+ mNarrowGlyphBuffer.UnicodeWeight = *Source;\r
+ for (Ypos = 0; Ypos < EFI_GLYPH_HEIGHT; Ypos++) {\r
+ for (Xpos = 0; Xpos < EFI_GLYPH_WIDTH; Xpos++) {\r
+ if (CompareMem (&Blt->Image.Bitmap[Ypos * EFI_GLYPH_WIDTH + Xpos], &mSysFGColor, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)) == 0) {\r
+ mNarrowGlyphBuffer.GlyphCol1[Ypos] |= 1 << (EFI_GLYPH_WIDTH - 1 - Xpos);\r
+ }\r
+ }\r
+ }\r
+\r
+ *GlyphBuffer = (UINT8 *) &mNarrowGlyphBuffer;\r
+ *BitWidth = EFI_GLYPH_WIDTH;\r
+ *Index += 1;\r
+ } else {\r
+ Status = EFI_NOT_FOUND;\r
+ }\r
+\r
+ }\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ *GlyphBuffer = NULL;\r
+ }\r
+ return Status;\r
}\r
\r
/**\r
IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer\r
)\r
{\r
- ASSERT (FALSE);\r
- return EFI_UNSUPPORTED;\r
+ UINTN X;\r
+ UINTN Y;\r
+\r
+ //\r
+ // Convert Monochrome bitmap of the Glyph to BltBuffer structure\r
+ //\r
+ for (Y = 0; Y < Height; Y++) {\r
+ for (X = 0; X < Width; X++) {\r
+ if ((((EFI_NARROW_GLYPH *) GlyphBuffer)->GlyphCol1[Y] & (1 << X)) != 0) {\r
+ BltBuffer[Y * Width * Count + (Width - X - 1)] = Foreground;\r
+ } else {\r
+ BltBuffer[Y * Width * Count + (Width - X - 1)] = Background;\r
+ }\r
+ }\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
}\r
[Depex]\r
gEfiHiiDatabaseProtocolGuid AND\r
gEfiHiiStringProtocolGuid AND\r
- gEfiHiiConfigRoutingProtocolGuid\r
+ gEfiHiiConfigRoutingProtocolGuid AND\r
+ gEfiHiiFontProtocolGuid\r
\r
\r
CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;\r
CONST EFI_HII_IMAGE_PROTOCOL *mHiiImageProtocol;\r
CONST EFI_HII_STRING_PROTOCOL *mHiiStringProtocol;\r
+CONST EFI_HII_FONT_PROTOCOL *mHiiFontProtocol;\r
CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRoutingProtocol;\r
CONST EFI_FORM_BROWSER2_PROTOCOL *mFormBrowser2Protocol;\r
\r
);\r
ASSERT_EFI_ERROR (Status);\r
\r
+ Status = gBS->LocateProtocol (\r
+ &gEfiHiiFontProtocolGuid,\r
+ NULL,\r
+ (VOID **) &mHiiFontProtocol\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
Status = gBS->LocateProtocol (\r
&gEfiHiiConfigRoutingProtocolGuid,\r
NULL,\r
extern CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;\r
extern CONST EFI_HII_IMAGE_PROTOCOL *mHiiImageProtocol;\r
extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProtocol;\r
+extern CONST EFI_HII_FONT_PROTOCOL *mHiiFontProtocol;\r
extern CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRoutingProtocol;\r
extern CONST EFI_FORM_BROWSER2_PROTOCOL *mFormBrowser2Protocol;\r
\r
\r
UOpcode.Question.Header.Prompt = FwOpcode->Prompt;\r
UOpcode.Question.Header.Help = FwOpcode->Help;\r
- \r
+ UOpcode.Question.VarStoreId = VarStoreId;\r
+ UOpcode.Question.VarStoreInfo.VarOffset = FwOpcode->QuestionId;\r
+ \r
//\r
// Go over the Framework IFR binary to get the QuestionId for generated UEFI One Of Option opcode\r
//\r
}\r
\r
InsertTailList (&ThunkContext->OneOfOptionMapListHead, &OneOfOptionMap->Link);\r
- } else { \r
- OneOfOptionMapEntry = AllocateZeroPool (sizeof (ONE_OF_OPTION_MAP_ENTRY));\r
- ASSERT (OneOfOptionMapEntry != NULL);\r
+ }\r
+ \r
+ OneOfOptionMapEntry = AllocateZeroPool (sizeof (ONE_OF_OPTION_MAP_ENTRY));\r
+ ASSERT (OneOfOptionMapEntry != NULL);\r
\r
- OneOfOptionMapEntry->FwKey = FwOneOfOp->Key;\r
- OneOfOptionMapEntry->Signature = ONE_OF_OPTION_MAP_ENTRY_SIGNATURE;\r
- \r
- CopyMem (&OneOfOptionMapEntry->Value, &FwOneOfOp->Value, FwOpcode->Width);\r
+ OneOfOptionMapEntry->FwKey = FwOneOfOp->Key;\r
+ OneOfOptionMapEntry->Signature = ONE_OF_OPTION_MAP_ENTRY_SIGNATURE;\r
+ \r
+ CopyMem (&OneOfOptionMapEntry->Value, &FwOneOfOp->Value, FwOpcode->Width);\r
\r
- ASSERT (OneOfOptionMap != NULL);\r
- InsertTailList (&OneOfOptionMap->OneOfOptionMapEntryListHead, &OneOfOptionMapEntry->Link);\r
- }\r
+ ASSERT (OneOfOptionMap != NULL);\r
+ InsertTailList (&OneOfOptionMap->OneOfOptionMapEntryListHead, &OneOfOptionMapEntry->Link);\r
}\r
\r
if (FwOneOfOp->Flags & FRAMEWORK_EFI_IFR_FLAG_RESET_REQUIRED) {\r
UOpcode.Question.Header.Prompt = FwOpcode->Prompt;\r
UOpcode.Question.Header.Help = FwOpcode->Help;\r
UOpcode.Question.VarStoreId = VarStoreId;\r
+ UOpcode.Question.VarStoreInfo.VarOffset = FwOpcode->QuestionId;\r
\r
UOpcode.MaxContainers = FwOpcode->MaxEntries;\r
\r
\r
#include "HiiDatabase.h"\r
\r
+typedef struct {\r
+ CHAR8 *Iso639;\r
+ CHAR8 *Rfc3066;\r
+} ISO639TORFC3066MAP;\r
+\r
+ISO639TORFC3066MAP Iso639ToRfc3066Map [] = {\r
+ {"eng", "en-US"},\r
+ {"fra", "fr-FR"},\r
+};\r
+\r
+CHAR8 *\r
+ConvertIso639ToRfc3066 (\r
+ CHAR8 *Iso638Lang\r
+ )\r
+{\r
+ UINTN Index;\r
+\r
+ for (Index = 0; Index < sizeof (Iso639ToRfc3066Map) / sizeof (Iso639ToRfc3066Map[0]); Index++) {\r
+ if (AsciiStrnCmp (Iso638Lang, Iso639ToRfc3066Map[Index].Iso639, AsciiStrSize (Iso638Lang)) == 0) {\r
+ return Iso639ToRfc3066Map[Index].Rfc3066;\r
+ }\r
+ }\r
+\r
+ return (CHAR8 *) NULL;\r
+}\r
+\r
+\r
EFI_STATUS\r
EFIAPI\r
HiiTestString (\r
return EFI_SUCCESS;\r
}\r
\r
+\r
+\r
EFI_STATUS\r
GetTagGuidByFwHiiHandle (\r
IN CONST HII_THUNK_PRIVATE_DATA *Private,\r
HII_THUNK_CONTEXT *ThunkContext;\r
EFI_STRING_ID StringId;\r
EFI_STRING_ID LastStringId;\r
- CHAR8 *AsciiLanguage;\r
+ CHAR8 AsciiLanguage[ISO_639_2_ENTRY_SIZE + 1];\r
BOOLEAN Found;\r
+ CHAR8 *Rfc3066AsciiLanguage;\r
\r
//\r
// BugBug: Conver the language to 3066.\r
LastStringId = (EFI_STRING_ID) 0;\r
StringId = (EFI_STRING_ID) 0;\r
Found = FALSE;\r
- AsciiLanguage = NULL;\r
+ Rfc3066AsciiLanguage = NULL;\r
\r
Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);\r
\r
ASSERT_EFI_ERROR (Status);\r
\r
if (Language != NULL) {\r
- AsciiLanguage = AllocateZeroPool (StrLen (Language) + 1);\r
+ ZeroMem (AsciiLanguage, sizeof (AsciiLanguage));;\r
+ \r
UnicodeStrToAsciiStr (Language, AsciiLanguage);\r
+ Rfc3066AsciiLanguage = ConvertIso639ToRfc3066 (AsciiLanguage);\r
+ ASSERT (Rfc3066AsciiLanguage != NULL);\r
}\r
\r
Link = GetFirstNode (&Private->ThunkContextListHead);\r
//\r
// Create a new string token.\r
//\r
- if (AsciiLanguage == NULL) {\r
+ if (Rfc3066AsciiLanguage == NULL) {\r
//\r
// For all languages in the package list.\r
//\r
mHiiStringProtocol,\r
ThunkContext->UefiHiiHandle,\r
&StringId,\r
- AsciiLanguage,\r
+ Rfc3066AsciiLanguage,\r
NULL,\r
NewString,\r
NULL\r
//\r
// Update the existing string token.\r
//\r
- if (AsciiLanguage == NULL) {\r
+ if (Rfc3066AsciiLanguage == NULL) {\r
//\r
// For all languages in the package list.\r
//\r
mHiiStringProtocol,\r
ThunkContext->UefiHiiHandle,\r
*Reference,\r
- AsciiLanguage,\r
+ Rfc3066AsciiLanguage,\r
NewString,\r
NULL\r
);\r
return EFI_SUCCESS;\r
}\r
\r
-typedef struct {\r
- CHAR8 *Iso639;\r
- CHAR8 *Rfc3066;\r
-} ISO639TORFC3066MAP;\r
-\r
-ISO639TORFC3066MAP Iso639ToRfc3066Map [] = {\r
- {"eng", "en-US"},\r
- {"fra", "fr-FR"},\r
-};\r
-\r
-CHAR8 *\r
-ConvertIso639ToRfc3066 (\r
- CHAR8 *Iso638Lang\r
- )\r
-{\r
- UINTN Index;\r
-\r
- for (Index = 0; Index < sizeof (Iso639ToRfc3066Map) / sizeof (Iso639ToRfc3066Map[0]); Index++) {\r
- if (AsciiStrnCmp (Iso638Lang, Iso639ToRfc3066Map[Index].Iso639, AsciiStrSize (Iso638Lang)) == 0) {\r
- return Iso639ToRfc3066Map[Index].Rfc3066;\r
- }\r
- }\r
-\r
- return (CHAR8 *) NULL;\r
-}\r
-\r
EFI_STATUS\r
EFIAPI\r
HiiGetString (\r
- IN EFI_HII_PROTOCOL *This,\r
- IN FRAMEWORK_EFI_HII_HANDLE Handle,\r
- IN STRING_REF Token,\r
- IN BOOLEAN Raw,\r
- IN CHAR16 *LanguageString,\r
- IN OUT UINTN *BufferLengthTemp,\r
- OUT EFI_STRING StringBuffer\r
+ IN EFI_HII_PROTOCOL *This,\r
+ IN FRAMEWORK_EFI_HII_HANDLE Handle,\r
+ IN STRING_REF Token,\r
+ IN BOOLEAN Raw,\r
+ IN CHAR16 *LanguageString,\r
+ IN OUT UINTN *BufferLengthTemp,\r
+ OUT EFI_STRING StringBuffer\r
)\r
/*++\r
\r
\r
--*/\r
{\r
- LIST_ENTRY *Link;\r
- HII_THUNK_CONTEXT *ThunkContext;\r
- CHAR8 *AsciiLanguage;\r
+ CHAR8 *Iso639AsciiLanguage;\r
HII_THUNK_PRIVATE_DATA *Private;\r
- CHAR8 *Rfc3066AsciiLanguage;\r
+ CHAR8 *Rfc3066AsciiLanguage;\r
+ EFI_HII_HANDLE UefiHiiHandle;\r
+ EFI_STATUS Status;\r
\r
Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);\r
\r
- if (LanguageString == NULL) {\r
- AsciiLanguage = NULL;\r
- } else {\r
- AsciiLanguage = AllocateZeroPool (StrLen (LanguageString) + 1);\r
- if (AsciiLanguage == NULL) {\r
+ Iso639AsciiLanguage = NULL;\r
+ Rfc3066AsciiLanguage = NULL;\r
+\r
+ if (LanguageString != NULL) {\r
+ Iso639AsciiLanguage = AllocateZeroPool (StrLen (LanguageString) + 1);\r
+ if (Iso639AsciiLanguage == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
- UnicodeStrToAsciiStr (LanguageString, AsciiLanguage);\r
+ UnicodeStrToAsciiStr (LanguageString, Iso639AsciiLanguage);\r
\r
- Rfc3066AsciiLanguage = ConvertIso639ToRfc3066 (AsciiLanguage);\r
+ //\r
+ // Caller of Framework HII Interface uses the Language Identification String defined \r
+ // in Iso639. So map it to the Language Identifier defined in RFC3066.\r
+ //\r
+ Rfc3066AsciiLanguage = ConvertIso639ToRfc3066 (Iso639AsciiLanguage);\r
\r
//\r
// If Rfc3066AsciiLanguage is NULL, more language mapping must be added to \r
// Iso639ToRfc3066Map.\r
//\r
ASSERT (Rfc3066AsciiLanguage != NULL);\r
- //\r
- // Caller of Framework HII Interface uses the Language Identification String defined \r
- // in Iso639. So map it to the Language Identifier defined in RFC3066.\r
- //\r
- if (Rfc3066AsciiLanguage != NULL) {\r
- FreePool (AsciiLanguage);\r
- AsciiLanguage = AllocateCopyPool (AsciiStrSize (Rfc3066AsciiLanguage), Rfc3066AsciiLanguage);\r
- }\r
\r
}\r
\r
- Link = GetFirstNode (&Private->ThunkContextListHead);\r
-\r
- while (!IsNull (&Private->ThunkContextListHead, Link)) {\r
-\r
- ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);\r
+ UefiHiiHandle = FwHiiHandleToUefiHiiHandle (Private, Handle);\r
+ if (UefiHiiHandle == NULL) {\r
+ Status = EFI_NOT_FOUND;\r
+ goto Done;\r
+ }\r
\r
- if (Handle == ThunkContext->FwHiiHandle) {\r
- if (AsciiLanguage == NULL) {\r
- return HiiLibGetString (ThunkContext->UefiHiiHandle, Token, StringBuffer, BufferLengthTemp);\r
- } else {\r
- return mHiiStringProtocol->GetString (\r
- mHiiStringProtocol,\r
- AsciiLanguage,\r
- ThunkContext->UefiHiiHandle,\r
- Token,\r
- StringBuffer,\r
- BufferLengthTemp,\r
- NULL\r
- );\r
- }\r
- }\r
- \r
- \r
- Link = GetNextNode (&Private->ThunkContextListHead, Link);\r
+ if (Rfc3066AsciiLanguage == NULL) {\r
+ Status = HiiLibGetString (UefiHiiHandle, Token, StringBuffer, BufferLengthTemp);\r
+ } else {\r
+ Status = mHiiStringProtocol->GetString (\r
+ mHiiStringProtocol,\r
+ Rfc3066AsciiLanguage,\r
+ UefiHiiHandle,\r
+ Token,\r
+ StringBuffer,\r
+ BufferLengthTemp,\r
+ NULL\r
+ );\r
}\r
\r
- return EFI_NOT_FOUND;\r
+Done:\r
+ SafeFreePool (Iso639AsciiLanguage);\r
+ \r
+ return Status;\r
}\r
\r
EFI_STATUS\r