2015-05-19 12:18:04 +01:00
|
|
|
/*
|
2017-01-31 22:53:37 +00:00
|
|
|
* Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
|
2015-05-19 12:18:04 +01:00
|
|
|
*
|
2017-05-03 09:38:09 +01:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2015-05-19 12:18:04 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <platform_def.h>
|
2018-12-14 00:18:21 +00:00
|
|
|
|
|
|
|
#include <arch.h>
|
|
|
|
#include <lib/psci/psci.h>
|
2015-05-19 12:18:04 +01:00
|
|
|
|
2015-08-07 05:33:00 +01:00
|
|
|
extern const unsigned char tegra_power_domain_tree_desc[];
|
2017-01-31 22:53:37 +00:00
|
|
|
#pragma weak plat_core_pos_by_mpidr
|
2015-08-07 05:33:00 +01:00
|
|
|
|
2015-05-19 12:18:04 +01:00
|
|
|
/*******************************************************************************
|
2015-08-07 05:33:00 +01:00
|
|
|
* This function returns the Tegra default topology tree information.
|
2015-05-19 12:18:04 +01:00
|
|
|
******************************************************************************/
|
2015-08-07 05:33:00 +01:00
|
|
|
const unsigned char *plat_get_power_domain_tree_desc(void)
|
2015-05-19 12:18:04 +01:00
|
|
|
{
|
2015-08-07 05:33:00 +01:00
|
|
|
return tegra_power_domain_tree_desc;
|
2015-05-19 12:18:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* This function implements a part of the critical interface between the psci
|
2015-08-07 05:33:00 +01:00
|
|
|
* generic layer and the platform that allows the former to query the platform
|
|
|
|
* to convert an MPIDR to a unique linear index. An error code (-1) is returned
|
|
|
|
* in case the MPIDR is invalid.
|
2015-05-19 12:18:04 +01:00
|
|
|
******************************************************************************/
|
2015-08-07 05:33:00 +01:00
|
|
|
int plat_core_pos_by_mpidr(u_register_t mpidr)
|
2015-05-19 12:18:04 +01:00
|
|
|
{
|
2015-08-07 05:33:00 +01:00
|
|
|
unsigned int cluster_id, cpu_id;
|
|
|
|
|
|
|
|
cluster_id = (mpidr >> MPIDR_AFF1_SHIFT) & MPIDR_AFFLVL_MASK;
|
|
|
|
cpu_id = (mpidr >> MPIDR_AFF0_SHIFT) & MPIDR_AFFLVL_MASK;
|
|
|
|
|
|
|
|
if (cluster_id >= PLATFORM_CLUSTER_COUNT)
|
2017-01-31 22:53:37 +00:00
|
|
|
return PSCI_E_NOT_PRESENT;
|
2015-08-07 05:33:00 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Validate cpu_id by checking whether it represents a CPU in
|
|
|
|
* one of the two clusters present on the platform.
|
|
|
|
*/
|
|
|
|
if (cpu_id >= PLATFORM_MAX_CPUS_PER_CLUSTER)
|
2017-01-31 22:53:37 +00:00
|
|
|
return PSCI_E_NOT_PRESENT;
|
2015-08-07 05:33:00 +01:00
|
|
|
|
|
|
|
return (cpu_id + (cluster_id * 4));
|
2015-05-19 12:18:04 +01:00
|
|
|
}
|