@@ -281,6 +281,82 @@ static bool match_sm(
281
281
return true;
282
282
}
283
283
284
+
285
+ struct special_map_entry {
286
+ const char * platform ;
287
+ uint16_t model ;
288
+ uint8_t series ;
289
+ char suffix ;
290
+ };
291
+
292
+ static const struct special_map_entry qualcomm_hardware_map_entries [] = {
293
+ {
294
+ /* "Kona" -> Qualcomm Kona */
295
+ .platform = "Kona" ,
296
+ .series = cpuinfo_arm_chipset_series_qualcomm_snapdragon ,
297
+ .model = 865 ,
298
+ },
299
+ {
300
+ /* "Bengal" -> Qualcomm Bengal */
301
+ .platform = "Bengal" ,
302
+ .series = cpuinfo_arm_chipset_series_qualcomm_snapdragon ,
303
+ .model = 662 ,
304
+ },
305
+ {
306
+ /* "Bengalp" -> Qualcomm Bengalp */
307
+ .platform = "Bengalp" ,
308
+ .series = cpuinfo_arm_chipset_series_qualcomm_snapdragon ,
309
+ .model = 662 ,
310
+ },
311
+ {
312
+ /* "Lito" -> Qualcomm Lito */
313
+ .platform = "Lito" ,
314
+ .series = cpuinfo_arm_chipset_series_qualcomm_snapdragon ,
315
+ .model = 765 ,
316
+ .suffix = 'G'
317
+ },
318
+ {
319
+ /* "Lagoon" -> Qualcomm Lagoon */
320
+ .platform = "Lagoon" ,
321
+ .series = cpuinfo_arm_chipset_series_qualcomm_snapdragon ,
322
+ .model = 0 ,
323
+ },
324
+ };
325
+
326
+
327
+ int strcicmp (char const * a , char const * b )
328
+ {
329
+ for (;; a ++ , b ++ ) {
330
+ int d = tolower ((unsigned char )* a ) - tolower ((unsigned char )* b );
331
+ if (d != 0 || !* a )
332
+ return d ;
333
+ }
334
+ }
335
+
336
+ static bool match_qualcomm_special (
337
+ const char * start , const char * end ,
338
+ struct cpuinfo_arm_chipset chipset [restrict static 1 ])
339
+ {
340
+ for (size_t i = 0 ; i < CPUINFO_COUNT_OF (qualcomm_hardware_map_entries ); i ++ ) {
341
+ int length = end - start ;
342
+ if (strcicmp (qualcomm_hardware_map_entries [i ].platform , start ) == 0 &&
343
+ qualcomm_hardware_map_entries [i ].platform [length ] == 0 )
344
+ {
345
+ * chipset = (struct cpuinfo_arm_chipset ) {
346
+ .vendor = chipset_series_vendor [qualcomm_hardware_map_entries [i ].series ],
347
+ .series = (enum cpuinfo_arm_chipset_series ) qualcomm_hardware_map_entries [i ].series ,
348
+ .model = qualcomm_hardware_map_entries [i ].model ,
349
+ .suffix = {
350
+ [0 ] = qualcomm_hardware_map_entries [i ].suffix ,
351
+ },
352
+ };
353
+ return true;
354
+ }
355
+ }
356
+ return false;
357
+
358
+ }
359
+
284
360
/**
285
361
* Tries to match /Samsung Exynos\d{4}$/ signature (case-insensitive) for Samsung Exynos chipsets.
286
362
* If match successful, extracts model information into \p chipset argument.
@@ -1752,13 +1828,6 @@ static bool is_tegra(const char* start, const char* end) {
1752
1828
return (length == 5 || start [5 ] == '3' );
1753
1829
}
1754
1830
1755
- struct special_map_entry {
1756
- const char * platform ;
1757
- uint16_t model ;
1758
- uint8_t series ;
1759
- char suffix ;
1760
- };
1761
-
1762
1831
static const struct special_map_entry special_hardware_map_entries [] = {
1763
1832
#if CPUINFO_ARCH_ARM
1764
1833
{
@@ -2317,6 +2386,14 @@ struct cpuinfo_arm_chipset cpuinfo_arm_linux_decode_chipset_from_proc_cpuinfo_ha
2317
2386
(int ) hardware_length , hardware );
2318
2387
return chipset ;
2319
2388
}
2389
+
2390
+ if (match_qualcomm_special (pos , hardware_end , & chipset )) {
2391
+ cpuinfo_log_debug (
2392
+ "matched Qualcomm signature in /proc/cpuinfo Hardware string \"%.*s\"" ,
2393
+ (int ) hardware_length , hardware );
2394
+ return chipset ;
2395
+ }
2396
+
2320
2397
}
2321
2398
word_start = false;
2322
2399
break ;
0 commit comments