Dandan: Please define KEY value like FORM_BOOT_ADD_ID, and check it in CallBack function.
> -----Original Message----- > From: Bi, Dandan > Sent: Tuesday, July 05, 2016 11:01 AM > To: [email protected] > Cc: Gao, Liming <[email protected]>; Dong, Eric <[email protected]> > Subject: [patch 1/2] MdeModulePkg/BootMaintUiLib: Update menus when > open BMM form > > 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. When opening BMM form, the > LeagcyBootMaintUiLib must have been initialized. > > Cc: Liming Gao <[email protected]> > Cc: Eric Dong <[email protected]> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Dandan Bi <[email protected]> > Reviewed-by: Eric Dong <[email protected]> > --- > .../BootMaintenanceManagerUiLib/BootMaintenance.c | 37 > ++++++++++++++++++---- > .../BootMaintenanceManager.vfr | 12 ++++++- > 2 files changed, 41 insertions(+), 8 deletions(-) > > diff --git > a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc > e.c > b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc > e.c > index b35e938..e26e9e0 100644 > --- > a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc > e.c > +++ > b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc > e.c > @@ -82,10 +82,11 @@ BMM_CALLBACK_DATA gBootMaintenancePrivate = > { > } > }; > > BMM_CALLBACK_DATA *mBmmCallbackInfo = &gBootMaintenancePrivate; > BOOLEAN mAllMenuInit = FALSE; > +BOOLEAN mFirstEnterBMMForm = FALSE; > > /** > Init all memu. > > @param CallbackData The BMM context data. > @@ -104,10 +105,20 @@ VOID > FreeAllMenu ( > VOID > ); > > /** > + > + Update the menus in the BMM page. > + > +**/ > +VOID > +CustomizeMenus ( > + VOID > + ); > + > +/** > This function will change video resolution and text mode > according to defined setup mode or defined boot mode > > @param IsSetupMode Indicate mode is changed to setup mode or boot > mode. > > @@ -869,18 +880,35 @@ BootMaintCallback ( > BM_MENU_ENTRY *NewMenuEntry; > BMM_FAKE_NV_DATA *CurrentFakeNVMap; > UINTN Index; > EFI_DEVICE_PATH_PROTOCOL * File; > > - if (Action != EFI_BROWSER_ACTION_CHANGING && Action != > EFI_BROWSER_ACTION_CHANGED) { > + if (Action != EFI_BROWSER_ACTION_CHANGING && Action != > EFI_BROWSER_ACTION_CHANGED && Action != > EFI_BROWSER_ACTION_FORM_OPEN) { > // > - // Do nothing for other UEFI Action. Only do call back when data is > changed. > + // Do nothing for other UEFI Action. Only do call back when data is > changed or the form is open. > // > return EFI_UNSUPPORTED; > } > > Private = BMM_CALLBACK_DATA_FROM_THIS (This); > + > + if (Action == EFI_BROWSER_ACTION_FORM_OPEN) { > + if (!mFirstEnterBMMForm) { > + // > + // BMMUiLib depends on LegacyUi library to show legacy menus. > + // If we want to show Legacy menus correctly in BMM page, > + // we must do it after the LegacyUi library has already been > initialized. > + // Opening the BMM form is the appropriate time that the LegacyUi > library has already been initialized. > + // So we do the tasks which are related to legacy menus here. > + // 1. Update the menus (including legacy munu) show in > BootMiantenanceManager page. > + // 2. Re-scan the BootOption menus (including the legacy boot option). > + // > + CustomizeMenus (); > + BOpt_GetBootOptions (Private); > + mFirstEnterBMMForm = TRUE; > + } > + } > // > // Retrive uncommitted data from Form Browser > // > CurrentFakeNVMap = &Private->BmmFakeNvData; > HiiGetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof > (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap); > @@ -1222,15 +1250,10 @@ InitializeBmmConfig ( > GetTerminalAttribute (CallbackData); > > 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/BootMaintenanc > eManager.vfr > b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc > eManager.vfr > index d46a3e9..6262c6c 100644 > --- > a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc > eManager.vfr > +++ > b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc > eManager.vfr > @@ -1,9 +1,9 @@ > ///** @file > // Boot Maintenance Utility Formset > // > -// Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR> > +// 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 > // > @@ -25,10 +25,20 @@ formset > name = BmmData, > guid = BOOT_MAINT_FORMSET_GUID; > > form formid = FORM_MAIN_ID, > title = STRING_TOKEN(STR_FORM_MAIN_TITLE); > + // > + // Add this invisable text in order to indicate enter Boot Maintenance > Manager form. > + // > + suppressif TRUE; > + text > + help = STRING_TOKEN(STR_NONE), > + text = STRING_TOKEN(STR_NONE), > + flags = INTERACTIVE, > + key = 0x0001; > + endif; > > label LABEL_FORM_MAIN_START; > // > // This is where we will dynamically add a Action type op-code to show > // the platform information. > -- > 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

