summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Lindholm <quic_llindhol@quicinc.com>2024-10-01 15:49:38 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-10-02 02:58:31 +0000
commit9ba11ee131fb2aaaf821c72477e3cf7b441e5c99 (patch)
tree17ee8b68dcf545b7c99e0605b16db400aef105e3
parent9dc9a4bae62beab984dc4b0ce5e58c4575bd1c05 (diff)
downloadedk2-9ba11ee131fb2aaaf821c72477e3cf7b441e5c99.tar.gz
edk2-9ba11ee131fb2aaaf821c72477e3cf7b441e5c99.tar.bz2
edk2-9ba11ee131fb2aaaf821c72477e3cf7b441e5c99.zip
MdePkg: export FdtOpenInto/FdtPack from BaseFdtLib
Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
-rw-r--r--MdePkg/Include/Library/FdtLib.h31
-rw-r--r--MdePkg/Library/BaseFdtLib/FdtLib.c37
2 files changed, 68 insertions, 0 deletions
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
@@ -287,6 +287,37 @@ FdtCheckHeader (
);
/**
+ 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.
@param[in] Buffer The pointer to allocate a pool for FDT blob.
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
@@ -149,6 +149,43 @@ FdtCreateEmptyTree (
}
/**
+ 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.
@param[in] Fdt The pointer to FDT blob.