]>
Commit | Line | Data |
---|---|---|
5c08e117 | 1 | /** @file\r |
128efbbc | 2 | This module produce main entry for BDS phase - BdsEntry.\r |
5c08e117 | 3 | When this module was dispatched by DxeCore, gEfiBdsArchProtocolGuid will be installed\r |
4 | which contains interface of BdsEntry.\r | |
5 | After DxeCore finish DXE phase, gEfiBdsArchProtocolGuid->BdsEntry will be invoked\r | |
6 | to enter BDS phase.\r | |
7 | \r | |
d2b9b337 | 8 | Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>\r |
180a5a35 | 9 | This program and the accompanying materials\r |
5c08e117 | 10 | are licensed and made available under the terms and conditions of the BSD License\r |
11 | which accompanies this distribution. The full text of the license may be found at\r | |
12 | http://opensource.org/licenses/bsd-license.php\r | |
13 | \r | |
14 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
15 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
16 | \r | |
17 | **/\r | |
18 | \r | |
19 | #include "Bds.h"\r | |
20 | #include "Language.h"\r | |
21 | #include "FrontPage.h"\r | |
22 | #include "Hotkey.h"\r | |
23 | #include "HwErrRecSupport.h"\r | |
24 | \r | |
25 | ///\r | |
26 | /// BDS arch protocol instance initial value.\r | |
27 | ///\r | |
28 | /// Note: Current BDS not directly get the BootMode, DefaultBoot,\r | |
29 | /// TimeoutDefault, MemoryTestLevel value from the BDS arch protocol.\r | |
128efbbc | 30 | /// Please refer to the library useage of BdsLibGetBootMode, BdsLibGetTimeout\r |
5c08e117 | 31 | /// and PlatformBdsDiagnostics in BdsPlatform.c\r |
32 | ///\r | |
f7cdf5cd | 33 | EFI_HANDLE gBdsHandle = NULL;\r |
34 | \r | |
35 | EFI_BDS_ARCH_PROTOCOL gBds = {\r | |
36 | BdsEntry\r | |
5c08e117 | 37 | };\r |
38 | \r | |
39 | UINT16 *mBootNext = NULL;\r | |
40 | \r | |
ff843847 RN |
41 | ///\r |
42 | /// The read-only variables defined in UEFI Spec.\r | |
43 | ///\r | |
44 | CHAR16 *mReadOnlyVariables[] = {\r | |
45 | L"PlatformLangCodes",\r | |
46 | L"LangCodes",\r | |
47 | L"BootOptionSupport",\r | |
48 | L"HwErrRecSupport",\r | |
49 | L"OsIndicationsSupported"\r | |
50 | };\r | |
51 | \r | |
5c08e117 | 52 | /**\r |
53 | \r | |
54 | Install Boot Device Selection Protocol\r | |
55 | \r | |
56 | @param ImageHandle The image handle.\r | |
57 | @param SystemTable The system table.\r | |
58 | \r | |
59 | @retval EFI_SUCEESS BDS has finished initializing.\r | |
60 | Return the dispatcher and recall BDS.Entry\r | |
61 | @retval Other Return status from AllocatePool() or gBS->InstallProtocolInterface\r | |
62 | \r | |
63 | **/\r | |
64 | EFI_STATUS\r | |
65 | EFIAPI\r | |
66 | BdsInitialize (\r | |
67 | IN EFI_HANDLE ImageHandle,\r | |
68 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
69 | )\r | |
70 | {\r | |
71 | EFI_STATUS Status;\r | |
72 | \r | |
5c08e117 | 73 | //\r |
74 | // Install protocol interface\r | |
75 | //\r | |
f7cdf5cd | 76 | Status = gBS->InstallMultipleProtocolInterfaces (\r |
77 | &gBdsHandle,\r | |
78 | &gEfiBdsArchProtocolGuid, &gBds,\r | |
79 | NULL\r | |
5c08e117 | 80 | );\r |
81 | ASSERT_EFI_ERROR (Status);\r | |
82 | \r | |
83 | return Status;\r | |
84 | }\r | |
85 | \r | |
5676ccca | 86 | \r |
87 | /**\r | |
88 | An empty function to pass error checking of CreateEventEx ().\r | |
89 | \r | |
90 | @param Event Event whose notification function is being invoked.\r | |
91 | @param Context Pointer to the notification function's context,\r | |
92 | which is implementation-dependent.\r | |
93 | \r | |
94 | **/\r | |
95 | VOID\r | |
96 | EFIAPI\r | |
97 | BdsEmptyCallbackFunction (\r | |
98 | IN EFI_EVENT Event,\r | |
99 | IN VOID *Context\r | |
100 | )\r | |
101 | {\r | |
102 | }\r | |
103 | \r | |
5c08e117 | 104 | /**\r |
105 | \r | |
106 | This function attempts to boot for the boot order specified\r | |
107 | by platform policy.\r | |
108 | \r | |
109 | **/\r | |
110 | VOID\r | |
111 | BdsBootDeviceSelect (\r | |
112 | VOID\r | |
113 | )\r | |
114 | {\r | |
115 | EFI_STATUS Status;\r | |
116 | LIST_ENTRY *Link;\r | |
117 | BDS_COMMON_OPTION *BootOption;\r | |
118 | UINTN ExitDataSize;\r | |
119 | CHAR16 *ExitData;\r | |
120 | UINT16 Timeout;\r | |
121 | LIST_ENTRY BootLists;\r | |
122 | CHAR16 Buffer[20];\r | |
123 | BOOLEAN BootNextExist;\r | |
124 | LIST_ENTRY *LinkBootNext;\r | |
5676ccca | 125 | EFI_EVENT ConnectConInEvent;\r |
5c08e117 | 126 | \r |
127 | //\r | |
128 | // Got the latest boot option\r | |
129 | //\r | |
130 | BootNextExist = FALSE;\r | |
131 | LinkBootNext = NULL;\r | |
5676ccca | 132 | ConnectConInEvent = NULL;\r |
5c08e117 | 133 | InitializeListHead (&BootLists);\r |
134 | \r | |
135 | //\r | |
136 | // First check the boot next option\r | |
137 | //\r | |
138 | ZeroMem (Buffer, sizeof (Buffer));\r | |
139 | \r | |
5676ccca | 140 | //\r |
141 | // Create Event to signal ConIn connection request\r | |
142 | //\r | |
143 | if (PcdGetBool (PcdConInConnectOnDemand)) {\r | |
144 | Status = gBS->CreateEventEx (\r | |
145 | EVT_NOTIFY_SIGNAL,\r | |
146 | TPL_CALLBACK,\r | |
147 | BdsEmptyCallbackFunction,\r | |
148 | NULL,\r | |
149 | &gConnectConInEventGuid,\r | |
150 | &ConnectConInEvent\r | |
151 | );\r | |
152 | if (EFI_ERROR(Status)) {\r | |
153 | ConnectConInEvent = NULL;\r | |
154 | }\r | |
155 | }\r | |
156 | \r | |
5c08e117 | 157 | if (mBootNext != NULL) {\r |
158 | //\r | |
159 | // Indicate we have the boot next variable, so this time\r | |
160 | // boot will always have this boot option\r | |
161 | //\r | |
162 | BootNextExist = TRUE;\r | |
163 | \r | |
164 | //\r | |
165 | // Clear the this variable so it's only exist in this time boot\r | |
166 | //\r | |
167 | gRT->SetVariable (\r | |
168 | L"BootNext",\r | |
169 | &gEfiGlobalVariableGuid,\r | |
170 | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r | |
171 | 0,\r | |
172 | mBootNext\r | |
173 | );\r | |
174 | \r | |
175 | //\r | |
176 | // Add the boot next boot option\r | |
177 | //\r | |
178 | UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *mBootNext);\r | |
179 | BootOption = BdsLibVariableToOption (&BootLists, Buffer);\r | |
128efbbc | 180 | \r |
5c08e117 | 181 | //\r |
182 | // If fail to get boot option from variable, just return and do nothing.\r | |
183 | //\r | |
184 | if (BootOption == NULL) {\r | |
185 | return;\r | |
186 | }\r | |
128efbbc | 187 | \r |
5c08e117 | 188 | BootOption->BootCurrent = *mBootNext;\r |
189 | }\r | |
190 | //\r | |
191 | // Parse the boot order to get boot option\r | |
192 | //\r | |
193 | BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");\r | |
d8600108 RN |
194 | \r |
195 | //\r | |
196 | // When we didn't have chance to build boot option variables in the first \r | |
197 | // full configuration boot (e.g.: Reset in the first page or in Device Manager),\r | |
198 | // we have no boot options in the following mini configuration boot.\r | |
199 | // Give the last chance to enumerate the boot options.\r | |
200 | //\r | |
201 | if (IsListEmpty (&BootLists)) {\r | |
202 | BdsLibEnumerateAllBootOption (&BootLists);\r | |
203 | }\r | |
204 | \r | |
5c08e117 | 205 | Link = BootLists.ForwardLink;\r |
206 | \r | |
207 | //\r | |
208 | // Parameter check, make sure the loop will be valid\r | |
209 | //\r | |
210 | if (Link == NULL) {\r | |
211 | return ;\r | |
212 | }\r | |
213 | //\r | |
214 | // Here we make the boot in a loop, every boot success will\r | |
215 | // return to the front page\r | |
216 | //\r | |
217 | for (;;) {\r | |
218 | //\r | |
219 | // Check the boot option list first\r | |
220 | //\r | |
221 | if (Link == &BootLists) {\r | |
5676ccca | 222 | //\r |
223 | // When LazyConIn enabled, signal connect ConIn event before enter UI\r | |
224 | //\r | |
225 | if (PcdGetBool (PcdConInConnectOnDemand) && ConnectConInEvent != NULL) {\r | |
226 | gBS->SignalEvent (ConnectConInEvent);\r | |
227 | }\r | |
228 | \r | |
5c08e117 | 229 | //\r |
230 | // There are two ways to enter here:\r | |
231 | // 1. There is no active boot option, give user chance to\r | |
232 | // add new boot option\r | |
233 | // 2. All the active boot option processed, and there is no\r | |
234 | // one is success to boot, then we back here to allow user\r | |
235 | // add new active boot option\r | |
236 | //\r | |
237 | Timeout = 0xffff;\r | |
238 | PlatformBdsEnterFrontPage (Timeout, FALSE);\r | |
239 | InitializeListHead (&BootLists);\r | |
240 | BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");\r | |
241 | Link = BootLists.ForwardLink;\r | |
242 | continue;\r | |
243 | }\r | |
244 | //\r | |
245 | // Get the boot option from the link list\r | |
246 | //\r | |
247 | BootOption = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);\r | |
248 | \r | |
249 | //\r | |
250 | // According to EFI Specification, if a load option is not marked\r | |
251 | // as LOAD_OPTION_ACTIVE, the boot manager will not automatically\r | |
252 | // load the option.\r | |
253 | //\r | |
254 | if (!IS_LOAD_OPTION_TYPE (BootOption->Attribute, LOAD_OPTION_ACTIVE)) {\r | |
255 | //\r | |
baf46e70 | 256 | // skip the header of the link list, because it has no boot option\r |
5c08e117 | 257 | //\r |
258 | Link = Link->ForwardLink;\r | |
259 | continue;\r | |
260 | }\r | |
261 | //\r | |
262 | // Make sure the boot option device path connected,\r | |
263 | // but ignore the BBS device path\r | |
264 | //\r | |
265 | if (DevicePathType (BootOption->DevicePath) != BBS_DEVICE_PATH) {\r | |
266 | //\r | |
267 | // Notes: the internal shell can not been connected with device path\r | |
268 | // so we do not check the status here\r | |
269 | //\r | |
270 | BdsLibConnectDevicePath (BootOption->DevicePath);\r | |
271 | }\r | |
2df686c6 | 272 | \r |
273 | //\r | |
274 | // Restore to original mode before launching boot option.\r | |
275 | //\r | |
276 | BdsSetConsoleMode (FALSE);\r | |
277 | \r | |
5c08e117 | 278 | //\r |
279 | // All the driver options should have been processed since\r | |
280 | // now boot will be performed.\r | |
281 | //\r | |
282 | Status = BdsLibBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);\r | |
59b9d73e | 283 | if (Status != EFI_SUCCESS) {\r |
5c08e117 | 284 | //\r |
285 | // Call platform action to indicate the boot fail\r | |
286 | //\r | |
287 | BootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_FAILED));\r | |
288 | PlatformBdsBootFail (BootOption, Status, ExitData, ExitDataSize);\r | |
289 | \r | |
290 | //\r | |
291 | // Check the next boot option\r | |
292 | //\r | |
293 | Link = Link->ForwardLink;\r | |
294 | \r | |
295 | } else {\r | |
296 | //\r | |
297 | // Call platform action to indicate the boot success\r | |
298 | //\r | |
128efbbc | 299 | BootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED));\r |
5c08e117 | 300 | PlatformBdsBootSuccess (BootOption);\r |
301 | \r | |
302 | //\r | |
303 | // Boot success, then stop process the boot order, and\r | |
304 | // present the boot manager menu, front page\r | |
305 | //\r | |
5676ccca | 306 | \r |
307 | //\r | |
308 | // When LazyConIn enabled, signal connect ConIn Event before enter UI\r | |
309 | //\r | |
310 | if (PcdGetBool (PcdConInConnectOnDemand) && ConnectConInEvent != NULL) {\r | |
311 | gBS->SignalEvent (ConnectConInEvent);\r | |
312 | }\r | |
313 | \r | |
5c08e117 | 314 | Timeout = 0xffff;\r |
315 | PlatformBdsEnterFrontPage (Timeout, FALSE);\r | |
316 | \r | |
317 | //\r | |
baf46e70 | 318 | // Rescan the boot option list, avoid potential risk of the boot\r |
5c08e117 | 319 | // option change in front page\r |
320 | //\r | |
321 | if (BootNextExist) {\r | |
322 | LinkBootNext = BootLists.ForwardLink;\r | |
323 | }\r | |
324 | \r | |
325 | InitializeListHead (&BootLists);\r | |
326 | if (LinkBootNext != NULL) {\r | |
327 | //\r | |
328 | // Reserve the boot next option\r | |
329 | //\r | |
330 | InsertTailList (&BootLists, LinkBootNext);\r | |
331 | }\r | |
332 | \r | |
333 | BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");\r | |
334 | Link = BootLists.ForwardLink;\r | |
335 | }\r | |
336 | }\r | |
337 | \r | |
338 | }\r | |
339 | \r | |
7ea22852 ED |
340 | /**\r |
341 | \r | |
342 | Validate input console variable data. \r | |
343 | \r | |
344 | If found the device path is not a valid device path, remove the variable.\r | |
345 | \r | |
346 | @param VariableName Input console variable name.\r | |
347 | \r | |
348 | **/\r | |
7ea22852 ED |
349 | VOID\r |
350 | BdsFormalizeConsoleVariable (\r | |
351 | IN CHAR16 *VariableName\r | |
352 | )\r | |
353 | {\r | |
354 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
355 | UINTN VariableSize;\r | |
356 | EFI_STATUS Status;\r | |
357 | \r | |
358 | DevicePath = BdsLibGetVariableAndSize (\r | |
359 | VariableName,\r | |
360 | &gEfiGlobalVariableGuid,\r | |
361 | &VariableSize\r | |
362 | );\r | |
98b241d6 | 363 | if ((DevicePath != NULL) && !IsDevicePathValid (DevicePath, VariableSize)) { \r |
7ea22852 ED |
364 | Status = gRT->SetVariable (\r |
365 | VariableName,\r | |
366 | &gEfiGlobalVariableGuid,\r | |
367 | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r | |
368 | 0,\r | |
369 | NULL\r | |
370 | );\r | |
371 | ASSERT_EFI_ERROR (Status);\r | |
372 | }\r | |
373 | }\r | |
374 | \r | |
375 | /**\r | |
376 | \r | |
18cf3950 | 377 | Formalize Bds global variables. \r |
7ea22852 | 378 | \r |
18cf3950 | 379 | 1. For ConIn/ConOut/ConErr, if found the device path is not a valid device path, remove the variable.\r |
380 | 2. For OsIndicationsSupported, Create a BS/RT/UINT64 variable to report caps \r | |
381 | 3. Delete OsIndications variable if it is not NV/BS/RT UINT64\r | |
382 | Item 3 is used to solve case when OS corrupts OsIndications. Here simply delete this NV variable.\r | |
383 | \r | |
7ea22852 ED |
384 | **/\r |
385 | VOID \r | |
386 | BdsFormalizeEfiGlobalVariable (\r | |
387 | VOID\r | |
388 | )\r | |
389 | {\r | |
18cf3950 | 390 | EFI_STATUS Status;\r |
391 | UINT64 OsIndicationSupport;\r | |
392 | UINT64 OsIndication;\r | |
393 | UINTN DataSize;\r | |
394 | UINT32 Attributes;\r | |
395 | \r | |
7ea22852 ED |
396 | //\r |
397 | // Validate Console variable.\r | |
398 | //\r | |
399 | BdsFormalizeConsoleVariable (L"ConIn");\r | |
400 | BdsFormalizeConsoleVariable (L"ConOut");\r | |
401 | BdsFormalizeConsoleVariable (L"ErrOut");\r | |
18cf3950 | 402 | \r |
403 | //\r | |
404 | // OS indicater support variable\r | |
405 | //\r | |
406 | OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI;\r | |
407 | Status = gRT->SetVariable (\r | |
408 | L"OsIndicationsSupported",\r | |
409 | &gEfiGlobalVariableGuid,\r | |
410 | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r | |
411 | sizeof(UINT64),\r | |
412 | &OsIndicationSupport\r | |
413 | );\r | |
414 | ASSERT_EFI_ERROR (Status);\r | |
415 | \r | |
416 | //\r | |
417 | // If OsIndications is invalid, remove it.\r | |
418 | // Invalid case\r | |
419 | // 1. Data size != UINT64\r | |
420 | // 2. OsIndication value inconsistence\r | |
421 | // 3. OsIndication attribute inconsistence\r | |
422 | //\r | |
423 | OsIndication = 0;\r | |
424 | Attributes = 0;\r | |
425 | DataSize = sizeof(UINT64);\r | |
426 | Status = gRT->GetVariable (\r | |
427 | L"OsIndications",\r | |
428 | &gEfiGlobalVariableGuid,\r | |
429 | &Attributes,\r | |
430 | &DataSize,\r | |
431 | &OsIndication\r | |
432 | );\r | |
433 | \r | |
434 | if (!EFI_ERROR(Status)) {\r | |
435 | if (DataSize != sizeof(UINT64) ||\r | |
436 | (OsIndication & ~OsIndicationSupport) != 0 ||\r | |
437 | Attributes != (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE)){\r | |
438 | \r | |
439 | DEBUG ((EFI_D_ERROR, "Unformalized OsIndications variable exists. Delete it\n"));\r | |
440 | Status = gRT->SetVariable (\r | |
441 | L"OsIndications",\r | |
442 | &gEfiGlobalVariableGuid,\r | |
443 | Attributes,\r | |
444 | 0,\r | |
445 | &OsIndication\r | |
446 | );\r | |
447 | ASSERT_EFI_ERROR (Status);\r | |
448 | }\r | |
449 | }\r | |
450 | \r | |
7ea22852 ED |
451 | }\r |
452 | \r | |
5c08e117 | 453 | /**\r |
454 | \r | |
455 | Service routine for BdsInstance->Entry(). Devices are connected, the\r | |
456 | consoles are initialized, and the boot options are tried.\r | |
457 | \r | |
458 | @param This Protocol Instance structure.\r | |
459 | \r | |
460 | **/\r | |
461 | VOID\r | |
462 | EFIAPI\r | |
463 | BdsEntry (\r | |
464 | IN EFI_BDS_ARCH_PROTOCOL *This\r | |
465 | )\r | |
466 | {\r | |
5c08e117 | 467 | LIST_ENTRY DriverOptionList;\r |
468 | LIST_ENTRY BootOptionList;\r | |
469 | UINTN BootNextSize;\r | |
9a6b4de2 | 470 | CHAR16 *FirmwareVendor;\r |
e1e91b73 SZ |
471 | EFI_STATUS Status;\r |
472 | UINT16 BootTimeOut;\r | |
ff843847 RN |
473 | UINTN Index;\r |
474 | EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;\r | |
5c08e117 | 475 | \r |
476 | //\r | |
477 | // Insert the performance probe\r | |
478 | //\r | |
128efbbc | 479 | PERF_END (NULL, "DXE", NULL, 0);\r |
480 | PERF_START (NULL, "BDS", NULL, 0);\r | |
5c08e117 | 481 | \r |
482 | //\r | |
483 | // Initialize the global system boot option and driver option\r | |
484 | //\r | |
485 | InitializeListHead (&DriverOptionList);\r | |
486 | InitializeListHead (&BootOptionList);\r | |
487 | \r | |
488 | //\r | |
489 | // Initialize hotkey service\r | |
490 | //\r | |
491 | InitializeHotkeyService ();\r | |
492 | \r | |
9a6b4de2 | 493 | //\r |
494 | // Fill in FirmwareVendor and FirmwareRevision from PCDs\r | |
495 | //\r | |
496 | FirmwareVendor = (CHAR16 *)PcdGetPtr (PcdFirmwareVendor);\r | |
497 | gST->FirmwareVendor = AllocateRuntimeCopyPool (StrSize (FirmwareVendor), FirmwareVendor);\r | |
498 | ASSERT (gST->FirmwareVendor != NULL);\r | |
499 | gST->FirmwareRevision = PcdGet32 (PcdFirmwareRevision);\r | |
500 | \r | |
501 | //\r | |
502 | // Fixup Tasble CRC after we updated Firmware Vendor and Revision\r | |
503 | //\r | |
d2b9b337 | 504 | gST->Hdr.CRC32 = 0;\r |
9a6b4de2 | 505 | gBS->CalculateCrc32 ((VOID *)gST, sizeof(EFI_SYSTEM_TABLE), &gST->Hdr.CRC32);\r |
506 | \r | |
7ea22852 ED |
507 | //\r |
508 | // Validate Variable.\r | |
509 | //\r | |
510 | BdsFormalizeEfiGlobalVariable();\r | |
511 | \r | |
ff843847 RN |
512 | //\r |
513 | // Mark the read-only variables if the Variable Lock protocol exists\r | |
514 | //\r | |
515 | Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);\r | |
516 | DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n", Status));\r | |
517 | if (!EFI_ERROR (Status)) {\r | |
518 | for (Index = 0; Index < sizeof (mReadOnlyVariables) / sizeof (mReadOnlyVariables[0]); Index++) {\r | |
519 | Status = VariableLock->RequestToLock (VariableLock, mReadOnlyVariables[Index], &gEfiGlobalVariableGuid);\r | |
520 | ASSERT_EFI_ERROR (Status);\r | |
521 | }\r | |
522 | }\r | |
523 | \r | |
cb38c322 | 524 | //\r |
525 | // Report Status Code to indicate connecting drivers will happen\r | |
526 | //\r | |
527 | REPORT_STATUS_CODE (\r | |
528 | EFI_PROGRESS_CODE,\r | |
529 | (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_BEGIN_CONNECTING_DRIVERS)\r | |
530 | );\r | |
531 | \r | |
a2b35995 | 532 | InitializeHwErrRecSupport();\r |
128efbbc | 533 | \r |
e1e91b73 SZ |
534 | //\r |
535 | // Initialize L"Timeout" EFI global variable.\r | |
536 | //\r | |
537 | BootTimeOut = PcdGet16 (PcdPlatformBootTimeOut);\r | |
538 | if (BootTimeOut != 0xFFFF) {\r | |
539 | //\r | |
540 | // If time out value equal 0xFFFF, no need set to 0xFFFF to variable area because UEFI specification\r | |
541 | // define same behavior between no value or 0xFFFF value for L"Timeout".\r | |
542 | //\r | |
543 | Status = gRT->SetVariable (\r | |
544 | L"Timeout",\r | |
545 | &gEfiGlobalVariableGuid,\r | |
546 | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r | |
547 | sizeof (UINT16),\r | |
548 | &BootTimeOut\r | |
549 | );\r | |
550 | ASSERT_EFI_ERROR(Status);\r | |
551 | }\r | |
552 | \r | |
5c08e117 | 553 | //\r |
554 | // bugbug: platform specific code\r | |
555 | // Initialize the platform specific string and language\r | |
556 | //\r | |
557 | InitializeStringSupport ();\r | |
558 | InitializeLanguage (TRUE);\r | |
559 | InitializeFrontPage (TRUE);\r | |
560 | \r | |
ff843847 RN |
561 | //\r |
562 | // Do the platform init, can be customized by OEM/IBV\r | |
563 | //\r | |
564 | PERF_START (NULL, "PlatformBds", "BDS", 0);\r | |
565 | PlatformBdsInit ();\r | |
566 | \r | |
5c08e117 | 567 | //\r |
568 | // Set up the device list based on EFI 1.1 variables\r | |
569 | // process Driver#### and Load the driver's in the\r | |
570 | // driver option list\r | |
571 | //\r | |
572 | BdsLibBuildOptionFromVar (&DriverOptionList, L"DriverOrder");\r | |
573 | if (!IsListEmpty (&DriverOptionList)) {\r | |
574 | BdsLibLoadDrivers (&DriverOptionList);\r | |
575 | }\r | |
576 | //\r | |
577 | // Check if we have the boot next option\r | |
578 | //\r | |
579 | mBootNext = BdsLibGetVariableAndSize (\r | |
580 | L"BootNext",\r | |
581 | &gEfiGlobalVariableGuid,\r | |
582 | &BootNextSize\r | |
583 | );\r | |
584 | \r | |
585 | //\r | |
586 | // Setup some platform policy here\r | |
587 | //\r | |
19bf20e1 | 588 | PlatformBdsPolicyBehavior (&DriverOptionList, &BootOptionList, BdsProcessCapsules, BdsMemoryTest);\r |
128efbbc | 589 | PERF_END (NULL, "PlatformBds", "BDS", 0);\r |
5c08e117 | 590 | \r |
591 | //\r | |
592 | // BDS select the boot device to load OS\r | |
593 | //\r | |
594 | BdsBootDeviceSelect ();\r | |
595 | \r | |
596 | //\r | |
597 | // Only assert here since this is the right behavior, we should never\r | |
598 | // return back to DxeCore.\r | |
599 | //\r | |
600 | ASSERT (FALSE);\r | |
601 | \r | |
602 | return ;\r | |
603 | }\r |