diff options
author | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-06-23 09:38:38 +0000 |
---|---|---|
committer | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-06-23 09:38:38 +0000 |
commit | 54cf87805f9ad61a316ce9e4eb9c67154c87cf0b (patch) | |
tree | 9a1aabb960f1530e0371bd18ef4391cfdffb0a55 /MdePkg/Library/HiiLib/HiiLib.c | |
parent | 9a2d4fe9a7650097e5ef27366efbf3a14326f5b5 (diff) | |
download | edk2-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/HiiLib.c')
-rw-r--r-- | MdePkg/Library/HiiLib/HiiLib.c | 62 |
1 files changed, 34 insertions, 28 deletions
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,
|