]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
Fix the bug that <continue> may not boot the first boot option but return back to...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / BdsEntry.c
index 055a52df1b887a254c5c69253276d1d298bef8dc..1cc383e3e51f7d0d679fb5f5dd94120a9e83e4ba 100644 (file)
@@ -1,12 +1,12 @@
 /** @file\r
-  This module produce main entry for BDS phase - BdsEntry. \r
+  This module produce main entry for BDS phase - BdsEntry.\r
   When this module was dispatched by DxeCore, gEfiBdsArchProtocolGuid will be installed\r
   which contains interface of BdsEntry.\r
   After DxeCore finish DXE phase, gEfiBdsArchProtocolGuid->BdsEntry will be invoked\r
   to enter BDS phase.\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -27,7 +27,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 ///\r
 /// Note: Current BDS not directly get the BootMode, DefaultBoot,\r
 /// TimeoutDefault, MemoryTestLevel value from the BDS arch protocol.\r
-/// Please refer to the library useage of BdsLibGetBootMode, BdsLibGetTimeout \r
+/// Please refer to the library useage of BdsLibGetBootMode, BdsLibGetTimeout\r
 /// and PlatformBdsDiagnostics in BdsPlatform.c\r
 ///\r
 EFI_HANDLE  gBdsHandle = NULL;\r
@@ -38,8 +38,6 @@ EFI_BDS_ARCH_PROTOCOL  gBds = {
 \r
 UINT16                          *mBootNext = NULL;\r
 \r
-EFI_HANDLE                      mBdsImageHandle;\r
-\r
 /**\r
 \r
   Install Boot Device Selection Protocol\r
@@ -61,8 +59,6 @@ BdsInitialize (
 {\r
   EFI_STATUS  Status;\r
 \r
-  mBdsImageHandle = ImageHandle;\r
-\r
   //\r
   // Install protocol interface\r
   //\r
@@ -133,20 +129,31 @@ BdsBootDeviceSelect (
     //\r
     UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *mBootNext);\r
     BootOption = BdsLibVariableToOption (&BootLists, Buffer);\r
-    \r
+\r
     //\r
     // If fail to get boot option from variable, just return and do nothing.\r
     //\r
     if (BootOption == NULL) {\r
       return;\r
     }\r
-    \r
+\r
     BootOption->BootCurrent = *mBootNext;\r
   }\r
   //\r
   // Parse the boot order to get boot option\r
   //\r
   BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");\r
+\r
+  //\r
+  // When we didn't have chance to build boot option variables in the first \r
+  // full configuration boot (e.g.: Reset in the first page or in Device Manager),\r
+  // we have no boot options in the following mini configuration boot.\r
+  // Give the last chance to enumerate the boot options.\r
+  //\r
+  if (IsListEmpty (&BootLists)) {\r
+    BdsLibEnumerateAllBootOption (&BootLists);\r
+  }\r
+\r
   Link = BootLists.ForwardLink;\r
 \r
   //\r
@@ -191,7 +198,7 @@ BdsBootDeviceSelect (
     //\r
     if (!IS_LOAD_OPTION_TYPE (BootOption->Attribute, LOAD_OPTION_ACTIVE)) {\r
       //\r
-      // skip the header of the link list, becuase it has no boot option\r
+      // skip the header of the link list, because it has no boot option\r
       //\r
       Link = Link->ForwardLink;\r
       continue;\r
@@ -228,7 +235,7 @@ BdsBootDeviceSelect (
       //\r
       // Call platform action to indicate the boot success\r
       //\r
-      BootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED)); \r
+      BootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED));\r
       PlatformBdsBootSuccess (BootOption);\r
 \r
       //\r
@@ -239,7 +246,7 @@ BdsBootDeviceSelect (
       PlatformBdsEnterFrontPage (Timeout, FALSE);\r
 \r
       //\r
-      // Rescan the boot option list, avoid pertential risk of the boot\r
+      // Rescan the boot option list, avoid potential risk of the boot\r
       // option change in front page\r
       //\r
       if (BootNextExist) {\r
@@ -283,8 +290,8 @@ BdsEntry (
   //\r
   // Insert the performance probe\r
   //\r
-  PERF_END (0, "DXE", NULL, 0);\r
-  PERF_START (0, "BDS", NULL, 0);\r
+  PERF_END (NULL, "DXE", NULL, 0);\r
+  PERF_START (NULL, "BDS", NULL, 0);\r
 \r
   //\r
   // Initialize the global system boot option and driver option\r
@@ -313,11 +320,11 @@ BdsEntry (
   //\r
   // Do the platform init, can be customized by OEM/IBV\r
   //\r
-  PERF_START (0, "PlatformBds", "BDS", 0);\r
+  PERF_START (NULL, "PlatformBds", "BDS", 0);\r
   PlatformBdsInit ();\r
 \r
   InitializeHwErrRecSupport();\r
-  \r
+\r
   //\r
   // bugbug: platform specific code\r
   // Initialize the platform specific string and language\r
@@ -347,8 +354,8 @@ BdsEntry (
   //\r
   // Setup some platform policy here\r
   //\r
-  PlatformBdsPolicyBehavior (&DriverOptionList, &BootOptionList);\r
-  PERF_END (0, "PlatformBds", "BDS", 0);\r
+  PlatformBdsPolicyBehavior (&DriverOptionList, &BootOptionList, BdsProcessCapsules, BdsMemoryTest);\r
+  PERF_END (NULL, "PlatformBds", "BDS", 0);\r
 \r
   //\r
   // BDS select the boot device to load OS\r