summaryrefslogtreecommitdiff
path: root/MdePkg
AgeCommit message (Collapse)Author
2019-02-28MdePkg/Include: Add Nasm.incYao, Jiewen
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1521 This is to add CET related instruction in Nasm because CET instruction is not supported yet. See https://www.nasm.us/xdoc/2.14.02/html/nasmdocb.html Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yao Jiewen <jiewen.yao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
2019-02-21MdePkg/UefiDevicePathLibDevicePathProtocol: Add sanity check for FilePath ↵Jian J Wang
device path REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1497 Current implementation of IsDevicePathValid() is not enough for type of MEDIA_FILEPATH_DP, which has NULL-terminated string in the device path. This patch add a simple NULL character check at Length position. Cc: Liming Gao <liming.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
2019-02-21MdePkg/UefiDevicePathLib: Add sanity check for FilePath device pathJian J Wang
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1497 Current implementation of IsDevicePathValid() is not enough for type of MEDIA_FILEPATH_DP, which has NULL-terminated string in the device path. This patch add a simple NULL character check at Length position. Cc: Liming Gao <liming.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
2019-02-19MdePkg/BaseLib: Change a variable type in a bitwise operationShenglei Zhang
Change the type of variable Chr from CHAR8 to UINT32 in a bitwise operation, to make the two variables in the operation have the same size. https://bugzilla.tianocore.org/show_bug.cgi?id=1527 Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2019-02-19MdePkg/StatusCodeDataTypeId.h: Add new definition per PI1.7 SpecDandan Bi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1398 According to PI1.7 Spec, add the new definition EFI_RETURN_STATUS_EXTENDED_DATA in StatusCodeDataTypeId.h Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Laszlo Ersek <lersek@redhat.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>
2019-02-15MdePkg: Support EFI_PEI_CORE_FV_LOCATION_PPIChasel, Chiu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1524 Add EFI_PEI_CORE_FV_LOCATION_PPI definition basing on PI spec 1.7, Section 6.3.9. This PPI can support the secnario that PEI Foundation not in BFV. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chasel Chiu <chasel.chiu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
2019-02-14MdePkg: Change function parameter typeShenglei Zhang
Change type of parameter Opcode from UINT16 to UINTN in EFI_S3_SAVE_STATE_WRITE and EFI_S3_SAVE_STATE_INSERT. According to PI 1.6(Errata A), the type of Opcode in EFI_S3_SAVE_STATE_WRITE and EFI_S3_SAVE_STATE_INSERT should be UINTN not UINT16. https://bugzilla.tianocore.org/show_bug.cgi?id=1517 Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2019-02-12MdePkg/BaseLib: implement SpeculationBarrier() for ARM and AArch64Ard Biesheuvel
Replace the dummy C implementation of SpeculationBarrier() with implementations consisting of the recommended DSB SY + ISB sequence, as recommended by ARM in the whitepaper "Cache Speculation Side-channels" version 2.4, dated October 2018. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2019-02-02MdePkg: Fix coding style issuesBi, Dandan
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1478 Fix issues that reported by Edk2 coding style check tool(ECC) that: in Comment, <@param SystemTable> does NOT consistent with parameter name MmSystemTable. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
2019-02-02MdePkg/BaseLib: Add Base64Encode() and Base64Decode()Mike Turner
Introduce public functions Base64Encode and Base64Decode. https://bugzilla.tianocore.org/show_bug.cgi?id=1370 v2:1.Remove some white space. 2.Add unit test with test vectors in RFC 4648. https://github.com/shenglei10/edk2/tree/encode_test https://github.com/shenglei10/edk2/tree/decode_test v3:1.Align white space. 2.Update comments of Base64Encode and Base64Decode. 3.Change the use of macro RETURN_DEVICE_ERROR to RETURN_INVALID_PARAMETER in string.c. v4:Change parameters' names. v5:1.Update usage of variables. 2.Remove debug message in Base64Decode(). Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2019-01-31MdePkg/UefiLib: Add a new API GetVariable3Bret Barkelew
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1396 Add a new API GetVariable3, which can return the attributes of a variable during reading it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jiansong Xu <jiansongx.xu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2019-01-31MdePkg/UefiDevicePathLib: Add a checking stepMike Turner
Add a checking step in DevicePathUtilities.c to verify DevicePath. https://bugzilla.tianocore.org/show_bug.cgi?id=1372 v2: Remove ASSERT() and the redundant checking step. Update related description. Cc: Liming Gao <liming.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2019-01-31MdePkg/BaseLib: Remove definitions of two functionsShenglei Zhang
InternalCharToUpper and InternalBaseLibAsciiToUpper are internal functions and now we will introduce public functions that have the same effects. So I remove their definitions in BaseLibInternals.h. https://bugzilla.tianocore.org/show_bug.cgi?id=1369 Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
2019-01-31MdePkg/BaseLib: Introduce CharToUpper and AsciiCharToUpper publiclyMike Turner
Introduce two public functions CharToUpper and AsciiCharToUpper. They have the same functions as InternalCharToUpper and InternalBaseLibAsciiToUpper.Considering the internal functions will be removed,so directly I change their function names to the public ones'. https://bugzilla.tianocore.org/show_bug.cgi?id=1369 Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
2019-01-31MdePkg/IndustryStandard: Remove an incorrectly spelled macroBret Barkelew
EFI_RETURNING_FROM_EFI_APPLICATOIN is not correctly spelled, so now remove it. https://bugzilla.tianocore.org/show_bug.cgi?id=1368 Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2019-01-31MdePkg/IndustryStandard: Introduce a correctly spelled macroBret Barkelew
EFI_RETURNING_FROM_EFI_APPLICATOIN is incorrect. Before removing it, introduce the correctly spelled one, EFI_RETURNING_FROM_EFI_APPLICATION. https://bugzilla.tianocore.org/show_bug.cgi?id=1368 Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2019-01-31MdePkg/UefiSpec.h: Add definition to support Capsule-on-Disk featureChen A Chen
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1482 UEFI Spec define this definition to support Capsule-on-Disk. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@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: Ray Ni <ray.ni@intel.com>
2019-01-31MdePkg/BasePeCoffLib: skip runtime relocation if reloc info is invalidHsueh, Hong-chihX
Skip runtime relocation for PE images that provide invalid relocation infomation (ex: RelocDir->Size = 0) to fix a hang observed while booting Windows. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Neo Hsueh <hong-chihx.hsueh@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Bi Dandan <dandan.bi@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2019-01-31MdePkg/UefiGpt.h: Add new definition for enable GPT supportChen A Chen
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1470 This definition comes from UEFI Spec to support GPT in FatPei driver. Cc: Liming Gao <liming.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@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: Liming Gao <liming.gao@intel.com>
2019-01-28MdeModulePkg:Tpm2Acpi.h: Upgrade UEFI supporting TCG spec infoZhang, Chao B
Update "TCG ACPI Specification Level 00 Revision 00.37" to "TCG ACPI Specification 1.2 Revision 8" https://trustedcomputinggroup.org/wp-content/uploads/TCG_ACPIGeneralSpecification_v1.20_r8.pdf Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yao Jiewen <jiewen.yao@intel.com> Signed-off-by: Zhang, Chao B <chao.b.zhang@intel.com> Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
2019-01-21MdePkg/UefiDevicePathLib: permit use by MM_STANDALONE modulesArd Biesheuvel
Add MM_STANDALONE to the list of module types that are permitted to link to this library. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
2019-01-21MdePkg/BasePeCoffLib: Correct the address of RelocBaseEndDandan Bi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1426 When calculating the address of RelocBaseEnd, the RelocBase address is ImageBase + RelocDir->VirtualAddress, the size of RelocDir is RelocDir->Size. So the RelocBaseEnd address is: ImageBase + RelocDir->VirtualAddress + RelocDir->Size - 1 not ImageBase + RelocDir->VirtualAddress + RelocDir->Size This patch is to fix this issue when call PeCoffLoaderImageAddress function to calculate the address of RelocBaseEnd. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Tested-by: Gary Lin <glin@suse.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2019-01-16MdePkg: add MM_STANDALONE implementation of MmServicesTableLibArd Biesheuvel
The newly introduced generic MmServicesTableLib can be implemented for traditional SMM (as we did already), but MM_STANDALONE drivers require an implementation that is based on standalone MM. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
2019-01-16MdePkg: introduce standalone MM entry point library implementationArd Biesheuvel
Add an implementation of the StandaloneMmDriverEntryPoint library class. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2019-01-16MdePkg: introduce standalone MM entry point library classArd Biesheuvel
Add the library interface for the standalone MM driver entry point. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2019-01-16MdePkg/BasePeCoffLib: Add more check for relocation dataDandan Bi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1426 V2: (1) Add NULL pointer check for the input parameters (2) Add check for the "Adjust" value before applying fix ups. In function PeCoffLoaderRelocateImageForRuntime, it doesn't do much check when do relocation. For API level consideration, it's not safe enough. So this patch is to replace the same code logic with function PeCoffLoaderImageAddress which will cover more validation. Cc: Michael D Kinney <michael.d.kinney@intel.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>
2019-01-14MdePkg: implement MmServicesTableLib based on traditional SMMArd Biesheuvel
The definitions of the rebranded MM protocol stack were chosen such that the existing SMM based core drivers can be reused. So let's implement MmServicesTableLib based on gEfiMmBaseProtocolGuid, which is simply gEfiSmmBase2ProtocolGuid under the hood. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2019-01-14MdePkg/Include: add MmServicesTableLib header fileJagadeesh Ujja
SMM has been rebranded as MM, and can be implemented in traditional mode or standalone mode, using the same prototype for the services table. Expose this table via MmServicesTableLib, permitting the respective implementations to expose a traditional or standalone version. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jagadeesh Ujja <jagadeesh.ujja@arm.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2019-01-10MdePkg/UefiLib: Abstract driver model protocol uninstallationAshish Singhal
Provided functions in UEFILib that abstract driver model protocol uninstallation. This helps drivers to install and uninstall protocols using a library to keep things seemless. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1429 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2019-01-08Revert "MdePkg: avoid __builtin_unreachable() on GCC v4.4"Laszlo Ersek
This reverts commit 357cec385d4f ("MdePkg: avoid __builtin_unreachable() on GCC v4.4", 2016-07-21). We've removed BaseTools support for GCC44..GCC47, therefore we need not catch the GCC44 corner case for __builtin_unreachable(). No GCC44..GCC47 references remain under MdePkg after this patch. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Liming Gao <liming.gao@intel.com> Cc: Marvin Haeuser <Marvin.Haeuser@outlook.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Marvin Haeuser <Marvin.Haeuser@outlook.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-12-25MdePkg/BaseLib: Introduce new SpeculationBarrier APIHao Wu
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1417 X86 specific BaseLib API AsmLfence() was introduced to address the Spectre Variant 1 (CVE-2017-5753) issue. The purpose of this API is to insert barriers to stop speculative execution. However, the API is highly architecture (X86) specific, and thus should be avoided using across generic code. To address this issue, this patch will add a new BaseLib API called SpeculationBarrier(). Different architectures will have different implementations for this API. For IA32 and x64, the implementation of SpeculationBarrier() will directly call AsmLfence(). For ARM and AARCH64, this patch will add a temporary empty implementation as a placeholder. We hope experts in ARM can help to contribute the actual implementation. For EBC, similar to the ARM and AARCH64 cases, a temporary empty implementation is added. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-12-20MdePkg/Arm/ProcessorBind.h: fix copy/paste errorArd Biesheuvel
Instead of #defining MAX_ALLOC_ADDRESS to MAX_ADDRESS as intended, it is #defined to itself, causing all ARM builds to break. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2018-12-20MdePkg/Base: introduce MAX_ALLOC_ADDRESSArd Biesheuvel
On some architectures, the maximum representable address deviates from the virtual address range that is accessible by the firmware at boot time. For instance, on AArch64, UEFI mandates a 4 KB page size, which limits the address space to 48 bits, while more than that may be populated on a particular platform, for use by the OS. So introduce a new macro MAX_ALLOC_ADDRESS, which represent the maximum address the firmware should take into account when allocating memory ranges that need to be accessible by the CPU at boot time. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-12-13MdePkg/BaseMemoryLibOptDxe ARM: add missing function annotationsArd Biesheuvel
ARM uses the low order bit of a branch target address to decide in which execution mode (ARM or Thumb) a function needs to be called. In order for this to work across object files, ELF function symbols will have the low bit set if they were emitted in Thumb mode and cleared otherwise. This annotation is only emitted if the ELF symbols are annotated as function, since taking the address of some data symbol (e.g., a literal) should not produce a value with the low bit set, even if it appears in an object file containing Thumb code. This means that all functions coded in assembler must have this function annotation, or they may end up getting called in the wrong mode, crashing the program. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-12-07Revert "MdePkg/ProcessorBind.h AARCH64: limit MAX_ADDRESS to 48 bits"Ard Biesheuvel
This reverts commit 82379bf6603274e81604d5a6f6bb14bdde616286. On AArch64, we can only use 48 address bits while running in UEFI, while the GCD and UEFI memory maps may describe up to 52 bits of physical address space. For this reason, MAX_ADDRESS was reduced to 48 bits, to ensure that the firmware does not inadvertently attempt to allocate memory that we cannot access. However, MAX_ADDRESS is used in runtime drivers as well, and runtime drivers may deal with kernel virtual addresses, which have bits [63:48] set. In fact, the OS may be running with 64 KB pages and pass addresses into the runtime services that use up to 52 bits of address space, either with the top bits set or cleared, even if the physical address space does not extend beyond 48 bits. In summary, changing MAX_ADDRESS is a mistake, and needs to be reverted. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2018-11-29MdePkg/ProcessorBind.h AARCH64: limit MAX_ADDRESS to 48 bitsArd Biesheuvel
AArch64 supports the use of more than 48 bits for physical and/or virtual addressing, but only if the page size is set to 64 KB, which is not supported by UEFI. So redefine MAX_ADDRESS to cover only 48 address bits. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-11-27MdePkg ACPI: fix the typos in Acpi61.h and Acpi62.hGary Lin
The GUID for VIRTUAL_CD_REGION_PERSISTENT was using the closing square bracket mistakenly. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
2018-11-21MdePkg: Check input Ptrs in GetSectionFromAnyFvByFileTypeDandan Bi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1337 In function GetSectionFromAnyFvByFileType, the input parameter "Buffer" and "size" should not be NULL, so add ASSERT here to avoid any checker report that the NULL pointer may be used. Cc: Michael D Kinney <michael.d.kinney@intel.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>
2018-11-21MdePkg: check Length para before use in DevPathToTextUsbWWIDDandan Bi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1336 In function DevPathToTextUsbWWID, the Length parameter is used without check. This patch is to add check before using it. Cc: Michael D Kinney <michael.d.kinney@intel.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>
2018-11-20SecurityPkg: TCG Add more Event typeZhang, Chao B
Add more event log type defined in TCG PTP spec 00.51 https://trustedcomputinggroup.org/wp-content/uploads/PC-ClientSpecific_Platform_Profile_for_TPM_2p0_Systems_v51.pdf Cc: Yao Jiewen <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhang, Chao B <chao.b.zhang@intel.com> Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
2018-11-15MdePkg/BaseIoLibIntrinsicArmVirt ARM: avoid double word loads and storesArd Biesheuvel
BaseIoLibIntrinsicArmVirt was created to prevent LTO from merging accesses to MMIO regions, resulting in instructions with multiple output registers that KVM on ARM cannot emulate (since the exception syndrome information that KVM relies on can only describe a single output register) However, using double word loads on ARM amounts to the same thing, and so code that relies on doing 64-bit MMIO to regions that are emulated under KVM (such as the GICv3 TYPER register) will still suffer from the original issue. So replace ldrd and strd with equivalent two instruction sequences. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2018-11-11MdePkg BaseUefiDecompressLib: Fix UEFI Decompression logic issueLiming Gao
https://bugzilla.tianocore.org/show_bug.cgi?id=1317 This is a regression issue caused by 2ec7953d49677142c5f7552e9e3d96fb406ba0c4. In Decode() function, once mOutBuf is fully filled, Decode() should return. Current logic misses the checker of mOutBuf after while() loop. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-11-11MdePkg: Fix incorrect check for DisplayOnly text format in AcpiExDandan Bi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1312 Text format for AcpiEx device path in UEFI Spec: AcpiEx(HID,CID,UID,HIDSTR,CIDSTR,UIDSTR) AcpiEx(HID|HIDSTR,(CID|CIDSTR,UID|UIDSTR))(Display Only) When convert device path to text for AcpiEx device path, current code check AllowShortcuts parameter to convert the device path to DisplayOnly text format(shorter text representation) by mistake. It should check DisplayOnly parameter. This commit is to fix this issue. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.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>
2018-11-08MdePkg/BaseSynchronizationLib: Fix InternalSync[De|In]crementRuiyu Ni
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1303 Today's code generates assembly code as below for InternalSyncIncrement: __asm__ __volatile__ ( "movl $1, %%eax \n\t" "lock \n\t" "xadd %%eax, %1 \n\t" "inc %%eax \n\t" : "=a" (Result), // %0 "+m" (*Value) // %1 : // no inputs that aren't also outputs : "memory", "cc" ); 0: 55 pushl %ebp 1: 89 e5 movl %esp, %ebp 3: 8b 45 08 movl 8(%ebp), %eax 6: b8 01 00 00 00 movl $1, %eax b: f0 lock c: 0f c1 00 xaddl %eax, _InternalSyncIncrement(%eax) f: 40 incl %eax 10: 5d popl %ebp 11: c3 retl Line #3 and Line #6 both use EAX as destination register. Line #c uses EAX and (EAX). The output operand "=a" tells GCC that EAX is used for output. But GCC only assumes that EAX will be used in the very last instruction. Per GCC document, "Use the '&' constraint modifier on all output operands that must not overlap an input. Otherwise, GCC may allocate the output operand in the same register as an unrelated input operand, on the assumption that the assembler code consumes its inputs before producing outputs. This assumption may be false if the assembler code actually consists of more than one instruction." "=&a" should be used to tell GCC not use EAX before the assembly. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Suggested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Fixes: 8a94eb9283fa09a30f5f06f0c12cf0ee4e14fbcf Fixes: 17634d026f968c404b039a8d8431b6389dd396ea
2018-11-02MdePkg/Base.h: Implement BASE_CR() via OFFSET_OF().Marvin.Haeuser@outlook.com
Replace the current NULL pointer dereference to retrieve Field's offset with a call to OFFSET_OF(). This is implemented via __builtin_offsetof for GCC and Clang, which eliminates UB caught by Clang UndefinedBehaviorSanitizer. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-10-24MdePkg: Handle AcpiExp device path when optional para is not specifiedDandan Bi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1243 AcpiExp text device path: AcpiExp(HID,CID,UIDSTR) And according to UEFI spec, the CID parameter is optional and has a default value of 0. But current implementation miss to check following cases for the AcpiExp. FromText:when text device is AcpiExp(HID,,UIDSTR)/AcpiExp(HID,0,UIDSTR) ToText: when the CID is 0 in the node structure This commit is to do the enhancement. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.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: Ruiyu Ni <ruiyu.ni@intel.com>
2018-10-24MdePkg: Handle USBxxx device path when optional para is not specifiedDandan Bi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1243 According to UEFI spec, for the Messaging Device Path with USB Class SubType, some paras are optional in the text device path. Take UsbClass(VID,PID,Class,SubClass,Protocol) for example, The VID is an integer between 0 and 65535 and is optional. The default value is 0xFFFF. The PID is an integer between 0 and 65535 and is optional. The default value is 0xFFFF. The Class is an integer between 0 and 255 and is optional. The default value is 0xFF. The SubClass is an integer between 0 and 255 and is optional. The default value is 0xFF. The Protocol is an integer between 0 and 255 and is optional. The default value is 0xFF. So if any the optional para is not specified in the text device, we should set related para in the node structure to default value. This commit is to do the enhancement for USB Class device path when optional para is not specified Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.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: Ruiyu Ni <ruiyu.ni@intel.com>
2018-10-24MdePkg: Handle Sata device path when optional para is not specifiedDandan Bi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1243 Sata device path format:Sata(HPN, PMPN, LUN) According to UEFI Spec, the PMPN is an integer between 0 and 65535 and is optional. If not provided, the default is 0xFFFF. This commit is to do the enhancement for Sata device path when optional para is not specified. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.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: Ruiyu Ni <ruiyu.ni@intel.com>
2018-10-24MdePkg-BaseLib: Fix PathCleanUpDirectories() issue with "\\..\\.."Jim.Dailey@dell.com
Replace multiple, consecutive "\" characters prior to other processing involving "\" characters. This fixes an issue where "\\..\\..", "//..//..", and similar input paths are not cleaned properly. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jim Dailey <jim_dailey@dell.com> Reviewed-by: Ruiyu Ni <Ruiyu.ni@Intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-10-24MdePkg: Add more checker in UefiDecompressLib to access the valid buffer ↵Liming Gao
only (CVE FIX) Fix CVE-2017-5731,CVE-2017-5732,CVE-2017-5733,CVE-2017-5734,CVE-2017-5735 https://bugzilla.tianocore.org/show_bug.cgi?id=686 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Holtsclaw Brent <brent.holtsclaw@intel.com> Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com>