From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 44FCF210DF749 for ; Tue, 7 Aug 2018 22:05:08 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Aug 2018 22:05:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,456,1526367600"; d="scan'208";a="63191645" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga007.jf.intel.com with ESMTP; 07 Aug 2018 22:05:04 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 7 Aug 2018 22:05:04 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 7 Aug 2018 22:05:03 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.143]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.240]) with mapi id 14.03.0319.002; Wed, 8 Aug 2018 13:05:01 +0800 From: "Ni, Ruiyu" To: "Zhang, Shenglei" , "edk2-devel@lists.01.org" CC: "Gao, Liming" Thread-Topic: [edk2] [PATCH 6/6] IntelFrameworkModulePkg BdsDxe: Remove redundant functions Thread-Index: AQHULsVkf9nWyrEVw0CxnwlEigi1/6S1TQxA Date: Wed, 8 Aug 2018 05:04:24 +0000 Deferred-Delivery: Wed, 8 Aug 2018 05:05:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BDC416C@SHSMSX104.ccr.corp.intel.com> References: <20180808030854.30124-1-shenglei.zhang@intel.com> <20180808030854.30124-7-shenglei.zhang@intel.com> In-Reply-To: <20180808030854.30124-7-shenglei.zhang@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 6/6] IntelFrameworkModulePkg BdsDxe: Remove redundant functions X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Aug 2018 05:05:08 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ruiyu Ni Thanks/Ray > -----Original Message----- > From: edk2-devel On Behalf Of shenglei > Sent: Wednesday, August 8, 2018 11:09 AM > To: edk2-devel@lists.01.org > Cc: Gao, Liming > Subject: [edk2] [PATCH 6/6] IntelFrameworkModulePkg BdsDxe: Remove > redundant functions >=20 > 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=3D1063 >=20 > Cc: Liming Gao > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: shenglei > --- > .../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(-) >=20 > 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; > } >=20 > -/** > - Adjusts the size of a previously allocated buffer. > - > - > - @param OldPool - A pointer to the buffer whose size is being a= djusted. > - @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 =3D NULL; > - if (NewSize !=3D 0) { > - NewPool =3D AllocateZeroPool (NewSize); > - } > - > - if (OldPool !=3D NULL) { > - if (NewPool !=3D NULL) { > - CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize); > - } > - > - FreePool (OldPool); > - } > - > - return NewPool; > -} >=20 > /** > 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 > ); >=20 > -/** > - > - 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 > - ); >=20 > /** >=20 > @@ -702,18 +686,6 @@ FreeAllConsoles ( > VOID > ); >=20 > -/** > - 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 > - ); >=20 > /** > Update the multi-instance device path of Terminal Device based on @@ - > 875,15 +847,6 @@ Var_UpdateErrorOutOption ( > VOID > ); >=20 > -/** > - 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 > - ); >=20 > /** > This function update the "BootNext" EFI Variable. If there is no "Boot= Nex" > specified in BMM, @@ -1154,22 +1117,6 @@ EfiLibFileInfo ( > IN EFI_FILE_HANDLE FHand > ); >=20 > -/** > - Adjusts the size of a previously allocated buffer. > - > - @param OldPool A pointer to the buffer whose size is being adj= usted. > - @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 > - ); >=20 > /** > 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; > } >=20 > -/** > - > - 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 =3D Dir->Open (Dir, &File, FileName, EFI_FILE_MODE_READ, 0); > - > - if (EFI_ERROR (Status)) { > - return FALSE; > - } > - > - BufferSize =3D sizeof (EFI_IMAGE_DOS_HEADER); > - File->Read (File, &BufferSize, &DosHdr); > - if (DosHdr.e_magic !=3D EFI_IMAGE_DOS_SIGNATURE) { > - File->Close (File); > - return FALSE; > - } >=20 > - File->SetPosition (File, DosHdr.e_lfanew); > - BufferSize =3D sizeof (EFI_IMAGE_OPTIONAL_HEADER_UNION); > - File->Read (File, &BufferSize, &PeHdr); > - if (PeHdr.Pe32.Signature !=3D EFI_IMAGE_NT_SIGNATURE) { > - File->Close (File); > - return FALSE; > - } > - // > - // Determine PE type and read subsytem > - // > - if (PeHdr.Pe32.OptionalHeader.Magic =3D=3D > EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { > - Subsystem =3D PeHdr.Pe32.OptionalHeader.Subsystem; > - } else if (PeHdr.Pe32.OptionalHeader.Magic =3D=3D > EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) { > - Subsystem =3D PeHdr.Pe32Plus.OptionalHeader.Subsystem; > - } else { > - return FALSE; > - } > - > - if (Subsystem =3D=3D EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION) { > - File->Close (File); > - return TRUE; > - } else { > - File->Close (File); > - return FALSE; > - } > -} >=20 > /** >=20 > 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 ( >=20 > } >=20 > -/** > - 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; >=20 > - Node =3D DevicePath; > - Node =3D NextDevicePathNode (Node); > - Com =3D 0; > - while (!IsDevicePathEnd (Node)) { > - Acpi =3D (ACPI_HID_DEVICE_PATH *) Node; > - if (IsIsaSerialNode (Acpi)) { > - CopyMem (&Com, &Acpi->UID, sizeof (UINT32)); > - } > - > - if ((DevicePathType (Node) =3D=3D MESSAGING_DEVICE_PATH) && > (DevicePathSubType (Node) =3D=3D MSG_UART_DP)) { > - NewMenuEntry =3D BOpt_GetMenuEntry ( > - &TerminalMenu, > - Com > - ); > - ASSERT (NewMenuEntry !=3D NULL); > - NewTerminalContext =3D (BM_TERMINAL_CONTEXT *) NewMenuEntry- > >VariableContext; > - Uart =3D (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 =3D NextDevicePathNode (Node); > - } > -} >=20 > /** > 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; > } >=20 > -/** > - 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; >=20 > - OutDevicePath =3D EfiLibGetVariable (L"ConOut", &gEfiGlobalVariableGui= d); > - InpDevicePath =3D EfiLibGetVariable (L"ConIn", &gEfiGlobalVariableGuid= ); > - ErrDevicePath =3D EfiLibGetVariable (L"ErrOut", &gEfiGlobalVariableGui= d); > - if (OutDevicePath !=3D NULL) { > - ChangeVariableDevicePath (OutDevicePath); > - Status =3D 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 variab= le > implementation shouldn't fail. > - // > - ASSERT_EFI_ERROR (Status); > - } > - > - if (InpDevicePath !=3D NULL) { > - ChangeVariableDevicePath (InpDevicePath); > - Status =3D 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 variab= le > implementation shouldn't fail. > - // > - ASSERT_EFI_ERROR (Status); > - } > - > - if (ErrDevicePath !=3D NULL) { > - ChangeVariableDevicePath (ErrDevicePath); > - Status =3D 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 variab= le > implementation shouldn't fail. > - // > - ASSERT_EFI_ERROR (Status); > - } > -} >=20 > /** > This function delete and build multi-instance device path for diff --g= it > 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; > } >=20 > -/** > - 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 =3D HiiGetPackageString (ProducerGuid, Token, NULL); > - if (TmpString =3D=3D NULL) { > - *String =3D GetStringById (STRING_TOKEN (STR_MISSING_STRING)); > - } else { > - *String =3D TmpString; > - } > - > - return EFI_SUCCESS; > -} >=20 > /** > 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 > ); >=20 > -/** > - 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 > - ); >=20 > /** > This function is the main entry of the platform setup entry. > -- > 2.18.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel