summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library
Commit message (Collapse)AuthorAgeFilesLines
...
* MdeModulePkg/ResetUtilityLib: Use STATIC_ASSERT macroVitaly Cheptsov via Groups.Io2019-09-171-1/+4
| | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2048 Use new STATIC_ASSERT macro instead of VERIFY_SIZE_OF. Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg/DxeCapsuleLibFmp: Improve comparisons in CapsuleOnDisk.cXu, Wei62019-08-151-1/+1
| | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2028 Non-Boolean comparisons should use a compare operator (==, !=, >, < >=, <=). Signed-off-by: Wei6 Xu <wei6.xu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg/DxeCapsuleLibFmp: Add missing description for parameterZhang, Shenglei2019-08-071-0/+1
| | | | | | | | | The description of parameter CapFileName is missing in comments. So add the description. Cc: Jian J Wang <jian.j.wang@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg: Remove RecoveryLib.h and PeiRecoveryLibNullZhang, Shenglei2019-08-053-79/+0
| | | | | | | | | | | | RecoveryLib.h and PeiRecoveryLibNull have been deprecated from 2009, so remove them. https://bugzilla.tianocore.org/show_bug.cgi?id=1299 Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Star Zeng <star.zeng@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg: Remove S3Lib.h and PeiS3LibNullZhang, Shenglei2019-08-053-81/+0
| | | | | | | | | | | S3Lib.h and PeiS3LibNull have been deprecated since 2009, so remove them. https://bugzilla.tianocore.org/show_bug.cgi?id=1299 Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Star Zeng <star.zeng@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg/DxeCapsuleLibFmp: Add missing NULL pointer check.Wei6 Xu2019-06-281-0/+6
| | | | | | | | | | | | | Add missing NULL pointer check for CapsuleNameBufStart. Also add comments to notice that capsule name integrity check assumes the capsule has been validated by IsValidCapsuleHeader(). Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Chao B Zhang <chao.b.zhang@intel.com> Signed-off-by: Wei6 Xu <wei6.xu@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Chao B Zhang <chao.b.zhang@intel.com>
* MdeModulePkg: Add Capsule On Disk APIs into CapsuleLib.Wei6 Xu2019-06-269-29/+2374
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | REF: https://github.com/tianocore/tianocore.github.io/wiki/ UEFI-Capsule-on-Disk-Introducation CoDCheckCapsuleOnDiskFlag() is to check if CapsuleOnDisk flag in "OsIndications" Variable is enabled. It is used to indicate whether capsule on disk is provisioned in normal boot path. CoDClearCapsuleOnDiskFlag() is to to clear CapsuleOnDisk flags, including "OsIndications" and "BootNext" variable. CoDRelocateCapsule() is to relocate the capsules from EFI system partition. Depends on PcdCapsuleInRamSupport, there are two solutions to relocate the capsule on disk images: When Capsule In Ram is supported, the Capsule On Disk images are relocated into memory, and call UpdateCapsule() service to deliver the capsules. When Capsule In Ram is not supported, the Capsule On Disk images are relocated into a temp file which will be stored in root directory on a platform specific storage device. CapsuleOnDiskLoadPei PEIM will retrieve the capsules from the relocation temp file and report capsule hobs for them. CoDRemoveTempFile() is to remove the relocation temp file in the next boot after capsules are processed. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Chao B Zhang <chao.b.zhang@intel.com> Signed-off-by: Wei6 Xu <wei6.xu@intel.com> Reviewed-by: Chao B Zhang <chao.b.zhang@intel.com> Acked-by: Hao A Wu <hao.a.wu@intel.com>
* Revert "Capsule-on-Disk entire PatchZhang, Chao B2019-06-219-2375/+29
| | | | | | | | | | | | | | | | This reverts commit 0d4aa276d1f6e0cb9d71a7fb88b30c416ba6d5a3, 6470a43160183cd48cad8901c912a48811f18b13, fd7286089542ee7a98cfea00be45ceb3561e0b20, 7837d1249807b4248079699097bc993254235d7a, 6b32af2e105f9b5454a55b581f2dc365c5eb6397, 8636f70b5a763ed1c03b292708f9c5543e531ea9, f17935321a5b818a66e999632ef371b374b98f0c due to incorrect review process. Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Signed-off-by: Zhang, Chao B <chao.b.zhang@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg: Add Capsule On Disk APIs into CapsuleLib.Wei6 Xu2019-06-209-29/+2375
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/tianocore/tianocore.github.io/wiki/UEFI-Capsule- on-Disk-Introducation CoDCheckCapsuleOnDiskFlag() is to check if CapsuleOnDisk flag in "OsIndications" Variable is enabled. It is used to indicate whether capsule on disk is provisioned in normal boot path. CoDClearCapsuleOnDiskFlag() is to to clear CapsuleOnDisk flags, including "OsIndications" and "BootNext" variable. CoDRelocateCapsule() is to relocate the capsules from EFI system partition. Depends on PcdCapsuleInRamSupport, there are two solutions to relocate the capsule on disk images: When Capsule In Ram is supported, the Capsule On Disk images are relocated into memory, and call UpdateCapsule() service to deliver the capsules. When Capsule In Ram is not supported, the Capsule On Disk images are relocated into a temp file which will be stored in root directory on a platform specific storage device. CapsuleOnDiskLoadPei PEIM will retrieve the capsules from the relocation temp file and report capsule hobs for them. CoDRemoveTempFile() is to remove the relocation temp file in the next boot after capsules are processed. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Chao B Zhang <chao.b.zhang@intel.com> Signed-off-by: Wei6 Xu <wei6.xu@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Chao B Zhang <chao.b.zhang@intel.com>
* NetworkPkg: Move Network library and drivers from MdeModulePkg to NetworkPkgLiming Gao2019-05-2720-12343/+0
| | | | | | | | Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
* MdeModulePkg/Library: Remove BaseUefiTianoCustomDecompressLibDandan Bi2019-05-154-1336/+0
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1722 Since we have merged this one into MdePkg, remove it now. Cc: Liming Gao <liming.gao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg: BaseSerialPortLib16550: Add Mmio32 supportTien Hock, Loh2019-04-292-4/+13
| | | | | | | | | Some buses doesn't allow 8 bit MMIO read/write, this adds support for 32 bits read/write Signed-off-by: "Tien Hock, Loh" <tien.hock.loh@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg/ResetUtilityLib: Add a new API ResetSystemWithSubtypeBret Barkelew2019-04-281-6/+34
| | | | | | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1458 Implement the new API ResetSystemWithSubtype. Depend on Uefi Spec 2.8 chapter 8.5.1, the ResetData is valid while the ResetStatus is EFI_SUCCESS regardless of the ResetType. Also change the function ResetPlatofrmSpecificGuid to directly call ResetSystemWithSubtype to reduce the duplicated code. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Turner <Michael.Turner@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg/PeiResetSystemlib.c: Change comments of ResetSystemZhichao Gao2019-04-281-3/+1
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1460 Refer to Uefi spec 2.8, the ResetData is valid while ResetStatus is EFI_SUCCESS regardless of the ResetType is EfiResetPlatformSpecific or not. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Turner <Michael.Turner@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg/RuntimeResetSystemLib.c: Change commentsZhichao Gao2019-04-281-3/+1
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1460 Refer to Uefi spec 2.8, the ResetData is valid while ResetStatus is EFI_SUCCESS regardless of the ResetType is EfiResetPlatformSpecific or not. So change the comments of ResetSystem. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Turner <Michael.Turner@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg/BaseResetSystemLibNull.c: Change comments of ResetSystemZhichao Gao2019-04-281-4/+2
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1460 Refer to Uefi spec 2.8, the ResetData is valid while ResetStatus is EFI_SUCCESS regardless of the ResetType is EfiResetPlatformSpecific or not. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Turner <Michael.Turner@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg/DxeResetSystemLib.c: Change comments of ResetSystemZhichao Gao2019-04-281-3/+1
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1460 Refer to Uefi spec 2.8, the ResetData is valid while ResetStatus is EFI_SUCCESS regardless of the ResetType is EfiResetPlatformSpecific or not. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Turner <Michael.Turner@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg/FileExplorer: Set Handle to NULL after uninstall protocolDandan Bi2019-04-281-1/+2
| | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1728 Currently Emulator meets ASSERT when enter setup->Continue->enter setup. When re-enter setup, the FeDriverHandle in FileExplorerLib Constructor is not NULL which cause InstallMultipleProtocolInterfaces failure, then ASSERT. So here set FeDriverHandle to NULL after uninstalling protocols on it in the Destructor function to avoid this issue. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* MdeModulePkg/BMMUiLib: Set Handle to NULL after uninstall protocolDandan Bi2019-04-281-1/+2
| | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1728 Currently Emulator meets ASSERT when enter setup->Continue->enter setup. When re-enter setup, the BmmDriverHandle in BMMUiLib Constructor is not NULL which cause InstallMultipleProtocolInterfaces failure, then ASSERT. So here set BmmDriverHandle to NULL after uninstalling protocols on it in Destructor function to avoid this issue. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* MdeModulePkg/DxeCapsuleLibFmp: clone ESRT for runtime accessArd Biesheuvel2019-04-232-8/+52
| | | | | | | | | | | | | | | | The DxeCapsuleLibFmp code accesses the ESRT table to decide whether a certain capsule is an FMP capsule. Since the UEFI spec mandates that the ESRT resides in EfiBootServicesData memory, this results in problems at OS runtime, since the firmware implementation itself cannot access memory that has not been virtually remapped. So let's take a private copy of the ESRT at ReadyToBoot, and store it in EfiRuntimeServicesData memory. The ESRT's size is order 10s of bytes so the memory footprint is going to be negligigble. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* MdeModulePkg/UefiBootManagerLib: fix crash on uninitialized ExitDataArd Biesheuvel2019-04-171-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As reported by Gary, the recent LoadImage/StartImage changes to accommodate dispatching PE/COFF images built for foreign architectures may result in a crash when loading an IA32 option ROM into a X64 VM running OVMF: Loading driver at 0x0007E537000 EntryPoint=0x0007E53C06D 8086100e.efi InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 7F003B98 ProtectUefiImageCommon - 0x7F002BC0 - 0x000000007E537000 - 0x000000000009F900 Image type IA32 can't be started on X64 UEFI system. ASSERT MdeModulePkg/Core/Dxe/Mem/Pool.c(698): Head->Signature == ((('p') | ('h' << 8)) | ((('d') | ('0' << 8)) << 16)) || Head->Signature == ((('p') | ('h' << 8)) | ((('d') | ('1' << 8)) << 16)) This turns out to be caused by the deferred image loading code in BDS, which ends up trying to free an uninitialized 'ExitData' pointer. Given that ExitData is never actually used, let's just get rid of it entirely. While we're at it, drop the pointless assignment of Status as well. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Gary Lin <glin@suse.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg/UefiBootManagerLib: allow foreign Driver#### imagesArd Biesheuvel2019-04-141-4/+2
| | | | | | | | | Allow PE/COFF images that must execute under emulation for Driver#### options, by removing the redundant machine type check from the BDS code. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg: Move BaseUefiTianoCustomDecompressLib toDandan Bi2019-04-104-0/+1336
| | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1683 We will remove IntelFrameworkModulePkg, but BaseUefiTianoCustomDecompressLib may still need to be used. So move BaseUefiTianoCustomDecompressLib from IntelFrameworkModulePkg to MdeModulePkg. Cc: Liming Gao <liming.gao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg: Replace BSD License with BSD+Patent LicenseMichael D Kinney2019-04-09338-2351/+338
| | | | | | | | | | | | | | | | | | | | | 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: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/PeiDebugLibDebugPpi: Add PEI debug libLiming Gao2019-04-022-0/+524
| | | | | | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1549 Add a PEI debug library instance PeiDebugLibDebugPpi base on DebugPpi. Using the combination of the DebugServicePei and this lib instance can reduce the image size of PEI drivers. Notes: this library instance can be used only the PEIM DebugSerivicePei is runed and install the gEdkiiDebugPpiGuid. And this library contian the depx of gEfiPeiPcdPpiGuid, that means the PcdPei.inf cannot use this library instance. The PcdPei.inf should use the same library instance that the PEIM DebugServicePei consumes. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Turner <Michael.Turner@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/PeiDxeDebugLibReportStatusCode: Add new APIsBret Barkelew2019-04-021-30/+147
| | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395 Add new APIs' implementation (DebugVPrint, DebugBPrint) in the DebugLib instance. These APIs would expose print routines with VaList parameter and BaseList parameter. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Turner <Michael.Turner@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/UefiBootManangerLib: Fix exception issueMing Huang2019-03-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | The system environment: virtual-CDROM(USB interface) via BMC, insert a iso file to CDROM, like ubuntu-18.04.1-server-arm64.iso, change CDROM to first boot option. With release version bios, disconnecting CDROM when boot to "1 seconds left, Press Esc or F2 to enter Setup" then system will get a exception. The root cause is the EFI_BLOCK_IO_PROTOCOL for UsbMass will be uninstalled in this situation after print some transfer error. The status will be invalid parameter. This line will get a exception for BlockIo not point to right address: AllocatePool (BlockIo->Media->BlockSize) So, here need to judge the status after ASSERT_EFI_ERROR. The Bugzilla tracker for this: https://bugzilla.tianocore.org/show_bug.cgi?id=1631 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ming Huang <ming.huang@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg/UefiBootManagerLib: fix LoadImage/StartImage status code rep.Laszlo Ersek2019-02-252-18/+48
| | | | | | | | | | | | | | | | | | | | | | | | In the EFI_RETURN_STATUS_EXTENDED_DATA structure from PI-1.7, there may be padding between the DataHeader and ReturnStatus members. The REPORT_STATUS_CODE_EX() macro starts populating the structure immediately after DataHeader, therefore the source data must provide for the padding. Extract the BmReportLoadFailure() function from EfiBootManagerBoot(), prepare a zero padding (if any) in a temporary EFI_RETURN_STATUS_EXTENDED_DATA object, and fix the REPORT_STATUS_CODE_EX() macro invocation. Cc: Dandan Bi <dandan.bi@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Star Zeng <star.zeng@intel.com> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=1539 Fixes: c2cf8720a5aad74230767a1f11bade2d86de3745 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg: Rename confusion function nameChen A Chen2019-02-251-1/+2
| | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1536 To avoid the confusion caused by function name, rename EfiBootManagerGetNextFullDevicePath to EfiBootManagerGetNextLoadOptionDevicePath. As an API function should add EFIAPI prefix for this function. Cc: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg: Add a runtime library instance of ResetSystemLibZhichao Gao2019-02-223-0/+287
| | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1461 Implement a runtime library instance of ResetSystemLib. It would use a internal point instead of gRT and convert it depend on gEfiEventVirtualAddressChangeGuid. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg: Add a new API ResetSystem for PEI ResetSystemLibZhichao Gao2019-02-221-1/+27
| | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1460 Add a new API ResetSystem for PEI ResetSystemLib to be in accord with DXE instance. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg: Add a new API ResetSystem for Null versionZhichao Gao2019-02-221-0/+27
| | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1460 Add a new API ResetSystem for BaseResetSystemLibNull to be in accord with other instances. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg: Add a new API ResetSystem for DXE ResetSystemLibZhichao Gao2019-02-221-1/+27
| | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1460 Add a new API ResetSystem for DXE ResetSystemLib. So the consumer of ResetSystemLib can use this API to reset system with additional reset data. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/SmmLockBoxLib: Support LockBox enlarge in UpdateLockBox()Hao Wu2019-02-224-8/+81
| | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1409 This commit will add the support to enlarge a LockBox when using the LockBoxLib API UpdateLockBox(). Please note that the new support will ONLY work for LockBox with attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY set. The functional uni-test for the commit is available at: https://github.com/hwu25/edk2/tree/lockbox_unitest Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Ray Ni <ray.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/SmmLockBox(PEI): Remove an ASSERT in RestoreLockBox()Hao Wu2019-02-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is out of the scope for BZ-1409. It is a refinement for the PEI library instance within SmmLockBoxLib. For the below ASSERT statement within function RestoreLockBox(): Status = SmmCommunicationPpi->Communicate ( SmmCommunicationPpi, &CommBuffer[0], &CommSize ); if (Status == EFI_NOT_STARTED) { // // Pei SMM communication not ready yet, so we access SMRAM directly // DEBUG ((DEBUG_INFO, "SmmLockBoxPeiLib Communicate - (%r)\n", Status)); Status = InternalRestoreLockBoxFromSmram (Guid, Buffer, Length); LockBoxParameterRestore->Header.ReturnStatus = (UINT64)Status; if (Length != NULL) { LockBoxParameterRestore->Length = (UINT64)*Length; } } ASSERT_EFI_ERROR (Status); It is possible for previous codes to return an error status that is possible for happen. One example is that, when the 'if' statement 'if (Status == EFI_NOT_STARTED) {' is entered, function InternalRestoreLockBoxFromSmram() is possible to return 'BUFFER_TOO_SMALL' if the caller of RestoreLockBox() provides a buffer that is too small to hold the content of LockBox. Thus, this commit will remove the ASSERT here. Please note that the current implementation of RestoreLockBox() is handling the above-mentioned error case properly, so no additional error handling codes are needed here. Cc: Jian J Wang <jian.j.wang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/SmmLockBoxLib: Use 'DEBUG_' prefix instead of 'EFI_D_'Hao Wu2019-02-223-63/+63
| | | | | | | | | | | | | | | | This commit is out of the scope for BZ-1409. It is a coding style refinement for the SmmLockBoxLib. More specifically, the commit will remove all the debug message display level macros starting with 'EFI_D_' and replace them with macros starting with 'DEBUG_'. Cc: Jian J Wang <jian.j.wang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/BmBoot: Report status when fail to load/start boot optionDandan Bi2019-02-191-6/+16
| | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1398 According to PI1.7 Spec, report extended data describing an EFI_STATUS return value along with EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR and EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED status code when fail to load or start boot option image. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg/ReportStatusCodeLib: Avoid using AllocatePool if possibleMax Knutsen2019-02-192-28/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1114 V2: simplify the code logic. update if (!mHaveExitedBootServices && (StatusCodeData != (EFI_STATUS_CODE_DATA *) StatusCodeBuffer)) { gBS->FreePool (StatusCodeData); } to if (StatusCodeData != (EFI_STATUS_CODE_DATA *) StatusCodeBuffer) { gBS->FreePool (StatusCodeData); } V3: And the code below into the else condition (stack buffer is not enough) in /DxeReportStatusCodeLib/ReportStatusCodeLib.c if (gBS == NULL || gBS->AllocatePool == NULL || gBS->FreePool == NULL) { return EFI_UNSUPPORTED; } V4: Refine code logic. When report status code with ExtendedData data, and the extended data can fit in the local static buffer, there is no need to use AllocatePool to hold the ExtendedData data. This patch is just to do the enhancement to avoid using AllocatePool. Cc: Star Zeng <star.zeng@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Michael Turner <Michael.Turner@microsoft.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg DxeCapsuleLibFmp: Update SupportCapsuleImage() for Fake CapsuleLiming Gao2019-02-111-0/+6
| | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1088 Per UEFI spec, the fake capsule image with the header only is a valid case in QueryCapsuleCpapbilities(). So, SupportCapsuleImage() is updated to support this case. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/DxeHttpLib: Use BaseLib api AsciiCharToUpperShenglei Zhang2019-01-311-23/+2
| | | | | | | | | | | | | | | Substitute HttpIoCharToUpper with AsciiCharToUpper which is a public function with the same effect. And remove the implement of HttpIoCharToUpper. https://bugzilla.tianocore.org/show_bug.cgi?id=1369 Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg/CapsuleApp: Add a function used to get next DevicePathChen A Chen2019-01-311-1/+23
| | | | | | | | | | | | | | BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1482 Add a new function to support Capsule-on-Disk feature. This function is used to get next full DevicePath from a load option. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Zhang Chao B <chao.b.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/UefiBootManagerLib: Match the nested partitionsGary Lin2019-01-311-21/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases, such as MD RAID1 in Linux, the bootloader may be in a nested EFI system partition partition. For example, sda1 and sdb1 are combined as md0 and the first partition of md0, md0p1, is an EFI system partition. Then, the bootloader can be located by the following device paths: PCI()/SATA(sda)/Partition(sda1)/Partition(md0p1)/File(bootloader.efi) PCI()/SATA(sdb)/Partition(sdb1)/Partition(md0p1)/File(bootloader.efi) To make the boot option more resilient, we may create a boot option with the short-form device path like "Partition(md0p1)/File(bootloader.efi)". However, BmMatchPartitionDevicePathNode() only matched the first partition node and ignored the nested partitions, so the firmware would refuse to load bootloader.efi since "Partition(md0p1)" doesn't match either "Partition(sda1)" or "Partition(sda2)". This commit modifies BmMatchPartitionDevicePathNode() to iterate all nested partitions so that the above boot option could work. v2 - Simplify the node matching logic Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg/VarCheckUefiLib: permit use by MM_STANDALONE modulesArd Biesheuvel2019-01-212-9/+7
| | | | | | | | | | | | Permit CheckUefiLib to be used by MM_STANDALONE modules. Since this library has a constructor, change the library's module type into BASE so its constructor prototype is compatible with MM_STANDALONE as well. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/VarCheckLib: add MM_STANDALONE supportArd Biesheuvel2019-01-161-1/+1
| | | | | | | | | | Add MM_STANDALONE to the list of permitted module types of the VarCheckLib library implementation. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>.
* MdeModulePkg/AuthVariableLibNull: add MM_STANDALONE supportArd Biesheuvel2019-01-161-1/+1
| | | | | | | | | | Add MM_STANDALONE to the list of permitted module types of the AuthVariableLibNull library implementation. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>.
* MdeModulePkg: implement NULL instance of MemoryAllocationLib library classArd Biesheuvel2019-01-163-0/+633
| | | | | | | | | | | In order to permit MM_STANDALONE modules to be built without relying on StandaloneMmPkg, provide a BASE type NULL implementation of MemoryAllocationLib. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>.
* MdeModulePkg: implement NULL instance of HobLib library classArd Biesheuvel2019-01-163-0/+600
| | | | | | | | | | In order to permit MM_STANDALONE modules to be built without relying on StandaloneMmPkg, provide a BASE type NULL implementation of HobLib. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>.
* MdeModulePkg: fix comments in BaseSortLibJaben Carsey2019-01-101-13/+9
| | | | | | | | | | | The comments are incorrect for the base version of this lib. Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/FileExplorerLib: avoid packed struct for program dataArd Biesheuvel2018-12-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Struct packing is only necessary for data structures whose in-memory representation is covered by the PI or UEFI specs, and may deviate from the ordinary C rules for alignment. So in case of FileExplorerLib, this applies to the device path struct only, and other structures used to carry program data should not be packed, or we may end up with alignment faults on architectures such as ARM, which don't permit load/store double or multiple instructions to access memory locations that are not 32-bit aligned. E.g., the following call in FileExplorerLibConstructor() InitializeListHead (&gFileExplorerPrivate.FsOptionMenu->Head); which is emitted as follows for 32-bit ARM/Thumb2 by Clang-5.0 3de0: b510 push {r4, lr} 3de2: 4604 mov r4, r0 ... 3de8: e9c4 4400 strd r4, r4, [r4] 3dec: bd10 pop {r4, pc} will perform a double-word store on the first argument, passed in register r0, assuming that the pointer type of the argument is enough to guarantee that the value is suitably aligned. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg/BaseSortLib: Enable for all module typesJeff Brasen2018-11-291-2/+2
| | | | | | | | | | Expose BaseSortLib for use in SEC and PEI phases. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>