summaryrefslogtreecommitdiff
path: root/MdePkg/Include/Library
AgeCommit message (Collapse)AuthorFilesLines
13 daysMdePkg/BaseLib: Add AsciiStrToUintn and AsciiStrToUint64Vishal Oliyil Kunnil1-0/+62
Add AsciiStrToUintn() and AsciiStrToUint64() to BaseLib. These are thin wrappers that dispatch to the existing AsciiStrHexToUintnS()/ AsciiStrDecimalToUintnS() (and UINT64 equivalents) based on Base, which must be 0 (auto-detect via a "0x"/"0X" prefix), 10, or 16. No new radix-parsing logic is introduced; the existing conversion routines already cover the bases actually used in practice. Signed-off-by: Vishal Oliyil Kunnil <vishalo@qti.qualcomm.com>
13 daysMdePkg/BaseLib: Add AsciiIsSpaceVishal Oliyil Kunnil1-0/+16
Add AsciiIsSpace() to BaseLib, which checks whether an ASCII character is a space character as defined by the ISO C isspace() function. This will be used to implement AsciiStrToUintn() and AsciiStrToUint64(). Signed-off-by: Vishal Oliyil Kunnil <vishalo@qti.qualcomm.com>
13 daysMdePkg/BaseLib: Add AsciiStrRChrVishal Oliyil Kunnil1-0/+30
Add AsciiStrRChr() to BaseLib, which returns the last occurrence of a character in a Null-terminated ASCII string. This mirrors the existing AsciiStrStr() API style and provides a reusable implementation for consumers that currently hand-roll this logic. Signed-off-by: Vishal Oliyil Kunnil <vishalo@qti.qualcomm.com>
2026-09-06MdePkg: ArmFfaMemMgmtLib: Fix ECC check failuresKun Qin1-28/+23
This change fixes some ECC check failures around the usage of doxygen keywords. Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2026-07-20MdePkg,MdeModulePkg: ArmFfaLib: Expand to include first 4 registersKun Qin1-0/+10
The direct message arguments stripped off the header, making the underlying FF-A function interface to lose information when it comes to certain return code, i.e. FFA_YIELD and FFA_INTERRUPT. This change adds back the header field for this purpose so that the callers can decide how to act on the corresponding return codes. It then populates the header field for this purpose in FFA direct message functions so that the callers can decide how to act on the corresponding return codes. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2026-06-09MdePkg: Remove contructor from Mpxy LibraryHimanshu Chauhan1-0/+13
Cases when MPXY extension is not present or it fails, the system boot fails. This is easily reproducible with Qemu master branch. Remove the constructor and let RAS agent client initialize the MPXY library and fail graceully in case of errors but the boot process continue. Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
2026-06-04MdePkg/BaseFdtLib: Add FdtStringListCount and FdtStringListSearch wrappersThamballi Sreelalitha1-0/+45
Add UEFI-native wrappers for libfdt string list count and search APIs. Signed-off-by: Thamballi Sreelalitha <sreelali@qti.qualcomm.com>
2026-05-28MdePkg MmUnblockMemoryLib.h: Add RETURN_OUT_OF_RESOURCES return valueStar Zeng1-0/+1
Signed-off-by: Star Zeng <star.zeng@intel.com>
2026-05-28MdePkg: StackCheckLib: Update __stack_chk_guard for GCC 17Oliver Smith-Denny1-1/+4
GCC 17 (upcoming release) is updating the type of __stack_chk_guard from a void * to a uintptr_t. This is only a type change, not a size change. However, it does cause the GCC 17 build to fail because of the type mismatch. uintptr_t is defined as unsigned long, which is not a type edk2 defines. It has the same size as UINTN on a given system, but on 64 bit systems we have the same type issue because UINTN is defined as unsigned long long, not unsigned long. To work around this and avoid defining a new type in edk2, use the compiler built in __UINTPTR_TYPE__ which is the underlying definition in GCC. This is a backwards compatible change with previous versions of GCC and CLANGDWARF but also fixes the upcoming definition change for GCC 17. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2026-05-27MdePkg/Library: RISC-V: Add RAS agent client libraryHimanshu Chauhan1-0/+150
Add the RAS agent client library which is used to communicate to a remote RAS agent. The RAS agent can be queried about the details of various hardware error sources in the system. Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
2026-05-27MdePkg/Include: RISCV: Add SBI Mpxy Library for SBI MPXY extensionHimanshu Chauhan1-0/+124
Add SBI Mpxy client library to communicate using RPMI or other protocols using SBI MPXY extension. Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
2026-05-27MdePkg/Include: RISC-V: Add SBI MPXY extension related macrosHimanshu Chauhan1-1/+16
Add SBI MPXY extension and its function macros. Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
2026-05-27MdePkg/Library: RISC-V: Add function to probe an SBI extensionHimanshu Chauhan1-0/+6
Extensions should be detected before they can be used. Add a function to detect the support for an SBI extension using probe extension SBI function. Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
2026-05-27MdePkg/Include: Add new SBI return codesHimanshu Chauhan1-2/+6
Add new error codes defined in SBI relating to shared memory, etc. Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
2026-05-08MdePkg: Fix Spelling Errors in CommentsOliver Smith-Denny17-34/+34
This fixes all non-breaking spelling errors in MdePkg. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2026-05-06MdeModulePkg,MdePkg: Send I/O without FUA if necessaryAnnie Li1-2/+6
Commit 8c654bb3ec sets FUA bit forcefully in SCSI sync I/O to avoid possible data loss. However, it may cause issues for the storage without the support FUA and WCE. For example, Windows Server 2025 guest fails to boot from vhost-scsi block device in such scenario. The booting Error code is 0xc0000185, the SCSI command fails with the following, Mode Sense Key: EFI_SCSI_SK_ILLEGAL_REQUEST Additional Sense Code: EFI_SCSI_ASC_INVALID_FIELD This patch gets the FUA and WCE support of the storage and sets FUA conditionally. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Annie Li <annie.li@oracle.com>
2026-04-28ArmPkg,MdePkg,MdeModulePkg: change ArmFfaLibGetVersion() with whole versionYeoreum Yun1-8/+4
Current ArmFfaLibGetVersion()'s arguments receive two arguments -- major version and minor version. However, This gives some impression treating major and minor version of the ABI as two unrelated 16-bit variables as opposed to the upper and lower 16-bits of a 32-bit version variable. Therefore, change the arguments with whole version and let user to get major/minor version via ARM_FFA_MAJOR/MINOR_VERSION_GET macros. Also, add some useful helper to check version compatibility and mimimum require ABI version. Continuous-integration-options: PatchCheck.ignore-multi-package Suggested-by: Leif Lindholm <quic_llindhol@quicinc.com> Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2026-04-21MdePkg: Add helper function to detect RMESami Mujawar1-1/+12
Add helper function to check if the Realm Management Extension (RME) is implemented by the hardware. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Leif Lindholm <leif.lindholm@oss.qualcomm.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
2026-03-24MdePkg/BaseFdtLib: Header style update to FdtOverlayApply andAntaeus Kleinert-Strand1-8/+6
FdtStrerror Update the FdtOverlayApply() function to mark the Fdt pointer as an IN OUT variable. The internal fdt_overlay_apply() function returns the merged blob in the Fdt variable. Update FdtStrerror to have it's return type on a single line, aligning the style with the rest of the file. Signed-off-by: Antaeus Kleinert-Strand <antklein@microsoft.com>
2026-03-24MdePkg/BaseFdtLib: FdtGetName, FdtGetPathAntaeus Kleinert-Strand1-7/+7
Update FdtGetName() and FdtGetPath() to correctly mark the VOID *Fdt as a CONST variable. This aligns with the internal libfdt implementation. Update MockFdtLib.h to align with the updated inputs for FdtGetName() and FdtGetPath(). Signed-off-by: Antaeus Kleinert-Strand <antklein@microsoft.com>
2026-03-24MdePkg/BaseFdtLib: Implement new libfdt wrappersAntaeus Kleinert-Strand1-0/+21
Add support for the define FdtForEachPropertyOffset and FdtFindMaxPhandle() wrappers. Signed-off-by: Antaeus Kleinert-Strand <antklein@microsoft.com>
2026-03-23MdePkg/DebugLib: add DEBUG_PAGINGGerd Hoffmann1-0/+1
Add new log bit for all paging-related log messages, i.e. page table updates because of memory encryption or memory attribute changes. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2026-03-18ArmPkg,MdePkg: Add an ASM function to read register AIDR_EL1Ka-in Ng1-0/+6
This provides access to the Auxilary ID register, AIDR_EL1. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Ka-in Ng <kainng@os.amperecomputing.com>
2026-03-12MdePkg/BaseLib: Add AsmReadFsBase and AsmWriteFsBase for X86-64Ray Ni1-0/+36
Signed-off-by: Ray Ni <ray.ni@intel.com>
2026-03-09MdePkg/ArmLib: Remove unused AArch32-only declarationsVishal Oliyil Kunnil1-39/+0
ArmLib contains obsolete AArch32-only declarations that are not relevant to AArch64: - ARM_PROCESSOR_MODE enum and processor mode constants - AArch32-specific MMU/vector helpers: ArmSetDomainAccessControl(), ArmSetLowVectors(), ArmSetHighVectors(), and ArmSetTTBCR() Remove these declarations as they are unused across the tree. Signed-off-by: Vishal Oliyil Kunnil <vishalo@qti.qualcomm.com>
2026-03-09MdePkg: Remove branch prediction control APIsVishal Oliyil Kunnil1-12/+0
Remove deprecated branch prediction control APIs from ArmLib and their callers. These interfaces are not required on AArch64 and do not have any valid in-tree consumers. Signed-off-by: Vishal Oliyil Kunnil <vishalo@qti.qualcomm.com>
2026-03-07MdePkg,MdeModulePkg: Add FFA_YIELD commandRaymond-MS1-0/+20
Add the FF-A YIELD command to the FF-A library. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
2026-02-24MdePkg: Replace include guards with #pragma onceMichael Kubacki85-339/+85
Replace traditional `#ifndef`/`#define`/`#endif` include guards with `#pragma` once. `#pragma once` is a widely supported preprocessor directive that prevents header files from being included multiple times. It is supported by all toolchains used to build edk2: GCC, Clang/LLVM, and MSVC. Compared to macro-based include guards, `#pragma once`: - Eliminates the risk of macro name collisions or copy/paste errors where two headers inadvertently use the same guard macro. - Eliminate inconsistency in the way include guard macros are named (e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.). - Reduces boilerplate (three lines replaced by one). - Avoids polluting the macro namespace with guard symbols. - Can improve build times as the preprocessor can skip re-opening the file entirely, rather than re-reading it to find the matching `#endif` ("multiple-include optimization"). - Note that some compilers may already optimize traditional include guards, by recognzining the idiomatic pattern. This change is made acknowledging that overall portability of the code will technically be reduced, as `#pragma once` is not part of the C/C++ standards. However, this is considered acceptable given: 1. edk2 already defines a subset of supported compilers in BaseTools/Conf/tools_def.template, all of which have supported `#pragma once` for over two decades. 2. There have been concerns raised to the project about inconsistent include guard naming and potential macro collisions. Approximate compiler support dates: - MSVC: Supported since Visual C++ 4.2 (1996) - GCC: Supported since 3.4 (2004) (http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html) - Clang (LLVM based): Since initial release in 2007 Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2026-02-02MdePkg: Replace non-ASCII characters with ASCIIdhiineshm1-2/+2
Replacing the non-ASCII characters with ASCII characters fixes build failures onWindows systems using non-English locales. These characters trigger MSVC warningC4819 (“file contains a character that cannot be represented in the current codepage”), which becomes an error when /WX is enabled. Cc: Sachin Ganesh <sachinganesh@ami.com> Signed-off-by: dhiineshm <dhiineshm@ami.com>
2026-01-26MdePkg: Fix property typos in MdePkgQihang Gao4-45/+45
The word property is misspelled as propery, so fix it. Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
2026-01-21MdePkg/BaseFdtLib: Add more wrappersMario Bălănică1-1/+28
Add FDT_HEADER field accessors and FdtOverlayApply() wrapper. Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2026-01-08MdePkg,MdeModulePkg/ArmFfaLib: introduce ArmFfaGetPartitionInfo()Levi Yun1-0/+24
Introduce ArmFfaGetPartitionInfo(), which retrieves the first partition associated with the service GUID. This allows us to remove duplicated code previously used to obtain the partition ID. Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com> Continuous-integration-options: PatchCheck.ignore-multi-package
2026-01-08MdePkg, MdeModulePkg/ArmFfaLib: add funcs to get partition info via regsLevi Yun1-0/+46
Starting from FF-A v1.2 [0], the FFA_PARTITION_INFO_GET_REGS interface was added to retrieve partition information through registers. This ABI is useful in environments where the Rx/Tx buffer does not need to be mapped, or where buffer mapping is not supported for retrieving partition information. To support this, two new APIs are introduced: ArmFfaLibPartitionInfoGetRegs() and ArmFfaLibPartitionCountGetRegs(). Link: https://developer.arm.com/documentation/den0077/latest [0] Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-12-09MdePkg/BaseLib: Avoid undefined behavior in Unaligned() accessorsArd Biesheuvel1-8/+8
The C standard qualifies misaligned pointers as undefined behavior. This means it is fundamentally impossible to define a conformant C API for unaligned access that is expressed in terms of types with a minimum alignment greater than 1 byte. Undefined behavior means that the compiler is free to generate code that assumes that only the defined behavior occurs. This means that a C implementation of ReadUnaligned64() might be emitted using a 64-bit load operation that does not tolerate misalignment, depending on the CPU architecture. So the only correct way to define such an API is in terms of types such as VOID* that have no implied alignment. Then, given that compilers today are perfectly capable of generating the right code, given accurate annotations, let's rely on those in the generic implementation. This will ensure that the correct access sequences are used, depending on the CPU architecture, and on the compiler flags (e.g., AArch64 uses -mstrict-align in XIP code as it may execute with the MMU disabled). Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2025-11-22MdePkg: fix various typosPhilipp Schuster1-14/+14
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2025-11-04MdePkg: Add code to detect running as an SEV guestRARelph1-0/+12
Similar to Intel's Tdx, we need a mechanism to detect running as an AMD SEV guest that will work in all phases everywhere. This will be immediately used to prevent usage of MTRRs with SEV guests. Signed-off-by: Richard Relph <richard.relph@amd.com>
2025-10-30MdePkg: Copy FvLib to MdePkgZhiguang Liu1-0/+104
Copy FvLib from StandaloneMmPkg to MdePkg because it is a common library. Future steps will include: 1. Modify platform code including Edk2Platforms repo to use FvLib from MdePkg. 2. Remove FvLib from StandaloneMmPkg Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2025-10-13MdePkg/BaseFdtLib: Add FdtGetPhandle wrapperSarah Walker1-0/+15
Add wrapper for fdt_get_phandle(). Signed-off-by: Sarah Walker <Sarah.Walker2@arm.com>
2025-10-06MdePkg/MockFdtLib: add FdtLib mock functionsBob Morgan1-0/+1
Add FdtDelNode() and FdtGetPath() mock functions. Signed-off-by: Bob Morgan <bobm@nvidia.com>
2025-10-01MdePkg/ArmLib: Add prototype for 52-bit VA support helperSarah Walker1-0/+13
Signed-off-by: Sarah Walker <Sarah.Walker2@arm.com>
2025-09-26MdePkg: Remove ARM32 SupportOliver Smith-Denny2-50/+1
edk2 is dropping support for the ARM32 architecture. This commit removes the remaining ARM32 code from MdePkg. This also removes irrelevant VALID_ARCHITECTURES comments from infs that are not arch specific. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-08Global: fix ArmFfaLibRun() caller couldn't get ret-argsLevi Yun1-2/+4
When ArmFfaLibDirectMsgReq(2) is preempted, caller of these functions should resume it works via ArmFfaLibRun() and the secure partition will be return with FFA_DIRECT_MSG_RESP(2) with return arguments. However, since ArmFfaLibRun() gets its return in its stack variable, So caller of ArmFfaLibRun() doesn't get the return arguments from secure partition. To resolve this, add output parameter to ArmFfaLibRun() to receive return arguments. Continuous-integration-options: PatchCheck.ignore-multi-package Fixes: 5d1b38dd07c4 ("ArmPkg: Add ArmFfaLib used in Dxe driver") Reported-by: Mariam Elshakfy <Mariam.Elshakfy@arm.com> Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-07-15MdePkg: RISC-V: Remove firmware context APIsTuan Phan1-56/+0
Eliminate the APIs using the scratch register as PI 1.9 specifies it for the PEI service table pointer. Signed-off-by: Tuan Phan <tphan@ventanamicro.com>
2025-07-15MdePkg/BaseCpuLib: Add FPU initialization support for RISC-VTuan Phan1-1/+1
Enable RISC-V support for the InitializeFloatingPointUnits function. Signed-off-by: Tuan Phan <tphan@ventanamicro.com>
2025-07-15MdePkg: Include: Add defines for AA64PFR2 system registerSarah Walker1-0/+12
The AA64PFR2 system register is required to detect GICv5 support. Signed-off-by: Sarah Walker <Sarah.Walker2@arm.com>
2025-07-14MdePkg: Add DEBUG_SECURITY Bit in PcdDebugPrintErrorLevelOliver Smith-Denny1-1/+2
Tcg2Dxe and its libraries are currently the noisiest modules in edk2. For a sample platform printing at INFO level, Tcg2Dxe printed 4,000 lines out of 5,700 total lines printed. This commit defines a DEBUG_SECURITY bit to control the debug output of Tcg2Dxe and other security related components. Most of the output is not useful except for deep debugging of TPM transactions, so it is appropriate to only print when the DEBUG_SECURITY bit is present. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-06-26MdePkg: ArmFfaMemMgmtLib: Introduce FF-A memory protocol libraryKun Qin1-0/+289
This change introduced a library interface that implements the FF-A memory protocol v1.3 ALP1: https://developer.arm.com/documentation/den0140/f Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-06-26MdePkg, MdeModulePkg: ArmFfaLib: Expose FFA_ARGS and ArmCallFfaKun Qin1-0/+36
FFA is a framework that supports various protocols built on top. i.e. memory protocol, which is nothing that can be done through existing interfaces. Instead of requiring protocol authors to check conduit PCD in every implementation, exposing the ArmCallFfa is a unified way to allow other protocols to leverage FFA interfaces. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-06-05MdePkg: BaseLib: Add UUID-GUID conversion functionKun Qin1-0/+95
With interactions between Standalone MM partitions and normal UEFI environment, there is constant need to convert UUID to GUID and back. This change added 2 new interfaces to BaseLib that support such usage. Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-05-30MdePkg/BaseFdtLib: fix declaration/definition misalignmentLeif Lindholm1-1/+1
Commit e25331fc4591 ("MdePkg,UefiPayloadPkg: clean up BaseFdtLib API confusion"), missed out aligning the wrapper for fdt_node_offset_by_property_value between heade and implementation. Fix this by updating the header to declare FdtNodeOffsetByPropValue instead of FdtNodeOffsetByPropertyValue. Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>