diff options
author | Chris Phillips <chrisp@hp.com> | 2014-08-19 23:15:22 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-08-19 23:15:22 +0000 |
commit | e7e0e42baca19cf7e5a7d2ac5574f97c0ecaf134 (patch) | |
tree | b42b2a006207bc8ab75654e9ac6f22dc533d03d0 | |
parent | deb21fd0ea32eee860768ae309bf4e06e7edaea9 (diff) | |
download | edk2-platforms-e7e0e42baca19cf7e5a7d2ac5574f97c0ecaf134.tar.xz |
ShellPkg: Move mHandleParsingHiiHandle init out of the constructor
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chris Phillips <chrisp@hp.com>
Signed-off-by: Eugene Cohen <eugene@hp.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15841 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c index f361f3a274..acc8a29796 100644 --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c @@ -16,7 +16,7 @@ #include "UefiHandleParsingLib.h"
#include "IndustryStandard/Acpi10.h"
-EFI_HANDLE mHandleParsingHiiHandle;
+EFI_HANDLE mHandleParsingHiiHandle = NULL;
HANDLE_INDEX_LIST mHandleList = {{{NULL,NULL},0,0},0};
GUID_INFO_BLOCK *GuidList;
UINTN GuidListCount;
@@ -102,12 +102,23 @@ HandleParsingLibConstructor ( GuidListCount = 0;
GuidList = NULL;
- mHandleParsingHiiHandle = HiiAddPackages (&gHandleParsingHiiGuid, gImageHandle, UefiHandleParsingLibStrings, NULL);
+ //
+ // Do nothing with mHandleParsingHiiHandle. Initialize HII as needed.
+ //
+ return (EFI_SUCCESS);
+}
+
+/**
+ Initialization function for HII packages.
+
+**/
+VOID
+HandleParsingHiiInit (VOID)
+{
if (mHandleParsingHiiHandle == NULL) {
- return (EFI_DEVICE_ERROR);
+ mHandleParsingHiiHandle = HiiAddPackages (&gHandleParsingHiiGuid, gImageHandle, UefiHandleParsingLibStrings, NULL);
+ ASSERT (mHandleParsingHiiHandle != NULL);
}
-
- return (EFI_SUCCESS);
}
/**
@@ -166,6 +177,8 @@ LoadedImageProtocolDumpInformation( return (CatSPrint(NULL, L"LoadedImage"));
}
+ HandleParsingHiiInit();
+
Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_LI_DUMP_MAIN), NULL);
RetVal = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));
if (Temp == NULL || RetVal == NULL) {
@@ -242,6 +255,8 @@ GraphicsOutputProtocolDumpInformation( return (CatSPrint(NULL, L"GraphicsOutput"));
}
+ HandleParsingHiiInit();
+
Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_GOP_DUMP_MAIN), NULL);
RetVal = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));
if (Temp == NULL || RetVal == NULL) {
@@ -322,6 +337,8 @@ PciRootBridgeIoDumpInformation( return (CatSPrint(NULL, L"PciRootBridgeIo"));
}
+ HandleParsingHiiInit();
+
Status = gBS->HandleProtocol(
TheHandle,
&gEfiPciRootBridgeIoProtocolGuid,
@@ -445,6 +462,8 @@ TxtOutProtocolDumpInformation( return (NULL);
}
+ HandleParsingHiiInit();
+
RetVal = NULL;
Size = 0;
@@ -883,6 +902,8 @@ AddNewGuidNameMapping( CONST GUID_INFO_BLOCK *Temp;
EFI_STRING_ID NameID;
+ HandleParsingHiiInit();
+
if (Guid == NULL || TheName == NULL){
return (EFI_INVALID_PARAMETER);
}
@@ -919,6 +940,8 @@ GetStringNameFromGuid( {
CONST GUID_INFO_BLOCK *Id;
+ HandleParsingHiiInit();
+
Id = InternalShellGetNodeFromGuid(Guid);
return (HiiGetString(mHandleParsingHiiHandle, Id==NULL?STRING_TOKEN(STR_UNKNOWN_DEVICE):Id->StringId, Lang));
}
@@ -986,6 +1009,8 @@ GetGuidFromStringName( CHAR16 *String;
UINTN LoopCount;
+ HandleParsingHiiInit();
+
ASSERT(Guid != NULL);
if (Guid == NULL) {
return (EFI_INVALID_PARAMETER);
|