3 Copyright (c) 1998 Intel Corporation
26 IN EFI_HANDLE ImageHandle,
27 IN EFI_SYSTEM_TABLE *SystemTable
33 Initializes EFI library for use
37 Firmware's EFI system table
45 EFI_LOADED_IMAGE *LoadedImage;
49 if (!LibInitialized) {
50 LibInitialized = TRUE;
51 LibFwInstance = FALSE;
54 // Set up global pointer to the system table, boot services table,
55 // and runtime services table
59 BS = SystemTable->BootServices;
60 RT = SystemTable->RuntimeServices;
61 // ASSERT (CheckCrc(0, &ST->Hdr));
62 // ASSERT (CheckCrc(0, &BS->Hdr));
63 // ASSERT (CheckCrc(0, &RT->Hdr));
67 // Initialize pool allocation type
71 Status = uefi_call_wrapper(
79 if (!EFI_ERROR(Status)) {
80 PoolAllocationType = LoadedImage->ImageDataType;
87 // Initialize Guid table
92 InitializeLibPlatform(ImageHandle,SystemTable);
99 if (ImageHandle && UnicodeInterface == &LibStubUnicodeInterface) {
100 LangCode = LibGetVariable (VarLanguage, &EfiGlobalVariable);
101 InitializeUnicodeSupport (LangCode);
109 InitializeUnicodeSupport (
113 EFI_UNICODE_COLLATION_INTERFACE *Ui;
116 UINTN Index, Position, Length;
121 // If we don't know it, lookup the current language code
124 LibLocateHandle (ByProtocol, &UnicodeCollationProtocol, NULL, &NoHandles, &Handles);
125 if (!LangCode || !NoHandles) {
130 // Check all driver's for a matching language code
133 for (Index=0; Index < NoHandles; Index++) {
134 Status = uefi_call_wrapper(BS->HandleProtocol, 3, Handles[Index], &UnicodeCollationProtocol, (VOID*)&Ui);
135 if (EFI_ERROR(Status)) {
140 // Check for a matching language code
143 Languages = Ui->SupportedLanguages;
144 Length = strlena(Languages);
145 for (Position=0; Position < Length; Position += ISO_639_2_ENTRY_SIZE) {
148 // If this code matches, use this driver
151 if (CompareMem (Languages+Position, LangCode, ISO_639_2_ENTRY_SIZE) == 0) {
152 UnicodeInterface = Ui;
178 DataSize = sizeof(EFIDebug);
179 Status = uefi_call_wrapper(RT->GetVariable, 5, L"EFIDebug", &EfiGlobalVariable, &Attributes, &DataSize, &NewEFIDebug);
180 if (!EFI_ERROR(Status)) {
181 EFIDebug = NewEFIDebug;