]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/BootMaintUiLib: Update menus when open BMM form
authorDandan Bi <dandan.bi@intel.com>
Thu, 30 Jun 2016 03:37:56 +0000 (11:37 +0800)
committerStar Zeng <star.zeng@intel.com>
Thu, 7 Jul 2016 04:49:01 +0000 (12:49 +0800)
BootMaintenanceManagerUiLib depend on the LeagcyBootMaintUiLib to show the
legacy menus. So we need to do the actions related to LegacyUi in BMM
after the LeagcyBootMaintUiLib have been initialized. So now : 1). update
menus (including legacy menus), 2) re-scan boot options (including legacy
boot option) when opening the BMM form. We think when opening BMM form,
the LeagcyBootMaintUiLib must have been initialized.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c
MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.vfr
MdeModulePkg/Library/BootMaintenanceManagerUiLib/FormGuid.h

index 393091f39a84b40410c2dde06875f87eb3959ae7..c2263e34221b48e0711492eda73c9b45806784e8 100644 (file)
@@ -84,6 +84,7 @@ BMM_CALLBACK_DATA  gBootMaintenancePrivate = {
 \r
 BMM_CALLBACK_DATA *mBmmCallbackInfo = &gBootMaintenancePrivate;\r
 BOOLEAN  mAllMenuInit               = FALSE;\r
+BOOLEAN  mFirstEnterBMMForm         = FALSE;\r
 \r
 /**\r
   Init all memu.\r
@@ -105,6 +106,16 @@ FreeAllMenu (
   VOID\r
   );\r
 \r
+/**\r
+\r
+  Update the menus in the BMM page.\r
+\r
+**/\r
+VOID\r
+CustomizeMenus (\r
+  VOID\r
+  );\r
+\r
 /**\r
   This function will change video resolution and text mode\r
   according to defined setup mode or defined boot mode  \r
@@ -874,14 +885,33 @@ BootMaintCallback (
   UINTN             Index;\r
   EFI_DEVICE_PATH_PROTOCOL * File;\r
 \r
-  if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) {\r
+  if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED && Action != EFI_BROWSER_ACTION_FORM_OPEN) {\r
     //\r
-    // Do nothing for other UEFI Action. Only do call back when data is changed.\r
+    // Do nothing for other UEFI Action. Only do call back when data is changed or the form is open.\r
     //\r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
   Private        = BMM_CALLBACK_DATA_FROM_THIS (This);\r
+\r
+  if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {\r
+    if (QuestionId == KEY_VALUE_TRIGGER_FORM_OPEN_ACTION) {\r
+      if (!mFirstEnterBMMForm) {\r
+        //\r
+        // BMMUiLib depends on LegacyUi library to show legacy menus.\r
+        // If we want to show Legacy menus correctly in BMM page,\r
+        // we must do it after the LegacyUi library has already been initialized.\r
+        // Opening the BMM form is the appropriate time that the LegacyUi library has already been initialized.\r
+        // So we do the tasks which are related to legacy menus here.\r
+        // 1. Update the menus (including legacy munu) show in BootMiantenanceManager page.\r
+        // 2. Re-scan the BootOption menus (including the legacy boot option).\r
+        //\r
+        CustomizeMenus ();\r
+        BOpt_GetBootOptions (Private);\r
+        mFirstEnterBMMForm = TRUE;\r
+      }\r
+    }\r
+  }\r
   //\r
   // Retrive uncommitted data from Form Browser\r
   //\r
@@ -1226,11 +1256,6 @@ InitializeBmmConfig (
 \r
   CallbackData->BmmFakeNvData.ForceReconnect = TRUE;\r
 \r
-  //\r
-  // Update the menus.\r
-  //\r
-  CustomizeMenus ();\r
-\r
   //\r
   // Backup Initialize BMM configuartion data to BmmOldFakeNVData\r
   //\r
index d46a3e9b91cdc2eb7de8e69e2c14192e4225e962..b0a636f56633b7c8a55fe8a8399270d1a043c923 100644 (file)
@@ -1,7 +1,7 @@
 ///** @file\r
 //  Boot Maintenance Utility Formset\r
 //\r
-//  Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+//  Copyright (c) 2004 - 2016, 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
@@ -27,6 +27,17 @@ formset
 \r
   form formid = FORM_MAIN_ID,\r
        title = STRING_TOKEN(STR_FORM_MAIN_TITLE);\r
+       //\r
+       // Add this invisible text in order to indicate enter Boot Maintenance Manager form.\r
+       // To trigger the form open action.\r
+       //\r
+       suppressif TRUE;\r
+          text\r
+              help  = STRING_TOKEN(STR_NONE),\r
+              text  = STRING_TOKEN(STR_NONE),\r
+              flags = INTERACTIVE,\r
+              key   = KEY_VALUE_TRIGGER_FORM_OPEN_ACTION;\r
+       endif;\r
          \r
     label LABEL_FORM_MAIN_START;\r
     //\r
index 3e3897e6ba468fa60022679307d8ae430a24c028..299a149f6011e357f449a76b35819a8a00cddde7 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Formset guids, form id and VarStore data structure for Boot Maintenance Manager.\r
 \r
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2016, 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
@@ -72,6 +72,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define KEY_VALUE_NO_SAVE_AND_EXIT_BOOT      0x1114\r
 #define KEY_VALUE_SAVE_AND_EXIT_DRIVER       0x1115\r
 #define KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER    0x1116\r
+#define KEY_VALUE_TRIGGER_FORM_OPEN_ACTION   0x1117\r
 \r
 #define MAXIMUM_NORMAL_KEY_VALUE             0x11FF\r
 \r