From fbd11e4013b554240897ecb20d93e7ec7b4c2d53 Mon Sep 17 00:00:00 2001 From: Hanna Hawa Date: Fri, 25 Aug 2017 16:45:12 +0300 Subject: plat: mvebu: add check of north bridge number to marvell_check_mpidr function Part of AP810 preparation and driver changes, add check of north bridge number to marvell_check_mpidr function. For Armada-8k family and Armada-37xx family, no functional change, they have single north bridge die. Armada-8k-plus family can contain 4 north bridge dies, so need to check the value of the die number. Change-Id: I1f3b9fa46e6b099f83024e411828f586bb8927c2 Signed-off-by: Hanna Hawa Reviewed-on: http://vgitil04.il.marvell.com:8080/43400 Tested-by: iSoC Platform CI Reviewed-by: Hua Jing Reviewed-by: Kostya Porotchkin --- include/plat/marvell/a3700/common/arm_def.h | 2 ++ plat/marvell/a8k/common/include/platform_def.h | 2 ++ plat/marvell/common/marvell_topology.c | 13 +++++++++---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/plat/marvell/a3700/common/arm_def.h b/include/plat/marvell/a3700/common/arm_def.h index f7ace8e0..d0f771aa 100644 --- a/include/plat/marvell/a3700/common/arm_def.h +++ b/include/plat/marvell/a3700/common/arm_def.h @@ -77,6 +77,8 @@ /* Special value used to verify platform parameters from BL2 to BL31 */ #define MARVELL_BL31_PLAT_PARAM_VAL 0x0f1e2d3c4b5a6978ULL +#define PLAT_MARVELL_NORTHB_COUNT 1 + #define PLAT_MARVELL_CLUSTER_COUNT 1 #define MARVELL_CACHE_WRITEBACK_SHIFT 6 diff --git a/plat/marvell/a8k/common/include/platform_def.h b/plat/marvell/a8k/common/include/platform_def.h index 9b7e60eb..3683c6c7 100644 --- a/plat/marvell/a8k/common/include/platform_def.h +++ b/plat/marvell/a8k/common/include/platform_def.h @@ -115,6 +115,8 @@ 0x20000) #define PLAT_MARVELL_FIP_MAX_SIZE 0x4000000 +#define PLAT_MARVELL_NORTHB_COUNT 1 + #define PLAT_MARVELL_CLUSTER_COUNT 2 #define PLAT_MARVELL_CLUSTER_CORE_COUNT 2 diff --git a/plat/marvell/common/marvell_topology.c b/plat/marvell/common/marvell_topology.c index dfd9ce6d..20770b19 100644 --- a/plat/marvell/common/marvell_topology.c +++ b/plat/marvell/common/marvell_topology.c @@ -97,15 +97,20 @@ const unsigned char *plat_get_power_domain_tree_desc(void) ******************************************************************************/ int marvell_check_mpidr(u_register_t mpidr) { - unsigned int cluster_id, cpu_id; + unsigned int nb_id, cluster_id, cpu_id; mpidr &= MPIDR_AFFINITY_MASK; - if (mpidr & ~(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK)) + if (mpidr & ~(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK | MPIDR_AFFLVL_MASK << MPIDR_AFF2_SHIFT)) return -1; - cluster_id = (mpidr >> MPIDR_AFF1_SHIFT) & MPIDR_AFFLVL_MASK; - cpu_id = (mpidr >> MPIDR_AFF0_SHIFT) & MPIDR_AFFLVL_MASK; + /* Get north bridge ID */ + nb_id = MPIDR_AFFLVL3_VAL(mpidr); + cluster_id = MPIDR_AFFLVL1_VAL(mpidr); + cpu_id = MPIDR_AFFLVL0_VAL(mpidr); + + if (nb_id >= PLAT_MARVELL_CLUSTER_COUNT) + return -1; if (cluster_id >= PLAT_MARVELL_CLUSTER_COUNT) return -1; -- cgit