From c7d310dd169ef84eee1ffab3af763372a363ab4b Mon Sep 17 00:00:00 2001 From: Dandan Bi Date: Mon, 14 Mar 2016 14:37:55 +0800 Subject: [PATCH] MdeModulePkg: Refine the UI code Remove the ASSERT in UI code that may be triggered, and clean up the useless code. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi Reviewed-by: Eric Dong --- MdeModulePkg/Application/UiApp/FrontPage.c | 7 ++- .../BootMaintenance.c | 15 ++++- .../BootMaintenanceManager.h | 10 ---- .../BootMaintenanceManagerUiLib/Variable.c | 56 ------------------- 4 files changed, 17 insertions(+), 71 deletions(-) diff --git a/MdeModulePkg/Application/UiApp/FrontPage.c b/MdeModulePkg/Application/UiApp/FrontPage.c index 5c67a3fa91..9cc877bedb 100644 --- a/MdeModulePkg/Application/UiApp/FrontPage.c +++ b/MdeModulePkg/Application/UiApp/FrontPage.c @@ -1,7 +1,7 @@ /** @file FrontPage routines to handle the callbacks and browser calls -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
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 @@ -420,7 +420,10 @@ FrontPageCallback ( AsciiStrSize (Lang), Lang ); - ASSERT_EFI_ERROR(Status); + if (EFI_ERROR (Status)) { + FreePool (Lang); + return EFI_DEVICE_ERROR; + } } else { ASSERT (FALSE); } diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c index 8189bd1084..745f971554 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c @@ -1,7 +1,7 @@ /** @file The functions for Boot Maintainence Main menu. -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
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 @@ -667,8 +667,17 @@ BootMaintRouteConfig ( sizeof(UINT16), &(NewBmmData->BootTimeOut) ); - ASSERT_EFI_ERROR(Status); - + if (EFI_ERROR (Status)) { + // + // If set variable fail, and don't have the appropriate error status for RouteConfig fuction to return, + // just return the EFI_NOT_FOUND. + // + if (Status == EFI_OUT_OF_RESOURCES) { + return Status; + } else { + return EFI_NOT_FOUND; + } + } Private->BmmOldFakeNVData.BootTimeOut = NewBmmData->BootTimeOut; } diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h index b482bf2892..2c93446a05 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h @@ -763,16 +763,6 @@ Var_UpdateOutOfBandOption ( IN UINT16 MenuIndex ); -/** - Update the device path of "ConOut", "ConIn" and "ErrOut" based on the new BaudRate, Data Bits, - parity and stop Bits set. - -**/ -VOID -Var_UpdateAllConsoleOption ( - VOID - ); - /** This function update the "BootNext" EFI Variable. If there is no "BootNex" specified in BMM, this EFI Variable is deleted. diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/Variable.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/Variable.c index 2ecf5b6605..b65d6a5c9e 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/Variable.c +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/Variable.c @@ -300,62 +300,6 @@ Var_ChangeDriverOrder ( return EFI_SUCCESS; } -/** - Update the device path of "ConOut", "ConIn" and "ErrOut" - based on the new BaudRate, Data Bits, parity and Stop Bits - set. - -**/ -VOID -Var_UpdateAllConsoleOption ( - VOID - ) -{ - EFI_DEVICE_PATH_PROTOCOL *OutDevicePath; - EFI_DEVICE_PATH_PROTOCOL *InpDevicePath; - EFI_DEVICE_PATH_PROTOCOL *ErrDevicePath; - EFI_STATUS Status; - - GetEfiGlobalVariable2 (L"ConOut", (VOID**)&OutDevicePath, NULL); - GetEfiGlobalVariable2 (L"ConIn", (VOID**)&InpDevicePath, NULL); - GetEfiGlobalVariable2 (L"ErrOut", (VOID**)&ErrDevicePath, NULL); - if (OutDevicePath != NULL) { - ChangeVariableDevicePath (OutDevicePath); - Status = gRT->SetVariable ( - L"ConOut", - &gEfiGlobalVariableGuid, - VAR_FLAG, - GetDevicePathSize (OutDevicePath), - OutDevicePath - ); - ASSERT (!EFI_ERROR (Status)); - } - - if (InpDevicePath != NULL) { - ChangeVariableDevicePath (InpDevicePath); - Status = gRT->SetVariable ( - L"ConIn", - &gEfiGlobalVariableGuid, - VAR_FLAG, - GetDevicePathSize (InpDevicePath), - InpDevicePath - ); - ASSERT (!EFI_ERROR (Status)); - } - - if (ErrDevicePath != NULL) { - ChangeVariableDevicePath (ErrDevicePath); - Status = gRT->SetVariable ( - L"ErrOut", - &gEfiGlobalVariableGuid, - VAR_FLAG, - GetDevicePathSize (ErrDevicePath), - ErrDevicePath - ); - ASSERT (!EFI_ERROR (Status)); - } -} - /** This function delete and build multi-instance device path for specified type of console device.