summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiHandleParsingLib
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Library/UefiHandleParsingLib')
-rw-r--r--ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c35
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);