diff --git a/include/common/fdt_wrappers.h b/include/common/fdt_wrappers.h index 1d8da1823..a571092e3 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 + /* 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 */ diff --git a/plat/rpi/rpi4/rpi4_bl31_setup.c b/plat/rpi/rpi4/rpi4_bl31_setup.c index 0a49d81b2..cfacd1fe1 100644 --- a/plat/rpi/rpi4/rpi4_bl31_setup.c +++ b/plat/rpi/rpi4/rpi4_bl31_setup.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -200,13 +201,6 @@ void bl31_plat_arch_setup(void) enable_mmu_el3(0); } -static uint32_t dtb_size(const void *dtb) -{ - const uint32_t *dtb_header = dtb; - - return fdt32_to_cpu(dtb_header[1]); -} - static void rpi4_prepare_dtb(void) { void *dtb = (void *)rpi4_get_dtb_address(); @@ -250,7 +244,7 @@ static void rpi4_prepare_dtb(void) if (ret < 0) ERROR("Failed to pack Device Tree at %p: error %d\n", dtb, ret); - clean_dcache_range((uintptr_t)dtb, dtb_size(dtb)); + clean_dcache_range((uintptr_t)dtb, fdt_blob_size(dtb)); INFO("Changed device tree to advertise PSCI.\n"); }