From 9ba11ee131fb2aaaf821c72477e3cf7b441e5c99 Mon Sep 17 00:00:00 2001 From: Leif Lindholm Date: Tue, 1 Oct 2024 15:49:38 +0100 Subject: MdePkg: export FdtOpenInto/FdtPack from BaseFdtLib Signed-off-by: Leif Lindholm --- MdePkg/Include/Library/FdtLib.h | 31 +++++++++++++++++++++++++++++++ MdePkg/Library/BaseFdtLib/FdtLib.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) (limited to 'MdePkg') diff --git a/MdePkg/Include/Library/FdtLib.h b/MdePkg/Include/Library/FdtLib.h index ae2025ec72..9e085b0b60 100644 --- a/MdePkg/Include/Library/FdtLib.h +++ b/MdePkg/Include/Library/FdtLib.h @@ -286,6 +286,37 @@ FdtCheckHeader ( IN CONST VOID *Fdt ); +/** + Unpack FDT blob into new buffer + + @param[in] Fdt The pointer to FDT blob. + @param[out] Buffer Pointer to destination buffer. + @param[in] BufferSize The size of destination buffer. + + @return Zero for successfully, otherwise failed. + + **/ +INT32 +EFIAPI +FdtOpenInto ( + IN CONST VOID *Fdt, + OUT VOID *Buffer, + IN INT32 BufferSize + ); + +/** + Pack FDT blob in place. + + @param[in][out] Fdt The pointer to FDT blob. + + @return Zero. +**/ +INT32 +EFIAPI +FdtPack ( + IN OUT VOID *Fdt + ); + /** Create a empty Flattened Device Tree. diff --git a/MdePkg/Library/BaseFdtLib/FdtLib.c b/MdePkg/Library/BaseFdtLib/FdtLib.c index 04e2f5552c..ca25a292cd 100644 --- a/MdePkg/Library/BaseFdtLib/FdtLib.c +++ b/MdePkg/Library/BaseFdtLib/FdtLib.c @@ -148,6 +148,43 @@ FdtCreateEmptyTree ( return fdt_create_empty_tree (Buffer, (int)BufferSize); } +/** + Unpack FDT blob into new buffer + + @param[in] Fdt The pointer to FDT blob. + @param[out] Buffer Pointer to destination buffer. + @param[in] BufferSize The size of destination buffer. + + @return Zero for successfully, otherwise failed. + + **/ +INT32 +EFIAPI +FdtOpenInto ( + IN CONST VOID *Fdt, + OUT VOID *Buffer, + IN INT32 BufferSize + ) +{ + return fdt_open_into (Fdt, Buffer, BufferSize); +} + +/** + Pack FDT blob in place. + + @param[in][out] Fdt The pointer to FDT blob. + + @return Zero. +**/ +INT32 +EFIAPI +FdtPack ( + IN OUT VOID *Fdt + ) +{ + return fdt_pack (Fdt); +} + /** Returns a offset of next node from the given node. -- cgit v1.2.3