2 <:copyright-BRCM:2012:DUAL/GPL:standard
4 Copyright (c) 2012 Broadcom
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License, version 2, as published by
9 the Free Software Foundation (the "GPL").
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
17 A copy of the GPL is available at http://www.broadcom.com/licenses/GPLv2.php, or by
18 writing to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
25 #include <platform_def.h>
26 #include "bcm_private.h"
28 /* The power domain tree descriptor */
29 static unsigned char power_domain_tree_desc
[] = {
30 /* Number of root nodes */
31 PLATFORM_CLUSTER_COUNT
,
32 /* Number of children for the first node */
33 PLATFORM_CLUSTER0_CORE_COUNT
,
34 /* Number of children for the second node */
35 PLATFORM_CLUSTER1_CORE_COUNT
,
38 /*******************************************************************************
39 * This function returns the ARM default topology tree information.
40 ******************************************************************************/
41 const unsigned char *plat_get_power_domain_tree_desc(void)
43 return power_domain_tree_desc
;
46 /*******************************************************************************
47 * This function implements a part of the critical interface between the psci
48 * generic layer and the platform that allows the former to query the platform
49 * to convert an MPIDR to a unique linear index. An error code (-1) is returned
50 * in case the MPIDR is invalid.
51 ******************************************************************************/
52 int plat_core_pos_by_mpidr(u_register_t mpidr
)
54 unsigned int cluster_id
, cpu_id
;
56 mpidr
&= MPIDR_AFFINITY_MASK
;
57 if (mpidr
& ~(MPIDR_CLUSTER_MASK
| MPIDR_CPU_MASK
))
60 cluster_id
= (mpidr
>> MPIDR_AFF1_SHIFT
) & MPIDR_AFFLVL_MASK
;
61 cpu_id
= (mpidr
>> MPIDR_AFF0_SHIFT
) & MPIDR_AFFLVL_MASK
;
63 if (cluster_id
>= PLATFORM_CLUSTER_COUNT
)
66 if (cpu_id
>= PLATFORM_MAX_CPUS_PER_CLUSTER
)
69 return plat_bcm_calc_core_pos(mpidr
);
72 /* Needed for floating point lib */
73 void raise (void) { asm("b ."); }