summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MdePkg/Include/Library/FdtLib.h34
-rw-r--r--MdePkg/Library/BaseFdtLib/FdtLib.c41
2 files changed, 75 insertions, 0 deletions
diff --git a/MdePkg/Include/Library/FdtLib.h b/MdePkg/Include/Library/FdtLib.h
index 89aa1e00f9..ffff40d8fe 100644
--- a/MdePkg/Include/Library/FdtLib.h
+++ b/MdePkg/Include/Library/FdtLib.h
@@ -248,6 +248,40 @@ FdtSubnodeOffsetNameLen (
);
/**
+ Returns number of reserved ranges.
+
+ @param[in] Fdt The pointer to FDT blob.
+
+ @return The number of reserved ranges.
+
+**/
+INTN
+EFIAPI
+FdtNumRsv (
+ IN CONST VOID *Fdt
+ );
+
+/**
+ Returns reserved ranges.
+
+ @param[in] *Fdt The pointer to FDT blob.
+ @param[in] Index Reserved entry index in the table.
+ @param[out] Addr Address returned
+ @param[out] *Size Pointer to size of the address range
+
+ @return Returns reserved range.
+
+**/
+INTN
+EFIAPI
+FdtGetMemRsv (
+ IN CONST VOID *Fdt,
+ IN INTN Index,
+ OUT UINT64 *Addr,
+ OUT UINT64 *Size
+ );
+
+/**
Returns a offset of first node which includes the given property name and value.
@param[in] Fdt The pointer to FDT blob.
diff --git a/MdePkg/Library/BaseFdtLib/FdtLib.c b/MdePkg/Library/BaseFdtLib/FdtLib.c
index 9b1ceac551..5ff06111b7 100644
--- a/MdePkg/Library/BaseFdtLib/FdtLib.c
+++ b/MdePkg/Library/BaseFdtLib/FdtLib.c
@@ -7,6 +7,7 @@
**/
#include <libfdt/libfdt/libfdt.h>
+#include <Uefi/UefiBaseType.h>
/**
Convert UINT16 data of the FDT blob to little-endian
@@ -206,6 +207,46 @@ FdtNextSubnode (
}
/**
+ Returns number of reserved mem nodes
+
+ @param[in] Fdt The pointer to FDT blob.
+
+ @return total reserved mem nodes
+
+**/
+INTN
+EFIAPI
+FdtNumRsv (
+ IN CONST VOID *Fdt
+ )
+{
+ return fdt_num_mem_rsv (Fdt);
+}
+
+/**
+ Returns reserved ranges.
+
+ @param[in] *Fdt The pointer to FDT blob.
+ @param[in] Index Reserved entry index in the table.
+ @param[out] Addr Address returned
+ @param[out] *Size Pointer to size of the address range
+
+ @return Returns reserved range.
+
+**/
+INTN
+EFIAPI
+FdtGetMemRsv (
+ IN CONST VOID *Fdt,
+ IN INTN Index,
+ OUT EFI_PHYSICAL_ADDRESS *Addr,
+ OUT UINT64 *Size
+ )
+{
+ return fdt_get_mem_rsv (Fdt, Index, Addr, Size);
+}
+
+/**
Returns a offset of first node which includes the given name.
@param[in] Fdt The pointer to FDT blob.