summaryrefslogtreecommitdiff
path: root/EmbeddedPkg/Library/PrePiLib/FwVol.c
AgeCommit message (Collapse)AuthorFilesLines
2026-06-24EmbeddedPkg: PrePiLib: Fix uninitialized variable warningsTuan Phan1-7/+7
In FfsProcessSection(), delete CompressionSectionHeaderSize and move CompressedData to avoid the compiler warning without changing functional behavior. Signed-off-by: Tuan Phan <tuan.phan@oss.qualcomm.com>
2026-06-13EmbeddedPkg, OvmfPkg: Produce FV3 HOBs for Extracted FVsOliver Smith-Denny1-15/+37
EmbeddedPkg's PrePiLib and OvmfPkg's PeilessStartupLib (which uses PrePiLib) only produce FV2 HOBs for extracted FVs. However, FV3 HOBs have superceded FV2 HOBs for describing extracted FVs. This commit updates both of these libs to also produce FV3 HOBs, following PEI's pattern of producing an FV, FV2, and FV3 HOB for each extracted FV. Eventually, only FV3 HOBs will be produced, so this paves the way for that. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2026-06-13EmbeddedPkg, OvmfPkg: PrePiLib: Use Correct FvName in FV2 HOB ProductionDmitry Antipov1-4/+9
PrePiLib is incorrectly producing FV2 HOBs. The FvName field of the FV2 HOB is intended to be the parent FV's name. This way the HOB consumer phase can identify when an FV has already been extracted: if the file name of the extracted FV and the parent FV name match in the FV2 HOB. With the incorrect FvName, DXE will re-extract the already extracted FV, which can be a large performance hit (some platforms we have seen ~1 second). This requires an update to FfsProcessFvFile to pass the parent FV handle through so the FV2 HOB can be correctly produced. OvmfPkg consumers are also updated. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2026-06-13EmbeddedPkg: PrePiLib: Zero Volume Info Buffer Before WritingOliver Smith-Denny1-1/+1
FfsGetVolumeInfo() in PrePiLib does not zero the VolumeInfo buffer before writing to it. However, it has some fields that are expected to be zero if certain conditions are not met. For example, the FvName is expected to be all 0's if the extended header is not present in the FV. Currently, the FvName field will point to garbage if the caller does not zero the buffer first. Flip the expectation and have FfsGetVolumeInfo() zero the buffer before it writes to it. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2026-06-13EmbeddedPkg: PrePiLib: Skip Extracting if FV3 HOB FoundOliver Smith-Denny1-10/+16
PrePiLib only searches for the existence of an FV2 HOB to determine if an FV has already been extracted. However, FV2 HOBs have been superceded by FV3 HOBs for describing extracted FVs. This commit updates PrePiLib to check for the existence of either an FV2 or FV3 HOB for this FV and skips extracting if either is found. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2026-04-13EmbeddedPkg/PrePiLib: Prevent overread with FFS size macrosGowtham M1-8/+6
Symptom:Unsafe typecasting may lead to out‑of‑bound memory access RootCause: FileSize and FileLength are declared as UINT32 and masked with 0x00FFFFFF to store only the lower 24 bits. Although this approach yields the correct result, it introduces a potential risk due to unsafe typecasting and dereferencing. Solution: Using the predefined macro FFS_FILE_SIZE() from MdePkg\Include\Pi\PiFirmwareFile.h, which safely performs the same operation by reconstructing the size using individual byte access. This commit also addresses the fix for coverity isssue "OVERRUN" Cc: Sachin Ganesh <sachinganesh@ami.com> Signed-off-by: Gowtham M <gowthamm@ami.com>
2025-09-12EmbeddedPkg/PrePiLib: minor cleanup in FfsProcessSection ()Leif Lindholm1-8/+8
Drop an else wrapper in FfsProcessSection () on the other side of an if-statemenmt that is an error return. Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-09-12EmbeddedPkg/PrePiLib: eliminate unneeded variable in FfsProcessSection ()Leif Lindholm1-9/+5
The "Found" variable provided only a deferred form of success handling, so eliminate it to improve readability. Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-09-12EmbeddedPkg/PrePiLib: refactor FfsProcessSection ()Leif Lindholm1-60/+122
Create some helper functions to make FfsProcessSection at least halfway readable by both humans and compilers. Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-01-15EmbeddedPkg: CodeQL Fixes.Vineel Kovvuri[MSFT]1-1/+1
Makes changes to comply with alerts raised by CodeQL. Most of the issues here fall into the following two categories: 1. Potential use of uninitialized pointer. 2. Inconsistent integer width in comparison. Co-authored-by: Taylor Beebe <taylor.d.beebe@gmail.com> Co-authored-by: Ken Lautner <kenlautner3@gmail.com> Co-authored-by: Bret Barkelew <bret@corthon.com> Signed-off-by: Vineel Kovvuri[MSFT] <vineelko@microsoft.com>
2023-01-19EmbeddedPkg: Add back FfsFindSectionDataMin M Xu1-0/+23
In commit c673216f53 a new input parameter is added in FfsFindSectionData. That change breaks the build of ArmVirtPkg. In this patch FfsFindSectionData is added back. It calls FfsFindSectionDataWithHook with a NULL hook. Signed-off-by: Min Xu <min.m.xu@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2023-01-19EmbeddedPkg: Rename FfsFindSectionData as FfsFindSectionDataWithHookMin M Xu1-4/+6
Commit c673216f53 introduces FFS_CHECK_SECTION_HOOK and add it as the second input parameter in FfsFindSectionData. This change breaks the build of ArmVirtPkg. To fix this issue, the new version of FfsFindSectionData is renamed as FfsFindSectionDataWithHook in this patch. In the following patch the original FfsFindSectionData will be added back. FfsFindSectionData is renamed as FfsFindSectionDataWithHook. Accordingly PeilessStartupLib in OvmfPkg should be updated as well. To prevent the build from being broken, the changes in OvmfPkg are in this patch. Signed-off-by: Min Xu <min.m.xu@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2023-01-18EmbeddedPkg/PrePiLib: Add FFS_CHECK_SECTION_HOOK when finding sectionMin M Xu1-12/+30
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4152 EmbeddedPkg/PrePiLib provides the service of finding sections based on the input SectionType. But sometimes there maybe multiple sections with the same SectionType. FFS_CHECK_SECTION_HOOK is a hook which can be called to do additional check. Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Abner Chang <abner.chang@amd.com> Cc: Daniel Schaefer <git@danielschaefer.me> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Acked-by: Ard Biesheuvel <ardb+tianocore@kernel.org> Signed-off-by: Min Xu <min.m.xu@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2022-01-27EmbeddedPkg: Fix a build error in FwVol.c in X64 archMin Xu1-3/+3
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3814 CompressedDataLength is declared as UINTN which is UINT64 in X64 arch. But the second parameter of UefiDecompressGetInfo() is declared as UINT32. So a build error is triggered. To declare CompressedDataLength as UINT32 to fix the build error. Cc: Leif Lindholm <leif@nuviainc.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Abner Chang <abner.chang@hpe.com> Cc: Daniel Schaefer <daniel.schaefer@hpe.com> Signed-off-by: Min Xu <min.m.xu@intel.com>
2021-12-07EmbeddedPkg: Apply uncrustify changesMichael Kubacki1-198/+177
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the EmbeddedPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Andrew Fish <afish@apple.com>
2021-12-07EmbeddedPkg: Change OPTIONAL keyword usage styleMichael D Kinney1-1/+1
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3760 Update all use of ', OPTIONAL' to ' OPTIONAL,' for function params. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Andrew Fish <afish@apple.com>
2021-12-07EmbeddedPkg: Change use of EFI_D_* to DEBUG_*Michael D Kinney1-4/+2
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3739 Update all use of EFI_D_* defines in DEBUG() macros to DEBUG_* defines. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2019-07-04EmbeddedPkg: Fix various typosCœur1-2/+2
Fix various typos in EmbeddedPkg. Signed-off-by: Coeur <coeur@gmx.fr> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2019-04-09EmbeddedPkg: Replace BSD License with BSD+Patent LicenseMichael D Kinney1-7/+1
https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2017-12-12EmbeddedPkg/PrePiLib: add support for v2 sectionsMichael Zimmermann1-12/+51
Implement the missing support for FFS files whose size equals or exceeds 16 MiB. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2015-05-05EmbeddedPkg/PrePiLib: Ensure the FFS files are always 8-byte alignedOlivier Martin1-0/+3
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> Reviewed-by: Ronald Cron <Ronald.Cron@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17308 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-26ARM Packages: Replace tabs by spaces for indentationRonald Cron1-8/+8
Replace tabs by spaces for indentation to comply to EDK2 coding standards. Done in files with extension ".S", ".c", ".h", ".asm", ".dsc", ".inc", "*.inf", "*.dec" or ".fdf" and located in ArmPkg, ArmPlatformPkg, EmbeddedPkg, BeagleBoardPkg or Omap35xxPkg. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ronald Cron <ronald.cron@arm.com> Reviewed-By: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15901 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-19ARM Packages: Removed trailing spacesRonald Cron1-68/+68
Trailing spaces create issue/warning when generating/applying patches. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ronald Cron <ronald.cron@arm.com> Reviewed-By: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15833 6f19259b-4bc3-4df7-8a09-765794883524
2014-02-24EmbeddedPkg/PrePiLib: Fixed incorrect type castingAndrew Fish1-3/+3
A pointer on a UINTN variable was used instead of UINT32 one. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Andrew Fish <afish@apple.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15252 6f19259b-4bc3-4df7-8a09-765794883524
2013-01-25ARM Packages: Fixed line endingsoliviermartin1-842/+842
This large code change only modifies the line endings to be CRLF to be compliant with the EDK2 coding convention document. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14088 6f19259b-4bc3-4df7-8a09-765794883524
2011-12-29EmbeddedPkg/PrePiLib: Ensure FvImageInfo has been initialized to zerooliviermartin1-0/+1
Signed-off-by: lgao4 Reviewed-by: oliviermartin git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12900 6f19259b-4bc3-4df7-8a09-765794883524
2010-04-29Update the copyright notice formathhtian1-2/+2
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10446 6f19259b-4bc3-4df7-8a09-765794883524
2009-12-06Adding support for BeagleBoard. AJFISH1-0/+841
ArmPkg - Supoprt for ARM specific things that can change as the architecture changes. Plus semihosting JTAG drivers. EmbeddedPkg - Generic support for an embeddded platform. Including a light weight command line shell. BeagleBoardPkg - Platform specifics for BeagleBoard. SD Card works, but USB has issues. Looks like a bug in the open source USB stack (Our internal stack works fine). git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9518 6f19259b-4bc3-4df7-8a09-765794883524