From ed82611100ad0bf094f25be04e10dff4f1a3c14d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=BBygowski?= Date: Wed, 4 Dec 2024 12:40:06 +0100 Subject: [PATCH 1/3] Revert "MdeModulePkg/Library/BootMaintenanceManagerUiLib: Handle timeout statically" This reverts commit 6d2f7672a9154d69ed125b5a0cab7e858421573e. --- .../BootMaintenance.c | 16 +--------------- .../BootMaintenanceManager.h | 2 +- .../BootMaintenanceManager.vfr | 11 ----------- .../BootMaintenanceManagerCustomizedUi.c | 2 +- 4 files changed, 3 insertions(+), 28 deletions(-) diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c index 0a8a3c3000..8f2a31a3e8 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c @@ -1109,9 +1109,7 @@ BootMaintCallback ( UINTN Index; EFI_DEVICE_PATH_PROTOCOL *File; - if ((Action != EFI_BROWSER_ACTION_CHANGING) && (Action != EFI_BROWSER_ACTION_CHANGED) && - (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_DEFAULT_STANDARD) && - (Action != EFI_BROWSER_ACTION_DEFAULT_MANUFACTURING)) { + 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 or the form is open. // @@ -1147,18 +1145,6 @@ BootMaintCallback ( OldFakeNVMap = &Private->BmmOldFakeNVData; HiiGetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *)CurrentFakeNVMap); - if (Action == EFI_BROWSER_ACTION_DEFAULT_STANDARD || Action == EFI_BROWSER_ACTION_DEFAULT_MANUFACTURING) { - if (Value == NULL) - return EFI_INVALID_PARAMETER; - - if (QuestionId == FORM_TIME_OUT_ID) { - CurrentFakeNVMap->BootTimeOut = PcdGet16 (PcdPlatformBootTimeOut); - Value->u16 = PcdGet16 (PcdPlatformBootTimeOut); - } else { - return EFI_UNSUPPORTED; - } - } - if (Action == EFI_BROWSER_ACTION_CHANGING) { if (Value == NULL) { return EFI_INVALID_PARAMETER; diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h index b776effba9..4018db963b 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h @@ -199,7 +199,7 @@ typedef enum _TYPE_OF_TERMINAL { #define COM1_DATA_RATE_QUESTION_ID QUESTION_ID (COM1DataRate) #define COM1_STOP_BITS_QUESTION_ID QUESTION_ID (COM1StopBits) #define COM1_PARITY_QUESTION_ID QUESTION_ID (COM1Parity) -#define COM1_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType) +#define COM1_TERMINAL_QUESTION_ID QUESTION_ID (COM1TerminalType) #define COM2_BAUD_RATE_QUESTION_ID QUESTION_ID (COM2BaudRate) #define COM2_DATA_RATE_QUESTION_ID QUESTION_ID (COM2DataRate) #define COM2_STOP_BITS_QUESTION_ID QUESTION_ID (COM2StopBits) diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.vfr b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.vfr index 93dbf34573..69fb606324 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.vfr +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.vfr @@ -40,17 +40,6 @@ formset // label LABEL_FORM_MAIN_END; - numeric varid = BmmData.BootTimeOut, - questionid = FORM_TIME_OUT_ID, - prompt = STRING_TOKEN(STR_NUM_AUTO_BOOT), - help = STRING_TOKEN(STR_HLP_AUTO_BOOT), - flags = RESET_REQUIRED | INTERACTIVE | NUMERIC_SIZE_2 | DISPLAY_UINT_DEC, - key = FORM_TIME_OUT_ID, - minimum = 0, - maximum = 65535, - step = 0, - endnumeric; - endform; form formid = FORM_BOOT_SETUP_ID, diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUi.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUi.c index a98d867ba2..d79212e75c 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUi.c +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUi.c @@ -58,7 +58,7 @@ UiCustomizeBMMPage ( // // Create "Time Out" menu. // - // BmmCreateTimeOutMenu (HiiHandle, StartOpCodeHandle); + BmmCreateTimeOutMenu (HiiHandle, StartOpCodeHandle); } /** From edd40509d08bb8055710bad0a607f963051da0be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=BBygowski?= Date: Wed, 4 Dec 2024 12:47:03 +0100 Subject: [PATCH 2/3] BootMaintenanceManagerUiLib: Guard for NULL DefaultOpCodeHandle for Timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Żygowski --- ...ootMaintenanceManagerCustomizedUiSupport.c | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c index 48c424c941..710d076bbc 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerCustomizedUiSupport.c @@ -125,12 +125,14 @@ BmmCreateTimeOutMenu ( DefaultOpCodeHandle = HiiAllocateOpCodeHandle (); ASSERT (DefaultOpCodeHandle != NULL); - HiiCreateDefaultOpCode ( - DefaultOpCodeHandle, - EFI_HII_DEFAULT_CLASS_STANDARD, - EFI_IFR_TYPE_NUM_SIZE_16, - PcdGet16 (PcdPlatformBootTimeOut) - ); + if (DefaultOpCodeHandle != NULL ) { + HiiCreateDefaultOpCode ( + DefaultOpCodeHandle, + EFI_HII_DEFAULT_CLASS_STANDARD, + EFI_IFR_TYPE_NUM_SIZE_16, + PcdGet16 (PcdPlatformBootTimeOut) + ); + } HiiCreateNumericOpCode ( StartOpCodeHandle, @@ -144,10 +146,12 @@ BmmCreateTimeOutMenu ( 0, 65535, 0, - DefaultOpCodeHandle + DefaultOpCodeHandle ? DefaultOpCodeHandle : NULL ); - HiiFreeOpCodeHandle (DefaultOpCodeHandle); + if (DefaultOpCodeHandle != NULL) { + HiiFreeOpCodeHandle (DefaultOpCodeHandle); + } } /** From 3e9bb7c128894becdd4e819f4dfb7387a939c23a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=BBygowski?= Date: Wed, 4 Dec 2024 12:49:40 +0100 Subject: [PATCH 3/3] BootMaintenanceManagerUiLib: Generate HII opcodes in lib constructor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move generating the HII opcodes to the library constructor. Previously the opcodes were generated on form entry, which prevented the F9 (reset to defaults) to not apply to the dynamically generated options if BMM was not enetered. NOw, when the opcodes are generated in the library constructor, the dynamically generated options are "visible" from any level of the setup browser and F9 can restore defaults from any browser level. There was a specific need to generate those dynamic options on form entry because of legacy UI library dependency. As we do not use legacy UI nor CSM, we do not have to worry about it. Signed-off-by: Michał Żygowski --- .../Library/BootMaintenanceManagerUiLib/BootMaintenance.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c index 8f2a31a3e8..9933b7bdd6 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c @@ -1130,7 +1130,7 @@ BootMaintCallback ( // 1. Update the menus (including legacy munu) show in BootMiantenanceManager page. // 2. Re-scan the BootOption menus (including the legacy boot option). // - CustomizeMenus (); + // CustomizeMenus (); EfiBootManagerRefreshAllBootOption (); BOpt_GetBootOptions (Private); mFirstEnterBMMForm = TRUE; @@ -1557,6 +1557,8 @@ InitializeBmmConfig ( GetConsoleErrCheck (CallbackData); GetTerminalAttribute (CallbackData); + CustomizeMenus(); + CallbackData->BmmFakeNvData.ForceReconnect = TRUE; //