Commit 6c77dfc5 authored by Louis Mayencourt's avatar Louis Mayencourt
Browse files

Use the proper size for tb_fw_cfg_dtb



Currently tb_fw_cfg_dtb size is fixed to max, which is generally a page
(but depend on the platform). Instead, read the actual size of the dtb
with the libfdt "fdt_totalsize" function.
This avoid flushing extra memory after updating the dtb with mbedtls
heap information when shared heap is used.

Change-Id: Ibec727661116429f486464a0c9f15e9760d7afe2
Signed-off-by: default avatarLouis Mayencourt <louis.mayencourt@arm.com>
parent 87b582ef
/* /*
* Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include <libfdt.h>
#include <platform_def.h> #include <platform_def.h>
...@@ -21,8 +22,6 @@ ...@@ -21,8 +22,6 @@
/* Variable to store the address to TB_FW_CONFIG passed from BL1 */ /* Variable to store the address to TB_FW_CONFIG passed from BL1 */
static void *tb_fw_cfg_dtb; static void *tb_fw_cfg_dtb;
static size_t tb_fw_cfg_dtb_size;
#if TRUSTED_BOARD_BOOT #if TRUSTED_BOARD_BOOT
...@@ -110,7 +109,7 @@ void arm_bl1_set_mbedtls_heap(void) ...@@ -110,7 +109,7 @@ void arm_bl1_set_mbedtls_heap(void)
* without the heap info. * without the heap info.
*/ */
flush_dcache_range((uintptr_t)tb_fw_cfg_dtb, flush_dcache_range((uintptr_t)tb_fw_cfg_dtb,
tb_fw_cfg_dtb_size); fdt_totalsize(tb_fw_cfg_dtb));
} }
} }
...@@ -146,7 +145,6 @@ void arm_load_tb_fw_config(void) ...@@ -146,7 +145,6 @@ void arm_load_tb_fw_config(void)
/* At this point we know that a DTB is indeed available */ /* At this point we know that a DTB is indeed available */
config_base = arm_tb_fw_info.image_info.image_base; config_base = arm_tb_fw_info.image_info.image_base;
tb_fw_cfg_dtb = (void *)config_base; tb_fw_cfg_dtb = (void *)config_base;
tb_fw_cfg_dtb_size = (size_t)arm_tb_fw_info.image_info.image_max_size;
/* The BL2 ep_info arg0 is modified to point to TB_FW_CONFIG */ /* The BL2 ep_info arg0 is modified to point to TB_FW_CONFIG */
desc = bl1_plat_get_image_desc(BL2_IMAGE_ID); desc = bl1_plat_get_image_desc(BL2_IMAGE_ID);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment