summaryrefslogtreecommitdiff
path: root/MdePkg/Include/Library
AgeCommit message (Collapse)AuthorFilesLines
2024-10-18MdePkg: Fix null macros for XCODE5 and CLANGMike Beaton1-4/+31
When building OvmfPkg in RELEASE mode in the XCODE5 toolchain, the ASSERT_EFI_ERROR change prevents this error: .../MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c:141:15: error: variable 'Status' set but not used [-Werror,-Wunused-but-set-variable] EFI_STATUS Status; ^ which is currently stopping the build. When building in RELEASE mode in the CLANGPDB toolchain,the DEBUG macro change prevents this error: .../edk2/OvmfPkg/VirtioSerialDxe/VirtioSerial.c:28:22: error: variable &apos;EventNames&apos; is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration] STATIC CONST CHAR8 *EventNames[] = { ^ which is currently stopping the build. CLANGDWARF produces the same error as CLANGPDB above, if -Wno-unneeded-internal-declaration is removed from its build flags. With the null DEBUG macro change, this warning suppression can be removed from CLANGDWARF, which is considered a benefit as it has the potential to catch real coding errors. This is done in a subsequent commit. This commit has the desirable side effect that we no longer require (and cannot use) explicit `#ifndef MDEPKG_NDEBUG` around items only used in DEBUG macros. This requires the ArmPkg change made here to be in the same commit as the MdePkg changes. Note: In common with existing macros in EDK II, including the pre-existing and unchanged DEBUG/NOOPT versions of the macros which are modified here, we use the standard approach of adding `do { ... } while (FALSE)` wrapping to ensure that the macros behave correctly with surrounding code (e.g. require a following ';' and do not combine in unexpected ways with nearby conditionals). Continuous-integration-options: PatchCheck.ignore-multi-package Co-authored-by: Mikhail Krichanov <krichanov@ispras.ru> Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2024-10-08MdePkg: DebugLib: Check Signature in CR in Release BuildsOliver Smith-Denny1-2/+10
The CR macro is used to access an enclosing structure from a pointer within the structure. In DEBUG builds (i.e. when MDEPKG_NDEBUG is not set and debug asserts are enabled), this macro does signature validation checking to ensure that the structure that has been found is the correct structure, based on a signature passed in by the caller. However, if MDEPKG_NDEBUG is set or debug asserts are disabled, no signature validation is performed, meaning that CR may return an invalid structure that the caller believes is valid and has had signature validation on, causing undefined behavior (memory corruption). We should where at all possible have defined behavior, particularly in RELEASE builds, which are what typical platforms will ship to consumers. This patch updates CR to do the signature validation in all scenarios to provide defined behavior from the macro. In the event of a signature failure, CR will either 1) assert if !MDEPKG_NDEBUG and debug asserts are enabled (existing behavior) or 2) return NULL to indicate to the caller that signature validation failed. There exist consumers today who already, erroneously, rely on this behavior. Another macro, BASE_CR, exists for callers who do not wish to perform signature validation. Any code that wishes to avoid the signature validation should move to this macro. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-10-02MdePkg: add various additional functions to BaseFdtLibLeif Lindholm1-0/+115
- FdtOffsetPointer - FdtParentOffset - FdtNodeOffsetByPhandle - FdtStringListContains - FdtGetAliasNameLen - FdtPathOffsetNameLen - FdtPathOffset Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02MdePkg: export additional Property functions from BaseFdtLibLeif Lindholm1-0/+62
- FdtSetPropU64 - FdtAppendProp - FdtDelProp Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02MdePkg: export FdtAddressCells/FdtSizeCells from BaseFdtLibLeif Lindholm1-0/+30
Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02MdePkg: export FdtOpenInto/FdtPack from BaseFdtLibLeif Lindholm1-0/+31
Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02MdePkg: export some additional macros from BaseFdtLibLeif Lindholm1-0/+16
- FDT_TAGSIZE and FDT_MAX_NCELLS - FdtGetHeader/FdtTotalSize - FdtForEachSubnode Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02MdePkg: add FdtStrerror wrapper to BaseFdtLibLeif Lindholm1-0/+117
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>
2024-10-02MdePkg: consistently use "Property" in BaseFdtLibLeif Lindholm1-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>
2024-10-02MdePkg,UefiPayloadPkg: improve BaseFdtLib memreserve helper styleLeif Lindholm1-9/+9
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>
2024-09-27MdePkg: Fix DEBUG_CODE and PERF_CODE macros for XCODE5Mike Beaton2-4/+14
Without these changes, we get the error: error: variable '__DebugCodeLocal' set but not used from the DebugLib.h DEBUG_CODE_BEGIN()/END() macros on XCODE5. Similarly, in NOOPT builds only, we get: error: variable '__PerformanceCodeLocal' set but not used from the PerformanceLib.h PERF_CODE_BEGIN()/END() macros on XCODE5. It is important to note that the previous code involving a local variable was intended to ensure correct behaviour of ; following the macros, in particular that ; should be required: - https://github.com/tianocore/edk2/pull/6226#issuecomment-2364087866 - https://github.com/tianocore/edk2/pull/6226#issuecomment-2364619759 This converted version repeats the standard do { ... } while (FALSE) idiom (which is already used in the END macro) to achieve the same affect. The modified versions work on all toolchains. Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2024-09-14MdePkg: Add reserved mem fdt helpersDhaval1-0/+34
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>
2024-09-13MdePkg DebugLib: Enable FILE NAME as DEBUG ASSERT for GCC12Chun-Yi Lee1-2/+2
Using __FILE_NAME__ is useful for reducing the size of debug image and it's also good for reproducable builds. The gcc-12 also supported this macro. Ref: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=1a9b3f04c11eb467a8dc504a37dad57a371a0d4c This patch removed the checking of __clang__ when using __FILE_NAME__. References: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42579 Signed-off-by: Chun-Yi Lee <jlee@suse.com>
2024-09-13MdePkg: Create Stack Check Null LibsTaylor Beebe1-0/+26
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>
2024-09-13MdePkg/ArmLib: Drop routines that maintain the entire D-cacheArd Biesheuvel1-18/+0
Cache maintenance on the D-cache hierarchy as a whole is not supported by the ARM architecture, so drop the routines from ArmLib that pretend to implement it. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-09-09MdePkg/BaseLib: Add NULL version Tdx functions for other architecturesCeping Sun1-4/+0
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>
2024-08-28MdePkg/BaseFdtLib: Add FdtNodeOffsetByCompatible()Nhi Pham1-0/+17
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>
2024-08-06MdePkg/BaseLib: Add CRC16 CCITT False Implementation.kuqin121-0/+17
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>
2024-08-01MdePkg/BaseLib: AARCH64: Add ArmReadIdAA64Isar0Reg()Pierre Gondois1-0/+72
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>
2024-08-01MdePkg/BaseLib: AARCH64: Add ArmReadCntPctReg()Pierre Gondois1-0/+15
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>
2024-06-19MdePkg/ArmLib: Drop obsolete library declarationsArd Biesheuvel1-36/+0
Drop obsolete library declarations that are no longer (and should not be) implemented in EDK2 or UEFI, given that they are specific to the secure world. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-06-15ArmPkg,MdePkg: Move ArmPkg/Chipset/Aarch64[|Mmu].h to MdePkgPierre Gondois1-1/+1
Following the discussion at [1] and as the ArmLib relies on them, move ArmPkg/Chipset/Aarch64[|Mmu].h files to the MdePkg. Update the path to correctly include the moved files. [1] https://edk2.groups.io/g/devel/message/111566 Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-06-15ArmPkg,MdePkg: Move ArmPkg/Chipset/ArmV7[|Mmu].h to MdePkgPierre Gondois1-1/+1
Following the discussion at [1] and as the ArmLib relies on them, move ArmPkg/Chipset/ArmV7[|Mmu].h files to the MdePkg. Update the path to correctly include the moved files. [1] https://edk2.groups.io/g/devel/message/111566 Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-06-15ArmPkg,MdePkg: move ArmLib.h to MdePkgLeif Lindholm1-0/+829
Related to https://bugzilla.tianocore.org/show_bug.cgi?id=4121, but not resolving it. (Nearly?) all of ArmPkg describes industry standard behaviour, and hence according to general rules, ought to live in MdePkg. Addressing this will however be a substantial task. Take a first step by moving the ArmLib interface definition to MdePkg, as discussed in https://edk2.groups.io/g/devel/topic/patch_v5_2_6/102725178 Continuous-integration-options: PatchCheck.ignore-multi-package Cc: Pierre Gondois <pierre.gondois@arm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2024-04-17MdePkg/BaseLib: Add a new VMGEXIT instruction invocation for SVSMTom Lendacky1-0/+39
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>
2024-02-14MdePkg/Include: Rename _DEBUG() to address name collisionMichael D Kinney1-3/+3
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4683 When VS20xx host-based unit tests are built with debug libraries a name collision occurs with the DebugLib.h internal macro _DEBUG(). Rename this internal macro to _DEBUGLIB_DEBUG() to address the name collision. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-02-09MdePkg: Add EFI_UNSUPPORTED return for some Runtime Service functionsSuqiang Ren1-3/+41
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>
2024-02-06MdePkg: Add a new library named PeiServicesTablePointerLibKs0Chao Li1-4/+5
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>
2024-02-06MdePkg: Add IOCSR operation for LoongArchChao Li1-0/+112
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>
2024-02-06MdePkg: Add CSR operation for LoongArchChao Li1-0/+45
Add CsrRead, CsrWrite and CsrXChg functions for LoongArch, and use them to operate the CSR register 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> Co-authored-by: Bibo Mao <maobibo@loongson.cn> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2024-02-06MdePkg: Add read stable counter operation for LoongArchChao Li1-0/+12
Add LoongArch gets stable counter ASM function. 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>
2024-02-06MdePkg: Add LoongArch Cpucfg functionChao Li1-0/+12
Add LoongArch AsmCpucfg function and Cpucfg definitions. Also added Include/Register/LoongArch64/Cpucfg.h to IgnoreFiles of EccCheck. 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>
2024-02-06MdePkg: Add LoongArch64 local interrupt function set into BaseLibChao Li1-0/+20
Adding LoongArch local interrupt function set, which is used to control the opening or closing of the local interrupt when the global interrupt is enabled. 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>
2024-02-06MdePkg: Add LoongArch64 exception function set into BaseLibChao Li1-0/+20
Adding SetExceptionBaseAddress and SetTlbRebaseAddress functions for LoongArch64. 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>
2024-02-06MdePkg: Add LoongArch64 FPU function set into BaseCpuLibChao Li1-5/+38
Adding InitializeFloatingPointUnits, EnableFloatingPointUnits and DisableFloatingPointUnits functions for LoongArch64. 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>
2024-01-11MdePkg/BaseLib: RISC-V: Add function to update stimecmp registerSunil V L1-0/+5
stimecmp is a CSR supported only when Sstc extension is supported by the platform. This register can be used to set the timer interrupt directly in S-mode instead of going via SBI call. Add a function to update this register. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Andrei Warkentin <andrei.warkentin@intel.com> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com> Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
2023-12-19MdePkg: Implement RISC-V Cache Management OperationsDhaval1-0/+33
Implement Cache Management Operations (CMO) defined by RISC-V spec https://github.com/riscv/riscv-CMOs. Notes: 1. CMO only supports block based Operations. Meaning cache flush/invd/clean Operations are not available for the entire range. In that case we fallback on fence.i instructions. 2. Operations are implemented using Opcodes to make them compiler independent. binutils 2.39+ compilers support CMO instructions. Test: 1. Ensured correct instructions are refelecting in asm 2. Qemu implements basic support for CMO operations in that it allwos instructions without exceptions. Verified it works properly in that sense. 3. SG2042Pkg implements CMO-like instructions. It was verified that CpuFlushCpuDataCache works fine. This more of less confirms that framework is alright. 4. TODO: Once Silicon is available with exact instructions, we will further verify this. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Sunil V L <sunilvl@ventanamicro.com> Cc: Daniel Schaefer <git@danielschaefer.me> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Pedro Falcato <pedro.falcato@gmail.com> Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Sunil V L <sunilvl@...> Reviewed-by: Jingyu Li <jingyu.li01@...>
2023-12-19MdePkg: Rename Cache Management Function To Clarify Fence Based OpDhaval1-2/+2
There are different ways to manage cache on RISC-V Processors. One way is to use fence instruction. Another way is to use CPU specific cache management operation instructions ratified as per RISC-V ISA specifications to be introduced in future patches. Current method is fence instruction based, rename the function accordingly to add that clarity. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Sunil V L <sunilvl@ventanamicro.com> Cc: Daniel Schaefer <git@danielschaefer.me> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Pedro Falcato <pedro.falcato@gmail.com> Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2023-12-19MdePkg: Move RISC-V Cache Management Declarations Into BaseLibDhaval Sharma1-0/+20
The declarations for cache Management functions belong to BaseLib instead of instance source file. This helps with further restructuring of cache management code for RISC-V. 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> Cc: Pedro Falcato <pedro.falcato@gmail.com> Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2023-12-11MdePkg: Improve wording of manageability debug level commentRebecca Cran1-2/+2
Improve the wording of the comment explaining the DEBUG_MANAGEABILITY debug level. Signed-off-by: Rebecca Cran <rebecca@os.amperecomputing.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-12-03MdePkg/BaseLib: Fix CRC16-ANSI calculationPedro Falcato1-0/+5
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4609 The current CalculateCrc16Ansi implementation does the following: 1) Invert the passed checksum 2) Calculate the new checksum by going through data and using the lookup table 3) Invert it back again This emulated my design for CalculateCrc32c, where 0 is passed as the initial checksum, and it inverts in the end. However, CRC16 does not invert the checksum on input and output. So this is incorrect. Fix the problem by not inverting input checksums nor output checksums. Callers should now pass CRC16ANSI_INIT as the initial value instead of "0". This is a breaking change. This problem was found out-of-list when older ext4 filesystems (that use crc16 checksums) failed to mount with "corruption". 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: Pedro Falcato <pedro.falcato@gmail.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-09-26UefiPayloadPkg: Add FIT supportBrucex.Wang1-3/+3
Provide Fit format for UniversalPayload, developer can use argument "--Fit" to build UniversalPayload.fit Cc: Guo Dong <guo.dong@intel.com> Cc: Sean Rhodes <sean@starlabs.systems> Cc: James Lu <james.lu@intel.com> Cc: Gua Guo <gua.guo@intel.com> Reviewed-by: Gua Guo <gua.guo@intel.com> Signed-off-by: BruceX Wang <brucex.wang@intel.com>
2023-09-26MdePkg/BaseFdtLib: Add Fdt function.Brucex.Wang1-0/+34
Add FdtGetName() and FdtNodeDepth() function. Cc: Benny Lin <benny.lin@intel.com> Cc: Gua Guo <gua.guo@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Cc: James Lu <james.lu@intel.com> Reviewed-by: Benny Lin <benny.lin@intel.com> Reviewed-by: Gua Guo <gua.guo@intel.com> Signed-off-by: BruceX Wang <brucex.wang@intel.com>
2023-09-08MdePkg/Rng: Add GetRngGuid() to RngLibPierre Gondois1-0/+17
The EFI_RNG_PROTOCOL can use the RngLib. The RngLib has multiple implementations, some of them are unsafe (e.g. BaseRngLibTimerLib). To allow the RngDxe to detect when such implementation is used, add a GetRngGuid() function to the RngLib. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Tested-by: Kun Qin <kun.qin@microsoft.com>
2023-07-15MdePkg/BaseLib: RISC-V: Support getting satp register valueTuan Phan1-0/+5
Add an API to retrieve satp register value. Signed-off-by: Tuan Phan <tphan@ventanamicro.com> Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com> Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
2023-05-17MdePkg: BaseRiscVSbiLib: make more useful to consumersAndrei Warkentin1-4/+38
Add a few more definitions and make SbiCall and TranslateError usable (not static) by library users. Cc: Daniel Schaefer <git@danielschaefer.me> Signed-off-by: Andrei Warkentin <andrei.warkentin@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Sunil V L <sunilvl@ventanamicro.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-11MdePkg: Add NULL library of TraceHubDebugSysTLibGua Guo1-0/+81
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4144 This Library is NULL library of TraceHubDebugSysTLib. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Guo Gua <gua.guo@intel.com> Cc: Chan Laura <laura.chan@intel.com> Cc: Prakashan Krishnadas Veliyathuparambil <krishnadas.veliyathuparambil.prakashan@intel.com> Cc: K N Karthik <karthik.k.n@intel.com> Signed-off-by: Guo Gua <gua.guo@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: K N Karthik <karthik.k.n@intel.com> Reviewed-by: Chan Laura <laura.chan@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
2023-05-11MdePkg: Add MipiSysTLib libraryGua Guo1-0/+66
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4144 This Library provides functions consuming MIPI SYS-T submodule. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Guo Gua <gua.guo@intel.com> Cc: Chan Laura <laura.chan@intel.com> Cc: Prakashan Krishnadas Veliyathuparambil <krishnadas.veliyathuparambil.prakashan@intel.com> Cc: K N Karthik <karthik.k.n@intel.com> Signed-off-by: Guo Gua <gua.guo@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: K N Karthik <karthik.k.n@intel.com> Reviewed-by: Chan Laura <laura.chan@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
2023-05-05MdePkg: Support FDT library.Benny Lin1-0/+401
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4392 Add FDT support in EDK2 by submodule 3rd party libfdt (https://github.com/devicetree-org/pylibfdt/tree/main/libfdt) and refer to LibcLib implementation by Pedro. 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: Benny Lin <benny.lin@intel.com> Acked-by: Pedro Falcato <pedro.falcato@gmail.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-04-21MdePkg: Add DEBUG_MANAGEABILITY print error levelAbner Chang1-20/+22
Bug #4414 Add DEBUG_MANAGEABILITY print error lever to output debug message of detailed manageability related module information, such as - RedfishPkg: - HTTP header/request/response - JSON plain text - Refish resource - Redfish Host interface information - Redfish credential information - Platform configuration to Redfish mapping - etc. - ManageabilityPKg - Protocol payload of MCTP/PLDM/IPMI - Payload of transport interface transfers - IPMI BLOB transfer - etc. - RedfishClinetPkg - Redfish feature driver dispatcher - Redfish BIOS attributes - Platform configuration (HII) to Redfish property information - Redfish C structure information - etc. Signed-off-by: Abner Chang <abner.chang@amd.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: Nickle Wang <nicklew@nvidia.com> Cc: Igor Kulchytskyy <igork@ami.com> Cc: Isaac Oram <isaac.w.oram@intel.com> Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com> Cc: Tinh Nguyen <tinhnguyen@os.amperecomputing.com>