Skip to content

Commit

Permalink
MdePkg: export some additional macros from BaseFdtLib
Browse files Browse the repository at this point in the history
- FDT_TAGSIZE and FDT_MAX_NCELLS
- FdtGetHeader/FdtTotalSize
- FdtForEachSubnode

Signed-off-by: Leif Lindholm <[email protected]>
  • Loading branch information
leiflindholm authored and mergify[bot] committed Oct 2, 2024
1 parent 0cc9963 commit 9dc9a4b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions MdePkg/Include/Library/FdtLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9dc9a4b

Please sign in to comment.