Change file arrangement to let user easy customize the BMM UI.
After this change:
1. UiCustomizeBMMPage function in BootMaintenanceManagerCustomizedUi.c
use to let user customize BMM first page menus. UiBMMCallbackHandler
function use to handle the callback for the added menus.
2. BootMaintenanceManagerCustomizedUiSupport.c file used to add support
 functions used by BootMaintenanceManagerCustomizedUi.c file.
3. After this change, only above two files need to be updated if BMM
first page menus needed to be changed.

Cc: Liming Gao <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <[email protected]>
---
 .../BootMaintenanceManagerUiLib/BootMaintenance.c  | 153 ++-----
 .../BootMaintenanceManager.h                       |  21 +-
 .../BootMaintenanceManager.vfr                     |  97 +----
 .../BootMaintenanceManagerCustomizedUi.c           |  99 +++++
 .../BootMaintenanceManagerCustomizedUi.h           |  60 +++
 .../BootMaintenanceManagerCustomizedUiSupport.c    | 471 +++++++++++++++++++++
 .../BootMaintenanceManagerCustomizedUiSupport.h    | 146 +++++++
 .../BootMaintenanceManagerStrings.uni              |   4 -
 .../BootMaintenanceManagerUiLib.inf                |   4 +
 .../Library/BootMaintenanceManagerUiLib/FormGuid.h |   6 +-
 .../BootMaintenanceManagerUiLib/UpdatePage.c       | 132 ------
 11 files changed, 812 insertions(+), 381 deletions(-)
 create mode 100644 
MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUi.c
 create mode 100644 
MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUi.h
 create mode 100644 
MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c
 create mode 100644 
MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.h

diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c
index 564a228..34b7809 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c
@@ -924,16 +924,6 @@ BootMaintCallback (
           UpdateDrvDelPage (Private);
           break;
 
-        case FORM_BOOT_NEXT_ID:
-          CleanUpPage (FORM_BOOT_NEXT_ID, Private);
-          UpdateBootNextPage (Private);
-          break;
-
-        case FORM_TIME_OUT_ID:
-          CleanUpPage (FORM_TIME_OUT_ID, Private);
-          UpdateTimeOutPage (Private);
-          break;
-
         case FORM_CON_IN_ID:
         case FORM_CON_OUT_ID:
         case FORM_CON_ERR_ID:
@@ -1122,42 +1112,20 @@ DiscardChangeHandler (
 }
 
 /**
-  Create dynamic code for BMM.
 
-  @param  BmmCallbackInfo        The BMM context data.
+  Update the menus in the BMM page.
 
 **/
 VOID
-InitializeDrivers(
-  IN BMM_CALLBACK_DATA        *BmmCallbackInfo
+CustomizeMenus (
+  VOID
   )
 {
-  EFI_HII_HANDLE              HiiHandle;
   VOID                        *StartOpCodeHandle;
   VOID                        *EndOpCodeHandle;
-  EFI_IFR_GUID_LABEL          *StartLabel;
-  EFI_IFR_GUID_LABEL          *EndLabel;
-  UINTN                       Index;    
-  EFI_STRING                  String;
-  EFI_STRING_ID               Token;
-  EFI_STRING_ID               TokenHelp;  
-  EFI_HII_HANDLE              *HiiHandles;
-  EFI_GUID                    FormSetGuid;
-  CHAR16                      *DevicePathStr;
-  EFI_STRING_ID               DevicePathId;
-  EFI_IFR_FORM_SET            *Buffer;      
-  UINTN                       BufferSize;   
-  UINT8                       ClassGuidNum; 
-  EFI_GUID                    *ClassGuid;   
-  UINTN                       TempSize;
-  UINT8                       *Ptr;
-  EFI_STATUS                  Status;
-
-  TempSize =0;
-  BufferSize = 0;
-  Buffer = NULL;
-
-  HiiHandle = BmmCallbackInfo->BmmHiiHandle;
+  EFI_IFR_GUID_LABEL          *StartGuidLabel;
+  EFI_IFR_GUID_LABEL          *EndGuidLabel;
+
   //
   // Allocate space for creation of UpdateData Buffer
   //
@@ -1166,104 +1134,29 @@ InitializeDrivers(
 
   EndOpCodeHandle = HiiAllocateOpCodeHandle ();
   ASSERT (EndOpCodeHandle != NULL);
-
   //
   // Create Hii Extend Label OpCode as the start opcode
   //
-  StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, 
&gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
-  StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
-  StartLabel->Number       = LABEL_BMM_PLATFORM_INFORMATION;
-
+  StartGuidLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode 
(StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
+  StartGuidLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
+  StartGuidLabel->Number       = LABEL_FORM_MAIN_START;
   //
   // Create Hii Extend Label OpCode as the end opcode
   //
-  EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, 
&gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
-  EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
-  EndLabel->Number       = LABEL_END;
+  EndGuidLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, 
&gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
+  EndGuidLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
+  EndGuidLabel->Number       = LABEL_FORM_MAIN_END;
 
   //
-  // Get all the Hii handles
-  //
-  HiiHandles = HiiGetHiiHandles (NULL);
-  ASSERT (HiiHandles != NULL);
-
+  //Updata Front Page form
   //
-  // Search for formset of each class type
-  //
-  for (Index = 0; HiiHandles[Index] != NULL; Index++) {
-    Status = HiiGetFormSetFromHiiHandle(HiiHandles[Index], 
&Buffer,&BufferSize);
-    if (EFI_ERROR (Status)) {
-      continue;
-    }
-
-    Ptr = (UINT8 *)Buffer;
-    while(TempSize < BufferSize)  {
-      TempSize += ((EFI_IFR_OP_HEADER *) Ptr)->Length;
-
-      if (((EFI_IFR_OP_HEADER *) Ptr)->Length <= OFFSET_OF (EFI_IFR_FORM_SET, 
Flags)){
-        Ptr += ((EFI_IFR_OP_HEADER *) Ptr)->Length;
-        continue;
-      }
-
-      //
-      // Find FormSet OpCode
-      //
-      ClassGuidNum = (UINT8) (((EFI_IFR_FORM_SET *)Ptr)->Flags & 0x3);
-      ClassGuid = (EFI_GUID *) (VOID *)(Ptr + sizeof (EFI_IFR_FORM_SET));
-      while (ClassGuidNum-- > 0) {
-        if (CompareGuid (&gEfiIfrBootMaintenanceGuid, ClassGuid) == 0){
-          ClassGuid ++;
-          continue;
-        }
-
-        String = HiiGetString (HiiHandles[Index], ((EFI_IFR_FORM_SET 
*)Ptr)->FormSetTitle, NULL);
-        if (String == NULL) {
-          String = HiiGetString (HiiHandle, STRING_TOKEN (STR_MISSING_STRING), 
NULL);
-          ASSERT (String != NULL);
-        }
-        Token = HiiSetString (HiiHandle, 0, String, NULL);
-        FreePool (String);
-
-        String = HiiGetString (HiiHandles[Index], ((EFI_IFR_FORM_SET 
*)Ptr)->Help, NULL);
-        if (String == NULL) {
-          String = HiiGetString (HiiHandle, STRING_TOKEN (STR_MISSING_STRING), 
NULL);
-          ASSERT (String != NULL);
-        }
-        TokenHelp = HiiSetString (HiiHandle, 0, String, NULL);
-        FreePool (String);
-
-        FormSetGuid = ((EFI_IFR_FORM_SET *)Ptr)->Guid;
-
-        DevicePathStr = BmmExtractDevicePathFromHiiHandle(HiiHandles[Index]);
-        DevicePathId  = 0;
-        if (DevicePathStr != NULL){
-          DevicePathId = HiiSetString (HiiHandle, 0, DevicePathStr, NULL);
-          FreePool (DevicePathStr);
-        }
-         HiiCreateGotoExOpCode (
-           StartOpCodeHandle,
-           0,
-           Token,
-           TokenHelp,
-           0,
-           (EFI_QUESTION_ID) (Index + FRONT_PAGE_KEY_OFFSET),
-           0,
-           &FormSetGuid,
-           DevicePathId
-         );
-        break;
-      }
-      Ptr += ((EFI_IFR_OP_HEADER *) Ptr)->Length;
-    }
+  UiCustomizeBMMPage (
+    mBmmCallbackInfo->BmmHiiHandle,
+    StartOpCodeHandle
+    );
 
-    FreePool(Buffer);
-    Buffer = NULL;
-    TempSize = 0;
-    BufferSize = 0;
-  } 
-  
   HiiUpdateForm (
-    HiiHandle,
+    mBmmCallbackInfo->BmmHiiHandle,
     &mBootMaintGuid,
     FORM_MAIN_ID,
     StartOpCodeHandle,
@@ -1271,8 +1164,7 @@ InitializeDrivers(
     );
 
   HiiFreeOpCodeHandle (StartOpCodeHandle);
-  HiiFreeOpCodeHandle (EndOpCodeHandle);  
-  FreePool (HiiHandles);
+  HiiFreeOpCodeHandle (EndOpCodeHandle);
 }
 
 /**
@@ -1293,8 +1185,6 @@ InitializeBmmConfig (
 
   ASSERT (CallbackData != NULL);
 
-  InitializeDrivers (CallbackData);
-
   //
   // Initialize data which located in BMM main page
   //
@@ -1333,6 +1223,11 @@ InitializeBmmConfig (
   CallbackData->BmmFakeNvData.ForceReconnect = TRUE;
 
   //
+  // Update the menus.
+  //
+  CustomizeMenus ();
+
+  //
   // Backup Initialize BMM configuartion data to BmmOldFakeNVData
   //
   CopyMem (&CallbackData->BmmOldFakeNVData, &CallbackData->BmmFakeNvData, 
sizeof (BMM_FAKE_NV_DATA));
diff --git 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
index d607314..b2db096 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
@@ -41,6 +41,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include <Library/UefiHiiServicesLib.h>
 #include <Library/UefiBootManagerLib.h>
 #include <Library/FileExplorerLib.h>
+#include "BootMaintenanceManagerCustomizedUi.h"
 
 #pragma pack(1)
 
@@ -918,26 +919,6 @@ UpdatePageBody (
   );
 
 /**
-  Create the dynamic page to allow user to set the "BootNext" vaule.
-
-  @param CallbackData    The BMM context data.
-**/
-VOID
-UpdateBootNextPage (
-  IN BMM_CALLBACK_DATA                *CallbackData
-  );
-
-/**
-  Create the dynamic page to allow user to set the "TimeOut" vaule.
-
-  @param CallbackData    The BMM context data.
-**/
-VOID
-UpdateTimeOutPage (
-  IN BMM_CALLBACK_DATA                *CallbackData
-  );
-
-/**
   Create the dynamic page which allows user to set the property such as Baud 
Rate, Data Bits,
   Parity, Stop Bits, Terminal Type.
 
diff --git 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.vfr 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.vfr
index afce340..d46a3e9 100644
--- 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.vfr
+++ 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.vfr
@@ -27,77 +27,14 @@ formset
 
   form formid = FORM_MAIN_ID,
        title = STRING_TOKEN(STR_FORM_MAIN_TITLE);
-
-    goto FORM_BOOT_SETUP_ID,
-         prompt = STRING_TOKEN(STR_FORM_BOOT_SETUP_TITLE),
-         help = STRING_TOKEN(STR_FORM_BOOT_SETUP_HELP),
-         flags = INTERACTIVE,
-         key = FORM_BOOT_SETUP_ID;
-
-    subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
-    goto FORM_DRIVER_SETUP_ID,
-         prompt = STRING_TOKEN(STR_FORM_DRIVER_SETUP_TITLE),
-         help = STRING_TOKEN(STR_FORM_DRIVER_SETUP_HELP),
-         flags = INTERACTIVE,
-         key = FORM_DRIVER_SETUP_ID;
-
-    subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
-    goto FORM_CON_MAIN_ID,
-         prompt = STRING_TOKEN(STR_FORM_CON_MAIN_TITLE),
-         help = STRING_TOKEN(STR_FORM_CON_MAIN_HELP),
-         flags = INTERACTIVE,
-         key = FORM_CON_MAIN_ID;
-
-    subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
-    goto FORM_MAIN_ID,
-         prompt = STRING_TOKEN(STR_BOOT_FROM_FILE),
-         help = STRING_TOKEN(STR_BOOT_FROM_FILE_HELP),
-         flags = INTERACTIVE,
-         key = KEY_VALUE_BOOT_FROM_FILE;
-
-    subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
-//    label FORM_MAIN_ID;
-
-    goto FORM_BOOT_NEXT_ID,
-         prompt = STRING_TOKEN(STR_FORM_BOOT_NEXT_TITLE),
-         help = STRING_TOKEN(STR_FORM_BOOT_NEXT_HELP),
-         flags = INTERACTIVE,
-         key = FORM_BOOT_NEXT_ID;
-
-    goto FORM_TIME_OUT_ID,
-         prompt = STRING_TOKEN(STR_FORM_TIME_OUT_TITLE),
-         help = STRING_TOKEN(STR_FORM_TIME_OUT_HELP),
-         flags = INTERACTIVE,
-         key = FORM_TIME_OUT_ID;
-
-    subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
-    text
-         help   = STRING_TOKEN(STR_RESET),
-         text   = STRING_TOKEN(STR_RESET),
-         flags  = INTERACTIVE,
-         key    = FORM_RESET;
          
-    label LABEL_BMM_PLATFORM_INFORMATION;
+    label LABEL_FORM_MAIN_START;
     //
     // This is where we will dynamically add a Action type op-code to show 
     // the platform information.
     //
-    
-    //
-    // This is where we will dynamically add a Action type op-code to show 
-    // the advanced menu.
-    //
-    
-    //
-    // This is where we will dynamically add a Action type op-code to show 
-    // the intel test menu.
-    //
-    label LABEL_END; 
+    label LABEL_FORM_MAIN_END;
+
   endform;
 
   form formid = FORM_BOOT_SETUP_ID,
@@ -214,34 +151,6 @@ formset
 
   endform;
 
-  form formid = FORM_BOOT_NEXT_ID,
-       title = STRING_TOKEN(STR_FORM_BOOT_NEXT_TITLE);
-
-       label FORM_BOOT_NEXT_ID;
-       label LABEL_END;
-  endform;
-
-  form formid = FORM_TIME_OUT_ID,
-       title = STRING_TOKEN(STR_FORM_TIME_OUT_TITLE);
-
-       label FORM_TIME_OUT_ID;
-       label LABEL_END;
-  endform;
-
-  form formid = FORM_MEMORY_CHECK_ID,
-       title = STRING_TOKEN(STR_FORM_MEMORY_CHECK_TITLE);
-
-       label FORM_MEMORY_CHECK_ID;
-       label LABEL_END;
-  endform;
-
-  form formid = FORM_UEFI_OPTIMIZED_BOOT_ID,
-       title = STRING_TOKEN(STR_FORM_UEFI_OPTIMIZED_BOOT_TITLE);
-
-       label FORM_UEFI_OPTIMIZED_BOOT_ID;
-       label LABEL_END;
-  endform;
-
   form formid = FORM_DRV_ADD_ID,
        title = STRING_TOKEN(STR_FORM_DRV_ADD_TITLE);
 
diff --git 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUi.c
 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUi.c
new file mode 100644
index 0000000..7f62e5b
--- /dev/null
+++ 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUi.c
@@ -0,0 +1,99 @@
+/** @file
+
+  This library class defines a set of interfaces to customize Ui module
+
+Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+This program and the accompanying materials are licensed and made available 
under
+the terms and conditions of the BSD License that accompanies this distribution.
+The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php.
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+#include <Uefi.h>
+#include <Protocol/HiiConfigAccess.h>
+#include "BootMaintenanceManagerCustomizedUiSupport.h"
+
+/**
+  Customize menus in the page.
+
+  @param[in]  HiiHandle             The HII Handle of the form to update.
+  @param[in]  StartOpCodeHandle     The context used to insert opcode.
+  @param[in]  CustomizePageType     The page type need to be customized.
+
+**/
+VOID
+UiCustomizeBMMPage (
+  IN EFI_HII_HANDLE  HiiHandle,
+  IN VOID            *StartOpCodeHandle
+  )
+{
+  //
+  // Create "Boot Option" menu.
+  //
+  BmmCreateBootOptionMenu(HiiHandle, StartOpCodeHandle);
+  //
+  // Create "Driver Option" menu.
+  //
+  BmmCreateDriverOptionMenu(HiiHandle, StartOpCodeHandle);
+  //
+  // Create "Com Option" menu.
+  //
+  BmmCreateComOptionMenu(HiiHandle, StartOpCodeHandle);
+  //
+  // Create "Boot From File" menu.
+  //
+  BmmCreateBootFromFileMenu(HiiHandle, StartOpCodeHandle);
+
+  //
+  // Find third party drivers which need to be shown in the Bmm page.
+  //
+  BmmListThirdPartyDrivers (HiiHandle, &gEfiIfrBootMaintenanceGuid, NULL, 
StartOpCodeHandle);
+
+  //
+  // Create empty line.
+  //
+  BmmCreateEmptyLine (HiiHandle, StartOpCodeHandle);
+
+  //
+  // Create "Boot Next" menu.
+  //
+  BmmCreateBootNextMenu (HiiHandle, StartOpCodeHandle);
+  //
+  // Create "Time Out" menu.
+  //
+  BmmCreateTimeOutMenu (HiiHandle, StartOpCodeHandle);
+}
+
+/**
+  This function processes the results of changes in configuration.
+
+
+  @param HiiHandle       Points to the hii handle for this formset.
+  @param Action          Specifies the type of action taken by the browser.
+  @param QuestionId      A unique value which is sent to the original 
exporting driver
+                         so that it can identify the type of data to expect.
+  @param Type            The type of value for the question.
+  @param Value           A pointer to the data being sent to the original 
exporting driver.
+  @param ActionRequest   On return, points to the action requested by the 
callback function.
+
+  @retval  EFI_SUCCESS           The callback successfully handled the action.
+  @retval  EFI_OUT_OF_RESOURCES  Not enough storage is available to hold the 
variable and its data.
+  @retval  EFI_DEVICE_ERROR      The variable could not be saved.
+  @retval  EFI_UNSUPPORTED       The specified Action is not supported by the 
callback.
+
+**/
+EFI_STATUS
+UiBMMCallbackHandler (
+  IN  EFI_HII_HANDLE                         HiiHandle,
+  IN  EFI_BROWSER_ACTION                     Action,
+  IN  EFI_QUESTION_ID                        QuestionId,
+  IN  UINT8                                  Type,
+  IN  EFI_IFR_TYPE_VALUE                     *Value,
+  OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest
+  )
+{
+  return EFI_UNSUPPORTED;
+}
diff --git 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUi.h
 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUi.h
new file mode 100644
index 0000000..13d02d6
--- /dev/null
+++ 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUi.h
@@ -0,0 +1,60 @@
+/** @file
+  This library class defines a set of interfaces to customize Ui module
+
+Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+This program and the accompanying materials are licensed and made available 
under
+the terms and conditions of the BSD License that accompanies this distribution.
+The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php.
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __CUSTOMIZED_UI_H__
+#define __CUSTOMIZED_UI_H__
+
+
+/**
+  Customize menus in the page.
+
+  @param[in]  HiiHandle             The HII Handle of the form to update.
+  @param[in]  StartOpCodeHandle     The context used to insert opcode.
+
+**/
+VOID
+UiCustomizeBMMPage (
+  IN EFI_HII_HANDLE  HiiHandle,
+  IN VOID            *StartOpCodeHandle
+  );
+
+/**
+  This function processes the results of changes in configuration.
+
+
+  @param HiiHandle       Points to the hii handle for this formset.
+  @param Action          Specifies the type of action taken by the browser.
+  @param QuestionId      A unique value which is sent to the original 
exporting driver
+                         so that it can identify the type of data to expect.
+  @param Type            The type of value for the question.
+  @param Value           A pointer to the data being sent to the original 
exporting driver.
+  @param ActionRequest   On return, points to the action requested by the 
callback function.
+
+  @retval  EFI_SUCCESS           The callback successfully handled the action.
+  @retval  EFI_OUT_OF_RESOURCES  Not enough storage is available to hold the 
variable and its data.
+  @retval  EFI_DEVICE_ERROR      The variable could not be saved.
+  @retval  EFI_UNSUPPORTED       The specified Action is not supported by the 
callback.
+
+**/
+EFI_STATUS
+UiBMMCallbackHandler (
+  IN  EFI_HII_HANDLE                         HiiHandle,
+  IN  EFI_BROWSER_ACTION                     Action,
+  IN  EFI_QUESTION_ID                        QuestionId,
+  IN  UINT8                                  Type,
+  IN  EFI_IFR_TYPE_VALUE                     *Value,
+  OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest
+  );
+
+#endif
diff --git 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c
 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c
new file mode 100644
index 0000000..b32cbdb
--- /dev/null
+++ 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c
@@ -0,0 +1,471 @@
+/** @file
+The functions for Boot Maintainence Main menu.
+
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD 
License
+which accompanies this distribution.  The full text of the license may be 
found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+
+#include "BootMaintenanceManager.h"
+#include "BootMaintenanceManagerCustomizedUiSupport.h"
+
+#define UI_HII_DRIVER_LIST_SIZE               0x8
+
+typedef struct {
+  EFI_STRING_ID   PromptId;
+  EFI_STRING_ID   HelpId;
+  EFI_STRING_ID   DevicePathId;
+  EFI_GUID        FormSetGuid;
+  BOOLEAN         EmptyLineAfter;
+} UI_HII_DRIVER_INSTANCE;
+
+UI_HII_DRIVER_INSTANCE       *gHiiDriverList;
+
+
+/**
+  Create the dynamic item to allow user to set the "BootNext" vaule.
+
+  @param CallbackData    The BMM context data.
+
+**/
+VOID
+BmmCreateBootNextMenu(
+  IN EFI_HII_HANDLE              HiiHandle,
+  IN VOID                        *StartOpCodeHandle
+  )
+{
+  BM_MENU_ENTRY   *NewMenuEntry;
+  BM_LOAD_CONTEXT *NewLoadContext;
+  UINTN           NumberOfOptions;
+  UINT16          Index;
+  VOID            *OptionsOpCodeHandle;
+  CHAR16          *StringBuffer;
+  EFI_STRING_ID   OptionId;
+
+  NumberOfOptions = BootOptionMenu.MenuNumber;
+  if (NumberOfOptions == 0) {
+    return;
+  }
+
+  OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
+  ASSERT (OptionsOpCodeHandle != NULL);
+
+  for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
+    NewMenuEntry    = BOpt_GetMenuEntry (&BootOptionMenu, Index);
+    NewLoadContext  = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
+
+    StringBuffer = HiiGetString (HiiHandle, NewMenuEntry->DisplayStringToken, 
NULL);
+    ASSERT (StringBuffer != NULL);
+    OptionId = HiiSetString (HiiHandle, 0, StringBuffer, NULL);
+    FreePool (StringBuffer);
+
+    HiiCreateOneOfOptionOpCode (
+      OptionsOpCodeHandle,
+      OptionId,
+      0,
+      EFI_IFR_TYPE_NUM_SIZE_16,
+      Index
+      );
+  }
+
+  StringBuffer = HiiGetString (HiiHandle, STRING_TOKEN (STR_NONE), NULL);
+  ASSERT (StringBuffer != NULL);
+  OptionId = HiiSetString (HiiHandle, 0, StringBuffer, NULL);
+  FreePool (StringBuffer);
+
+  //
+  // Set no Boot Next Value as default.
+  //
+  HiiCreateOneOfOptionOpCode (
+    OptionsOpCodeHandle,
+    OptionId,
+    EFI_IFR_OPTION_DEFAULT,
+    EFI_IFR_TYPE_NUM_SIZE_16,
+    Index
+    );
+
+  HiiCreateOneOfOpCode (
+    StartOpCodeHandle,
+    (EFI_QUESTION_ID) BOOT_NEXT_QUESTION_ID,
+    VARSTORE_ID_BOOT_MAINT,
+    BOOT_NEXT_VAR_OFFSET,
+    STRING_TOKEN (STR_BOOT_NEXT),
+    STRING_TOKEN (STR_BOOT_NEXT_HELP),
+    0,
+    EFI_IFR_NUMERIC_SIZE_2,
+    OptionsOpCodeHandle,
+    NULL
+    );
+
+  HiiFreeOpCodeHandle (OptionsOpCodeHandle);
+
+}
+
+/**
+  Create Time Out Menu in the page.
+
+  @param[in]    HiiHandle           The hii handle for the Uiapp driver.
+  @param[in]    StartOpCodeHandle   The opcode handle to save the new opcode.
+  @param[in]    PromptId            The Prompt string id.
+  @param[in]    HelpId              The help string id.
+  @param[in]    FormId              The Form id for the dest form.
+  @param[in]    QuestionId          The question id for this goto question.
+
+**/
+VOID
+BmmCreateTimeOutMenu (
+  IN EFI_HII_HANDLE              HiiHandle,
+  IN VOID                        *StartOpCodeHandle
+  )
+{
+  HiiCreateNumericOpCode (
+    StartOpCodeHandle,
+    (EFI_QUESTION_ID) FORM_TIME_OUT_ID,
+    VARSTORE_ID_BOOT_MAINT,
+    BOOT_TIME_OUT_VAR_OFFSET,
+    STRING_TOKEN(STR_NUM_AUTO_BOOT),
+    STRING_TOKEN(STR_HLP_AUTO_BOOT),
+    EFI_IFR_FLAG_CALLBACK,
+    EFI_IFR_NUMERIC_SIZE_2 | EFI_IFR_DISPLAY_UINT_DEC,
+    0,
+    65535,
+    0,
+    NULL
+    );
+}
+
+/**
+  Create Boot Option menu in the page.
+
+  @param[in]    HiiHandle           The hii handle for the Uiapp driver.
+  @param[in]    StartOpCodeHandle   The opcode handle to save the new opcode.
+
+**/
+VOID
+BmmCreateBootOptionMenu (
+  IN EFI_HII_HANDLE              HiiHandle,
+  IN VOID                        *StartOpCodeHandle
+  )
+{
+  HiiCreateGotoOpCode (
+    StartOpCodeHandle,
+    FORM_BOOT_SETUP_ID,
+    STRING_TOKEN (STR_FORM_BOOT_SETUP_TITLE),
+    STRING_TOKEN (STR_FORM_BOOT_SETUP_HELP),
+    EFI_IFR_FLAG_CALLBACK,
+    FORM_BOOT_SETUP_ID
+    );
+}
+
+/**
+  Create Driver Option menu in the page.
+
+  @param[in]    HiiHandle           The hii handle for the Uiapp driver.
+  @param[in]    StartOpCodeHandle   The opcode handle to save the new opcode.
+
+**/
+VOID
+BmmCreateDriverOptionMenu (
+  IN EFI_HII_HANDLE              HiiHandle,
+  IN VOID                        *StartOpCodeHandle
+  )
+{
+  HiiCreateGotoOpCode (
+    StartOpCodeHandle,
+    FORM_DRIVER_SETUP_ID,
+    STRING_TOKEN (STR_FORM_DRIVER_SETUP_TITLE),
+    STRING_TOKEN (STR_FORM_DRIVER_SETUP_HELP),
+    EFI_IFR_FLAG_CALLBACK,
+    FORM_DRIVER_SETUP_ID
+    );
+}
+
+/**
+  Create Com Option menu in the page.
+
+  @param[in]    HiiHandle           The hii handle for the Uiapp driver.
+  @param[in]    StartOpCodeHandle   The opcode handle to save the new opcode.
+
+**/
+VOID
+BmmCreateComOptionMenu (
+  IN EFI_HII_HANDLE              HiiHandle,
+  IN VOID                        *StartOpCodeHandle
+  )
+{
+  HiiCreateGotoOpCode (
+    StartOpCodeHandle,
+    FORM_CON_MAIN_ID,
+    STRING_TOKEN (STR_FORM_CON_MAIN_TITLE),
+    STRING_TOKEN (STR_FORM_CON_MAIN_HELP),
+    EFI_IFR_FLAG_CALLBACK,
+    FORM_CON_MAIN_ID
+    );
+}
+
+/**
+  Create Com Option menu in the page.
+
+  @param[in]    HiiHandle           The hii handle for the Uiapp driver.
+  @param[in]    StartOpCodeHandle   The opcode handle to save the new opcode.
+  @param[in]    PromptId            The Prompt string id.
+  @param[in]    HelpId              The help string id.
+  @param[in]    FormId              The Form id for the dest form.
+  @param[in]    QuestionId          The question id for this goto question.
+
+**/
+VOID
+BmmCreateBootFromFileMenu (
+  IN EFI_HII_HANDLE              HiiHandle,
+  IN VOID                        *StartOpCodeHandle
+  )
+{
+  HiiCreateGotoOpCode (
+    StartOpCodeHandle,
+    FORM_MAIN_ID,
+    STRING_TOKEN (STR_BOOT_FROM_FILE),
+    STRING_TOKEN (STR_BOOT_FROM_FILE_HELP),
+    EFI_IFR_FLAG_CALLBACK,
+    KEY_VALUE_BOOT_FROM_FILE
+    );
+}
+
+/**
+  Create empty line menu in the front page.
+
+  @param    HiiHandle           The hii handle for the Uiapp driver.
+  @param    StartOpCodeHandle   The opcode handle to save the new opcode.
+
+**/
+VOID
+BmmCreateEmptyLine (
+  IN EFI_HII_HANDLE              HiiHandle,
+  IN VOID                        *StartOpCodeHandle
+  )
+{
+  HiiCreateSubTitleOpCode (StartOpCodeHandle, STRING_TOKEN (STR_NULL_STRING), 
0, 0, 0);
+}
+
+/**
+  Extract device path for given HII handle and class guid.
+
+  @param Handle          The HII handle.
+
+  @retval  NULL          Fail to get the device path string.
+  @return  PathString    Get the device path string.
+
+**/
+CHAR16 *
+ExtractDevicePathFromHandle (
+  IN      EFI_HII_HANDLE      Handle
+  )
+{
+  EFI_STATUS                       Status;
+  EFI_HANDLE                       DriverHandle;
+
+  ASSERT (Handle != NULL);
+
+  if (Handle == NULL) {
+    return NULL;
+  }
+
+  Status = gHiiDatabase->GetPackageListHandle (gHiiDatabase, Handle, 
&DriverHandle);
+  if (EFI_ERROR (Status)) {
+    return NULL;
+  }
+
+  return ConvertDevicePathToText(DevicePathFromHandle (DriverHandle), FALSE, 
FALSE);
+}
+
+/**
+  Check whether this driver need to be shown in the front page.
+
+  @param    HiiHandle           The hii handle for the driver.
+  @param    Guid                The special guid for the driver which is the 
target.
+  @param    PromptId            Return the prompt string id.
+  @param    HelpId              Return the help string id.
+  @param    FormsetGuid         Return the formset guid info.
+
+  @retval   EFI_SUCCESS         Search the driver success
+
+**/
+BOOLEAN
+IsRequiredDriver (
+  IN  EFI_HII_HANDLE              HiiHandle,
+  IN  EFI_GUID                    *Guid,
+  OUT EFI_STRING_ID               *PromptId,
+  OUT EFI_STRING_ID               *HelpId,
+  OUT VOID                        *FormsetGuid
+  )
+{
+  EFI_STATUS                  Status;
+  UINT8                       ClassGuidNum;
+  EFI_GUID                    *ClassGuid;
+  EFI_IFR_FORM_SET            *Buffer;
+  UINTN                       BufferSize;
+  UINT8                       *Ptr;
+  UINTN                       TempSize;
+  BOOLEAN                     RetVal;
+
+  Status = HiiGetFormSetFromHiiHandle(HiiHandle, &Buffer,&BufferSize);
+  if (EFI_ERROR (Status)) {
+    return FALSE;
+  }
+
+  RetVal = FALSE;
+  TempSize = 0;
+  Ptr = (UINT8 *) Buffer;
+  while(TempSize < BufferSize)  {
+    TempSize += ((EFI_IFR_OP_HEADER *) Ptr)->Length;
+
+    if (((EFI_IFR_OP_HEADER *) Ptr)->Length <= OFFSET_OF (EFI_IFR_FORM_SET, 
Flags)){
+      Ptr += ((EFI_IFR_OP_HEADER *) Ptr)->Length;
+      continue;
+    }
+
+    ClassGuidNum = (UINT8) (((EFI_IFR_FORM_SET *)Ptr)->Flags & 0x3);
+    ClassGuid = (EFI_GUID *) (VOID *)(Ptr + sizeof (EFI_IFR_FORM_SET));
+    while (ClassGuidNum-- > 0) {
+      if (!CompareGuid (Guid, ClassGuid)){
+        ClassGuid ++;
+        continue;
+      }
+
+      *PromptId = ((EFI_IFR_FORM_SET *)Ptr)->FormSetTitle;
+      *HelpId = ((EFI_IFR_FORM_SET *)Ptr)->Help;
+      CopyMem (FormsetGuid, &((EFI_IFR_FORM_SET *) Ptr)->Guid, sizeof 
(EFI_GUID));
+      RetVal = TRUE;
+    }
+  }
+
+  FreePool (Buffer);
+
+  return RetVal;
+}
+
+/**
+  Search the drivers in the system which need to show in the front page
+  and insert the menu to the front page.
+
+  @param    HiiHandle           The hii handle for the Uiapp driver.
+  @param    ClassGuid           The class guid for the driver which is the 
target.
+  @param    StartOpCodeHandle   The opcode handle to save the new opcode.
+  @param    SpecialHandler      The pointer to the specail handler function, 
if any.
+
+  @retval   EFI_SUCCESS         Search the driver success
+
+**/
+EFI_STATUS
+BmmListThirdPartyDrivers (
+  IN EFI_HII_HANDLE              HiiHandle,
+  IN EFI_GUID                    *ClassGuid,
+  IN DRIVER_SPECIAL_HANDLER      SpecialHandlerFn,
+  IN VOID                        *StartOpCodeHandle
+  )
+{
+  UINTN                       Index;
+  EFI_STRING                  String;
+  EFI_STRING_ID               Token;
+  EFI_STRING_ID               TokenHelp;
+  EFI_HII_HANDLE              *HiiHandles;
+  CHAR16                      *DevicePathStr;
+  UINTN                       Count;
+  UINTN                       CurrentSize;
+  UI_HII_DRIVER_INSTANCE      *DriverListPtr;
+  EFI_STRING                  NewName;
+  BOOLEAN                     EmptyLineAfter;
+
+  if (gHiiDriverList != NULL) {
+    FreePool (gHiiDriverList);
+  }
+
+  HiiHandles = HiiGetHiiHandles (NULL);
+  ASSERT (HiiHandles != NULL);
+
+  gHiiDriverList = AllocateZeroPool (UI_HII_DRIVER_LIST_SIZE * sizeof 
(UI_HII_DRIVER_INSTANCE));
+  ASSERT (gHiiDriverList != NULL);
+  DriverListPtr = gHiiDriverList;
+  CurrentSize = UI_HII_DRIVER_LIST_SIZE;
+
+  for (Index = 0, Count = 0; HiiHandles[Index] != NULL; Index++) {
+    if (!IsRequiredDriver (HiiHandles[Index], ClassGuid, &Token, &TokenHelp, 
&gHiiDriverList[Count].FormSetGuid)) {
+      continue;
+    }
+
+    String = HiiGetString (HiiHandles[Index], Token, NULL);
+    if (String == NULL) {
+      String = HiiGetString (HiiHandle, STRING_TOKEN (STR_MISSING_STRING), 
NULL);
+      ASSERT (String != NULL);
+    } else if (SpecialHandlerFn != NULL) {
+      //
+      // Check whether need to rename the driver name.
+      //
+      EmptyLineAfter = FALSE;
+      if (SpecialHandlerFn (String, &NewName, &EmptyLineAfter)) {
+        FreePool (String);
+        String = NewName;
+        DriverListPtr[Count].EmptyLineAfter = EmptyLineAfter;
+      }
+    }
+    DriverListPtr[Count].PromptId = HiiSetString (HiiHandle, 0, String, NULL);
+    FreePool (String);
+
+    String = HiiGetString (HiiHandles[Index], TokenHelp, NULL);
+    if (String == NULL) {
+      String = HiiGetString (HiiHandle, STRING_TOKEN (STR_MISSING_STRING), 
NULL);
+      ASSERT (String != NULL);
+    }
+    DriverListPtr[Count].HelpId = HiiSetString (HiiHandle, 0, String, NULL);
+    FreePool (String);
+
+    DevicePathStr = ExtractDevicePathFromHandle(HiiHandles[Index]);
+    if (DevicePathStr != NULL){
+      DriverListPtr[Count].DevicePathId = HiiSetString (HiiHandle, 0, 
DevicePathStr, NULL);
+      FreePool (DevicePathStr);
+    } else {
+      DriverListPtr[Count].DevicePathId = 0;
+    }
+
+    Count++;
+    if (Count >= CurrentSize) {
+      DriverListPtr = AllocateCopyPool ((Count + UI_HII_DRIVER_LIST_SIZE) * 
sizeof (UI_HII_DRIVER_INSTANCE), gHiiDriverList);
+      ASSERT (DriverListPtr != NULL);
+      FreePool (gHiiDriverList);
+      gHiiDriverList = DriverListPtr;
+      CurrentSize += UI_HII_DRIVER_LIST_SIZE;
+    }
+  }
+
+  FreePool (HiiHandles);
+
+  Index = 0;
+  while (gHiiDriverList[Index].PromptId != 0) {
+    HiiCreateGotoExOpCode (
+      StartOpCodeHandle,
+      0,
+      gHiiDriverList[Index].PromptId,
+      gHiiDriverList[Index].HelpId,
+      0,
+      0,
+      0,
+      &gHiiDriverList[Index].FormSetGuid,
+      gHiiDriverList[Index].DevicePathId
+    );
+
+    if (gHiiDriverList[Index].EmptyLineAfter) {
+      BmmCreateEmptyLine (HiiHandle, StartOpCodeHandle);
+    }
+
+    Index ++;
+  }
+
+  return EFI_SUCCESS;
+}
+
diff --git 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.h
 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.h
new file mode 100644
index 0000000..2c69888
--- /dev/null
+++ 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.h
@@ -0,0 +1,146 @@
+/** @file
+  This library class defines a set of interfaces to be used by customize Ui 
module
+
+Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+This program and the accompanying materials are licensed and made available 
under
+the terms and conditions of the BSD License that accompanies this distribution.
+The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php.
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __BOOT_MAINTENANCE_MANAGER_UI_LIB_H__
+#define __BOOT_MAINTENANCE_MANAGER_UI_LIB_H__
+
+/**
+  Create Time Out Menu in the page.
+
+  @param[in]    HiiHandle           The hii handle for the Uiapp driver.
+  @param[in]    StartOpCodeHandle   The opcode handle to save the new opcode.
+
+**/
+VOID
+BmmCreateTimeOutMenu (
+  IN EFI_HII_HANDLE              HiiHandle,
+  IN VOID                        *StartOpCodeHandle
+  );
+
+/**
+  Create the dynamic item to allow user to set the "BootNext" vaule.
+
+  @param CallbackData    The BMM context data.
+
+**/
+VOID
+BmmCreateBootNextMenu(
+  IN EFI_HII_HANDLE              HiiHandle,
+  IN VOID                        *StartOpCodeHandle
+  );
+
+/**
+  Create Boot Option menu in the page.
+
+  @param[in]    HiiHandle           The hii handle for the Uiapp driver.
+  @param[in]    StartOpCodeHandle   The opcode handle to save the new opcode.
+
+**/
+VOID
+BmmCreateBootOptionMenu (
+  IN EFI_HII_HANDLE              HiiHandle,
+  IN VOID                        *StartOpCodeHandle
+  );
+
+/**
+  Create Driver Option menu in the page.
+
+  @param[in]    HiiHandle           The hii handle for the Uiapp driver.
+  @param[in]    StartOpCodeHandle   The opcode handle to save the new opcode.
+
+**/
+VOID
+BmmCreateDriverOptionMenu (
+  IN EFI_HII_HANDLE              HiiHandle,
+  IN VOID                        *StartOpCodeHandle
+  );
+
+/**
+  Create Com Option menu in the page.
+
+  @param[in]    HiiHandle           The hii handle for the Uiapp driver.
+  @param[in]    StartOpCodeHandle   The opcode handle to save the new opcode.
+
+**/
+VOID
+BmmCreateComOptionMenu (
+  IN EFI_HII_HANDLE              HiiHandle,
+  IN VOID                        *StartOpCodeHandle
+  );
+
+/**
+  Create Com Option menu in the page.
+
+  @param[in]    HiiHandle           The hii handle for the Uiapp driver.
+  @param[in]    StartOpCodeHandle   The opcode handle to save the new opcode.
+
+**/
+VOID
+BmmCreateBootFromFileMenu (
+  IN EFI_HII_HANDLE              HiiHandle,
+  IN VOID                        *StartOpCodeHandle
+  );
+
+/**
+  Create empty line menu in the front page.
+
+  @param    HiiHandle           The hii handle for the Uiapp driver.
+  @param    StartOpCodeHandle   The opcode handle to save the new opcode.
+
+**/
+VOID
+BmmCreateEmptyLine (
+  IN EFI_HII_HANDLE              HiiHandle,
+  IN VOID                        *StartOpCodeHandle
+  );
+
+/**
+  Rename the driver name if necessary.
+
+  @param    DriverName          Input the driver name.
+  @param    NewDriverName       Return the new driver name.
+  @param    EmptyLineAfter      Whether need to insert empty line.
+
+  @retval   New driver name if compared, else NULL.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *DRIVER_SPECIAL_HANDLER)(
+  IN  CHAR16                   *DriverName,
+  OUT CHAR16                   **NewName,
+  OUT BOOLEAN                  *EmptyLineAfter
+);
+
+/**
+  Search the drivers in the system which need to show in the front page
+  and insert the menu to the front page.
+
+  @param    HiiHandle           The hii handle for the Uiapp driver.
+  @param    ClassGuid           The class guid for the driver which is the 
target.
+  @param    StartOpCodeHandle   The opcode handle to save the new opcode.
+  @param    SpecialHandler      The pointer to the specail handler function, 
if any.
+
+  @retval   EFI_SUCCESS         Search the driver success
+
+**/
+EFI_STATUS
+BmmListThirdPartyDrivers (
+  IN EFI_HII_HANDLE              HiiHandle,
+  IN EFI_GUID                    *ClassGuid,
+  IN DRIVER_SPECIAL_HANDLER      SpecialHandlerFn,
+  IN VOID                        *StartOpCodeHandle
+  );
+
+#endif
diff --git 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerStrings.uni
 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerStrings.uni
index af0ea5e..20b2a77 100644
--- 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerStrings.uni
+++ 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerStrings.uni
@@ -67,10 +67,6 @@
                                        #language fr-FR  "Set Memory Check Type"
 #string STR_FORM_MEMORY_CHECK_HELP     #language en-US  "Modify the type of 
memory checking"
                                        #language fr-FR  "Modify the type of 
memory checking"
-#string STR_MEMORY_CHECK_SETUP         #language en-US  "Memory Check Type"
-                                       #language fr-FR  "Memory Check Type"
-#string STR_MEMORY_CHECK_SETUP_HELP    #language en-US  "Memory test coverage 
level. Ignore chooses not to test memory. Quick and Sparse test some memory, 
and Extensive performs a detailed memory test."
-                                       #language fr-FR  "Memory test coverage 
level. Ignore chooses not to test memory. Quick and Sparse test some memory, 
and Extensive performs a detailed memory test."
 #string STR_FORM_UEFI_OPTIMIZED_BOOT_TITLE #language en-US "UEFI Optimized 
Boot"
                                            #language fr-FR "UEFI Optimized 
Boot"
 #string STR_FORM_UEFI_OPTIMIZED_BOOT_HELP  #language en-US "Modify the UEFI 
Optimized Boot setting"
diff --git 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
index cd1fe96..25f990e 100644
--- 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
+++ 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
@@ -39,6 +39,10 @@
   Variable.c
   UpdatePage.c
   BmLib.c
+  BootMaintenanceManagerCustomizedUi.c
+  BootMaintenanceManagerCustomizedUi.h
+  BootMaintenanceManagerCustomizedUiSupport.c
+  BootMaintenanceManagerCustomizedUiSupport.h
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/FormGuid.h 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/FormGuid.h
index cf14b40..3e3897e 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/FormGuid.h
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/FormGuid.h
@@ -45,8 +45,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #define FORM_BOOT_ADD_DESCRIPTION_ID         0x101F
 #define FORM_DRIVER_ADD_FILE_DESCRIPTION_ID  0x1020
 #define FORM_CON_MODE_ID                     0x1021
-#define FORM_MEMORY_CHECK_ID                 0x1022
-#define FORM_UEFI_OPTIMIZED_BOOT_ID          0x1023
 #define FORM_BOOT_FROM_FILE_ID               0x1024
 
 
@@ -85,10 +83,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 //
 // End Label
 //
+#define LABEL_FORM_MAIN_START                0xfffc
+#define LABEL_FORM_MAIN_END                  0xfffd
+
 #define LABEL_BMM_PLATFORM_INFORMATION       0xfffe
 #define LABEL_END                            0xffff
 #define MAX_MENU_NUMBER                      100
 
+
 ///
 /// This is the structure that will be used to store the
 /// question's current value. Use it at initialize time to
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c
index 484f1ac..13a29db 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c
@@ -658,138 +658,6 @@ UpdateOrderPage (
 }
 
 /**
-  Create the dynamic page to allow user to set
-  the "BootNext" value.
-
-  @param CallbackData    The BMM context data.
-
-**/
-VOID
-UpdateBootNextPage (
-  IN BMM_CALLBACK_DATA                *CallbackData
-  )
-{
-  BM_MENU_ENTRY   *NewMenuEntry;
-  BM_LOAD_CONTEXT *NewLoadContext;
-  UINTN           NumberOfOptions;
-  UINT16          Index;
-  VOID            *OptionsOpCodeHandle;
-
-  NumberOfOptions               = BootOptionMenu.MenuNumber;
-  CallbackData->BmmAskSaveOrNot = TRUE;
-
-  UpdatePageStart (CallbackData);
-
-  if (NumberOfOptions > 0) {
-    OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
-    ASSERT (OptionsOpCodeHandle != NULL);
-
-    CallbackData->BmmFakeNvData.BootNext = NONE_BOOTNEXT_VALUE;
-
-    for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
-      NewMenuEntry    = BOpt_GetMenuEntry (&BootOptionMenu, Index);
-      NewLoadContext  = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
-
-      if (NewLoadContext->IsBootNext) {
-        HiiCreateOneOfOptionOpCode (
-          OptionsOpCodeHandle,
-          NewMenuEntry->DisplayStringToken,
-          EFI_IFR_OPTION_DEFAULT,
-          EFI_IFR_TYPE_NUM_SIZE_32,
-          Index
-          );
-        CallbackData->BmmFakeNvData.BootNext = Index;
-      } else {
-        HiiCreateOneOfOptionOpCode (
-          OptionsOpCodeHandle,
-          NewMenuEntry->DisplayStringToken,
-          0,
-          EFI_IFR_TYPE_NUM_SIZE_32,
-          Index
-          );
-      }
-    }
-
-    if (CallbackData->BmmFakeNvData.BootNext == NONE_BOOTNEXT_VALUE) {
-      HiiCreateOneOfOptionOpCode (
-        OptionsOpCodeHandle,
-        STRING_TOKEN (STR_NONE),
-        EFI_IFR_OPTION_DEFAULT,
-        EFI_IFR_TYPE_NUM_SIZE_32,
-        NONE_BOOTNEXT_VALUE
-        );
-    } else {
-      HiiCreateOneOfOptionOpCode (
-        OptionsOpCodeHandle,
-        STRING_TOKEN (STR_NONE),
-        0,
-        EFI_IFR_TYPE_NUM_SIZE_32,
-        NONE_BOOTNEXT_VALUE
-        );
-    }      
-
-    HiiCreateOneOfOpCode (
-      mStartOpCodeHandle,
-      (EFI_QUESTION_ID) BOOT_NEXT_QUESTION_ID,
-      VARSTORE_ID_BOOT_MAINT,
-      BOOT_NEXT_VAR_OFFSET,
-      STRING_TOKEN (STR_BOOT_NEXT),
-      STRING_TOKEN (STR_BOOT_NEXT_HELP),
-      0,
-      EFI_IFR_NUMERIC_SIZE_4,
-      OptionsOpCodeHandle,
-      NULL
-      );
-
-    HiiFreeOpCodeHandle (OptionsOpCodeHandle);
-  }
-
-  UpdatePageEnd (CallbackData);
-}
-
-/**
-  Create the dynamic page to allow user to set the "TimeOut" value.
-
-  @param CallbackData    The BMM context data.
-
-**/
-VOID
-UpdateTimeOutPage (
-  IN BMM_CALLBACK_DATA                *CallbackData
-  )
-{
-  VOID    *DefaultOpCodeHandle;
-
-  CallbackData->BmmAskSaveOrNot = TRUE;
-
-  UpdatePageStart (CallbackData);
-
-  DefaultOpCodeHandle = HiiAllocateOpCodeHandle ();
-  ASSERT (DefaultOpCodeHandle != NULL);
-  HiiCreateDefaultOpCode (DefaultOpCodeHandle, EFI_HII_DEFAULT_CLASS_STANDARD, 
EFI_IFR_TYPE_NUM_SIZE_16, CallbackData->BmmFakeNvData.BootTimeOut);
-
-  HiiCreateNumericOpCode (
-    mStartOpCodeHandle,
-    (EFI_QUESTION_ID) BOOT_TIME_OUT_QUESTION_ID,
-    VARSTORE_ID_BOOT_MAINT,
-    BOOT_TIME_OUT_VAR_OFFSET,
-    STRING_TOKEN (STR_NUM_AUTO_BOOT),
-    STRING_TOKEN (STR_HLP_AUTO_BOOT),
-    0,
-    EFI_IFR_NUMERIC_SIZE_2 | EFI_IFR_DISPLAY_UINT_DEC,
-    0,
-    65535,
-    0,
-    DefaultOpCodeHandle
-    );
-  
-  HiiFreeOpCodeHandle (DefaultOpCodeHandle);
-
-  UpdatePageEnd (CallbackData);
-}
-
-
-/**
   Refresh the text mode page.
 
   @param CallbackData    The BMM context data.
-- 
2.6.4.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to