arm-trusted-firmware/plat/aspeed/ast2700/plat_topology.c
Chia-Wei Wang 85f199b774 feat(ast2700): add Aspeed AST2700 platform support
Aspeed AST2700 is a quad-core SoC with ARM Cortex-A35 integrated.
This patch adds the initial platform support for AST2700 and also
updates the documents.

Change-Id: I1796f7aae5ed2d1799e91fabb8949607959cd9b3
Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
2023-06-12 10:28:21 +08:00

43 lines
916 B
C

/*
* Copyright (c) 2023, Aspeed Technology Inc.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <arch.h>
#include <lib/psci/psci.h>
#include <platform_def.h>
static const unsigned char ast2700_power_domain_tree_desc[] = {
PLATFORM_SYSTEM_COUNT,
PLATFORM_CORE_COUNT_PER_CLUSTER,
};
const unsigned char *plat_get_power_domain_tree_desc(void)
{
return ast2700_power_domain_tree_desc;
}
unsigned int plat_core_pos_by_mpidr(u_register_t mpidr)
{
unsigned int cluster_id, cpu_id;
mpidr &= MPIDR_AFFINITY_MASK;
if (mpidr & ~(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK)) {
return -1;
}
cluster_id = (mpidr >> MPIDR_AFF1_SHIFT) & MPIDR_AFFLVL_MASK;
cpu_id = (mpidr >> MPIDR_AFF0_SHIFT) & MPIDR_AFFLVL_MASK;
if (cluster_id >= PLATFORM_CLUSTER_COUNT) {
return -1;
}
if (cpu_id >= PLATFORM_CORE_COUNT_PER_CLUSTER) {
return -1;
}
return (cluster_id * PLATFORM_CORE_COUNT_PER_CLUSTER) + cpu_id;
}