blob: e3a979ea6d4bf4aaf819c8e00693927fd58544bb [file] [log] [blame]
Soren Brinkmann76fcae32016-03-06 20:16:27 -08001/*
Michal Simek2a47faa2023-04-14 08:43:51 +02002 * Copyright (c) 2015-2018, Arm Limited and Contributors. All rights reserved.
Soren Brinkmann76fcae32016-03-06 20:16:27 -08003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Soren Brinkmann76fcae32016-03-06 20:16:27 -08005 */
6
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00007#include <plat/common/platform.h>
8
Prasad Kummari536e1102023-06-22 10:50:02 +05309#include <plat_private.h>
10
Venkatesh Yadav Abbarapue7c45382022-05-19 14:49:49 +053011int32_t plat_core_pos_by_mpidr(u_register_t mpidr)
Soren Brinkmann76fcae32016-03-06 20:16:27 -080012{
Venkatesh Yadav Abbarapu5f115db2021-01-10 20:40:16 -070013 if (mpidr & MPIDR_CLUSTER_MASK) {
Soren Brinkmann76fcae32016-03-06 20:16:27 -080014 return -1;
Venkatesh Yadav Abbarapu5f115db2021-01-10 20:40:16 -070015 }
Soren Brinkmann76fcae32016-03-06 20:16:27 -080016
Venkatesh Yadav Abbarapu5f115db2021-01-10 20:40:16 -070017 if ((mpidr & MPIDR_CPU_MASK) >= PLATFORM_CORE_COUNT) {
Soren Brinkmann76fcae32016-03-06 20:16:27 -080018 return -1;
Venkatesh Yadav Abbarapu5f115db2021-01-10 20:40:16 -070019 }
Soren Brinkmann76fcae32016-03-06 20:16:27 -080020
Antonio Nino Diazea3c4de2018-10-17 16:46:41 +010021 return zynqmp_calc_core_pos(mpidr);
Soren Brinkmann76fcae32016-03-06 20:16:27 -080022}