aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArunachalam Ganapathy <arunachalam.ganapathy@arm.com>2020-09-22 13:25:21 +0100
committerArunachalam Ganapathy <arunachalam.ganapathy@arm.com>2020-10-14 17:49:05 +0100
commit51be1fed841ce211384391fc0bf1967aa238ee9f (patch)
tree0a2eaf443c15190c3c65445b1deb70ef2e77cc2c
parent8c65f72e903377d42b78239eefc6e0d78166e8c1 (diff)
downloadtf-a-tests-51be1fed841ce211384391fc0bf1967aa238ee9f.tar.gz
cactus: re-structure platform dependent files
This patch makes below changes to cactus: - Platform dependent files are moved to spm/cactus/plat/arm/fvp - Removes relative path dependency for cactus dts by copying it to build directory. - Platform dependent macros are defined in cactus_platform_def.h like - Device base - Console UART - RX Base - Execution context count Change-Id: I59e3c3f8640e01e46fc91bee4d8ce4255eaf9737 Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
-rw-r--r--plat/arm/fvp/platform.mk2
-rw-r--r--spm/cactus/cactus.mk32
-rw-r--r--spm/cactus/cactus_def.h2
-rw-r--r--spm/cactus/cactus_ffa_tests.c22
-rw-r--r--spm/cactus/cactus_main.c12
-rw-r--r--spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts (renamed from spm/cactus/cactus-secondary.dts)0
-rw-r--r--spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts (renamed from spm/cactus/cactus-tertiary.dts)0
-rw-r--r--spm/cactus/plat/arm/fvp/fdts/cactus.dts (renamed from spm/cactus/cactus.dts)0
-rw-r--r--spm/cactus/plat/arm/fvp/include/cactus_platform_def.h24
-rw-r--r--spm/cactus/plat/arm/fvp/platform.mk17
-rwxr-xr-xtools/generate_json/generate_json.sh13
11 files changed, 102 insertions, 22 deletions
diff --git a/plat/arm/fvp/platform.mk b/plat/arm/fvp/platform.mk
index 3c4311ffa..42779c720 100644
--- a/plat/arm/fvp/platform.mk
+++ b/plat/arm/fvp/platform.mk
@@ -68,7 +68,7 @@ $(eval $(call add_define,NS_BL2U_DEFINES,FVP_CLUSTER_COUNT))
$(eval $(call add_define,NS_BL2U_DEFINES,FVP_MAX_CPUS_PER_CLUSTER))
$(eval $(call add_define,NS_BL2U_DEFINES,FVP_MAX_PE_PER_CPU))
-PLAT_INCLUDES := -Iplat/arm/fvp/include/
+PLAT_INCLUDES += -Iplat/arm/fvp/include/
PLAT_SOURCES := drivers/arm/gic/arm_gic_v2v3.c \
drivers/arm/gic/gic_v2.c \
diff --git a/spm/cactus/cactus.mk b/spm/cactus/cactus.mk
index e6577c3ca..779fd38a4 100644
--- a/spm/cactus/cactus.mk
+++ b/spm/cactus/cactus.mk
@@ -7,6 +7,12 @@
include branch_protection.mk
include lib/xlat_tables_v2/xlat_tables.mk
+# Include cactus platform make file
+CACTUS_PLAT_PATH := $(shell find spm/cactus/plat -wholename '*/${PLAT}')
+ifneq (${CACTUS_PLAT_PATH},)
+ include ${CACTUS_PLAT_PATH}/platform.mk
+endif
+
CACTUS_DTB := $(BUILD_PLAT)/cactus.dtb
CACTUS_INCLUDES := \
@@ -69,16 +75,32 @@ $(eval $(call add_define,CACTUS_DEFINES,FVP_MAX_PE_PER_CPU))
$(eval $(call add_define,CACTUS_DEFINES,LOG_LEVEL))
$(eval $(call add_define,CACTUS_DEFINES,PLAT_${PLAT}))
-
$(CACTUS_DTB) : $(BUILD_PLAT)/cactus $(BUILD_PLAT)/cactus/cactus.elf
-$(CACTUS_DTB) : spm/cactus/cactus.dts
- @echo " DTBGEN spm/cactus/cactus.dts"
+$(CACTUS_DTB) : $(CACTUS_DTS)
+ @echo " DTBGEN $@"
${Q}tools/generate_dtb/generate_dtb.sh \
- cactus spm/cactus/cactus.dts $(BUILD_PLAT)
+ cactus ${CACTUS_DTS} $(BUILD_PLAT)
${Q}tools/generate_json/generate_json.sh \
- cactus $(PLAT) $(BUILD_TYPE)
+ cactus $(BUILD_PLAT)
@echo
@echo "Built $@ successfully"
@echo
cactus: $(CACTUS_DTB)
+
+# FDTS_CP copies flattened device tree sources
+# $(1) = output directory
+# $(2) = flattened device tree source file to copy
+define FDTS_CP
+ $(eval FDTS := $(addprefix $(1)/,$(notdir $(2))))
+FDTS_LIST += $(FDTS)
+$(FDTS): $(2) $(CACTUS_DTB)
+ @echo " CP $$<"
+ ${Q}cp $$< $$@
+endef
+
+ifdef FDTS_CP_LIST
+ $(eval files := $(filter %.dts,$(FDTS_CP_LIST)))
+ $(eval $(foreach file,$(files),$(call FDTS_CP,$(BUILD_PLAT),$(file))))
+cactus: $(FDTS_LIST)
+endif
diff --git a/spm/cactus/cactus_def.h b/spm/cactus/cactus_def.h
index be6f06ae1..83be35f7b 100644
--- a/spm/cactus/cactus_def.h
+++ b/spm/cactus/cactus_def.h
@@ -24,7 +24,7 @@
* RX/TX buffer used by VM's in SPM for memory sharing
* Each VM allocated 2 pages, one for RX and one for TX buffer.
*/
-#define CACTUS_RX_BASE ULL(0x7300000)
+#define CACTUS_RX_BASE PLAT_CACTUS_RX_BASE
#define CACTUS_TX_BASE CACTUS_RX_BASE + PAGE_SIZE
#define CACTUS_RX_TX_SIZE PAGE_SIZE * 2
diff --git a/spm/cactus/cactus_ffa_tests.c b/spm/cactus/cactus_ffa_tests.c
index a242e41a0..81970f763 100644
--- a/spm/cactus/cactus_ffa_tests.c
+++ b/spm/cactus/cactus_ffa_tests.c
@@ -6,6 +6,7 @@
#include <assert.h>
#include <debug.h>
#include <errno.h>
+#include <cactus_platform_def.h>
#include <cactus_def.h>
#include <ffa_helpers.h>
#include <sp_helpers.h>
@@ -121,9 +122,24 @@ static void ffa_partition_info_get_test(struct mailbox_buffers *mb)
const char *test_all = "Get all partitions info";
const struct ffa_partition_info expected_info[] = {
- {.id = SPM_VM_ID_FIRST, .exec_context = 8U, .properties = 0U}, /* Primary partition info */
- {.id = SPM_VM_ID_FIRST + 1U, .exec_context = 8U, .properties = 0U}, /* Secondary partition info */
- {.id = SPM_VM_ID_FIRST + 2U, .exec_context = 8U, .properties = 0U} /* Tertiary partition info */
+ /* Primary partition info */
+ {
+ .id = SPM_VM_ID_FIRST,
+ .exec_context = CACTUS_PRIMARY_EC_COUNT,
+ .properties = 0U
+ },
+ /* Secondary partition info */
+ {
+ .id = SPM_VM_ID_FIRST + 1U,
+ .exec_context = CACTUS_SECONDARY_EC_COUNT,
+ .properties = 0U
+ },
+ /* Tertiary partition info */
+ {
+ .id = SPM_VM_ID_FIRST + 2U,
+ .exec_context = CACTUS_TERTIARY_EC_COUNT,
+ .properties = 0U
+ }
};
announce_test_section_start(test_partition_info);
diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c
index 080971630..acbe2af65 100644
--- a/spm/cactus/cactus_main.c
+++ b/spm/cactus/cactus_main.c
@@ -9,6 +9,7 @@
#include "cactus.h"
#include "cactus_def.h"
+#include <cactus_platform_def.h>
#include "cactus_tests.h"
#include <debug.h>
#include <drivers/arm/pl011.h>
@@ -84,8 +85,9 @@ static void __dead2 message_loop(ffa_vm_id_t vm_id)
}
static const mmap_region_t cactus_mmap[] __attribute__((used)) = {
- /* DEVICE0 area includes UART2 necessary to console */
- MAP_REGION_FLAT(DEVICE0_BASE, DEVICE0_SIZE, MT_DEVICE | MT_RW),
+ /* PLAT_ARM_DEVICE0 area includes UART2 necessary to console */
+ MAP_REGION_FLAT(PLAT_ARM_DEVICE0_BASE, PLAT_ARM_DEVICE0_SIZE,
+ MT_DEVICE | MT_RW),
{0}
};
@@ -179,9 +181,9 @@ void __dead2 cactus_main(void)
enable_mmu_el1(0);
if (ffa_id == SPM_VM_ID_FIRST) {
- console_init(PL011_UART2_BASE,
- PL011_UART2_CLK_IN_HZ,
- PL011_BAUDRATE);
+ console_init(CACTUS_PL011_UART_BASE,
+ CACTUS_PL011_UART_CLK_IN_HZ,
+ PL011_BAUDRATE);
set_putc_impl(PL011_AS_STDOUT);
diff --git a/spm/cactus/cactus-secondary.dts b/spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts
index 661684bd7..661684bd7 100644
--- a/spm/cactus/cactus-secondary.dts
+++ b/spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts
diff --git a/spm/cactus/cactus-tertiary.dts b/spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts
index ea7d5d6ff..ea7d5d6ff 100644
--- a/spm/cactus/cactus-tertiary.dts
+++ b/spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts
diff --git a/spm/cactus/cactus.dts b/spm/cactus/plat/arm/fvp/fdts/cactus.dts
index e64d3a8ef..e64d3a8ef 100644
--- a/spm/cactus/cactus.dts
+++ b/spm/cactus/plat/arm/fvp/fdts/cactus.dts
diff --git a/spm/cactus/plat/arm/fvp/include/cactus_platform_def.h b/spm/cactus/plat/arm/fvp/include/cactus_platform_def.h
new file mode 100644
index 000000000..e87900275
--- /dev/null
+++ b/spm/cactus/plat/arm/fvp/include/cactus_platform_def.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <platform_def.h>
+
+#ifndef CACTUS_PLATFORM_DEF_H
+#define CACTUS_PLATFORM_DEF_H
+
+#define PLAT_ARM_DEVICE0_BASE DEVICE0_BASE
+#define PLAT_ARM_DEVICE0_SIZE DEVICE0_SIZE
+
+#define CACTUS_PL011_UART_BASE PL011_UART2_BASE
+#define CACTUS_PL011_UART_CLK_IN_HZ PL011_UART2_CLK_IN_HZ
+
+#define PLAT_CACTUS_RX_BASE ULL(0x7300000)
+
+#define CACTUS_PRIMARY_EC_COUNT (8U)
+#define CACTUS_SECONDARY_EC_COUNT (8U)
+#define CACTUS_TERTIARY_EC_COUNT (8U)
+
+#endif /* CACTUS_PLATFORM_DEF_H */
diff --git a/spm/cactus/plat/arm/fvp/platform.mk b/spm/cactus/plat/arm/fvp/platform.mk
new file mode 100644
index 000000000..c7b01bbec
--- /dev/null
+++ b/spm/cactus/plat/arm/fvp/platform.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+FVP_CACTUS_BASE = spm/cactus/plat/arm/fvp
+
+PLAT_INCLUDES += -I${FVP_CACTUS_BASE}/include/
+
+# Add the FDT source
+CACTUS_DTS = ${FVP_CACTUS_BASE}/fdts/cactus.dts
+
+# List of FDTS to copy
+FDTS_CP_LIST = ${FVP_CACTUS_BASE}/fdts/cactus.dts
+FDTS_CP_LIST += ${FVP_CACTUS_BASE}/fdts/cactus-secondary.dts
+FDTS_CP_LIST += ${FVP_CACTUS_BASE}/fdts/cactus-tertiary.dts
diff --git a/tools/generate_json/generate_json.sh b/tools/generate_json/generate_json.sh
index 449733ce8..f46cf158a 100755
--- a/tools/generate_json/generate_json.sh
+++ b/tools/generate_json/generate_json.sh
@@ -10,11 +10,10 @@
# Secure Partitions as part of FIP.
# $1 = Secure Partition (cactus)
-# $2 = Platform (fvp)
-# $3 = Build Type
-# Output = build/plat/<Build Type>/sp_layout.json
+# $2 = Platform built path
+# Output = $2/sp_layout.json
-GENERATED_JSON=build/$2/$3/sp_layout.json
+GENERATED_JSON=$2/sp_layout.json
# To demonstrate communication between SP's, two cactus S-EL1 instances used.
# To also test mapping of the RXTX region a third cactus S-EL1 instance is used.
@@ -23,13 +22,13 @@ GENERATED_JSON=build/$2/$3/sp_layout.json
if [ "$1" == "cactus" ]; then
echo -e "{\n\t\"$1-primary\" : {\n \
\t\"image\": \"$1.bin\",\n \
- \t\"pm\": \"../../../spm/$1/$1.dts\",\n \
+ \t\"pm\": \"$1.dts\",\n \
\t\"owner\": \"SiP\"\n\t},\n\n\t\"$1-secondary\" : {\n \
\t\"image\": \"$1.bin\",\n \
- \t\"pm\": \"../../../spm/$1/$1-secondary.dts\",\n \
+ \t\"pm\": \"$1-secondary.dts\",\n \
\t\"owner\": \"Plat\"\n\t},\n\n\t\"$1-tertiary\" : {\n \
\t\"image\": \"$1.bin\",\n \
- \t\"pm\": \"../../../spm/$1/$1-tertiary.dts\" \n \
+ \t\"pm\": \"$1-tertiary.dts\" \n \
}\n}" \
> "$GENERATED_JSON"
else