29
29
30
30
#define CPU_UNKNOWN 0
31
31
#define CPU_ARMV8 1
32
- #define CPU_CORTEXA57 2
33
- #define CPU_VULCAN 3
34
- #define CPU_THUNDERX 4
35
- #define CPU_THUNDERX2T99 5
32
+ // Arm
33
+ #define CPU_CORTEXA53 2
34
+ #define CPU_CORTEXA57 3
35
+ #define CPU_CORTEXA72 4
36
+ #define CPU_CORTEXA73 5
37
+ // Qualcomm
38
+ #define CPU_FALKOR 6
39
+ // Cavium
40
+ #define CPU_THUNDERX 7
41
+ #define CPU_THUNDERX2T99 8
36
42
37
43
static char * cpuname [] = {
38
44
"UNKNOWN" ,
39
45
"ARMV8" ,
46
+ "CORTEXA53" ,
40
47
"CORTEXA57" ,
41
- "VULCAN" ,
48
+ "CORTEXA72" ,
49
+ "CORTEXA73" ,
50
+ "FALKOR" ,
42
51
"THUNDERX" ,
43
52
"THUNDERX2T99"
44
53
};
45
54
46
55
static char * cpuname_lower [] = {
47
56
"unknown" ,
48
- "armv8" ,
57
+ "armv8" ,
58
+ "cortexa53" ,
49
59
"cortexa57" ,
50
- "vulcan" ,
60
+ "cortexa72" ,
61
+ "cortexa73" ,
62
+ "falkor" ,
51
63
"thunderx" ,
52
64
"thunderx2t99"
53
65
};
@@ -114,14 +126,24 @@ int detect(void)
114
126
115
127
fclose (infile );
116
128
if (cpu_part != NULL && cpu_implementer != NULL ) {
117
- if (strstr (cpu_implementer , "0x41" ) &&
118
- (strstr (cpu_part , "0xd07" ) || strstr (cpu_part ,"0xd08" )))
119
- return CPU_CORTEXA57 ; //or compatible, ex. A72
120
- else if (strstr (cpu_part , "0x516" ) && strstr (cpu_implementer , "0x42" ))
121
- return CPU_VULCAN ;
122
- else if (strstr (cpu_part , "0x0a1" ) && strstr (cpu_implementer , "0x43" ))
129
+ // Arm
130
+ if (strstr (cpu_implementer , "0x41" )) {
131
+ if (strstr (cpu_part , "0xd03" ))
132
+ return CPU_CORTEXA53 ;
133
+ else if (strstr (cpu_part , "0xd07" ))
134
+ return CPU_CORTEXA57 ;
135
+ else if (strstr (cpu_part , "0xd08" ))
136
+ return CPU_CORTEXA72 ;
137
+ else if (strstr (cpu_part , "0xd09" ))
138
+ return CPU_CORTEXA73 ;
139
+ }
140
+ // Qualcomm
141
+ else if (strstr (cpu_implementer , "0x51" ) && strstr (cpu_part , "0xc00" ))
142
+ return CPU_FALKOR ;
143
+ // Cavium
144
+ else if (strstr (cpu_implementer , "0x43" ) && strstr (cpu_part , "0x0a1" ))
123
145
return CPU_THUNDERX ;
124
- else if (strstr (cpu_part , "0x0af " ) && strstr (cpu_implementer , "0x43 " ))
146
+ else if (strstr (cpu_implementer , "0x43 " ) && strstr (cpu_part , "0x0af " ))
125
147
return CPU_THUNDERX2T99 ;
126
148
}
127
149
@@ -180,62 +202,62 @@ void get_subdirname(void)
180
202
void get_cpuconfig (void )
181
203
{
182
204
205
+ // All arches should define ARMv8
206
+ printf ("#define ARMV8\n" );
207
+ printf ("#define HAVE_NEON\n" ); // This shouldn't be necessary
208
+ printf ("#define HAVE_VFPV4\n" ); // This shouldn't be necessary
209
+
183
210
int d = detect ();
184
211
switch (d )
185
212
{
186
213
214
+ case CPU_CORTEXA53 :
215
+ printf ("#define %s\n" , cpuname [d ]);
216
+ // Fall-through
187
217
case CPU_ARMV8 :
188
- printf ("#define ARMV8\n" );
189
- printf ("#define L1_DATA_SIZE 32768\n" );
190
- printf ("#define L1_DATA_LINESIZE 64\n" );
191
- printf ("#define L2_SIZE 262144\n" );
192
- printf ("#define L2_LINESIZE 64\n" );
193
- printf ("#define DTB_DEFAULT_ENTRIES 64\n" );
194
- printf ("#define DTB_SIZE 4096\n" );
195
- printf ("#define L2_ASSOCIATIVE 4\n" );
196
- break ;
197
-
198
- case CPU_VULCAN :
199
- printf ("#define VULCAN \n" );
200
- printf ("#define HAVE_VFP \n" );
201
- printf ("#define HAVE_VFPV3 \n" );
202
- printf ("#define HAVE_NEON \n" );
203
- printf ("#define HAVE_VFPV4 \n" );
204
- printf ("#define L1_CODE_SIZE 32768 \n" );
205
- printf ("#define L1_CODE_LINESIZE 64 \n" );
206
- printf ("#define L1_CODE_ASSOCIATIVE 8 \n" );
207
- printf ("#define L1_DATA_SIZE 32768 \n" );
208
- printf ("#define L1_DATA_LINESIZE 64 \n" );
209
- printf ("#define L1_DATA_ASSOCIATIVE 8 \n" );
210
- printf ("#define L2_SIZE 262144 \n" );
211
- printf ("#define L2_LINESIZE 64 \n" );
212
- printf ("#define L2_ASSOCIATIVE 8 \n" );
213
- printf ("#define L3_SIZE 33554432 \n" );
214
- printf ("#define L3_LINESIZE 64 \n" );
215
- printf ("#define L3_ASSOCIATIVE 32 \n" );
216
- printf ("#define DTB_DEFAULT_ENTRIES 64 \n" );
217
- printf ("#define DTB_SIZE 4096 \n" );
218
+ // Minimum parameters for ARMv8 (based on A53)
219
+ printf ("#define L1_DATA_SIZE 32768\n" );
220
+ printf ("#define L1_DATA_LINESIZE 64\n" );
221
+ printf ("#define L2_SIZE 262144\n" );
222
+ printf ("#define L2_LINESIZE 64\n" );
223
+ printf ("#define DTB_DEFAULT_ENTRIES 64\n" );
224
+ printf ("#define DTB_SIZE 4096\n" );
225
+ printf ("#define L2_ASSOCIATIVE 4\n" );
218
226
break ;
219
227
220
228
case CPU_CORTEXA57 :
221
- printf ("#define CORTEXA57\n" );
222
- printf ("#define HAVE_VFP\n" );
223
- printf ("#define HAVE_VFPV3\n" );
224
- printf ("#define HAVE_NEON\n" );
225
- printf ("#define HAVE_VFPV4\n" );
229
+ case CPU_CORTEXA72 :
230
+ case CPU_CORTEXA73 :
231
+ // Common minimum settings for these Arm cores
232
+ // Can change a lot, but we need to be conservative
233
+ // TODO: detect info from /sys if possible
234
+ printf ("#define %s\n" , cpuname [d ]);
226
235
printf ("#define L1_CODE_SIZE 49152\n" );
227
236
printf ("#define L1_CODE_LINESIZE 64\n" );
228
237
printf ("#define L1_CODE_ASSOCIATIVE 3\n" );
229
238
printf ("#define L1_DATA_SIZE 32768\n" );
230
239
printf ("#define L1_DATA_LINESIZE 64\n" );
231
240
printf ("#define L1_DATA_ASSOCIATIVE 2\n" );
232
- printf ("#define L2_SIZE 2097152 \n" );
241
+ printf ("#define L2_SIZE 524288 \n" );
233
242
printf ("#define L2_LINESIZE 64\n" );
234
243
printf ("#define L2_ASSOCIATIVE 16\n" );
235
244
printf ("#define DTB_DEFAULT_ENTRIES 64\n" );
236
245
printf ("#define DTB_SIZE 4096\n" );
237
246
break ;
238
247
248
+ case CPU_FALKOR :
249
+ printf ("#define FALKOR\n" );
250
+ printf ("#define L1_CODE_SIZE 65536\n" );
251
+ printf ("#define L1_CODE_LINESIZE 64\n" );
252
+ printf ("#define L1_DATA_SIZE 32768\n" );
253
+ printf ("#define L1_DATA_LINESIZE 128\n" );
254
+ printf ("#define L2_SIZE 524288\n" );
255
+ printf ("#define L2_LINESIZE 64\n" );
256
+ printf ("#define DTB_DEFAULT_ENTRIES 64\n" );
257
+ printf ("#define DTB_SIZE 4096\n" );
258
+ printf ("#define L2_ASSOCIATIVE 16\n" );
259
+ break ;
260
+
239
261
case CPU_THUNDERX :
240
262
printf ("#define THUNDERX\n" );
241
263
printf ("#define L1_DATA_SIZE 32768\n" );
@@ -249,10 +271,6 @@ void get_cpuconfig(void)
249
271
250
272
case CPU_THUNDERX2T99 :
251
273
printf ("#define VULCAN \n" );
252
- printf ("#define HAVE_VFP \n" );
253
- printf ("#define HAVE_VFPV3 \n" );
254
- printf ("#define HAVE_NEON \n" );
255
- printf ("#define HAVE_VFPV4 \n" );
256
274
printf ("#define L1_CODE_SIZE 32768 \n" );
257
275
printf ("#define L1_CODE_LINESIZE 64 \n" );
258
276
printf ("#define L1_CODE_ASSOCIATIVE 8 \n" );
0 commit comments