Reviewed-by: Eric Dong <eric.d...@intel.com>

> -----Original Message-----
> From: Bi, Dandan
> Sent: Monday, March 14, 2016 3:24 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming; Dong, Eric
> Subject: [patch] MdeModulePkg: Refine the UI code
> 
> Remove the ASSERT in UI code that may be triggered,
> and clean up the useless code.
> 
> Cc: Liming Gao <liming....@intel.com>
> Cc: Eric Dong <eric.d...@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Dandan Bi <dandan...@intel.com>
> ---
>  MdeModulePkg/Application/UiApp/FrontPage.c         |  7 ++-
>  .../BootMaintenanceManagerUiLib/BootMaintenance.c  | 15 ++++--
>  .../BootMaintenanceManager.h                       | 10 ----
>  .../Library/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 5c67a3f..9cc877b 100644
> --- a/MdeModulePkg/Application/UiApp/FrontPage.c
> +++ b/MdeModulePkg/Application/UiApp/FrontPage.c
> @@ -1,9 +1,9 @@
>  /** @file
>    FrontPage routines to handle the callbacks and browser calls
> 
> -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
> 
> @@ -418,11 +418,14 @@ FrontPageCallback (
>                          &gEfiGlobalVariableGuid,
>                          EFI_VARIABLE_NON_VOLATILE | 
> EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
>                          AsciiStrSize (Lang),
>                          Lang
>                          );
> -        ASSERT_EFI_ERROR(Status);
> +        if (EFI_ERROR (Status)) {
> +          FreePool (Lang);
> +          return EFI_DEVICE_ERROR;
> +        }
>        } else {
>          ASSERT (FALSE);
>        }
>        FreePool (Lang);
>        //
> diff --git 
> a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c
> index 8189bd1..3864996 100644
> --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c
> +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c
> @@ -1,9 +1,9 @@
>  /** @file
>  The functions for Boot Maintainence Main menu.
> 
> -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
> 
> @@ -665,12 +665,21 @@ BootMaintRouteConfig (
>                      &gEfiGlobalVariableGuid,
>                      EFI_VARIABLE_BOOTSERVICE_ACCESS | 
> EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
>                      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;
>    }
> 
>    //
>    // Check data which located in Driver Options Menu and save the settings 
> if need
> diff --git 
> a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
> index b482bf2..2c93446 100644
> --- 
> a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
> +++ 
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
> @@ -762,20 +762,10 @@ EFI_STATUS
>  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.
>    It also update the BMM context data specified the "BootNext" value.
> 
>    @param CallbackData    The BMM context data.
> diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/Variable.c
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/Variable.c
> index 2ecf5b6..b65d6a5 100644
> --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/Variable.c
> +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/Variable.c
> @@ -299,66 +299,10 @@ 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.
> 
>    This function clear the EFI variable defined by ConsoleName and
>    gEfiGlobalVariableGuid. It then build the multi-instance device
> --
> 1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to