summaryrefslogtreecommitdiff
path: root/MdePkg/Library/HiiLib
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-06-23 09:38:38 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-06-23 09:38:38 +0000
commit54cf87805f9ad61a316ce9e4eb9c67154c87cf0b (patch)
tree9a1aabb960f1530e0371bd18ef4391cfdffb0a55 /MdePkg/Library/HiiLib
parent9a2d4fe9a7650097e5ef27366efbf3a14326f5b5 (diff)
downloadedk2-platforms-54cf87805f9ad61a316ce9e4eb9c67154c87cf0b.tar.xz
Merged in the following trackers from EDK:
EDK1145 Cursor mising in shell in some case EDK1099: Dell - [HII] HiiGetFontInfo() not retrieve the system font by FoFontInfoMask EDK1127: [UEFI 2.10] Keyboard layout support EDK1129: [UEFI HII] GUID is represented wrongly in Config String And some other fixes such as *[UEFI HII] HiiGetAltCfg is generating "Name=" sub string in the wrong format *UEFI HII: GetUnicodeStringTextOrSize() doesn't handle NULL StringDest properly *GetFontInfo() need be updated to avoid iteration *HIIStringProtocolTest failed on multiple platform *[Uefi 2.1] Comply with latest Hii ECR * GetFontInfo() need be updated to avoid iteration git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5360 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/HiiLib')
-rw-r--r--MdePkg/Library/HiiLib/HiiLanguage.c5
-rw-r--r--MdePkg/Library/HiiLib/HiiLib.c62
-rw-r--r--MdePkg/Library/HiiLib/HiiLib.inf5
-rw-r--r--MdePkg/Library/HiiLib/InternalHiiLib.h12
4 files changed, 49 insertions, 35 deletions
diff --git a/MdePkg/Library/HiiLib/HiiLanguage.c b/MdePkg/Library/HiiLib/HiiLanguage.c
index 14a9313507..cd2b66063b 100644
--- a/MdePkg/Library/HiiLib/HiiLanguage.c
+++ b/MdePkg/Library/HiiLib/HiiLanguage.c
@@ -95,6 +95,8 @@ HiiLibGetSupportedLanguages (
if (LanguageString == NULL) {
return NULL;
}
+
+ LocateHiiProtocols ();
Status = mHiiStringProt->GetLanguages (mHiiStringProt, HiiHandle, LanguageString, &BufferSize);
@@ -164,6 +166,9 @@ HiiLibGetSupportedSecondaryLanguages (
if (LanguageString == NULL) {
return NULL;
}
+
+ LocateHiiProtocols ();
+
Status = mHiiStringProt->GetSecondaryLanguages (mHiiStringProt, HiiHandle, FirstLanguage, LanguageString, &BufferSize);
if (Status == EFI_BUFFER_TOO_SMALL) {
diff --git a/MdePkg/Library/HiiLib/HiiLib.c b/MdePkg/Library/HiiLib/HiiLib.c
index 1f59fa4fa5..940536620c 100644
--- a/MdePkg/Library/HiiLib/HiiLib.c
+++ b/MdePkg/Library/HiiLib/HiiLib.c
@@ -16,44 +16,36 @@
CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt;
CONST EFI_HII_STRING_PROTOCOL *mHiiStringProt;
+BOOLEAN mHiiProtocolsInitialized = FALSE;
+
/**
- The constructor function of Hii Library.
-
- The constructor function caches the value of default HII protocol instances.
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
+ This function locate Hii relative protocols for later usage.
+
+ @param VOID
+
+ @retval VOID
**/
-EFI_STATUS
-EFIAPI
-UefiHiiLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+VOID
+LocateHiiProtocols (
+ VOID
)
{
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol (
- &gEfiHiiDatabaseProtocolGuid,
- NULL,
- (VOID **) &mHiiDatabaseProt
- );
+ EFI_STATUS Status;
+
+ if (mHiiProtocolsInitialized) {
+ return;
+ }
+
+ Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &mHiiDatabaseProt);
ASSERT_EFI_ERROR (Status);
- ASSERT (mHiiDatabaseProt != NULL);
- Status = gBS->LocateProtocol (
- &gEfiHiiStringProtocolGuid,
- NULL,
- (VOID **) &mHiiStringProt
- );
+ Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &mHiiStringProt);
ASSERT_EFI_ERROR (Status);
- ASSERT (mHiiStringProt != NULL);
- return EFI_SUCCESS;
+ mHiiProtocolsInitialized = TRUE;
}
@@ -151,6 +143,8 @@ HiiLibAddPackages (
ASSERT (HiiHandle != NULL);
+ LocateHiiProtocols ();
+
VA_START (Args, HiiHandle);
PackageListHeader = InternalHiiLibPreparePackages (NumberOfPackages, GuidId, Args);
@@ -174,8 +168,10 @@ HiiLibRemovePackages (
)
{
EFI_STATUS Status;
-
ASSERT (HiiHandle != NULL);
+
+ LocateHiiProtocols ();
+
Status = mHiiDatabaseProt->RemovePackageList (mHiiDatabaseProt, HiiHandle);
ASSERT_EFI_ERROR (Status);
}
@@ -196,6 +192,8 @@ HiiLibGetHiiHandles (
BufferLength = 0;
+ LocateHiiProtocols ();
+
//
// Try to find the actual buffer size for HiiHandle Buffer.
//
@@ -245,6 +243,9 @@ HiiLibExtractGuidFromHiiHandle (
//
BufferSize = 0;
HiiPackageList = NULL;
+
+ LocateHiiProtocols ();
+
Status = mHiiDatabaseProt->ExportPackageLists (mHiiDatabaseProt, Handle, &BufferSize, HiiPackageList);
ASSERT (Status != EFI_NOT_FOUND);
@@ -326,6 +327,8 @@ HiiLibDevicePathToHiiHandle (
return NULL;
}
+ LocateHiiProtocols ();
+
//
// Retrieve all Hii Handles from HII database
//
@@ -392,6 +395,9 @@ IsHiiHandleRegistered (
HiiPackageList = NULL;
BufferSize = 0;
+
+ LocateHiiProtocols ();
+
Status = mHiiDatabaseProt->ExportPackageLists (
mHiiDatabaseProt,
HiiHandle,
diff --git a/MdePkg/Library/HiiLib/HiiLib.inf b/MdePkg/Library/HiiLib/HiiLib.inf
index 30a1657984..f9ff028942 100644
--- a/MdePkg/Library/HiiLib/HiiLib.inf
+++ b/MdePkg/Library/HiiLib/HiiLib.inf
@@ -24,8 +24,6 @@
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x0002000A
- CONSTRUCTOR = UefiHiiLibConstructor
-
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
@@ -54,8 +52,5 @@
[Guids]
gEfiGlobalVariableGuid
-[Depex]
- gEfiHiiDatabaseProtocolGuid AND gEfiHiiStringProtocolGuid
-
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang \ No newline at end of file
diff --git a/MdePkg/Library/HiiLib/InternalHiiLib.h b/MdePkg/Library/HiiLib/InternalHiiLib.h
index b2c8b87707..5d03cd1b78 100644
--- a/MdePkg/Library/HiiLib/InternalHiiLib.h
+++ b/MdePkg/Library/HiiLib/InternalHiiLib.h
@@ -36,8 +36,10 @@
#define HII_LIB_DEFAULT_STRING_SIZE 0x200
-extern CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt;
-extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProt;
+extern CONST EFI_HII_DATABASE_PROTOCOL *mHiiDatabaseProt;
+extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProt;
+extern BOOLEAN mHiiProtocolsInitialized;
+
BOOLEAN
IsHiiHandleRegistered (
@@ -45,4 +47,10 @@ IsHiiHandleRegistered (
)
;
+VOID
+LocateHiiProtocols (
+ VOID
+ )
+;
+
#endif