summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library
Commit message (Collapse)AuthorAgeFilesLines
* MdePkg/DxeRngLib: make mSecureHashAlgorithms staticGerd Hoffmann7 days1-1/+1
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* MdePkg: CodeQL Fixes.Michael Kubacki2024-11-0110-193/+459
| | | | | | | | | | | | | Includes changes across the repo for the following CodeQL rules: - cpp/comparison-with-wider-type - cpp/overflow-buffer - cpp/redundant-null-check-param - cpp/uselesstest Co-authored-by: Taylor Beebe <tabeebe@microsoft.com> Co-authored-by: kenlautner <85201046+kenlautner@users.noreply.github.com> Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
* MdePkg: MdeLibs.dsc.inc: Introduce CUSTOM_STACK_CHECK_LIB MacroOliver Smith-Denny2024-10-041-7/+75
| | | | | | | | | | | | | In order to support a platform overriding StackCheckLibNull provided by MdeLibs.dsc.inc, the CUSTOM_STACK_CHECK_LIB macro is introduced. If this macro is defined, MdeLibs.dsc.inc will not link StackCheckLibNull and it is expected that the platform will link the version(s) of StackCheckLib that it requires. The StackCheckLib README is also updated in this patch to document the new macro and provide additional information. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* MdePkg: Improving readability of CVE patch for PeCoffLoaderRelocateImageDoug Flick2024-10-021-1/+1
| | | | | | | | | | This change adds parantheses to the if condition detecting overflow in the PeCoffLoaderRelocateImage function to improve readability. Follow on change for: REF!: https://github.com/tianocore/edk2/pull/6249 Signed-off-by: Doug Flick <dougflick@microsoft.com>
* MdePkg: add various additional functions to BaseFdtLibLeif Lindholm2024-10-021-0/+157
| | | | | | | | | | | | - FdtOffsetPointer - FdtParentOffset - FdtNodeOffsetByPhandle - FdtStringListContains - FdtGetAliasNameLen - FdtPathOffsetNameLen - FdtPathOffset Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
* MdePkg: export additional Property functions from BaseFdtLibLeif Lindholm2024-10-021-0/+75
| | | | | | | | - FdtSetPropU64 - FdtAppendProp - FdtDelProp Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
* MdePkg: export FdtAddressCells/FdtSizeCells from BaseFdtLibLeif Lindholm2024-10-021-0/+36
| | | | Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
* MdePkg: export FdtOpenInto/FdtPack from BaseFdtLibLeif Lindholm2024-10-021-0/+37
| | | | Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
* MdePkg: align BaseFdtLib function prototypesLeif Lindholm2024-10-021-4/+5
| | | | | | | | | | | FdtLib.h uses CONST FDT_PROPERTY * return values for some wrapper functions, but the implementation in FdtLib.c used to original CONST struct fdt_property * instead of the exported typedef. Import LibFdt.h in the implementation file and make the implementation consistent with the declaration. Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
* MdePkg: add FdtStrerror wrapper to BaseFdtLibLeif Lindholm2024-10-021-0/+11
| | | | | | | Add a wrapper for fdt_strerror () and add the currently supported error code defines from submodule. Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
* MdePkg: consistently use "Property" in BaseFdtLibLeif Lindholm2024-10-021-2/+2
| | | | | | | | | | | There is currently a mix on functions named as Prop or Property. The latter is in majority, and the better fit for tianocore coding style, so rename FdtNodeOffsetByPropValue () and FdtSetProp () for consistency. To avoid breaking bisect, change existing users in UefiPayloadPkg. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
* MdePkg,UefiPayloadPkg: improve BaseFdtLib memreserve helper styleLeif Lindholm2024-10-021-10/+10
| | | | | | | | | | | | | | | | | | FdtNumRsv and FdtGetMemRsv were added for the benefit of UefiPayloadPkg, but their naming matches neither upstream libfdt nor tianocore coding style rules. And there was scope for improvement of the doxygen descriptions as well. These functions currently have only one in-tree user, UefiPayloadPkg FdtParserLib. So rename them more conformant FdtGetNumberOfReserveMapEntries and FdtGetReserveMapEntry and update the description comment blocks, at the same time as updating the existing user. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
* MdePkg: Fix overflow issue in BasePeCoffLibDoug Flick2024-09-301-1/+1
| | | | | | | | | | The RelocDir->Size is a UINT32 value, and RelocDir->VirtualAddress is also a UINT32 value. The current code does not check for overflow when adding RelocDir->Size to RelocDir->VirtualAddress. This patch adds a check to ensure that the addition does not overflow. Signed-off-by: Doug Flick <dougflick@microsoft.com> Authored-by: sriraamx gobichettipalayam <sri..@intel.com>
* MdePkg: Add reserved mem fdt helpersDhaval2024-09-141-0/+41
| | | | | | | Devicetree defines a short hand way of defining reserved memory ranges. Add APIs to access such nodes Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
* MdePkg/DxeRngLib: Add gEfiRngAlgorithmArmRndr to the secure algorithmsPierre Gondois2024-09-132-0/+10
| | | | | | | | | | | | DxeRngLib iterates over a list of secure algorithms before trying to use the default algorithm provided by the Rng protocol. Add gEfiRngAlgorithmArmRndr to this list. The algorithm represented by this GUID is a secure DRBG of an unknown type, implemented by the aarch64 RNDR instruction. On AARCH64 platform, use the RNDR instruction as the first option if it is available. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
* MdePkg/DxeRngLib: Use PcdEnforceSecureRngAlgorithms for default algorithmPierre Gondois2024-09-132-5/+10
| | | | | | | | | Use PcdEnforceSecureRngAlgorithms to allow using the Rng protocol with the default algorithm. All previous call to the Rng protocol are requesting a secure Rng algorithm. Not specifying the Rng algorithm GUID to use is considered unsecure. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
* MdePkg/DxeRngLib: Refactor Rng algorithm selectionPierre Gondois2024-09-132-31/+158
| | | | | | | | | | | Add a library constructor which: - locate the RNG prototocol and keep a reference to it in order to avoid locating it multiple times (for each random number generation) - check which secure algorithm is available on the platform. This avoids to try each secure algorithm until finding one available for each random number generation call. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
* MdePkg: Remove Old Stack Check Lib ImplementationOliver Smith-Denny2024-09-134-114/+0
| | | | | | | Now that the new stack check lib implementation is being used everywhere, remove the old one. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* MdePkg: Create Stack Check LibTaylor Beebe2024-09-1311-0/+463
| | | | | | | | | | | | | | | | | | StackCheckLib contains the required functionality for initializing the stack cookie value, checking the value, and triggering an interrupt when a mismatch occurs. The stack cookie is a random value placed on the stack between the stack variables and the return address so that continuously writing past the stack variables will cause the stack cookie to be overwritten. Before the function returns, the stack cookie value will be checked and if there is a mismatch then StackCheckLib handles the failure. Because UEFI doesn't use the C runtime libraries provided by MSVC, the stack check code is written in assembly within this library. GCC and Clang compilers have built-in support for stack cookie checking, so this library only handles failures. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* MdePkg: Create Stack Check Null LibsTaylor Beebe2024-09-139-0/+208
| | | | | | | | | | | | | | | | | | | | | Add Null libs for Stack Check and Stack Check Failure Hook Lib that allow a platform to opt out of stack checks and the stack check failure hook lib. StackCheckLib allows implementation (or in this case null implementation) of stack checks on binaries. There is a Host Application specific version of this null lib because MSVC host applications must not be linked against our lib (so the file here is a no-op but that doesn't cause the build system to fail the build for not building a file for MSVC) as it links against the MSVC C runtime lib that provides the stack cookie definitions. GCC host applications do not link against such a C runtime lib and must be linked against our version. StackCheckFailureHookLib lets a platform do custom functionality when a stack check failure occurs (such as log it to a platform defined mechanism). The null lib simply returns. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* MdePkg: Move CompilerIntrinsicsLib from ArmPkgOliver Smith-Denny2024-09-1244-0/+2762
| | | | | | | | | | | | | | | | | | | | As per the emailed RFC in https://edk2.groups.io/g/devel/topic/rfc_move/107675828, this patch moves CompilerIntrinsicsLib from ArmPkg to MdePkg as this library provides compiler intrinsics, which are industry standard. This aligns with the goal of integrating ArmPkg into existing packages: https://bugzilla.tianocore.org/show_bug.cgi?id=4121. The newly placed CompilerIntrinsicsLib is added to MdeLibs.dsc.inc as every DSC that builds ARM/AARCH64 needs this library added. The old location is removed from every DSC in edk2 in this commit also to not break bisectability with minimal hoop jumping. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* Refactor SetMemWrapper to reduce binary sizeAshraf Ali2024-09-1121-246/+392
| | | | | | | | | | | | Moved SetMemN API to a separate file to eliminate unnecessary inclusion of InternalMemSetMem64 and InternalMemSetMem32 APIs in driver binary. When the compiler linking the Object files it may not remove all the unused from NASM OBJs. This change is to reorganize the C files to minimize the impact of the NASM behavior resulting is code size reduction. Signed-off-by: Ashraf Ali <ashraf.ali.s@intel.com>
* MdePkg/BaseLib: Add NULL version Tdx functions for other architecturesCeping Sun2024-09-091-0/+5
| | | | | | | | | | | | | | Currently, the NULL version Tdx functions are only built for Ia32. In BaseLib, the others architectures also need such NULL version Tdx functions. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Min Xu <min.m.xu@intel.com> Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
* MdePkg: Fix a buffer overread.John Baldwin2024-09-031-1/+2
| | | | | | | | | | | | | | DevPathToTextUsbWWID allocates a separate copy of the SerialNumber string to append a null terminator if the original string is not null terminated. However, by using AllocateCopyPool, it tries to copy 'Length + 1' words from the existing string containing 'Length' characters into the target string. Split the copy out to only copy 'Length' characters instead. This was reported by GCC's -Wstringop-overread when compiling a copy of this routine included in a library on FreeBSD. Signed-off-by: John Baldwin <jhb@FreeBSD.org>
* MdePkg: Remove duplicate source from BaseMemoryLib INF filesAshraf Ali2024-08-315-116/+13
| | | | Signed-off-by: Ashraf Ali <ashraf.ali.s@intel.com>
* MdePkg: Rename the LoongArch CSR 0x20 registerChao Li2024-08-301-12/+12
| | | | | | | | | | | | | Added a new name for CSR 0x20 because LoongArch SPEC has adjustd the CSR 0x20 register name. Ref: LoongArch Reference Manual Vol 1, Seciton 7.1. https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#control-and-status-registers Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn>
* MdePkg:BaseArmTrngLibNull: Assert causing FVP stallingPrachotan Reddy Bathi2024-08-291-1/+1
| | | | | | | | FVP Base Revc doesn't support Trng. ASSERT (FALSE) is causing the boot to stall. Replacing ASSERT with ERROR log. Signed-off-by: Prachotan Reddy Bathi <Prachotan.Bathi@arm.com>
* MdePkg: Fix build error after enable FDT support.Linus Liu2024-08-281-2/+5
| | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4786 Disable some compiling warnings caused by submodule code. Those can be removed later once issues fixed by submodule owner. Signed-off-by: Linus Liu <linus.liu@intel.com>
* MdePkg/BaseFdtLib: Add FdtNodeOffsetByCompatible()Nhi Pham2024-08-281-0/+20
| | | | | | | This adds FdtNodeOffsetByCompatible() to support finding the offset of the first node with a given 'compatible' value after an offset. Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
* MdePkg/BaseLib: Add CRC16 CCITT False Implementation.kuqin122024-08-061-0/+69
| | | | | | | | | | | | | | This change is added to incorporate basic implementation for CRC16-CCITT-FALSE algorithm. This function is useful for providing CRC16 value used in other data structures that requires CRC16 value that complies with JEDEC SPD requirements, i.e. BDAT table. The lookup table is inherited from `https://crccalc.com/` and the result values are also compared against this site. Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
* MdePkg: Fix some spelling mistakes found by cspellRebecca Cran2024-08-014-31/+31
| | | | | | | | | | | When cspell is installed (via `npm install cspell`), CI checks for spelling mistakes. There are currently a very large number of them: some are genuine mistakes while others are words or acryonyms that cspell doesn't know. Fix a few of the misspellings in MdePkg. Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
* MdePkg/BaseRngLib: Prefer ArmReadIdAA64Isar0Reg() over ArmReadIdIsar0()Pierre Gondois2024-08-015-82/+2
| | | | | | | | | | | | | | | A ArmReadIdAA64Isar0Reg() function was recently added to BaseLib. Use it instead of its ArmReadIdIsar0() equivalent, which was private to the BaseRngLib library. This also allows to avoid the confusion between the following registers: - ID_ISAR0_EL1: allows to probe for Divide instructions, Debug instructions, ... - ID_AA64ISAR0_EL1: AARCH64 specific register allowing to probe for AESE, RNDR, ... instructions Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
* MdePkg/BaseLib: AARCH64: Add ArmReadIdAA64Isar0Reg()Pierre Gondois2024-08-013-0/+62
| | | | | | | | | | | | | | To enable AARCH64 native instruction support for Openssl, some interfaces must be implemented. OPENSSL_cpuid_setup() allows to probe the supported features of the platform. Add ArmReadIdAA64Isar0Reg() to read the AA64Isar0, containing Arm64 instruction capabilities. A similar ArmReadIdAA64Isar0() function is available in the ArmPkg, but the CryptoPkg where OPENSSL_cpuid_setup will reside cannot rely on the ArmPkg. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
* MdePkg/BaseLib: AARCH64: Add ArmReadCntPctReg()Pierre Gondois2024-08-013-1/+63
| | | | | | | | | | | | | To enable AARCH64 native instruction support for Openssl, some interfaces must be implemented. OPENSSL_rdtsc() requests an access to a counter to get some non-trusted entropy. Add ArmReadCntPctReg() to read system count. A similar ArmReadCntPct() function is available in the ArmPkg, but the CryptoPkg where OPENSSL_rdtsc will reside cannot rely on the ArmPkg. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
* MdePkg/BaseLib: Optimize LOONGARCH64 csr usageDongyan Qian2024-07-172-9/+7
| | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4812 When the Select is out of support, use method break exception instead of method return -1, avoid unknown errors caused by untimely detection. Cc: Chao Li <lichao@loongson.cn> Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
* MdePkg/UefiDebugLibDebugPortProtocol: ExitBootServicesCallback() staticMichael Kubacki2024-07-161-2/+3
| | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3083 Since this is a library, make the function ExitBootServicesCallback() STATIC to prevent the likelihood that it collides with other symbols. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
* MdePkg/Library: Add RISCV64 support to BaseRngLibDhaval2024-07-153-0/+304
| | | | | | | | | | | | | | | The ratified RISC-V crypto scalar extensions provide entropy bits via the seed CSR, as exposed by the Zkr extension. The Zkr extension is ratified and provides 16 bits of entropy seed when reading the SEED CSR. Guarded by a RISCV64 Feature PCD, 64-bit random numbers can be accumulated from the `seed` CSR. This driver is based on the driver in the Linux kernel. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com> Co-authored-by: Tim Wawrzynczak <tim@rivosinc.com>
* MdePkg/StandaloneMmServicesTableLib: Support MM_CORE_STANDALONEJiaxin Wu2024-07-051-1/+1
| | | | | | Support the module type for MM_CORE_STANDALONE Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
* MdePkg/BaseLib: Fix an instruction write width error in LoongArch64Dongyan Qian2024-06-261-1/+1
| | | | | | | | | | | | Cpucfg fetch is a 32-bit register, and AsmCpucfg's function declaration is a 32-bit address storage operation in BaseLib.h, So, fix it by replacing stptr.d with stptr.w instrcution. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4797 Cc: Chao Li <lichao@loongson.cn> Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn> Co-authored-by: Chao Li <lichao@loongson.cn>
* MdePkg/X86UnitTestHost: set rdrand cpuid bitGerd Hoffmann2024-06-141-1/+10
| | | | | | | Set the rdrand feature bit when faking cpuid for host test cases. Needed to make the CryptoPkg test cases work. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* MdePkg/BaseRngLib: Add a smoketest for RDRAND and check CPUIDPedro Falcato2024-06-131-8/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RDRAND has notoriously been broken many times over its lifespan. Add a smoketest to RDRAND, in order to better sniff out potential security concerns. Also add a proper CPUID test in order to support older CPUs which may not have it; it was previously being tested but then promptly ignored. Testing algorithm inspired by linux's arch/x86/kernel/cpu/rdrand.c :x86_init_rdrand() per commit 049f9ae9.. Many thanks to Jason Donenfeld for relicensing his linux RDRAND detection code to MIT and the public domain. >On Tue, Nov 22, 2022 at 2:21 PM Jason A. Donenfeld <Jason@zx2c4.com> wrote: <..> > I (re)wrote that function in Linux. I hereby relicense it as MIT, and > also place it into public domain. Do with it what you will now. > > Jason BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4163 Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Jason A. Donenfeld <Jason@zx2c4.com>
* MdePkg/BaseLib: Let CpuDeadLoop() be breakable in debuggerRay Ni2024-06-121-2/+4
| | | | | | | | | | | | | | | | | | | Starting from certain version of Visual Studio C compiler (I don’t have the exact version. I am using VS2019), CpuDeadLoop is optimized quite well by compiler. The compiler does not generate instructions that jump out of the loop when the "Index" is non-zero. It becomes harder/impossible for developers to break out of the dead-loop in debugger. The new version of CpuDeadLoop() compares a volatile global to a volatile local. This forces 2 reads and a comparison on every loop iteration. The local variable can be set to 1 to exit the loop without modifying the global variable. Using VS2019 with max opt enabled, The dead-loop can be exit by setting Index to 1 in a debugger. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
* MdePkg/BaseRngLib AARCH64: Remove overzealous ASSERT()Ard Biesheuvel2024-05-241-1/+0
| | | | | | | | | | | | | | | | | | | | | | BaseRngLib on AARCH64 will discover whether or not RNDR instructions are supported, by inspecting the ISAR0 identification register, and setting a global boolean accordingly. This boolean is used in subsequent execution to decide whether or not to issue the instruction. The same discovery code also ASSERT()s that RNDR instructions are implemented, which is unnecessary, and breaks execution on systems that incorporate the library but don't implement the instruction (or fail to expose it to the exception level that the firmware executes at). So drop the ASSERT(). Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Committed-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdePkg/BaseLib: Fix AARCH64 compilation errorShun Cheng Liu2024-05-152-0/+2
| | | | | | | | | | | | | Declare InternalAssertJumpBuffer as EXTERN Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Shun Cheng Liu <adam.liu@tw.synaptics.com> Reviewed-by: levi.yun <yeoreum.yun@arm.com>
* MdePkg/BaseLib: Add a new VMGEXIT instruction invocation for SVSMTom Lendacky2024-04-173-0/+135
| | | | | | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4654 The SVSM specification relies on a specific register calling convention to hold the parameters that are associated with the SVSM request. The SVSM is invoked by requesting the hypervisor to run the VMPL0 VMSA of the guest using the GHCB MSR Protocol or a GHCB NAE event. Create a new version of the VMGEXIT instruction that will adhere to this calling convention and load the SVSM function arguments into the proper register before invoking the VMGEXIT instruction. On return, perform the atomic exchange on the SVSM call pending value as specified in the SVSM specification. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
* MdePkg: Update the comments of GetInformation functionQingyu2024-04-151-1/+4
| | | | | | | | | | | | | Refer to Uefi spec 2.10 section 11.11.2, add a new retval EFI_NOT_FOUND to EFI_ADAPTER_INFORMATION_PROTOCOL.GetInformation(). Reference: [mantis #1866] - GetInfo() of Adapter Information Protocol should have a provision for IHV to return no data. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Qingyu <qingyu.shang@intel.com> Signed-off-by: Gahan Saraiya <gahan.saraiya@intel.com>
* MdePkg/BaseLib: Update TDVMCALL_EXPOSE_REGS_MASKCeping Sun2024-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4696 Refer to the [GHCI] spec, TDVF should clear the BIT5 for RBP in the mask. Reference: [GHCI]: TDX Guest-Host-Communication Interface v1.5 https://cdrdv2.intel.com/v1/dl/getContent/726792 Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Michael Roth <michael.roth@amd.com> Cc: Isaku Yamahata <isaku.yamahata@intel.com> Signed-off-by: Ceping Sun <cepingx.sun@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdePkg: Add EFI_UNSUPPORTED return for some Runtime Service functionsSuqiang Ren2024-02-091-3/+40
| | | | | | | | | | | | | | | | | According to UEFI Spec 2.10 page 206, if any EFI_RUNTIME_SERVICES* calls are not supported for use by the OS at runtime, an EFI_RT_PROPERTIES_TABLE configuration table should be published describing which runtime services are supported at runtime. So need to add EFI_UNSUPPORTED return for some Runtime Service functions. REF: UEFI spec 2.10 section 8 Services ? Runtime Services Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Suqiang Ren <suqiangx.ren@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdePkg: Add a new library named PeiServicesTablePointerLibKs0Chao Li2024-02-063-0/+144
| | | | | | | | | | | | | | | | | | Adding PeiServicesTablePointerLibKs0 for LoongArch64, which provides setting and getting the PEI service table pointer through the CSR KS0 register. The idea of this library is derived from ArmPkg/Library/PeiServicesTablePointerLib/ BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584 Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Chao Li <lichao@loongson.cn> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdePkg: Add IOCSR operation for LoongArchChao Li2024-02-062-0/+121
| | | | | | | | | | | | | | | Add IoCsrRead8, IoCsrRead16, IoCsrRead32, IoCsrRead64, IoCsrWrite8, IoCsrWrite16, IoCsrWrite32, IoCsrWrite64 to operate the IOCSR registers of LoongArch architecture. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584 Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>