From: "Laszlo Ersek" <lersek@redhat.com>
To: Dandan Bi <dandan.bi@intel.com>, devel@edk2.groups.io
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Julien Grall <julien.grall@arm.com>
Subject: Re: [patch 1/7] ArmVirtPkg: Update UefiDecompressLib instance
Date: Thu, 4 Apr 2019 16:57:36 +0200 [thread overview]
Message-ID: <cf6648c3-c06d-c712-0384-8ede8a731499@redhat.com> (raw)
In-Reply-To: <20190404135209.13116-2-dandan.bi@intel.com>
On 04/04/19 15:52, Dandan Bi wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1683
>
> BaseUefiDecompressLib in MdePkg is the
> base UEFI decompress Library.
> BaseUefiTianoCustomDecompressLib in IntelFrameworkModulePkg
> implements the base UEFI decompress functionality and
> Tiano decompress functionality.
>
> 1. TIANOCOMPRESSED rule in ArmVirtRules.fdf.inc
> is not used, so remove it.
That's correct, the only FDF files that refer to any TIANOCOMPRESSED rules, with RuleOverride, are:
- Nt32Pkg.fdf (for EnglishDxe.inf)
- Quark.fdf (for Shell.inf)
And the GUID in the rule being removed, A31280AD-481E-41B6-95E8-127F4C984779, is indeed gTianoCustomDecompressGuid.
> 2. Platform doesn't use the TianoCompress, so do
> not have to use BaseUefiTianoCustomDecompressLib,
> can use the BaseUefiDecompressLib in MdePkg directly.
It looks like we have the following guid-ed section extractors in edk2:
BrotliCustomDecompress 3D532050-5CDA-4FD0-879E-0F7F630D5AFB
EfiCertTypeRsa2048Sha256 A7717414-C616-4977-9420-844712A735BF
EfiCrc32GuidedSectionExtraction FC1BCDB0-7D31-49AA-936A-A4600D9DD083
LzmaCustomDecompress EE4E5898-3914-4259-9D6E-DC7BD79403CF
LzmaF86CustomDecompress D42AE6BD-1352-4BFB-909A-CA72A6EAE889
TianoCustomDecompress A31280AD-481E-41B6-95E8-127F4C984779
(with the leading "g" and trailing "Guid" stripped).
In order to see whether a platform uses an algorithm for section encoding, we should grep that platform's FDF files for the algorithm's GUID directly... And, indeed, under ArmVirtPkg, the only mention of A31280AD-481E-41B6-95E8-127F4C984779 is in the (unused) rule that's being removed.
The one algorithm that ArmVirtPkg does use, for section encoding, is LzmaCustomDecompress. For that, we have "MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf" resolutions in place already.
So what needs UefiDecompressLib at all? ... Aha, both of these:
- MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
- MdeModulePkg/Core/Dxe/DxeMain.inf
That's a good argument for preserving the lib class resolution at all.
I've compared "BaseUefiTianoCustomDecompressLib.c" to "BaseUefiDecompressLib.c". The main differences are:
* the latter has no constructor that registers a guid-ed section extractor -- and that's fine here, because in the code modified by this patch, the lib instance is not hooked into another module via NULL resolution,
* the following hunk:
//
// The length of the field 'Position Set Code Length Array Size' in Block Header.
// For UEFI 2.0 de/compression algorithm(Version 1), mPBit = 4
- // For Tiano de/compression algorithm(Version 2), mPBit = 5
//
- switch (Version) {
- case 1 :
- Sd->mPBit = 4;
- break;
- case 2 :
- Sd->mPBit = 5;
- break;
- default:
- ASSERT (FALSE);
- }
+ Sd->mPBit = 4;
So, let's see the patch:
>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Julien Grall <julien.grall@arm.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
> ArmVirtPkg/ArmVirt.dsc.inc | 4 ++--
> ArmVirtPkg/ArmVirtRules.fdf.inc | 9 ---------
> 2 files changed, 2 insertions(+), 11 deletions(-)
>
> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> index d172a082c9..556ec0dcb1 100644
> --- a/ArmVirtPkg/ArmVirt.dsc.inc
> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> @@ -223,17 +223,17 @@
> SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
> PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
> MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
>
> [LibraryClasses.common.UEFI_APPLICATION]
> - UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
> + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
> PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
> MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
> HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
>
> [LibraryClasses.common.UEFI_DRIVER]
> - UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
> + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
> ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
> PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
> MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
>
> [LibraryClasses.common.DXE_RUNTIME_DRIVER]
> diff --git a/ArmVirtPkg/ArmVirtRules.fdf.inc b/ArmVirtPkg/ArmVirtRules.fdf.inc
> index 5ff3004786..bed06364e1 100644
> --- a/ArmVirtPkg/ArmVirtRules.fdf.inc
> +++ b/ArmVirtPkg/ArmVirtRules.fdf.inc
> @@ -56,19 +56,10 @@
> PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
> TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
> UI STRING="$(MODULE_NAME)" Optional
> }
>
> -[Rule.Common.PEIM.TIANOCOMPRESSED]
> - FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 {
> - PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
> - GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE {
> - PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
> - UI STRING="$(MODULE_NAME)" Optional
> - }
> - }
> -
> [Rule.Common.DXE_CORE]
> FILE DXE_CORE = $(NAMED_GUID) {
> PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
> UI STRING="$(MODULE_NAME)" Optional
> }
>
The patch seems good, but we could improve it: in "ArmVirtPkg", we already have the following UefiDecompressLib resolutions:
ArmVirt.dsc.inc:44: UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
ArmVirt.dsc.inc:192: UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
ArmVirt.dsc.inc:208: UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
ArmVirt.dsc.inc:219: UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
ArmVirt.dsc.inc:228: UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
ArmVirt.dsc.inc:234: UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
On line 44, the resolution is for [LibraryClasses.common]. So, rather than multiplying the same resolution for UEFI_APPLICATION and UEFI_DRIVER too, I suggest removing *all* the resolutions, except the one on line 44 (i.e., in section [LibraryClasses.common]).
The commit message needs a minimal change only -- please append a sentence about the default resolution being right already, and relying on that for all module types.
The "ArmVirtRules.fdf.inc" hunk is good as-is, of course.
Thanks!
Laszlo
next prev parent reply other threads:[~2019-04-04 14:57 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-04 13:52 [patch 0/7] Move BaseUefiTianoCustomDecompressLib from IntelFrameworkModulePkg to MdeModulePkg dandan.bi
2019-04-04 13:52 ` [patch 1/7] ArmVirtPkg: Update UefiDecompressLib instance Dandan Bi
2019-04-04 14:57 ` Laszlo Ersek [this message]
2019-04-05 1:10 ` Dandan Bi
2019-04-04 13:52 ` [patch 2/7] BeagleBoardPkg: " Dandan Bi
2019-04-04 15:26 ` Ard Biesheuvel
2019-04-05 1:03 ` [edk2-devel] " Dandan Bi
2019-04-04 13:52 ` [patch 3/7] EmulatorPkg: " Dandan Bi
2019-04-04 13:52 ` [patch 4/7] MdeModulePkg: Move BaseUefiTianoCustomDecompressLib to Dandan Bi
2019-04-04 14:21 ` [edk2-devel] " Laszlo Ersek
2019-04-05 1:21 ` Dandan Bi
2019-04-04 21:14 ` felixp
2019-04-05 1:00 ` Dandan Bi
2019-04-04 13:52 ` [patch 5/7] Nt32Pkg: Update to use UefiDecompressLib in MdeModulePkg Dandan Bi
2019-04-04 21:21 ` [edk2-devel] " Felix Polyudov
2019-04-05 0:52 ` Dandan Bi
2019-04-04 13:52 ` [patch 6/7] Quark: " Dandan Bi
2019-04-04 13:52 ` [patch 7/7] Vlv2TbltDevicePkg: " Dandan Bi
2019-04-08 3:30 ` Qian, Yi
2019-04-23 16:26 ` [patch 0/7] Move BaseUefiTianoCustomDecompressLib from IntelFrameworkModulePkg to MdeModulePkg Ard Biesheuvel
2019-04-23 23:13 ` [edk2-devel] " Dandan Bi
2019-04-24 9:52 ` Laszlo Ersek
2019-04-24 12:46 ` Liming Gao
2019-04-24 12:48 ` Ard Biesheuvel
2019-04-24 13:02 ` Liming Gao
2019-04-24 13:03 ` Ard Biesheuvel
2019-04-24 17:23 ` Michael D Kinney
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=cf6648c3-c06d-c712-0384-8ede8a731499@redhat.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