From 4d476e45f271dd520fb22a5a7277c59689400a4d Mon Sep 17 00:00:00 2001 From: Roberto Vargas Date: Fri, 20 Oct 2017 10:37:48 +0100 Subject: [PATCH 1/3] Include debug.h in debug.S debug.S was using macros defined in debug.h, but since it didn't include it, these macros were taking the value 0, which means that all the preprocessor conditionals were wrong. Change-Id: If4ca81cc5a1662991589f914a2557ceff0eaaede Signed-off-by: Roberto Vargas --- common/aarch64/debug.S | 1 + 1 file changed, 1 insertion(+) diff --git a/common/aarch64/debug.S b/common/aarch64/debug.S index d794d12ead..4478d0d038 100644 --- a/common/aarch64/debug.S +++ b/common/aarch64/debug.S @@ -6,6 +6,7 @@ #include #include +#include .globl asm_print_str .globl asm_print_hex From d58f3cacc3520e17430997af6dadb2beeae7e503 Mon Sep 17 00:00:00 2001 From: Roberto Vargas Date: Fri, 20 Oct 2017 10:46:23 +0100 Subject: [PATCH 2/3] Always define ARM_TSP_RAM_LOCATION_ID ARM_TSP_RAM_LOCATION_ID was defined only in AARCH64, but the macro was also used in AARCH32, and it meant that it was taking the value 0, which happened to equal ARM_TRUSTED_SRAM_ID. Change-Id: If9f4dbee1a2ba15e7806f2a03305b554bd327363 Signed-off-by: Roberto Vargas --- plat/arm/common/arm_common.mk | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plat/arm/common/arm_common.mk b/plat/arm/common/arm_common.mk index 82f02b1764..2239a08b39 100644 --- a/plat/arm/common/arm_common.mk +++ b/plat/arm/common/arm_common.mk @@ -21,14 +21,17 @@ ifeq (${ARCH}, aarch64) endif # Process flags - $(eval $(call add_define,ARM_TSP_RAM_LOCATION_ID)) - # Process ARM_BL31_IN_DRAM flag ARM_BL31_IN_DRAM := 0 $(eval $(call assert_boolean,ARM_BL31_IN_DRAM)) $(eval $(call add_define,ARM_BL31_IN_DRAM)) +else + ARM_TSP_RAM_LOCATION_ID = ARM_TRUSTED_SRAM_ID endif +$(eval $(call add_define,ARM_TSP_RAM_LOCATION_ID)) + + # For the original power-state parameter format, the State-ID can be encoded # according to the recommended encoding or zero. This flag determines which # State-ID encoding to be parsed. From e8a87acd4b7f3c526de036920df42230e37e6144 Mon Sep 17 00:00:00 2001 From: Roberto Vargas Date: Mon, 23 Oct 2017 08:22:17 +0100 Subject: [PATCH 3/3] Fix usage of IMAGE_BLx macros These macros are only defined for corresponding image, and they are undefined for other images. It means that we have to use ifdef or defined() instead of relying on being 0 by default. Change-Id: Iad11efab9830ddf471599b46286e1c56581ef5a7 Signed-off-by: Roberto Vargas --- include/lib/xlat_tables/xlat_tables_v2_helpers.h | 2 +- plat/hisilicon/hikey/aarch64/hikey_common.c | 8 ++++---- plat/hisilicon/hikey/hikey_io_storage.c | 2 +- plat/hisilicon/hikey/include/platform_def.h | 6 +++--- plat/hisilicon/hikey960/aarch64/hikey960_common.c | 8 ++++---- plat/hisilicon/hikey960/include/platform_def.h | 4 ++-- plat/rockchip/rk3328/include/platform_def.h | 8 ++++---- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/lib/xlat_tables/xlat_tables_v2_helpers.h b/include/lib/xlat_tables/xlat_tables_v2_helpers.h index 28228c4c65..96dee1a06d 100644 --- a/include/lib/xlat_tables/xlat_tables_v2_helpers.h +++ b/include/lib/xlat_tables/xlat_tables_v2_helpers.h @@ -168,7 +168,7 @@ struct xlat_ctx { * This IMAGE_EL macro must not to be used outside the library, and it is only * used in AArch64. */ -#if IMAGE_BL1 || IMAGE_BL31 +#if defined(IMAGE_BL1) || defined(IMAGE_BL31) # define IMAGE_EL 3 # define IMAGE_XLAT_DEFAULT_REGIME EL3_REGIME #else diff --git a/plat/hisilicon/hikey/aarch64/hikey_common.c b/plat/hisilicon/hikey/aarch64/hikey_common.c index 02a00ac804..d5b63cc6ef 100644 --- a/plat/hisilicon/hikey/aarch64/hikey_common.c +++ b/plat/hisilicon/hikey/aarch64/hikey_common.c @@ -59,7 +59,7 @@ * This doesn't include Trusted RAM as the 'mem_layout' argument passed to * hikey_init_mmu_elx() will give the available subset of that, */ -#if IMAGE_BL1 +#ifdef IMAGE_BL1 static const mmap_region_t hikey_mmap[] = { MAP_DEVICE, MAP_ROM_PARAM, @@ -68,7 +68,7 @@ static const mmap_region_t hikey_mmap[] = { }; #endif -#if IMAGE_BL2 +#ifdef IMAGE_BL2 static const mmap_region_t hikey_mmap[] = { MAP_DDR, MAP_DEVICE, @@ -82,7 +82,7 @@ static const mmap_region_t hikey_mmap[] = { }; #endif -#if IMAGE_BL31 +#ifdef IMAGE_BL31 static const mmap_region_t hikey_mmap[] = { MAP_DEVICE, MAP_SRAM, @@ -91,7 +91,7 @@ static const mmap_region_t hikey_mmap[] = { }; #endif -#if IMAGE_BL32 +#ifdef IMAGE_BL32 static const mmap_region_t hikey_mmap[] = { MAP_DEVICE, MAP_DDR, diff --git a/plat/hisilicon/hikey/hikey_io_storage.c b/plat/hisilicon/hikey/hikey_io_storage.c index 60ec42b771..57c66d501b 100644 --- a/plat/hisilicon/hikey/hikey_io_storage.c +++ b/plat/hisilicon/hikey/hikey_io_storage.c @@ -47,7 +47,7 @@ static const io_block_spec_t emmc_fip_spec = { static const io_block_dev_spec_t emmc_dev_spec = { /* It's used as temp buffer in block driver. */ -#if IMAGE_BL1 +#ifdef IMAGE_BL1 .buffer = { .offset = HIKEY_BL1_MMC_DATA_BASE, .length = HIKEY_BL1_MMC_DATA_SIZE, diff --git a/plat/hisilicon/hikey/include/platform_def.h b/plat/hisilicon/hikey/include/platform_def.h index 01806542d8..f4a3fd4e07 100644 --- a/plat/hisilicon/hikey/include/platform_def.h +++ b/plat/hisilicon/hikey/include/platform_def.h @@ -151,15 +151,15 @@ */ #define ADDR_SPACE_SIZE (1ull << 32) -#if IMAGE_BL1 || IMAGE_BL32 +#if defined(IMAGE_BL1) || defined(IMAGE_BL32) #define MAX_XLAT_TABLES 3 #endif -#if IMAGE_BL31 +#ifdef IMAGE_BL31 #define MAX_XLAT_TABLES 4 #endif -#if IMAGE_BL2 +#ifdef IMAGE_BL2 #if LOAD_IMAGE_V2 #ifdef SPD_opteed #define MAX_XLAT_TABLES 4 diff --git a/plat/hisilicon/hikey960/aarch64/hikey960_common.c b/plat/hisilicon/hikey960/aarch64/hikey960_common.c index bce0c96a45..b1020a683f 100644 --- a/plat/hisilicon/hikey960/aarch64/hikey960_common.c +++ b/plat/hisilicon/hikey960/aarch64/hikey960_common.c @@ -55,7 +55,7 @@ * This doesn't include Trusted RAM as the 'mem_layout' argument passed to * hikey960_init_mmu_elx() will give the available subset of that, */ -#if IMAGE_BL1 +#ifdef IMAGE_BL1 static const mmap_region_t hikey960_mmap[] = { MAP_UFS_DATA, MAP_BL1_RW, @@ -65,7 +65,7 @@ static const mmap_region_t hikey960_mmap[] = { }; #endif -#if IMAGE_BL2 +#ifdef IMAGE_BL2 static const mmap_region_t hikey960_mmap[] = { MAP_DDR, MAP_DEVICE, @@ -79,7 +79,7 @@ static const mmap_region_t hikey960_mmap[] = { }; #endif -#if IMAGE_BL31 +#ifdef IMAGE_BL31 static const mmap_region_t hikey960_mmap[] = { MAP_DEVICE, MAP_TSP_MEM, @@ -87,7 +87,7 @@ static const mmap_region_t hikey960_mmap[] = { }; #endif -#if IMAGE_BL32 +#ifdef IMAGE_BL32 static const mmap_region_t hikey960_mmap[] = { MAP_DEVICE, MAP_DDR, diff --git a/plat/hisilicon/hikey960/include/platform_def.h b/plat/hisilicon/hikey960/include/platform_def.h index 202952c5ea..cb7609076c 100644 --- a/plat/hisilicon/hikey960/include/platform_def.h +++ b/plat/hisilicon/hikey960/include/platform_def.h @@ -116,11 +116,11 @@ */ #define ADDR_SPACE_SIZE (1ull << 32) -#if IMAGE_BL1 || IMAGE_BL31 || IMAGE_BL32 +#if defined(IMAGE_BL1) || defined(IMAGE_BL31) || defined(IMAGE_BL32) #define MAX_XLAT_TABLES 3 #endif -#if IMAGE_BL2 +#ifdef IMAGE_BL2 #if LOAD_IMAGE_V2 #ifdef SPD_opteed #define MAX_XLAT_TABLES 4 diff --git a/plat/rockchip/rk3328/include/platform_def.h b/plat/rockchip/rk3328/include/platform_def.h index 7304dcfad8..39d3c21e1c 100644 --- a/plat/rockchip/rk3328/include/platform_def.h +++ b/plat/rockchip/rk3328/include/platform_def.h @@ -26,13 +26,13 @@ /* Size of cacheable stacks */ #if DEBUG_XLAT_TABLE #define PLATFORM_STACK_SIZE 0x800 -#elif IMAGE_BL1 +#elif defined(IMAGE_BL1) #define PLATFORM_STACK_SIZE 0x440 -#elif IMAGE_BL2 +#elif defined(IMAGE_BL2) #define PLATFORM_STACK_SIZE 0x400 -#elif IMAGE_BL31 +#elif defined(IMAGE_BL31) #define PLATFORM_STACK_SIZE 0x800 -#elif IMAGE_BL32 +#elif defined(IMAGE_BL32) #define PLATFORM_STACK_SIZE 0x440 #endif