blob: ba17b1d9f0af02fb1f6feebaa65bebbcd2ab30ac [file] [log] [blame]
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +05301/*
Michal Simek2a47faa2023-04-14 08:43:51 +02002 * Copyright (c) 2018-2021, Arm Limited and Contributors. All rights reserved.
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +05303 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00006
7#include <plat/common/platform.h>
8
Prasad Kummari536e1102023-06-22 10:50:02 +05309#include <plat_private.h>
10
Venkatesh Yadav Abbarapubde87592022-05-24 11:11:12 +053011int32_t plat_core_pos_by_mpidr(u_register_t mpidr)
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053012{
Abhyuday Godhasarabacbdee2021-08-20 00:27:03 -070013 if ((mpidr & MPIDR_CLUSTER_MASK) != 0U) {
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053014 return -1;
Venkatesh Yadav Abbarapu5f115db2021-01-10 20:40:16 -070015 }
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053016
Venkatesh Yadav Abbarapu5f115db2021-01-10 20:40:16 -070017 if ((mpidr & MPIDR_CPU_MASK) >= PLATFORM_CORE_COUNT) {
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053018 return -1;
Venkatesh Yadav Abbarapu5f115db2021-01-10 20:40:16 -070019 }
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053020
Venkatesh Yadav Abbarapubde87592022-05-24 11:11:12 +053021 return (int32_t)versal_calc_core_pos(mpidr);
Siva Durga Prasad Paladugufe4af662018-09-25 18:44:58 +053022}