diff options
author | Andre Przywara <andre.przywara@arm.com> | 2020-07-09 12:33:17 +0100 |
---|---|---|
committer | Andre Przywara <andre.przywara@arm.com> | 2020-07-17 11:35:24 +0100 |
commit | 5a430c0219681afde74a8362665fe583473f0b0f (patch) | |
tree | f0772e91a3aaf28188ffa31045f4367a291da78a /include/common | |
parent | 2bdb4611ad6efdb3da2ff0d2de7fee4c43e95aeb (diff) | |
download | trusted-firmware-a-5a430c0219681afde74a8362665fe583473f0b0f.tar.gz |
rpi4/fdt: Move dtb_size() function to fdt_wrappers.h
Getting the actual size of a DTB blob is useful beyond the Raspberry Pi
port, so let's move this helper to a common header.
Change-Id: Ia5be46e9353ca859a1e5ad9e3c057a322dfe22e2
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Diffstat (limited to 'include/common')
-rw-r--r-- | include/common/fdt_wrappers.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/common/fdt_wrappers.h b/include/common/fdt_wrappers.h index 1d8da18235..a571092e36 100644 --- a/include/common/fdt_wrappers.h +++ b/include/common/fdt_wrappers.h @@ -9,6 +9,8 @@ #ifndef FDT_WRAPPERS_H #define FDT_WRAPPERS_H +#include <libfdt_env.h> + /* Number of cells, given total length in bytes. Each cell is 4 bytes long */ #define NCELLS(len) ((len) / 4U) @@ -37,4 +39,11 @@ int fdt_get_stdout_node_offset(const void *dtb); uint64_t fdtw_translate_address(const void *dtb, int bus_node, uint64_t base_address); +static inline uint32_t fdt_blob_size(const void *dtb) +{ + const uint32_t *dtb_header = dtb; + + return fdt32_to_cpu(dtb_header[1]); +} + #endif /* FDT_WRAPPERS_H */ |