]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/Bds/Bds.c
ArmPlatformPkg: Removed the global ImageHandle when UefiBootServicesTableLib is included
[mirror_edk2.git] / ArmPlatformPkg / Bds / Bds.c
1 /** @file
2 *
3 * Copyright (c) 2011-2014, ARM Limited. All rights reserved.
4 *
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
9 *
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 *
13 **/
14
15 #include "BdsInternal.h"
16
17 #include <Library/PcdLib.h>
18 #include <Library/PerformanceLib.h>
19
20 #include <Protocol/Bds.h>
21
22 #define EFI_SET_TIMER_TO_SECOND 10000000
23
24 STATIC
25 EFI_STATUS
26 GetConsoleDevicePathFromVariable (
27 IN CHAR16* ConsoleVarName,
28 IN CHAR16* DefaultConsolePaths,
29 OUT EFI_DEVICE_PATH** DevicePaths
30 )
31 {
32 EFI_STATUS Status;
33 UINTN Size;
34 EFI_DEVICE_PATH_PROTOCOL* DevicePathInstances;
35 EFI_DEVICE_PATH_PROTOCOL* DevicePathInstance;
36 CHAR16* DevicePathStr;
37 CHAR16* NextDevicePathStr;
38 EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *EfiDevicePathFromTextProtocol;
39
40 Status = GetGlobalEnvironmentVariable (ConsoleVarName, NULL, NULL, (VOID**)&DevicePathInstances);
41 if (EFI_ERROR(Status)) {
42 // In case no default console device path has been defined we assume a driver handles the console (eg: SimpleTextInOutSerial)
43 if ((DefaultConsolePaths == NULL) || (DefaultConsolePaths[0] == L'\0')) {
44 *DevicePaths = NULL;
45 return EFI_SUCCESS;
46 }
47
48 Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
49 ASSERT_EFI_ERROR(Status);
50
51 DevicePathInstances = NULL;
52
53 // Extract the Device Path instances from the multi-device path string
54 while ((DefaultConsolePaths != NULL) && (DefaultConsolePaths[0] != L'\0')) {
55 NextDevicePathStr = StrStr (DefaultConsolePaths, L";");
56 if (NextDevicePathStr == NULL) {
57 DevicePathStr = DefaultConsolePaths;
58 DefaultConsolePaths = NULL;
59 } else {
60 DevicePathStr = (CHAR16*)AllocateCopyPool ((NextDevicePathStr - DefaultConsolePaths + 1) * sizeof(CHAR16), DefaultConsolePaths);
61 *(DevicePathStr + (NextDevicePathStr - DefaultConsolePaths)) = L'\0';
62 DefaultConsolePaths = NextDevicePathStr;
63 if (DefaultConsolePaths[0] == L';') {
64 DefaultConsolePaths++;
65 }
66 }
67
68 DevicePathInstance = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath (DevicePathStr);
69 ASSERT(DevicePathInstance != NULL);
70 DevicePathInstances = AppendDevicePathInstance (DevicePathInstances, DevicePathInstance);
71
72 if (NextDevicePathStr != NULL) {
73 FreePool (DevicePathStr);
74 }
75 FreePool (DevicePathInstance);
76 }
77
78 // Set the environment variable with this device path multi-instances
79 Size = GetDevicePathSize (DevicePathInstances);
80 if (Size > 0) {
81 gRT->SetVariable (
82 ConsoleVarName,
83 &gEfiGlobalVariableGuid,
84 EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
85 Size,
86 DevicePathInstances
87 );
88 } else {
89 Status = EFI_INVALID_PARAMETER;
90 }
91 }
92
93 if (!EFI_ERROR(Status)) {
94 *DevicePaths = DevicePathInstances;
95 }
96 return Status;
97 }
98
99 STATIC
100 EFI_STATUS
101 InitializeConsolePipe (
102 IN EFI_DEVICE_PATH *ConsoleDevicePaths,
103 IN EFI_GUID *Protocol,
104 OUT EFI_HANDLE *Handle,
105 OUT VOID* *Interface
106 )
107 {
108 EFI_STATUS Status;
109 UINTN Size;
110 UINTN NoHandles;
111 EFI_HANDLE *Buffer;
112 EFI_DEVICE_PATH_PROTOCOL* DevicePath;
113
114 // Connect all the Device Path Consoles
115 while (ConsoleDevicePaths != NULL) {
116 DevicePath = GetNextDevicePathInstance (&ConsoleDevicePaths, &Size);
117
118 Status = BdsConnectDevicePath (DevicePath, Handle, NULL);
119 DEBUG_CODE_BEGIN();
120 if (EFI_ERROR(Status)) {
121 // We convert back to the text representation of the device Path
122 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
123 CHAR16* DevicePathTxt;
124 EFI_STATUS Status;
125
126 Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
127 if (!EFI_ERROR(Status)) {
128 DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (DevicePath, TRUE, TRUE);
129
130 DEBUG((EFI_D_ERROR,"Fail to start the console with the Device Path '%s'. (Error '%r')\n", DevicePathTxt, Status));
131
132 FreePool (DevicePathTxt);
133 }
134 }
135 DEBUG_CODE_END();
136
137 // If the console splitter driver is not supported by the platform then use the first Device Path
138 // instance for the console interface.
139 if (!EFI_ERROR(Status) && (*Interface == NULL)) {
140 Status = gBS->HandleProtocol (*Handle, Protocol, Interface);
141 }
142 }
143
144 // No Device Path has been defined for this console interface. We take the first protocol implementation
145 if (*Interface == NULL) {
146 Status = gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &NoHandles, &Buffer);
147 if (EFI_ERROR (Status)) {
148 BdsConnectAllDrivers();
149 Status = gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &NoHandles, &Buffer);
150 }
151
152 if (!EFI_ERROR(Status)) {
153 *Handle = Buffer[0];
154 Status = gBS->HandleProtocol (*Handle, Protocol, Interface);
155 ASSERT_EFI_ERROR(Status);
156 }
157 FreePool (Buffer);
158 } else {
159 Status = EFI_SUCCESS;
160 }
161
162 return Status;
163 }
164
165 EFI_STATUS
166 InitializeConsole (
167 VOID
168 )
169 {
170 EFI_STATUS Status;
171 EFI_DEVICE_PATH* ConOutDevicePaths;
172 EFI_DEVICE_PATH* ConInDevicePaths;
173 EFI_DEVICE_PATH* ConErrDevicePaths;
174
175 // By getting the Console Device Paths from the environment variables before initializing the console pipe, we
176 // create the 3 environment variables (ConIn, ConOut, ConErr) that allows to initialize all the console interface
177 // of newly installed console drivers
178 Status = GetConsoleDevicePathFromVariable (L"ConOut", (CHAR16*)PcdGetPtr(PcdDefaultConOutPaths), &ConOutDevicePaths);
179 ASSERT_EFI_ERROR (Status);
180 Status = GetConsoleDevicePathFromVariable (L"ConIn", (CHAR16*)PcdGetPtr(PcdDefaultConInPaths), &ConInDevicePaths);
181 ASSERT_EFI_ERROR (Status);
182 Status = GetConsoleDevicePathFromVariable (L"ErrOut", (CHAR16*)PcdGetPtr(PcdDefaultConOutPaths), &ConErrDevicePaths);
183 ASSERT_EFI_ERROR (Status);
184
185 // Initialize the Consoles
186 Status = InitializeConsolePipe (ConOutDevicePaths, &gEfiSimpleTextOutProtocolGuid, &gST->ConsoleOutHandle, (VOID **)&gST->ConOut);
187 ASSERT_EFI_ERROR (Status);
188 Status = InitializeConsolePipe (ConInDevicePaths, &gEfiSimpleTextInProtocolGuid, &gST->ConsoleInHandle, (VOID **)&gST->ConIn);
189 ASSERT_EFI_ERROR (Status);
190 Status = InitializeConsolePipe (ConErrDevicePaths, &gEfiSimpleTextOutProtocolGuid, &gST->StandardErrorHandle, (VOID **)&gST->StdErr);
191 if (EFI_ERROR(Status)) {
192 // In case of error, we reuse the console output for the error output
193 gST->StandardErrorHandle = gST->ConsoleOutHandle;
194 gST->StdErr = gST->ConOut;
195 }
196
197 // Free Memory allocated for reading the UEFI Variables
198 if (ConOutDevicePaths) {
199 FreePool (ConOutDevicePaths);
200 }
201 if (ConInDevicePaths) {
202 FreePool (ConInDevicePaths);
203 }
204 if (ConErrDevicePaths) {
205 FreePool (ConErrDevicePaths);
206 }
207
208 return EFI_SUCCESS;
209 }
210
211 EFI_STATUS
212 DefineDefaultBootEntries (
213 VOID
214 )
215 {
216 BDS_LOAD_OPTION* BdsLoadOption;
217 UINTN Size;
218 EFI_STATUS Status;
219 EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol;
220 EFI_DEVICE_PATH* BootDevicePath;
221 UINT8* OptionalData;
222 UINTN OptionalDataSize;
223 ARM_BDS_LOADER_ARGUMENTS* BootArguments;
224 ARM_BDS_LOADER_TYPE BootType;
225 EFI_DEVICE_PATH* InitrdPath;
226 UINTN InitrdSize;
227 UINTN CmdLineSize;
228 UINTN CmdLineAsciiSize;
229 CHAR16* DefaultBootArgument;
230 CHAR8* AsciiDefaultBootArgument;
231
232 //
233 // If Boot Order does not exist then create a default entry
234 //
235 Size = 0;
236 Status = gRT->GetVariable (L"BootOrder", &gEfiGlobalVariableGuid, NULL, &Size, NULL);
237 if (Status == EFI_NOT_FOUND) {
238 if ((PcdGetPtr(PcdDefaultBootDevicePath) == NULL) || (StrLen ((CHAR16*)PcdGetPtr(PcdDefaultBootDevicePath)) == 0)) {
239 return EFI_UNSUPPORTED;
240 }
241
242 Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
243 if (EFI_ERROR(Status)) {
244 // You must provide an implementation of DevicePathFromTextProtocol in your firmware (eg: DevicePathDxe)
245 DEBUG((EFI_D_ERROR,"Error: Bds requires DevicePathFromTextProtocol\n"));
246 return Status;
247 }
248 BootDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootDevicePath));
249
250 DEBUG_CODE_BEGIN();
251 // We convert back to the text representation of the device Path to see if the initial text is correct
252 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
253 CHAR16* DevicePathTxt;
254
255 Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
256 ASSERT_EFI_ERROR(Status);
257 DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (BootDevicePath, TRUE, TRUE);
258
259 ASSERT (StrCmp ((CHAR16*)PcdGetPtr(PcdDefaultBootDevicePath), DevicePathTxt) == 0);
260
261 FreePool (DevicePathTxt);
262 DEBUG_CODE_END();
263
264 // Create the entry is the Default values are correct
265 if (BootDevicePath != NULL) {
266 BootType = (ARM_BDS_LOADER_TYPE)PcdGet32 (PcdDefaultBootType);
267
268 // We do not support NULL pointer
269 ASSERT (PcdGetPtr (PcdDefaultBootArgument) != NULL);
270
271 //
272 // Logic to handle ASCII or Unicode default parameters
273 //
274 if (*(CHAR8*)PcdGetPtr (PcdDefaultBootArgument) == '\0') {
275 CmdLineSize = 0;
276 CmdLineAsciiSize = 0;
277 DefaultBootArgument = NULL;
278 AsciiDefaultBootArgument = NULL;
279 } else if (IsUnicodeString ((CHAR16*)PcdGetPtr (PcdDefaultBootArgument))) {
280 // The command line is a Unicode string
281 DefaultBootArgument = (CHAR16*)PcdGetPtr (PcdDefaultBootArgument);
282 CmdLineSize = StrSize (DefaultBootArgument);
283
284 // Initialize ASCII variables
285 CmdLineAsciiSize = CmdLineSize / 2;
286 AsciiDefaultBootArgument = AllocatePool (CmdLineAsciiSize);
287 if (AsciiDefaultBootArgument == NULL) {
288 return EFI_OUT_OF_RESOURCES;
289 }
290 UnicodeStrToAsciiStr ((CHAR16*)PcdGetPtr (PcdDefaultBootArgument), AsciiDefaultBootArgument);
291 } else {
292 // The command line is a ASCII string
293 AsciiDefaultBootArgument = (CHAR8*)PcdGetPtr (PcdDefaultBootArgument);
294 CmdLineAsciiSize = AsciiStrSize (AsciiDefaultBootArgument);
295
296 // Initialize ASCII variables
297 CmdLineSize = CmdLineAsciiSize * 2;
298 DefaultBootArgument = AllocatePool (CmdLineSize);
299 if (DefaultBootArgument == NULL) {
300 return EFI_OUT_OF_RESOURCES;
301 }
302 AsciiStrToUnicodeStr (AsciiDefaultBootArgument, DefaultBootArgument);
303 }
304
305 if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
306 InitrdPath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootInitrdPath));
307 InitrdSize = GetDevicePathSize (InitrdPath);
308
309 OptionalDataSize = sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineAsciiSize + InitrdSize;
310 BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (OptionalDataSize);
311 if (BootArguments == NULL) {
312 return EFI_OUT_OF_RESOURCES;
313 }
314 BootArguments->LinuxArguments.CmdLineSize = CmdLineAsciiSize;
315 BootArguments->LinuxArguments.InitrdSize = InitrdSize;
316
317 CopyMem ((VOID*)(BootArguments + 1), AsciiDefaultBootArgument, CmdLineAsciiSize);
318 CopyMem ((VOID*)((UINTN)(BootArguments + 1) + CmdLineAsciiSize), InitrdPath, InitrdSize);
319
320 OptionalData = (UINT8*)BootArguments;
321 } else {
322 OptionalData = (UINT8*)DefaultBootArgument;
323 OptionalDataSize = CmdLineSize;
324 }
325
326 BootOptionCreate (LOAD_OPTION_ACTIVE | LOAD_OPTION_CATEGORY_BOOT,
327 (CHAR16*)PcdGetPtr(PcdDefaultBootDescription),
328 BootDevicePath,
329 BootType,
330 OptionalData,
331 OptionalDataSize,
332 &BdsLoadOption
333 );
334 FreePool (BdsLoadOption);
335
336 if (DefaultBootArgument == (CHAR16*)PcdGetPtr (PcdDefaultBootArgument)) {
337 FreePool (AsciiDefaultBootArgument);
338 } else if (DefaultBootArgument != NULL) {
339 FreePool (DefaultBootArgument);
340 }
341 } else {
342 Status = EFI_UNSUPPORTED;
343 }
344 }
345
346 return Status;
347 }
348
349 EFI_STATUS
350 StartDefaultBootOnTimeout (
351 VOID
352 )
353 {
354 UINTN Size;
355 UINT16 Timeout;
356 UINT16 *TimeoutPtr;
357 EFI_EVENT WaitList[2];
358 UINTN WaitIndex;
359 UINT16 *BootOrder;
360 UINTN BootOrderSize;
361 UINTN Index;
362 CHAR16 BootVariableName[9];
363 EFI_STATUS Status;
364 EFI_INPUT_KEY Key;
365
366 Size = sizeof(UINT16);
367 Timeout = (UINT16)PcdGet16 (PcdPlatformBootTimeOut);
368 Status = GetGlobalEnvironmentVariable (L"Timeout", &Timeout, &Size, (VOID**)&TimeoutPtr);
369 if (!EFI_ERROR (Status)) {
370 Timeout = *TimeoutPtr;
371 FreePool (TimeoutPtr);
372 }
373
374 if (Timeout != 0xFFFF) {
375 if (Timeout > 0) {
376 // Create the waiting events (keystroke and 1sec timer)
377 gBS->CreateEvent (EVT_TIMER, 0, NULL, NULL, &WaitList[0]);
378 gBS->SetTimer (WaitList[0], TimerPeriodic, EFI_SET_TIMER_TO_SECOND);
379 WaitList[1] = gST->ConIn->WaitForKey;
380
381 // Start the timer
382 WaitIndex = 0;
383 Print(L"The default boot selection will start in ");
384 while ((Timeout > 0) && (WaitIndex == 0)) {
385 Print(L"%3d seconds",Timeout);
386 gBS->WaitForEvent (2, WaitList, &WaitIndex);
387 if (WaitIndex == 0) {
388 Print(L"\b\b\b\b\b\b\b\b\b\b\b");
389 Timeout--;
390 }
391 }
392 // Discard key in the buffer
393 do {
394 Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
395 } while(!EFI_ERROR(Status));
396 gBS->CloseEvent (WaitList[0]);
397 Print(L"\n\r");
398 }
399
400 // In case of Timeout we start the default boot selection
401 if (Timeout == 0) {
402 // Get the Boot Option Order from the environment variable (a default value should have been created)
403 GetGlobalEnvironmentVariable (L"BootOrder", NULL, &BootOrderSize, (VOID**)&BootOrder);
404
405 for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) {
406 UnicodeSPrint (BootVariableName, 9 * sizeof(CHAR16), L"Boot%04X", BootOrder[Index]);
407 Status = BdsStartBootOption (BootVariableName);
408 if(!EFI_ERROR(Status)){
409 // Boot option returned successfully, hence don't need to start next boot option
410 break;
411 }
412 // In case of success, we should not return from this call.
413 }
414 FreePool (BootOrder);
415 }
416 }
417 return EFI_SUCCESS;
418 }
419
420 /**
421 This function uses policy data from the platform to determine what operating
422 system or system utility should be loaded and invoked. This function call
423 also optionally make the use of user input to determine the operating system
424 or system utility to be loaded and invoked. When the DXE Core has dispatched
425 all the drivers on the dispatch queue, this function is called. This
426 function will attempt to connect the boot devices required to load and invoke
427 the selected operating system or system utility. During this process,
428 additional firmware volumes may be discovered that may contain addition DXE
429 drivers that can be dispatched by the DXE Core. If a boot device cannot be
430 fully connected, this function calls the DXE Service Dispatch() to allow the
431 DXE drivers from any newly discovered firmware volumes to be dispatched.
432 Then the boot device connection can be attempted again. If the same boot
433 device connection operation fails twice in a row, then that boot device has
434 failed, and should be skipped. This function should never return.
435
436 @param This The EFI_BDS_ARCH_PROTOCOL instance.
437
438 @return None.
439
440 **/
441 VOID
442 EFIAPI
443 BdsEntry (
444 IN EFI_BDS_ARCH_PROTOCOL *This
445 )
446 {
447 UINTN Size;
448 EFI_STATUS Status;
449 UINT16 *BootNext;
450 UINTN BootNextSize;
451 CHAR16 BootVariableName[9];
452
453 PERF_END (NULL, "DXE", NULL, 0);
454
455 //
456 // Declare the Firmware Vendor
457 //
458 if (FixedPcdGetPtr(PcdFirmwareVendor) != NULL) {
459 Size = 0x100;
460 gST->FirmwareVendor = AllocateRuntimePool (Size);
461 ASSERT (gST->FirmwareVendor != NULL);
462 UnicodeSPrint (gST->FirmwareVendor, Size, L"%a EFI %a %a", PcdGetPtr(PcdFirmwareVendor), __DATE__, __TIME__);
463 }
464
465 //
466 // Fixup Table CRC after we updated Firmware Vendor
467 //
468 gST->Hdr.CRC32 = 0;
469 Status = gBS->CalculateCrc32 ((VOID*)gST, gST->Hdr.HeaderSize, &gST->Hdr.CRC32);
470 ASSERT_EFI_ERROR (Status);
471
472 // If BootNext environment variable is defined then we just load it !
473 BootNextSize = sizeof(UINT16);
474 Status = GetGlobalEnvironmentVariable (L"BootNext", NULL, &BootNextSize, (VOID**)&BootNext);
475 if (!EFI_ERROR(Status)) {
476 ASSERT(BootNextSize == sizeof(UINT16));
477
478 // Generate the requested Boot Entry variable name
479 UnicodeSPrint (BootVariableName, 9 * sizeof(CHAR16), L"Boot%04X", *BootNext);
480
481 // Set BootCurrent variable
482 gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
483 EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
484 BootNextSize, BootNext);
485
486 FreePool (BootNext);
487
488 // Start the requested Boot Entry
489 Status = BdsStartBootOption (BootVariableName);
490 if (Status != EFI_NOT_FOUND) {
491 // BootNext has not been succeeded launched
492 if (EFI_ERROR(Status)) {
493 Print(L"Fail to start BootNext.\n");
494 }
495
496 // Delete the BootNext environment variable
497 gRT->SetVariable (L"BootNext", &gEfiGlobalVariableGuid,
498 EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
499 0, NULL);
500 }
501
502 // Clear BootCurrent variable
503 gRT->SetVariable (L"BootCurrent", &gEfiGlobalVariableGuid,
504 EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
505 0, NULL);
506 }
507
508 // If Boot Order does not exist then create a default entry
509 DefineDefaultBootEntries ();
510
511 // Now we need to setup the EFI System Table with information about the console devices.
512 InitializeConsole ();
513
514 //
515 // Update the CRC32 in the EFI System Table header
516 //
517 gST->Hdr.CRC32 = 0;
518 Status = gBS->CalculateCrc32 ((VOID*)gST, gST->Hdr.HeaderSize, &gST->Hdr.CRC32);
519 ASSERT_EFI_ERROR (Status);
520
521 // Timer before initiating the default boot selection
522 StartDefaultBootOnTimeout ();
523
524 // Start the Boot Menu
525 Status = BootMenuMain ();
526 ASSERT_EFI_ERROR (Status);
527
528 }
529
530 EFI_BDS_ARCH_PROTOCOL gBdsProtocol = {
531 BdsEntry,
532 };
533
534 EFI_STATUS
535 EFIAPI
536 BdsInitialize (
537 IN EFI_HANDLE ImageHandle,
538 IN EFI_SYSTEM_TABLE *SystemTable
539 )
540 {
541 EFI_STATUS Status;
542
543 Status = gBS->InstallMultipleProtocolInterfaces (
544 &ImageHandle,
545 &gEfiBdsArchProtocolGuid, &gBdsProtocol,
546 NULL
547 );
548 ASSERT_EFI_ERROR (Status);
549
550 return Status;
551 }