diff options
author | Leif Lindholm <quic_llindhol@quicinc.com> | 2024-10-01 14:51:47 +0100 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-10-02 02:58:31 +0000 |
commit | 9dc9a4bae62beab984dc4b0ce5e58c4575bd1c05 (patch) | |
tree | 7ec36e6b8b244dc3b39037e9514a3310b1cac7c6 /MdePkg | |
parent | 0cc9963cc93d568fc3468a4726105983dfc19354 (diff) | |
download | edk2-9dc9a4bae62beab984dc4b0ce5e58c4575bd1c05.tar.gz edk2-9dc9a4bae62beab984dc4b0ce5e58c4575bd1c05.tar.bz2 edk2-9dc9a4bae62beab984dc4b0ce5e58c4575bd1c05.zip |
MdePkg: export some additional macros from BaseFdtLib
- FDT_TAGSIZE and FDT_MAX_NCELLS
- FdtGetHeader/FdtTotalSize
- FdtForEachSubnode
Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
Diffstat (limited to 'MdePkg')
-rw-r--r-- | MdePkg/Include/Library/FdtLib.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/MdePkg/Include/Library/FdtLib.h b/MdePkg/Include/Library/FdtLib.h index ea853a6885..ae2025ec72 100644 --- a/MdePkg/Include/Library/FdtLib.h +++ b/MdePkg/Include/Library/FdtLib.h @@ -172,6 +172,22 @@ typedef struct { CHAR8 Data[];
} FDT_PROPERTY;
+#ifndef FDT_TAGSIZE
+#define FDT_TAGSIZE sizeof(UINT32)
+#endif
+#ifndef FDT_MAX_NCELLS
+#define FDT_MAX_NCELLS 4
+#endif
+
+#define FdtGetHeader(Fdt, Field) \
+ (Fdt32ToCpu (((const FDT_HEADER *)(Fdt))->Field))
+#define FdtTotalSize(Fdt) (FdtGetHeader ((Fdt), TotalSize))
+
+#define FdtForEachSubnode(Node, Fdt, Parent) \
+ for (Node = FdtFirstSubnode (Fdt, Parent); \
+ Node >= 0; \
+ Node = FdtNextSubnode (Fdt, Node))
+
/**
Convert UINT16 data of the FDT blob to little-endian
|