1*003faaa5SAlexei Fedorov/* 2*003faaa5SAlexei Fedorov * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. 3*003faaa5SAlexei Fedorov * 4*003faaa5SAlexei Fedorov * SPDX-License-Identifier: BSD-3-Clause 5*003faaa5SAlexei Fedorov */ 6*003faaa5SAlexei Fedorov 7*003faaa5SAlexei Fedorov#ifndef FVP_DEFS_DYNAMIQ_DTSI 8*003faaa5SAlexei Fedorov#define FVP_DEFS_DYNAMIQ_DTSI 9*003faaa5SAlexei Fedorov 10*003faaa5SAlexei Fedorov/* Set default topology values if not passed from platform's makefile */ 11*003faaa5SAlexei Fedorov#ifdef FVP_CLUSTER_COUNT 12*003faaa5SAlexei Fedorov#define CLUSTER_COUNT FVP_CLUSTER_COUNT 13*003faaa5SAlexei Fedorov#else 14*003faaa5SAlexei Fedorov#define CLUSTER_COUNT 1 15*003faaa5SAlexei Fedorov#endif 16*003faaa5SAlexei Fedorov 17*003faaa5SAlexei Fedorov#ifdef FVP_MAX_CPUS_PER_CLUSTER 18*003faaa5SAlexei Fedorov#define CPUS_PER_CLUSTER FVP_MAX_CPUS_PER_CLUSTER 19*003faaa5SAlexei Fedorov#else 20*003faaa5SAlexei Fedorov#define CPUS_PER_CLUSTER 8 21*003faaa5SAlexei Fedorov#endif 22*003faaa5SAlexei Fedorov 23*003faaa5SAlexei Fedorov#define CONCAT(x, y) x##y 24*003faaa5SAlexei Fedorov#define CONC(x, y) CONCAT(x, y) 25*003faaa5SAlexei Fedorov 26*003faaa5SAlexei Fedorov/* 27*003faaa5SAlexei Fedorov * n - CPU number 28*003faaa5SAlexei Fedorov * r - MPID 29*003faaa5SAlexei Fedorov */ 30*003faaa5SAlexei Fedorov#define CPU(n, r) \ 31*003faaa5SAlexei Fedorov CPU##n:cpu@r## { \ 32*003faaa5SAlexei Fedorov device_type = "cpu"; \ 33*003faaa5SAlexei Fedorov compatible = "arm,armv8"; \ 34*003faaa5SAlexei Fedorov reg = <0x0 0x##r>; \ 35*003faaa5SAlexei Fedorov enable-method = "psci"; \ 36*003faaa5SAlexei Fedorov cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>; \ 37*003faaa5SAlexei Fedorov next-level-cache = <&L2_0>; \ 38*003faaa5SAlexei Fedorov }; 39*003faaa5SAlexei Fedorov 40*003faaa5SAlexei Fedorov#if (PE_PER_CPU == 2) 41*003faaa5SAlexei Fedorov#define THREAD(n) \ 42*003faaa5SAlexei Fedorov thread##n { \ 43*003faaa5SAlexei Fedorov cpu = <&CONC(CPU, __COUNTER__)>; \ 44*003faaa5SAlexei Fedorov }; 45*003faaa5SAlexei Fedorov 46*003faaa5SAlexei Fedorov#define CORE(n) \ 47*003faaa5SAlexei Fedorov core##n { \ 48*003faaa5SAlexei Fedorov THREAD(0) \ 49*003faaa5SAlexei Fedorov THREAD(1) \ 50*003faaa5SAlexei Fedorov }; 51*003faaa5SAlexei Fedorov 52*003faaa5SAlexei Fedorov#else /* PE_PER_CPU == 1 */ 53*003faaa5SAlexei Fedorov#define CORE(n) \ 54*003faaa5SAlexei Fedorov core##n { \ 55*003faaa5SAlexei Fedorov cpu = <&CPU##n>;\ 56*003faaa5SAlexei Fedorov }; 57*003faaa5SAlexei Fedorov#endif /* PE_PER_CORE */ 58*003faaa5SAlexei Fedorov 59*003faaa5SAlexei Fedorov#if (CPUS_PER_CLUSTER == 1) 60*003faaa5SAlexei Fedorov#if (PE_PER_CPU == 1) 61*003faaa5SAlexei Fedorov#define CPUS \ 62*003faaa5SAlexei Fedorov CPU(0, 0) 63*003faaa5SAlexei Fedorov#else 64*003faaa5SAlexei Fedorov#define CPUS \ 65*003faaa5SAlexei Fedorov CPU(0, 0) \ 66*003faaa5SAlexei Fedorov CPU(1, 1) 67*003faaa5SAlexei Fedorov#endif 68*003faaa5SAlexei Fedorov#define CLUSTER(n) \ 69*003faaa5SAlexei Fedorov cluster##n { \ 70*003faaa5SAlexei Fedorov CORE(0) \ 71*003faaa5SAlexei Fedorov }; 72*003faaa5SAlexei Fedorov 73*003faaa5SAlexei Fedorov#elif (CPUS_PER_CLUSTER == 2) 74*003faaa5SAlexei Fedorov#if (PE_PER_CPU == 1) 75*003faaa5SAlexei Fedorov#define CPUS \ 76*003faaa5SAlexei Fedorov CPU(0, 0) \ 77*003faaa5SAlexei Fedorov CPU(1, 100) 78*003faaa5SAlexei Fedorov#else 79*003faaa5SAlexei Fedorov#define CPUS \ 80*003faaa5SAlexei Fedorov CPU(0, 0) \ 81*003faaa5SAlexei Fedorov CPU(1, 1) \ 82*003faaa5SAlexei Fedorov CPU(2, 100) \ 83*003faaa5SAlexei Fedorov CPU(3, 101) 84*003faaa5SAlexei Fedorov#endif 85*003faaa5SAlexei Fedorov#define CLUSTER(n) \ 86*003faaa5SAlexei Fedorov cluster##n { \ 87*003faaa5SAlexei Fedorov CORE(0) \ 88*003faaa5SAlexei Fedorov CORE(1) \ 89*003faaa5SAlexei Fedorov }; 90*003faaa5SAlexei Fedorov 91*003faaa5SAlexei Fedorov#elif (CPUS_PER_CLUSTER == 3) 92*003faaa5SAlexei Fedorov#if (PE_PER_CPU == 1) 93*003faaa5SAlexei Fedorov#define CPUS \ 94*003faaa5SAlexei Fedorov CPU(0, 0) \ 95*003faaa5SAlexei Fedorov CPU(1, 100) \ 96*003faaa5SAlexei Fedorov CPU(2, 200) 97*003faaa5SAlexei Fedorov#else 98*003faaa5SAlexei Fedorov#define CPUS \ 99*003faaa5SAlexei Fedorov CPU(0, 0) \ 100*003faaa5SAlexei Fedorov CPU(1, 1) \ 101*003faaa5SAlexei Fedorov CPU(2, 100) \ 102*003faaa5SAlexei Fedorov CPU(3, 101) \ 103*003faaa5SAlexei Fedorov CPU(4, 200) \ 104*003faaa5SAlexei Fedorov CPU(5, 201) 105*003faaa5SAlexei Fedorov#endif 106*003faaa5SAlexei Fedorov#define CLUSTER(n) \ 107*003faaa5SAlexei Fedorov cluster##n { \ 108*003faaa5SAlexei Fedorov CORE(0) \ 109*003faaa5SAlexei Fedorov CORE(1) \ 110*003faaa5SAlexei Fedorov CORE(2) \ 111*003faaa5SAlexei Fedorov }; 112*003faaa5SAlexei Fedorov 113*003faaa5SAlexei Fedorov#elif (CPUS_PER_CLUSTER == 4) 114*003faaa5SAlexei Fedorov#if (PE_PER_CPU == 1) 115*003faaa5SAlexei Fedorov#define CPUS \ 116*003faaa5SAlexei Fedorov CPU(0, 0) \ 117*003faaa5SAlexei Fedorov CPU(1, 100) \ 118*003faaa5SAlexei Fedorov CPU(2, 200) \ 119*003faaa5SAlexei Fedorov CPU(3, 300) 120*003faaa5SAlexei Fedorov#else 121*003faaa5SAlexei Fedorov#define CPUS \ 122*003faaa5SAlexei Fedorov CPU(0, 0) \ 123*003faaa5SAlexei Fedorov CPU(1, 1) \ 124*003faaa5SAlexei Fedorov CPU(2, 100) \ 125*003faaa5SAlexei Fedorov CPU(3, 101) \ 126*003faaa5SAlexei Fedorov CPU(4, 200) \ 127*003faaa5SAlexei Fedorov CPU(5, 201) \ 128*003faaa5SAlexei Fedorov CPU(6, 300) \ 129*003faaa5SAlexei Fedorov CPU(7, 301) 130*003faaa5SAlexei Fedorov#endif 131*003faaa5SAlexei Fedorov#define CLUSTER(n) \ 132*003faaa5SAlexei Fedorov cluster##n { \ 133*003faaa5SAlexei Fedorov CORE(0) \ 134*003faaa5SAlexei Fedorov CORE(1) \ 135*003faaa5SAlexei Fedorov CORE(2) \ 136*003faaa5SAlexei Fedorov CORE(3) \ 137*003faaa5SAlexei Fedorov }; 138*003faaa5SAlexei Fedorov 139*003faaa5SAlexei Fedorov#elif (CPUS_PER_CLUSTER == 5) 140*003faaa5SAlexei Fedorov#if (PE_PER_CPU == 1) 141*003faaa5SAlexei Fedorov#define CPUS \ 142*003faaa5SAlexei Fedorov CPU(0, 0) \ 143*003faaa5SAlexei Fedorov CPU(1, 100) \ 144*003faaa5SAlexei Fedorov CPU(2, 200) \ 145*003faaa5SAlexei Fedorov CPU(3, 300) \ 146*003faaa5SAlexei Fedorov CPU(4, 400) 147*003faaa5SAlexei Fedorov#else 148*003faaa5SAlexei Fedorov#define CPUS \ 149*003faaa5SAlexei Fedorov CPU(0, 0) \ 150*003faaa5SAlexei Fedorov CPU(1, 1) \ 151*003faaa5SAlexei Fedorov CPU(2, 100) \ 152*003faaa5SAlexei Fedorov CPU(3, 101) \ 153*003faaa5SAlexei Fedorov CPU(4, 200) \ 154*003faaa5SAlexei Fedorov CPU(5, 201) \ 155*003faaa5SAlexei Fedorov CPU(6, 300) \ 156*003faaa5SAlexei Fedorov CPU(7, 301) \ 157*003faaa5SAlexei Fedorov CPU(8, 400) \ 158*003faaa5SAlexei Fedorov CPU(9, 401) 159*003faaa5SAlexei Fedorov#endif 160*003faaa5SAlexei Fedorov#define CLUSTER(n) \ 161*003faaa5SAlexei Fedorov cluster##n { \ 162*003faaa5SAlexei Fedorov CORE(0) \ 163*003faaa5SAlexei Fedorov CORE(1) \ 164*003faaa5SAlexei Fedorov CORE(2) \ 165*003faaa5SAlexei Fedorov CORE(3) \ 166*003faaa5SAlexei Fedorov CORE(4) \ 167*003faaa5SAlexei Fedorov }; 168*003faaa5SAlexei Fedorov 169*003faaa5SAlexei Fedorov#elif (CPUS_PER_CLUSTER == 6) 170*003faaa5SAlexei Fedorov#if (PE_PER_CPU == 1) 171*003faaa5SAlexei Fedorov#define CPUS \ 172*003faaa5SAlexei Fedorov CPU(0, 0) \ 173*003faaa5SAlexei Fedorov CPU(1, 100) \ 174*003faaa5SAlexei Fedorov CPU(2, 200) \ 175*003faaa5SAlexei Fedorov CPU(3, 300) \ 176*003faaa5SAlexei Fedorov CPU(4, 400) \ 177*003faaa5SAlexei Fedorov CPU(5, 500) 178*003faaa5SAlexei Fedorov#else 179*003faaa5SAlexei Fedorov#define CPUS \ 180*003faaa5SAlexei Fedorov CPU(0, 0) \ 181*003faaa5SAlexei Fedorov CPU(1, 1) \ 182*003faaa5SAlexei Fedorov CPU(2, 100) \ 183*003faaa5SAlexei Fedorov CPU(3, 101) \ 184*003faaa5SAlexei Fedorov CPU(4, 200) \ 185*003faaa5SAlexei Fedorov CPU(5, 201) \ 186*003faaa5SAlexei Fedorov CPU(6, 300) \ 187*003faaa5SAlexei Fedorov CPU(7, 301) \ 188*003faaa5SAlexei Fedorov CPU(8, 400) \ 189*003faaa5SAlexei Fedorov CPU(9, 401) \ 190*003faaa5SAlexei Fedorov CPU(10, 500) \ 191*003faaa5SAlexei Fedorov CPU(11, 501) 192*003faaa5SAlexei Fedorov#endif 193*003faaa5SAlexei Fedorov#define CLUSTER(n) \ 194*003faaa5SAlexei Fedorov cluster##n { \ 195*003faaa5SAlexei Fedorov CORE(0) \ 196*003faaa5SAlexei Fedorov CORE(1) \ 197*003faaa5SAlexei Fedorov CORE(2) \ 198*003faaa5SAlexei Fedorov CORE(3) \ 199*003faaa5SAlexei Fedorov CORE(4) \ 200*003faaa5SAlexei Fedorov CORE(5) \ 201*003faaa5SAlexei Fedorov }; 202*003faaa5SAlexei Fedorov 203*003faaa5SAlexei Fedorov#elif (CPUS_PER_CLUSTER == 7) 204*003faaa5SAlexei Fedorov#if (PE_PER_CPU == 1) 205*003faaa5SAlexei Fedorov#define CPUS \ 206*003faaa5SAlexei Fedorov CPU(0, 0) \ 207*003faaa5SAlexei Fedorov CPU(1, 100) \ 208*003faaa5SAlexei Fedorov CPU(2, 200) \ 209*003faaa5SAlexei Fedorov CPU(3, 300) \ 210*003faaa5SAlexei Fedorov CPU(4, 400) \ 211*003faaa5SAlexei Fedorov CPU(5, 500) \ 212*003faaa5SAlexei Fedorov CPU(6, 600) 213*003faaa5SAlexei Fedorov#else 214*003faaa5SAlexei Fedorov#define CPUS \ 215*003faaa5SAlexei Fedorov CPU(0, 0) \ 216*003faaa5SAlexei Fedorov CPU(1, 1) \ 217*003faaa5SAlexei Fedorov CPU(2, 100) \ 218*003faaa5SAlexei Fedorov CPU(3, 101) \ 219*003faaa5SAlexei Fedorov CPU(4, 200) \ 220*003faaa5SAlexei Fedorov CPU(5, 201) \ 221*003faaa5SAlexei Fedorov CPU(6, 300) \ 222*003faaa5SAlexei Fedorov CPU(7, 301) \ 223*003faaa5SAlexei Fedorov CPU(8, 400) \ 224*003faaa5SAlexei Fedorov CPU(9, 401) \ 225*003faaa5SAlexei Fedorov CPU(10, 500) \ 226*003faaa5SAlexei Fedorov CPU(11, 501) \ 227*003faaa5SAlexei Fedorov CPU(12, 600) \ 228*003faaa5SAlexei Fedorov CPU(13, 601) 229*003faaa5SAlexei Fedorov#endif 230*003faaa5SAlexei Fedorov#define CLUSTER(n) \ 231*003faaa5SAlexei Fedorov cluster##n { \ 232*003faaa5SAlexei Fedorov CORE(0) \ 233*003faaa5SAlexei Fedorov CORE(1) \ 234*003faaa5SAlexei Fedorov CORE(2) \ 235*003faaa5SAlexei Fedorov CORE(3) \ 236*003faaa5SAlexei Fedorov CORE(4) \ 237*003faaa5SAlexei Fedorov CORE(5) \ 238*003faaa5SAlexei Fedorov CORE(6) \ 239*003faaa5SAlexei Fedorov }; 240*003faaa5SAlexei Fedorov 241*003faaa5SAlexei Fedorov#else 242*003faaa5SAlexei Fedorov#if (PE_PER_CPU == 1) 243*003faaa5SAlexei Fedorov#define CPUS \ 244*003faaa5SAlexei Fedorov CPU(0, 0) \ 245*003faaa5SAlexei Fedorov CPU(1, 100) \ 246*003faaa5SAlexei Fedorov CPU(2, 200) \ 247*003faaa5SAlexei Fedorov CPU(3, 300) \ 248*003faaa5SAlexei Fedorov CPU(4, 400) \ 249*003faaa5SAlexei Fedorov CPU(5, 500) \ 250*003faaa5SAlexei Fedorov CPU(6, 600) \ 251*003faaa5SAlexei Fedorov CPU(7, 700) 252*003faaa5SAlexei Fedorov#else 253*003faaa5SAlexei Fedorov#define CPUS \ 254*003faaa5SAlexei Fedorov CPU(0, 0) \ 255*003faaa5SAlexei Fedorov CPU(1, 1) \ 256*003faaa5SAlexei Fedorov CPU(2, 100) \ 257*003faaa5SAlexei Fedorov CPU(3, 101) \ 258*003faaa5SAlexei Fedorov CPU(4, 200) \ 259*003faaa5SAlexei Fedorov CPU(5, 201) \ 260*003faaa5SAlexei Fedorov CPU(6, 300) \ 261*003faaa5SAlexei Fedorov CPU(7, 301) \ 262*003faaa5SAlexei Fedorov CPU(8, 400) \ 263*003faaa5SAlexei Fedorov CPU(9, 401) \ 264*003faaa5SAlexei Fedorov CPU(10, 500) \ 265*003faaa5SAlexei Fedorov CPU(11, 501) \ 266*003faaa5SAlexei Fedorov CPU(12, 600) \ 267*003faaa5SAlexei Fedorov CPU(13, 601) \ 268*003faaa5SAlexei Fedorov CPU(14, 700) \ 269*003faaa5SAlexei Fedorov CPU(15, 701) 270*003faaa5SAlexei Fedorov#endif 271*003faaa5SAlexei Fedorov#define CLUSTER(n) \ 272*003faaa5SAlexei Fedorov cluster##n { \ 273*003faaa5SAlexei Fedorov CORE(0) \ 274*003faaa5SAlexei Fedorov CORE(1) \ 275*003faaa5SAlexei Fedorov CORE(2) \ 276*003faaa5SAlexei Fedorov CORE(3) \ 277*003faaa5SAlexei Fedorov CORE(4) \ 278*003faaa5SAlexei Fedorov CORE(5) \ 279*003faaa5SAlexei Fedorov CORE(6) \ 280*003faaa5SAlexei Fedorov CORE(7) \ 281*003faaa5SAlexei Fedorov }; 282*003faaa5SAlexei Fedorov#endif /* CPUS_PER_CLUSTER */ 283*003faaa5SAlexei Fedorov 284*003faaa5SAlexei Fedorov#define CPU_MAP \ 285*003faaa5SAlexei Fedorov cpu-map { \ 286*003faaa5SAlexei Fedorov CLUSTER(0) \ 287*003faaa5SAlexei Fedorov }; 288*003faaa5SAlexei Fedorov 289*003faaa5SAlexei Fedorov#endif /* FVP_DEFS_DYNAMIQ_DTSI */ 290