xref: /rk3399_ARM-atf/plat/mediatek/mt8173/plat_topology.c (revision c4a99e894943efcc093bbb8d0b5c0339ac7a7fdf)
17d116dccSCC Ma /*
27d116dccSCC Ma  * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
37d116dccSCC Ma  *
47d116dccSCC Ma  * Redistribution and use in source and binary forms, with or without
57d116dccSCC Ma  * modification, are permitted provided that the following conditions are met:
67d116dccSCC Ma  *
77d116dccSCC Ma  * Redistributions of source code must retain the above copyright notice, this
87d116dccSCC Ma  * list of conditions and the following disclaimer.
97d116dccSCC Ma  *
107d116dccSCC Ma  * Redistributions in binary form must reproduce the above copyright notice,
117d116dccSCC Ma  * this list of conditions and the following disclaimer in the documentation
127d116dccSCC Ma  * and/or other materials provided with the distribution.
137d116dccSCC Ma  *
147d116dccSCC Ma  * Neither the name of ARM nor the names of its contributors may be used
157d116dccSCC Ma  * to endorse or promote products derived from this software without specific
167d116dccSCC Ma  * prior written permission.
177d116dccSCC Ma  *
187d116dccSCC Ma  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
197d116dccSCC Ma  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
207d116dccSCC Ma  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
217d116dccSCC Ma  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
227d116dccSCC Ma  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
237d116dccSCC Ma  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
247d116dccSCC Ma  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
257d116dccSCC Ma  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
267d116dccSCC Ma  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
277d116dccSCC Ma  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
287d116dccSCC Ma  * POSSIBILITY OF SUCH DAMAGE.
297d116dccSCC Ma  */
307d116dccSCC Ma #include <arch.h>
31*c4a99e89SJimmy Huang #include <platform_def.h>
327d116dccSCC Ma #include <psci.h>
337d116dccSCC Ma 
347d116dccSCC Ma unsigned int plat_get_aff_count(unsigned int aff_lvl, unsigned long mpidr)
357d116dccSCC Ma {
367d116dccSCC Ma 	/* Report 1 (absent) instance at levels higher that the cluster level */
377d116dccSCC Ma 	if (aff_lvl > MPIDR_AFFLVL1)
38*c4a99e89SJimmy Huang 		return PLATFORM_SYSTEM_COUNT;
397d116dccSCC Ma 
407d116dccSCC Ma 	if (aff_lvl == MPIDR_AFFLVL1)
41*c4a99e89SJimmy Huang 		return PLATFORM_CLUSTER_COUNT;
427d116dccSCC Ma 
43*c4a99e89SJimmy Huang 	return mpidr & 0x100 ? PLATFORM_CLUSTER1_CORE_COUNT :
44*c4a99e89SJimmy Huang 			       PLATFORM_CLUSTER0_CORE_COUNT;
457d116dccSCC Ma }
467d116dccSCC Ma 
477d116dccSCC Ma unsigned int plat_get_aff_state(unsigned int aff_lvl, unsigned long mpidr)
487d116dccSCC Ma {
497d116dccSCC Ma 	return aff_lvl <= MPIDR_AFFLVL2 ? PSCI_AFF_PRESENT : PSCI_AFF_ABSENT;
507d116dccSCC Ma }
517d116dccSCC Ma 
527d116dccSCC Ma int mt_setup_topology(void)
537d116dccSCC Ma {
547d116dccSCC Ma 	/* [TODO] Make topology configurable via SCC */
557d116dccSCC Ma 	return 0;
567d116dccSCC Ma }
57