|
@@ -46,57 +46,52 @@ Returns:
|
|
|
EFI_STATUS Status;
|
|
|
CHAR8 *LangCode;
|
|
|
|
|
|
- if (!LibInitialized) {
|
|
|
- LibInitialized = TRUE;
|
|
|
- LibFwInstance = FALSE;
|
|
|
- LibImageHandle = ImageHandle;
|
|
|
+ if (LibInitialized)
|
|
|
+ return;
|
|
|
|
|
|
+ LibInitialized = TRUE;
|
|
|
+ LibFwInstance = FALSE;
|
|
|
+ LibImageHandle = ImageHandle;
|
|
|
|
|
|
- //
|
|
|
- // Set up global pointer to the system table, boot services table,
|
|
|
- // and runtime services table
|
|
|
- //
|
|
|
-
|
|
|
- ST = SystemTable;
|
|
|
- BS = SystemTable->BootServices;
|
|
|
- RT = SystemTable->RuntimeServices;
|
|
|
-// ASSERT (CheckCrc(0, &ST->Hdr));
|
|
|
-// ASSERT (CheckCrc(0, &BS->Hdr));
|
|
|
-// ASSERT (CheckCrc(0, &RT->Hdr));
|
|
|
-
|
|
|
-
|
|
|
- //
|
|
|
- // Initialize pool allocation type
|
|
|
- //
|
|
|
-
|
|
|
- if (ImageHandle) {
|
|
|
- Status = uefi_call_wrapper(
|
|
|
- BS->HandleProtocol,
|
|
|
- 3,
|
|
|
- ImageHandle,
|
|
|
- &LoadedImageProtocol,
|
|
|
- (VOID*)&LoadedImage
|
|
|
- );
|
|
|
-
|
|
|
- if (!EFI_ERROR(Status)) {
|
|
|
- PoolAllocationType = LoadedImage->ImageDataType;
|
|
|
- }
|
|
|
- EFIDebugVariable ();
|
|
|
- }
|
|
|
+ //
|
|
|
+ // Set up global pointer to the system table, boot services table,
|
|
|
+ // and runtime services table
|
|
|
+ //
|
|
|
|
|
|
- //
|
|
|
- // Initialize Guid table
|
|
|
- //
|
|
|
+ ST = SystemTable;
|
|
|
+ BS = SystemTable->BootServices;
|
|
|
+ RT = SystemTable->RuntimeServices;
|
|
|
+ // ASSERT (CheckCrc(0, &ST->Hdr));
|
|
|
+ // ASSERT (CheckCrc(0, &BS->Hdr));
|
|
|
+ // ASSERT (CheckCrc(0, &RT->Hdr));
|
|
|
|
|
|
- InitializeGuid();
|
|
|
+ //
|
|
|
+ // Initialize pool allocation type
|
|
|
+ //
|
|
|
|
|
|
- InitializeLibPlatform(ImageHandle,SystemTable);
|
|
|
+ if (ImageHandle) {
|
|
|
+ Status = uefi_call_wrapper(
|
|
|
+ BS->HandleProtocol,
|
|
|
+ 3,
|
|
|
+ ImageHandle,
|
|
|
+ &LoadedImageProtocol,
|
|
|
+ (VOID*)&LoadedImage
|
|
|
+ );
|
|
|
+
|
|
|
+ if (!EFI_ERROR(Status)) {
|
|
|
+ PoolAllocationType = LoadedImage->ImageDataType;
|
|
|
+ }
|
|
|
+ EFIDebugVariable ();
|
|
|
}
|
|
|
|
|
|
//
|
|
|
- //
|
|
|
+ // Initialize Guid table
|
|
|
//
|
|
|
|
|
|
+ InitializeGuid();
|
|
|
+
|
|
|
+ InitializeLibPlatform(ImageHandle,SystemTable);
|
|
|
+
|
|
|
if (ImageHandle && UnicodeInterface == &LibStubUnicodeInterface) {
|
|
|
LangCode = LibGetVariable (VarLanguage, &EfiGlobalVariable);
|
|
|
InitializeUnicodeSupport (LangCode);
|