diff options
author | Radoslaw Biernacki <radoslaw.biernacki@linaro.org> | 2018-05-17 22:19:35 +0200 |
---|---|---|
committer | Sandrine Bailleux <sandrine.bailleux@arm.com> | 2019-09-18 15:58:13 +0200 |
commit | 9a006ad10509cf158089470ef713f7edde073eaf (patch) | |
tree | 3730ccc4409e0b16b1a109db1aad41d3dfe3d39e /plat/qemu | |
parent | 301d27d998892c054dec925264f81b11dcd64822 (diff) | |
download | arm-trusted-firmware-9a006ad10509cf158089470ef713f7edde073eaf.tar.gz |
qemu: Simplify the image size calculation
Patch introduce the macro NS_IMAGE_MAX_SIZE to simplify the image size
calculation. Use of additional parenthesis removes the possibility of
improper calculations due nested macro expansion for subtraction.
In case of platforms with DRAM window over 32bits, patch also removes
potential problems with type casting, as meminfo.image_size is uint32_t
but macro calculations were done in 64bit space.
Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
Change-Id: I2d05a2d9dd6000dba6114df53262995cf85af018
Diffstat (limited to 'plat/qemu')
-rw-r--r-- | plat/qemu/common/qemu_bl2_mem_params_desc.c | 5 | ||||
-rw-r--r-- | plat/qemu/qemu/include/platform_def.h | 3 |
2 files changed, 4 insertions, 4 deletions
diff --git a/plat/qemu/common/qemu_bl2_mem_params_desc.c b/plat/qemu/common/qemu_bl2_mem_params_desc.c index a01f2dc91..f8b9066df 100644 --- a/plat/qemu/common/qemu_bl2_mem_params_desc.c +++ b/plat/qemu/common/qemu_bl2_mem_params_desc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -139,8 +139,7 @@ static bl_mem_params_node_t bl2_mem_params_descs[] = { SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, VERSION_2, image_info_t, 0), .image_info.image_base = NS_IMAGE_OFFSET, - .image_info.image_max_size = NS_DRAM0_BASE + NS_DRAM0_SIZE - - NS_IMAGE_OFFSET, + .image_info.image_max_size = NS_IMAGE_MAX_SIZE, # endif /* !PRELOADED_BL33_BASE */ .next_handoff_image_id = INVALID_IMAGE_ID, diff --git a/plat/qemu/qemu/include/platform_def.h b/plat/qemu/qemu/include/platform_def.h index d7f77cc78..a90573712 100644 --- a/plat/qemu/qemu/include/platform_def.h +++ b/plat/qemu/qemu/include/platform_def.h @@ -165,7 +165,8 @@ # error "Unsupported BL32_RAM_LOCATION_ID value" #endif -#define NS_IMAGE_OFFSET 0x60000000 +#define NS_IMAGE_OFFSET (NS_DRAM0_BASE + 0x20000000) +#define NS_IMAGE_MAX_SIZE (NS_DRAM0_SIZE - 0x20000000) #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32) #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32) |