blob: 25ebac6b927f30bcee7a62fcf5f77f7599b166d1 [file] [log] [blame]
Soren Brinkmann76fcae32016-03-06 20:16:27 -08001/*
Antonio Nino Diazea3c4de2018-10-17 16:46:41 +01002 * 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
Jolly Shah0bfd7002019-01-08 11:10:47 -08007#include <plat_private.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00008#include <plat/common/platform.h>
9
Venkatesh Yadav Abbarapue7c45382022-05-19 14:49:49 +053010int32_t plat_core_pos_by_mpidr(u_register_t mpidr)
Soren Brinkmann76fcae32016-03-06 20:16:27 -080011{
Venkatesh Yadav Abbarapu5f115db2021-01-10 20:40:16 -070012 if (mpidr & MPIDR_CLUSTER_MASK) {
Soren Brinkmann76fcae32016-03-06 20:16:27 -080013 return -1;
Venkatesh Yadav Abbarapu5f115db2021-01-10 20:40:16 -070014 }
Soren Brinkmann76fcae32016-03-06 20:16:27 -080015
Venkatesh Yadav Abbarapu5f115db2021-01-10 20:40:16 -070016 if ((mpidr & MPIDR_CPU_MASK) >= PLATFORM_CORE_COUNT) {
Soren Brinkmann76fcae32016-03-06 20:16:27 -080017 return -1;
Venkatesh Yadav Abbarapu5f115db2021-01-10 20:40:16 -070018 }
Soren Brinkmann76fcae32016-03-06 20:16:27 -080019
Antonio Nino Diazea3c4de2018-10-17 16:46:41 +010020 return zynqmp_calc_core_pos(mpidr);
Soren Brinkmann76fcae32016-03-06 20:16:27 -080021}