]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Bug fix for "Tiano BIOS needs to implement an automatic reboot when BIOS settings...
authordtang2 <dtang2@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 8 Nov 2006 03:12:19 +0000 (03:12 +0000)
committerdtang2 <dtang2@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 8 Nov 2006 03:12:19 +0000 (03:12 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1913 6f19259b-4bc3-4df7-8a09-765794883524

EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootMaint.c
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManager.c
EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManager.c
EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c
EdkNt32Pkg/Include/library/EdkGenericBdsLib.h
EdkNt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c

index c4b3211dfd63c588fb307014aea0809b00f264d9..6eefa0bd30b3ecee315da40e8aa9098c9a2b6a71 100644 (file)
@@ -1230,6 +1230,7 @@ Returns:
   UINTN                     Index;\r
   BM_MENU_ENTRY             *NewMenuEntry;\r
   BM_FILE_CONTEXT           *NewFileContext;\r
+  BOOLEAN                       BootMaintMenuResetRequired;\r
 \r
   Location        = NULL;\r
   Index           = 0;\r
@@ -1247,6 +1248,7 @@ Returns:
   while (1) {\r
     UpdatePageId (CallbackData, FORM_MAIN_ID);\r
 \r
+    BootMaintMenuResetRequired = FALSE;\r
     Status = FormConfig->SendForm (\r
                           FormConfig,\r
                           TRUE,\r
@@ -1256,9 +1258,13 @@ Returns:
                           NULL,\r
                           (UINT8 *) CallbackData->BmmFakeNvData,\r
                           NULL,\r
-                          NULL\r
+                          &BootMaintMenuResetRequired\r
                           );\r
 \r
+    if (BootMaintMenuResetRequired) {\r
+      EnableResetRequired ();\r
+    }\r
+\r
     ReclaimStringDepository ();\r
 \r
     //\r
@@ -1267,6 +1273,7 @@ Returns:
     if (INACTIVE_STATE != CallbackData->FeCurrentState) {\r
       UpdateFileExplorer (CallbackData, 0);\r
 \r
+      BootMaintMenuResetRequired = FALSE;\r
       Status = FormConfig->SendForm (\r
                             FormConfig,\r
                             TRUE,\r
@@ -1276,9 +1283,13 @@ Returns:
                             NULL,\r
                             NULL,\r
                             NULL,\r
-                            NULL\r
+                            &BootMaintMenuResetRequired\r
                             );\r
 \r
+      if (BootMaintMenuResetRequired) {\r
+        EnableResetRequired ();\r
+      }\r
+\r
       CallbackData->FeCurrentState    = INACTIVE_STATE;\r
       CallbackData->FeDisplayContext  = UNKNOWN_CONTEXT;\r
       ReclaimStringDepository ();\r
index d90cfaa0a85331e1ecc69e3e7321f404c17c0214..23b878961716537e29a9dd8ebe2bd77ffc926a10 100644 (file)
@@ -139,6 +139,7 @@ Returns:
   UINT8               *Location;\r
   EFI_GUID            BmGuid;\r
   LIST_ENTRY          BdsBootOptionList;\r
+  BOOLEAN                BootMngrMenuResetRequired;\r
 \r
   gOption = NULL;\r
   InitializeListHead (&BdsBootOptionList);\r
@@ -299,13 +300,34 @@ Returns:
 \r
   ASSERT (gBrowser);\r
 \r
-  gBrowser->SendForm (gBrowser, TRUE, &gBootManagerHandle, 1, NULL, NULL, NULL, NULL, NULL);\r
+  BootMngrMenuResetRequired = FALSE;\r
+  gBrowser->SendForm (\r
+              gBrowser, \r
+              TRUE, \r
+              &gBootManagerHandle, \r
+              1, \r
+              NULL, \r
+              NULL, \r
+              NULL, \r
+              NULL, \r
+              &BootMngrMenuResetRequired\r
+              );\r
+\r
+  if (BootMngrMenuResetRequired) {\r
+    EnableResetRequired ();\r
+  }\r
 \r
   Hii->ResetStrings (Hii, gBootManagerHandle);\r
 \r
   if (gOption == NULL) {\r
     return ;\r
   }\r
+  \r
+  //\r
+  //Will leave browser, check any reset required change is applied? if yes, reset system\r
+  //\r
+  SetupResetReminder ();\r
+  \r
   //\r
   // BugBug: This code looks repeated from the BDS. Need to save code space.\r
   //\r
index 0e73a4e3fe5492221bf4ef3e4d983c9fd7f4f6a8..3f648b7de6d43eb979b706cd3591758fdb51485b 100644 (file)
@@ -197,6 +197,7 @@ Returns:
   UINTN               VideoOptionSize;\r
   EFI_HII_HANDLE      *HiiHandles;\r
   UINT16              HandleBufferLength;\r
+  BOOLEAN                BootDeviceMngrMenuResetRequired;\r
 \r
   IfrOptionList       = NULL;\r
   VideoOption         = NULL;\r
@@ -435,6 +436,7 @@ Returns:
     gBS->FreePool (IfrOptionList);\r
   }\r
 \r
+  BootDeviceMngrMenuResetRequired = FALSE;\r
   Status = gBrowser->SendForm (\r
                       gBrowser,\r
                       TRUE,                             // Use the database\r
@@ -444,9 +446,13 @@ Returns:
                       FPCallbackInfo.CallbackHandle,\r
                       (UINT8 *) &FPCallbackInfo.Data,\r
                       NULL,\r
-                      NULL\r
+                      &BootDeviceMngrMenuResetRequired\r
                       );\r
 \r
+  if (BootDeviceMngrMenuResetRequired) {\r
+    EnableResetRequired ();\r
+  }\r
+\r
   Hii->ResetStrings (Hii, FPCallbackInfo.DevMgrHiiHandle);\r
 \r
   //\r
@@ -454,6 +460,7 @@ Returns:
   // a target to display\r
   //\r
   if (gCallbackKey != 0 && gCallbackKey < 0x2000) {\r
+    BootDeviceMngrMenuResetRequired = FALSE;\r
     Status = gBrowser->SendForm (\r
                         gBrowser,\r
                         TRUE,                             // Use the database\r
@@ -463,9 +470,12 @@ Returns:
                         NULL,                             // This is the handle that the interface to the callback was installed on\r
                         NULL,\r
                         NULL,\r
-                        NULL\r
+                        &BootDeviceMngrMenuResetRequired\r
                         );\r
 \r
+    if (BootDeviceMngrMenuResetRequired) {\r
+      EnableResetRequired ();\r
+    }\r
     //\r
     // Force return to Device Manager\r
     //\r
index 69b2fb507815339344329ad13ede3074804c8494..45992db02d4a03b888cd4f066195fbc056100c1a 100644 (file)
@@ -417,6 +417,7 @@ Returns:
 {\r
   EFI_STATUS  Status;\r
   UINT8       FakeNvRamMap[1];\r
+  BOOLEAN     FrontPageMenuResetRequired;\r
 \r
   //\r
   // Begin waiting for USER INPUT\r
@@ -427,6 +428,7 @@ Returns:
         );\r
 \r
   FakeNvRamMap[0] = (UINT8) mLastSelection;\r
+  FrontPageMenuResetRequired = FALSE;\r
   Status = gBrowser->SendForm (\r
                       gBrowser,\r
                       TRUE,                     // Use the database\r
@@ -436,8 +438,14 @@ Returns:
                       FrontPageCallbackHandle,  // This is the handle that the interface to the callback was installed on\r
                       FakeNvRamMap,\r
                       NULL,\r
-                      NULL\r
+                      &FrontPageMenuResetRequired\r
                       );\r
+  //\r
+  // Check whether user change any option setting which needs a reset to be effective\r
+  //                      \r
+  if (FrontPageMenuResetRequired) {\r
+    EnableResetRequired ();\r
+  }\r
 \r
   Hii->ResetStrings (Hii, gFrontPageHandle);\r
 \r
@@ -877,6 +885,11 @@ Returns:
 \r
   } while ((Status == EFI_SUCCESS) && (gCallbackKey != 1));\r
 \r
+  //\r
+  //Will leave browser, check any reset required change is applied? if yes, reset system\r
+  //\r
+  SetupResetReminder ();\r
+  \r
   //\r
   // Automatically load current entry\r
   // Note: The following lines of code only execute when Auto boot\r
index 3f01119041d561b4af3cac7e4bb76218a2f7c23e..9abda558913d8c4cccfb7a61df438b2a1bb5c1d6 100644 (file)
@@ -59,6 +59,11 @@ extern EFI_HANDLE mBdsImageHandle;
 #define MIN_ALIGNMENT_SIZE  4\r
 #define ALIGN_SIZE(a)       ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)\r
 \r
+//\r
+// Define maximum characters for boot option variable "BootXXXX"\r
+//\r
+#define BOOT_OPTION_MAX_CHAR 10\r
+\r
 //\r
 // This data structure is the part of BDS_CONNECT_ENTRY that we can hard code.\r
 //\r
@@ -329,4 +334,49 @@ BdsRefreshBbsTableForBoot (
   IN BDS_COMMON_OPTION        *Entry\r
   );\r
 \r
+EFI_STATUS\r
+BdsDeleteBootOption (\r
+  IN UINTN                       OptionNumber,\r
+  IN OUT UINT16                  *BootOrder,\r
+  IN OUT UINTN                   *BootOrderSize\r
+  );\r
+\r
+//\r
+//The interface functions relate with Setup Browser Reset Reminder feature\r
+//\r
+VOID\r
+EnableResetReminderFeature (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+DisableResetReminderFeature (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+EnableResetRequired (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+DisableResetRequired (\r
+  VOID\r
+  );\r
+\r
+BOOLEAN\r
+IsResetReminderFeatureEnable (\r
+  VOID\r
+  );\r
+\r
+BOOLEAN\r
+IsResetRequired (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+SetupResetReminder (\r
+  VOID\r
+  );\r
+  \r
 #endif // _BDS_LIB_H_\r
index 576ae7237f721dd065cb7d383d1ef3d4da21ac55..def31023c04b96de530cd377db8984a088b0fd42 100644 (file)
@@ -19,6 +19,9 @@ Abstract:
 \r
 --*/\r
 \r
+#define MAX_STRING_LEN        200\r
+static BOOLEAN   mFeaturerSwitch = TRUE;\r
+static BOOLEAN   mResetRequired  = FALSE;\r
 extern UINT16 gPlatformBootTimeOutDefault;\r
 \r
 UINT16\r
@@ -762,3 +765,218 @@ Returns:
 \r
   return Status;\r
 }\r
+\r
+//\r
+//  Following are BDS Lib functions which  contain all the code about setup browser reset reminder feature.\r
+//  Setup Browser reset reminder feature is that an reset reminder will be given before user leaves the setup browser  if \r
+//  user change any option setting which needs a reset to be effective, and  the reset will be applied according to  the user selection.\r
+//\r
+\r
+VOID\r
+EnableResetReminderFeature (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
\r
+  Enable the setup browser reset reminder feature.\r
+  This routine is used in platform tip. If the platform policy need the feature, use the routine to enable it.\r
+\r
+Arguments:\r
+\r
+  VOID\r
+\r
+Returns:\r
+\r
+  VOID\r
+\r
+--*/\r
+{\r
+  mFeaturerSwitch = TRUE;\r
+} \r
+\r
+VOID\r
+DisableResetReminderFeature (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
\r
+  Disable the setup browser reset reminder feature.\r
+  This routine is used in platform tip. If the platform policy do not want the feature, use the routine to disable it.\r
+  \r
+Arguments:\r
+\r
+  VOID\r
+\r
+Returns:\r
+\r
+  VOID\r
+\r
+--*/\r
+{\r
+  mFeaturerSwitch = FALSE;\r
+} \r
+\r
+VOID\r
+EnableResetRequired (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
\r
+   Record the info that  a reset is required.\r
+   A  module boolean variable is used to record whether a reset is required. \r
+  \r
+Arguments:\r
+\r
+  VOID\r
+\r
+Returns:\r
+\r
+  VOID\r
+\r
+--*/\r
+{\r
+  mResetRequired = TRUE;\r
+} \r
+\r
+VOID\r
+DisableResetRequired (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+   Record the info that  no reset is required.\r
+   A  module boolean variable is used to record whether a reset is required. \r
+\r
+Arguments:\r
+\r
+  VOID\r
+\r
+Returns:\r
+\r
+  VOID\r
+\r
+--*/\r
+{\r
+  mResetRequired = FALSE;\r
+} \r
+\r
+BOOLEAN\r
+IsResetReminderFeatureEnable (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
\r
+  Check whether platform policy enable the reset reminder feature. The default is enabled.\r
+\r
+Arguments:\r
+\r
+  VOID\r
+\r
+Returns:\r
+\r
+  VOID\r
+\r
+--*/\r
+{\r
+  return mFeaturerSwitch;\r
+}\r
+\r
+BOOLEAN\r
+IsResetRequired (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
\r
+  Check if  user changed any option setting which needs a system reset to be effective.\r
+  \r
+Arguments:\r
+\r
+  VOID\r
+\r
+Returns:\r
+\r
+  VOID\r
+\r
+--*/\r
+{\r
+  return mResetRequired;\r
+}\r
+\r
+VOID\r
+SetupResetReminder (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
\r
+  Check whether a reset is needed, and finish the reset reminder feature.\r
+  If a reset is needed, Popup a menu to notice user, and finish the feature \r
+  according to the user selection.\r
+\r
+Arguments:\r
+\r
+  VOID\r
+\r
+Returns:\r
+\r
+  VOID\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                    Status;\r
+  EFI_FORM_BROWSER_PROTOCOL     *Browser;\r
+  EFI_INPUT_KEY                 Key;  \r
+  CHAR16                        *StringBuffer1;\r
+  CHAR16                        *StringBuffer2;    \r
+\r
+\r
+  //\r
+  //check any reset required change is applied? if yes, reset system\r
+  //\r
+  if (IsResetReminderFeatureEnable ()) {\r
+    if (IsResetRequired ()) {\r
+    \r
+      Status = gBS->LocateProtocol (\r
+                      &gEfiFormBrowserProtocolGuid,\r
+                      NULL,\r
+                      &Browser\r
+                      );      \r
+                      \r
+      StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));\r
+      ASSERT (StringBuffer1 != NULL);\r
+      StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));\r
+      ASSERT (StringBuffer2 != NULL);      \r
+      StrCpy (StringBuffer1, L"Configuration changed. Reset to apply it Now ? ");\r
+      StrCpy (StringBuffer2, L"Enter (YES)  /   Esc (NO)");      \r
+      //\r
+      // Popup a menu to notice user\r
+      // \r
+      do {\r
+        Browser->CreatePopUp (2, TRUE, 0, NULL, &Key, StringBuffer1, StringBuffer2);\r
+      } while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN)); \r
+      \r
+      gBS->FreePool (StringBuffer1);      \r
+      gBS->FreePool (StringBuffer2);            \r
+      //\r
+      // If the user hits the YES Response key, reset\r
+      //\r
+      if ((Key.UnicodeChar == CHAR_CARRIAGE_RETURN)) {\r
+        gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);\r
+      }\r
+      gST->ConOut->ClearScreen (gST->ConOut);\r
+    } \r
+  } \r
+} \r