summaryrefslogtreecommitdiff
path: root/MdePkg/Library/BaseFdtLib
AgeCommit message (Collapse)AuthorFilesLines
10 daysMdePkg/BaseFdtLib: Update libfdt submoduleVishal Oliyil Kunnil1-0/+0
Update libfdt submodule to commit f48b965 of pylibfdt. Repo: https://github.com/devicetree-org/pylibfdt Commit: f48b965 This moves to dtc v1.7.2-24-gf4c53f4ebf78. Signed-off-by: Vishal Oliyil Kunnil <vishalo@qti.qualcomm.com>
2026-09-15MdePkg/BaseFdtLib: Use BaseLib strrchr/strtoul, drop LibFdtWrapper.cVishal Oliyil Kunnil3-168/+2
Point the strrchr and strtoul macros in LibFdtSupport.h at the new AsciiStrRChr() and AsciiStrToUintn() BaseLib APIs instead of the private fdt_strrchr()/fdt_strtoul() implementations. This removes duplicated logic and picks up the overflow-detection already present in the underlying AsciiStrHexToUintnS()/AsciiStrDecimalToUintnS() conversion routines. LibFdtWrapper.c is now empty of purpose and is removed, along with its entry in BaseFdtLib.inf. Signed-off-by: Vishal Oliyil Kunnil <vishalo@qti.qualcomm.com>
2026-06-04MdePkg/BaseFdtLib: Add FdtStringListCount and FdtStringListSearch wrappersThamballi Sreelalitha1-0/+51
Add UEFI-native wrappers for libfdt string list count and search APIs. Signed-off-by: Thamballi Sreelalitha <sreelali@qti.qualcomm.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/+19
Add support for the define FdtForEachPropertyOffset and FdtFindMaxPhandle() wrappers. Signed-off-by: Antaeus Kleinert-Strand <antklein@microsoft.com>
2026-02-24MdePkg: Replace include guards with #pragma onceMichael Kubacki7-10/+1
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-01-21MdePkg/Library/BaseFdtLib: Fix VS2022 NOOPT IA32 issuesMichael D Kinney3-0/+109
VS2022 NOOPT IA32 builds of BaseFdtLib introduce use of intrinsics __allshl and __aullshr from the libfdt submodule that can not be modified. Add the implementation of __allshl and __aullshr intrinsics from from the CryptoPkg to BaseFdtLib. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2026-01-21MdePkg/BaseFdtLib: Add more wrappersMario Bălănică1-0/+18
Add FDT_HEADER field accessors and FdtOverlayApply() wrapper. Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
2025-10-13MdePkg/BaseFdtLib: Add FdtGetPhandle wrapperSarah Walker1-0/+18
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-08-26MdePkg/BaseFdtLib: Remove unused macros and string APIsThamballi Sreelalitha1-20/+11
Removed legacy macros and string helper APIs that are no longer used in the BaseFdtLib implementation. Specifically: - Dropped strcmp macro that incorrectly expected 3 arguments but ignored the third parameter. - Cleaned up other unused macros and redundant string APIs. These changes align with the current upstream libfdt module and reduce dead code. Signed-off-by: Thamballi Sreelalitha <sreelali@qti.qualcomm.com>
2025-05-30MdePkg/BaseFdtLib: add a few new function wrappersLeif Lindholm1-0/+40
Add FdtSetPropString(), FdtDelNode() and FdtGetPath(). Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-04-30MdePkg/BaseFdtLib: add FdtGetPropertyW wrapperLeif Lindholm1-0/+24
Add wrapper for fdt_get_property_w. Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-04-30MdePkg,UefiPayloadPkg: clean up BaseFdtLib API confusionLeif Lindholm1-2/+27
Commit 8040fdbb8b8b (MdePkg: consistently use "Property" in BaseFdtLib) got a bit carried away and confused around how libfdt contains both getprop and get_property functions, which operate quite differently; the getprop variant returns a pointer to the value of the property, whereas the get_property returns a pointer to the fdt_property structure. Untangle this, including fixing up affected existing in-tree users, and adding the previously not exported FdtGetProp wrapper on fdt_getprop. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-01-31MdePkg/BaseFdtLib: fix build with gcc 15Gerd Hoffmann1-9/+13
gcc 15 switched to use the new ISO C23 standard by default. 'bool', 'true' and 'false' are keywords in C23, so do not try to define them. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-10-02MdePkg: add various additional functions to BaseFdtLibLeif Lindholm1-0/+157
- 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/+75
- FdtSetPropU64 - FdtAppendProp - FdtDelProp Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02MdePkg: export FdtAddressCells/FdtSizeCells from BaseFdtLibLeif Lindholm1-0/+36
Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02MdePkg: export FdtOpenInto/FdtPack from BaseFdtLibLeif Lindholm1-0/+37
Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-10-02MdePkg: align BaseFdtLib function prototypesLeif Lindholm1-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>
2024-10-02MdePkg: add FdtStrerror wrapper to BaseFdtLibLeif Lindholm1-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>
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-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>
2024-09-14MdePkg: Add reserved mem fdt helpersDhaval1-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>
2024-08-28MdePkg: Fix build error after enable FDT support.Linus Liu1-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>
2024-08-28MdePkg/BaseFdtLib: Add FdtNodeOffsetByCompatible()Nhi Pham1-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>
2024-01-24MdePkg/BaseFdtLib: Rename standard functionsJeff Brasen2-25/+7
Rename the standard functions in the LibFdtSupport to remove conflicts with other libraries that define them. 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: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-09-26UefiPayloadPkg: Add FIT supportBrucex.Wang1-4/+4
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/+40
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-05-05MdePkg: Support FDT library.Benny Lin11-0/+812
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-05-05Tianocore: Support FDT library.Benny Lin1-0/+0
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) Add submodule libfdt and update ReadMe for the license. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Benny Lin <benny.lin@intel.com> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>