From 9dc9a4bae62beab984dc4b0ce5e58c4575bd1c05 Mon Sep 17 00:00:00 2001 From: Leif Lindholm Date: Tue, 1 Oct 2024 14:51:47 +0100 Subject: MdePkg: export some additional macros from BaseFdtLib - FDT_TAGSIZE and FDT_MAX_NCELLS - FdtGetHeader/FdtTotalSize - FdtForEachSubnode Signed-off-by: Leif Lindholm --- MdePkg/Include/Library/FdtLib.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'MdePkg') 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 -- cgit v1.2.3