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 = BS->HandleProtocol (
77
if (!EFI_ERROR(Status)) {
78
PoolAllocationType = LoadedImage->ImageDataType;
85
// Initialize Guid table
90
InitializeLibPlatform(ImageHandle,SystemTable);
97
if (ImageHandle && UnicodeInterface == &LibStubUnicodeInterface) {
98
LangCode = LibGetVariable (VarLanguage, &EfiGlobalVariable);
99
InitializeUnicodeSupport (LangCode);
107
InitializeUnicodeSupport (
111
EFI_UNICODE_COLLATION_INTERFACE *Ui;
114
UINTN Index, Position, Length;
119
// If we don't know it, lookup the current language code
122
LibLocateHandle (ByProtocol, &UnicodeCollationProtocol, NULL, &NoHandles, &Handles);
123
if (!LangCode || !NoHandles) {
128
// Check all driver's for a matching language code
131
for (Index=0; Index < NoHandles; Index++) {
132
Status = BS->HandleProtocol (Handles[Index], &UnicodeCollationProtocol, (VOID*)&Ui);
133
if (EFI_ERROR(Status)) {
138
// Check for a matching language code
141
Languages = Ui->SupportedLanguages;
142
Length = strlena(Languages);
143
for (Position=0; Position < Length; Position += ISO_639_2_ENTRY_SIZE) {
146
// If this code matches, use this driver
149
if (CompareMem (Languages+Position, LangCode, ISO_639_2_ENTRY_SIZE) == 0) {
150
UnicodeInterface = Ui;
176
DataSize = sizeof(EFIDebug);
177
Status = RT->GetVariable(L"EFIDebug", &EfiGlobalVariable, &Attributes, &DataSize, &NewEFIDebug);
178
if (!EFI_ERROR(Status)) {
179
EFIDebug = NewEFIDebug;