public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ruiyu" <ruiyu.ni@intel.com>
To: "Zhang, Shenglei" <shenglei.zhang@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [PATCH 6/6] IntelFrameworkModulePkg BdsDxe: Remove redundant functions
Date: Wed, 8 Aug 2018 05:04:24 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BDC416C@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20180808030854.30124-7-shenglei.zhang@intel.com>

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Thanks/Ray

> -----Original Message-----
> From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of shenglei
> Sent: Wednesday, August 8, 2018 11:09 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: [edk2] [PATCH 6/6] IntelFrameworkModulePkg BdsDxe: Remove
> redundant functions
> 
> The redundant functions which are never called have been removed. They
> are GetProducerString,ChangeVariableDevicePath,
> EfiReallocatePool,Var_UpdateAllConsoleOption and BOpt_IsEfiApp.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1063
> 
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: shenglei <shenglei.zhang@intel.com>
> ---
>  .../Universal/BdsDxe/BootMaint/BmLib.c        | 36 -----------
>  .../Universal/BdsDxe/BootMaint/BootMaint.h    | 53 ---------------
>  .../Universal/BdsDxe/BootMaint/BootOption.c   | 62 ------------------
>  .../BdsDxe/BootMaint/ConsoleOption.c          | 64 -------------------
>  .../Universal/BdsDxe/BootMaint/Variable.c     | 63 ------------------
>  .../Universal/BdsDxe/FrontPage.c              | 29 ---------
>  .../Universal/BdsDxe/FrontPage.h              | 17 -----
>  7 files changed, 324 deletions(-)
> 
> diff --git
> a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BmLib.c
> b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BmLib.c
> index d27113c015..a7ff449557 100644
> --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BmLib.c
> +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BmLib.c
> @@ -323,42 +323,6 @@ EfiDevicePathInstanceCount (
>    return Count;
>  }
> 
> -/**
> -  Adjusts the size of a previously allocated buffer.
> -
> -
> -  @param OldPool         - A pointer to the buffer whose size is being adjusted.
> -  @param OldSize         - The size of the current buffer.
> -  @param NewSize         - The size of the new buffer.
> -
> -  @return   The newly allocated buffer.
> -  @retval   NULL  Allocation failed.
> -
> -**/
> -VOID *
> -EfiReallocatePool (
> -  IN VOID                 *OldPool,
> -  IN UINTN                OldSize,
> -  IN UINTN                NewSize
> -  )
> -{
> -  VOID  *NewPool;
> -
> -  NewPool = NULL;
> -  if (NewSize != 0) {
> -    NewPool = AllocateZeroPool (NewSize);
> -  }
> -
> -  if (OldPool != NULL) {
> -    if (NewPool != NULL) {
> -      CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
> -    }
> -
> -    FreePool (OldPool);
> -  }
> -
> -  return NewPool;
> -}
> 
>  /**
>    Get a string from the Data Hub record based on diff --git
> a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h
> b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h
> index bdd22c8e75..b3b905d7ef 100644
> --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h
> +++
> b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h
> @@ -548,22 +548,6 @@ BOpt_IsEfiImageName (
>    IN UINT16  *FileName
>    );
> 
> -/**
> -
> -  Check whether current FileName point to a valid Efi Application
> -
> -  @param Dir       Pointer to current Directory
> -  @param FileName  Pointer to current File name.
> -
> -  @retval TRUE      Is a valid Efi Application
> -  @retval FALSE     not a valid Efi Application
> -
> -**/
> -BOOLEAN
> -BOpt_IsEfiApp (
> -  IN EFI_FILE_HANDLE Dir,
> -  IN UINT16          *FileName
> -  );
> 
>  /**
> 
> @@ -702,18 +686,6 @@ FreeAllConsoles (
>    VOID
>    );
> 
> -/**
> -  Update the device path that describing a terminal device
> -  based on the new BaudRate, Data Bits, parity and Stop Bits
> -  set.
> -
> -  @param DevicePath     The devicepath protocol instance wanted to be
> updated.
> -
> -**/
> -VOID
> -ChangeVariableDevicePath (
> -  IN OUT EFI_DEVICE_PATH_PROTOCOL  *DevicePath
> -  );
> 
>  /**
>    Update the multi-instance device path of Terminal Device based on @@ -
> 875,15 +847,6 @@ Var_UpdateErrorOutOption (
>    VOID
>    );
> 
> -/**
> -  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, @@ -1154,22 +1117,6 @@ EfiLibFileInfo (
>    IN EFI_FILE_HANDLE      FHand
>    );
> 
> -/**
> -  Adjusts the size of a previously allocated buffer.
> -
> -  @param OldPool         A pointer to the buffer whose size is being adjusted.
> -  @param OldSize         The size of the current buffer.
> -  @param NewSize         The size of the new buffer.
> -
> -  @return   The newly allocated buffer. if NULL, allocation failed.
> -
> -**/
> -VOID*
> -EfiReallocatePool (
> -  IN VOID                 *OldPool,
> -  IN UINTN                OldSize,
> -  IN UINTN                NewSize
> -  );
> 
>  /**
>    Function deletes the variable specified by VarName and VarGuid.
> diff --git
> a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
> b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
> index 895f13f214..c4a0e17f3b 100644
> ---
> a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
> +++
> b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
> @@ -1192,69 +1192,7 @@ BOpt_IsEfiImageName (
>    return FALSE;
>  }
> 
> -/**
> -
> -  Check whether current FileName point to a valid Efi Application
> -
> -  @param Dir       Pointer to current Directory
> -  @param FileName  Pointer to current File name.
> -
> -  @retval TRUE      Is a valid Efi Application
> -  @retval FALSE     not a valid Efi Application
> -
> -**/
> -BOOLEAN
> -BOpt_IsEfiApp (
> -  IN EFI_FILE_HANDLE Dir,
> -  IN UINT16          *FileName
> -  )
> -{
> -  UINTN                       BufferSize;
> -  EFI_IMAGE_DOS_HEADER        DosHdr;
> -  UINT16                      Subsystem;
> -  EFI_FILE_HANDLE             File;
> -  EFI_STATUS                  Status;
> -  EFI_IMAGE_OPTIONAL_HEADER_UNION PeHdr;
> -
> -  Status = Dir->Open (Dir, &File, FileName, EFI_FILE_MODE_READ, 0);
> -
> -  if (EFI_ERROR (Status)) {
> -    return FALSE;
> -  }
> -
> -  BufferSize = sizeof (EFI_IMAGE_DOS_HEADER);
> -  File->Read (File, &BufferSize, &DosHdr);
> -  if (DosHdr.e_magic != EFI_IMAGE_DOS_SIGNATURE) {
> -    File->Close (File);
> -    return FALSE;
> -  }
> 
> -  File->SetPosition (File, DosHdr.e_lfanew);
> -  BufferSize = sizeof (EFI_IMAGE_OPTIONAL_HEADER_UNION);
> -  File->Read (File, &BufferSize, &PeHdr);
> -  if (PeHdr.Pe32.Signature != EFI_IMAGE_NT_SIGNATURE) {
> -    File->Close (File);
> -    return FALSE;
> -  }
> -  //
> -  // Determine PE type and read subsytem
> -  //
> -  if (PeHdr.Pe32.OptionalHeader.Magic ==
> EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
> -    Subsystem = PeHdr.Pe32.OptionalHeader.Subsystem;
> -  } else if (PeHdr.Pe32.OptionalHeader.Magic ==
> EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
> -    Subsystem = PeHdr.Pe32Plus.OptionalHeader.Subsystem;
> -  } else {
> -    return FALSE;
> -  }
> -
> -  if (Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION) {
> -    File->Close (File);
> -    return TRUE;
> -  } else {
> -    File->Close (File);
> -    return FALSE;
> -  }
> -}
> 
>  /**
> 
> diff --git
> a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.
> c
> b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.
> c
> index 964d8850ef..33b53bf3b6 100644
> ---
> a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.
> c
> +++
> b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.
> c
> @@ -218,71 +218,7 @@ ChangeTerminalDevicePath (
> 
>  }
> 
> -/**
> -  Update the device path that describing a terminal device
> -  based on the new BaudRate, Data Bits, parity and Stop Bits
> -  set.
> -
> -  @param DevicePath terminal device's path
> -
> -**/
> -VOID
> -ChangeVariableDevicePath (
> -  IN OUT EFI_DEVICE_PATH_PROTOCOL  *DevicePath
> -  )
> -{
> -  EFI_DEVICE_PATH_PROTOCOL  *Node;
> -  ACPI_HID_DEVICE_PATH      *Acpi;
> -  UART_DEVICE_PATH          *Uart;
> -  UINTN                     Com;
> -  BM_TERMINAL_CONTEXT       *NewTerminalContext;
> -  BM_MENU_ENTRY             *NewMenuEntry;
> 
> -  Node  = DevicePath;
> -  Node  = NextDevicePathNode (Node);
> -  Com   = 0;
> -  while (!IsDevicePathEnd (Node)) {
> -    Acpi = (ACPI_HID_DEVICE_PATH *) Node;
> -    if (IsIsaSerialNode (Acpi)) {
> -      CopyMem (&Com, &Acpi->UID, sizeof (UINT32));
> -    }
> -
> -    if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) &&
> (DevicePathSubType (Node) == MSG_UART_DP)) {
> -      NewMenuEntry = BOpt_GetMenuEntry (
> -                      &TerminalMenu,
> -                      Com
> -                      );
> -      ASSERT (NewMenuEntry != NULL);
> -      NewTerminalContext  = (BM_TERMINAL_CONTEXT *) NewMenuEntry-
> >VariableContext;
> -      Uart                = (UART_DEVICE_PATH *) Node;
> -      CopyMem (
> -        &Uart->BaudRate,
> -        &NewTerminalContext->BaudRate,
> -        sizeof (UINT64)
> -        );
> -
> -      CopyMem (
> -        &Uart->DataBits,
> -        &NewTerminalContext->DataBits,
> -        sizeof (UINT8)
> -        );
> -
> -      CopyMem (
> -        &Uart->Parity,
> -        &NewTerminalContext->Parity,
> -        sizeof (UINT8)
> -        );
> -
> -      CopyMem (
> -        &Uart->StopBits,
> -        &NewTerminalContext->StopBits,
> -        sizeof (UINT8)
> -        );
> -    }
> -
> -    Node = NextDevicePathNode (Node);
> -  }
> -}
> 
>  /**
>    Retrieve ACPI UID of UART from device path diff --git
> a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
> b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
> index ea798fab9d..2a7bdb13a8 100644
> --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
> +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
> @@ -312,70 +312,7 @@ 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;
> 
> -  OutDevicePath = EfiLibGetVariable (L"ConOut", &gEfiGlobalVariableGuid);
> -  InpDevicePath = EfiLibGetVariable (L"ConIn", &gEfiGlobalVariableGuid);
> -  ErrDevicePath = EfiLibGetVariable (L"ErrOut", &gEfiGlobalVariableGuid);
> -  if (OutDevicePath != NULL) {
> -    ChangeVariableDevicePath (OutDevicePath);
> -    Status = gRT->SetVariable (
> -                    L"ConOut",
> -                    &gEfiGlobalVariableGuid,
> -                    EFI_VARIABLE_BOOTSERVICE_ACCESS |
> EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
> -                    GetDevicePathSize (OutDevicePath),
> -                    OutDevicePath
> -                    );
> -    //
> -    // Changing variable without increasing its size with current variable
> implementation shouldn't fail.
> -    //
> -    ASSERT_EFI_ERROR (Status);
> -  }
> -
> -  if (InpDevicePath != NULL) {
> -    ChangeVariableDevicePath (InpDevicePath);
> -    Status = gRT->SetVariable (
> -                    L"ConIn",
> -                    &gEfiGlobalVariableGuid,
> -                    EFI_VARIABLE_BOOTSERVICE_ACCESS |
> EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
> -                    GetDevicePathSize (InpDevicePath),
> -                    InpDevicePath
> -                    );
> -    //
> -    // Changing variable without increasing its size with current variable
> implementation shouldn't fail.
> -    //
> -    ASSERT_EFI_ERROR (Status);
> -  }
> -
> -  if (ErrDevicePath != NULL) {
> -    ChangeVariableDevicePath (ErrDevicePath);
> -    Status = gRT->SetVariable (
> -                    L"ErrOut",
> -                    &gEfiGlobalVariableGuid,
> -                    EFI_VARIABLE_BOOTSERVICE_ACCESS |
> EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
> -                    GetDevicePathSize (ErrDevicePath),
> -                    ErrDevicePath
> -                    );
> -    //
> -    // Changing variable without increasing its size with current variable
> implementation shouldn't fail.
> -    //
> -    ASSERT_EFI_ERROR (Status);
> -  }
> -}
> 
>  /**
>    This function delete and build multi-instance device path for diff --git
> a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
> b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
> index bdf63eabbf..46fdc53f2b 100644
> --- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
> +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
> @@ -569,35 +569,6 @@ CallFrontPage (
>    return Status;
>  }
> 
> -/**
> -  Acquire the string associated with the ProducerGuid and return it.
> -
> -
> -  @param ProducerGuid    The Guid to search the HII database for
> -  @param Token           The token value of the string to extract
> -  @param String          The string that is extracted
> -
> -  @retval  EFI_SUCCESS  The function returns EFI_SUCCESS always.
> -
> -**/
> -EFI_STATUS
> -GetProducerString (
> -  IN      EFI_GUID                  *ProducerGuid,
> -  IN      EFI_STRING_ID             Token,
> -  OUT     CHAR16                    **String
> -  )
> -{
> -  EFI_STRING      TmpString;
> -
> -  TmpString = HiiGetPackageString (ProducerGuid, Token, NULL);
> -  if (TmpString == NULL) {
> -    *String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));
> -  } else {
> -    *String = TmpString;
> -  }
> -
> -  return EFI_SUCCESS;
> -}
> 
>  /**
>    Convert Processor Frequency Data to a string.
> diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.h
> b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.h
> index bc2c0612d0..7e6290fd62 100644
> --- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.h
> +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.h
> @@ -198,23 +198,6 @@ InitializeFrontPage (
>    IN BOOLEAN    InitializeHiiData
>    );
> 
> -/**
> -  Acquire the string associated with the ProducerGuid and return it.
> -
> -
> -  @param ProducerGuid    - The Guid to search the HII database for
> -  @param Token           - The token value of the string to extract
> -  @param String          - The string that is extracted
> -
> -  @retval  EFI_SUCCESS  The function returns EFI_SUCCESS always.
> -
> -**/
> -EFI_STATUS
> -GetProducerString (
> -  IN      EFI_GUID                  *ProducerGuid,
> -  IN      EFI_STRING_ID             Token,
> -  OUT     CHAR16                    **String
> -  );
> 
>  /**
>    This function is the main entry of the platform setup entry.
> --
> 2.18.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


      reply	other threads:[~2018-08-08  5:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-08  3:08 [PATCH 0/6] IntelFrameworkModulePkg: Remove something reduntdant shenglei
2018-08-08  3:08 ` [PATCH 1/6] IntelFrameworkModulePkg IsaIoDxe: Remove a redundant protocol shenglei
2018-08-08  5:05   ` Ni, Ruiyu
2018-08-08  3:08 ` [PATCH 2/6] IntelFrameworkModulePkg Ps2KeyboardDxe: Remove a redundant function shenglei
2018-08-08  5:05   ` Ni, Ruiyu
2018-08-08  3:08 ` [PATCH 3/6] IntelFrameworkModulePkg IdeBusDxe: Remove redundant functions shenglei
2018-08-08  5:05   ` Ni, Ruiyu
2018-08-08  3:08 ` [PATCH 4/6] IntelFrameworkModulePkg Snp16Dxe: " shenglei
     [not found]   ` <C0706E73DB8C124D9B9C38AA364E5D5E5E1B89@shsmsx102.ccr.corp.intel.com>
2018-08-24  3:28     ` Ni, Ruiyu
2018-08-08  3:08 ` [PATCH 5/6] IntelFrameworkModulePkg LegacyBiosDxe: Remove redundant LibraryClasses shenglei
2018-08-08  5:04   ` Ni, Ruiyu
2018-08-08  3:08 ` [PATCH 6/6] IntelFrameworkModulePkg BdsDxe: Remove redundant functions shenglei
2018-08-08  5:04   ` Ni, Ruiyu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=734D49CCEBEEF84792F5B80ED585239D5BDC416C@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox