280
281
*model_id = *system_id = *serial_number = 0;
281
282
cpu_variation = cpu_revision = 0;
282
283
ct = 0; bogo = 0;
284
286
hd_data->boot = boot_uboot;
286
288
for(sl = hd_data->cpu; sl; sl = sl->next) {
287
if(sscanf(sl->str, "Processor : %79[^\n]", model_id) == 1) continue;
288
if(sscanf(sl->str, "Hardware : %79[^\n]", system_id) == 1) continue;
289
if(sscanf(sl->str, "Features : %1000[^\n]", features) == 1) continue;
290
if(sscanf(sl->str, "CPU variant : 0x%x", &cpu_variation) == 1) continue;
291
if(sscanf(sl->str, "CPU implementer : 0x%x", &vendor_id) == 1) continue;
292
if(sscanf(sl->str, "CPU revision : %d", &cpu_revision) == 1) continue;
289
if(sscanf(sl->str, "Processor : %79[^\n]", model_id) == 1);
290
if(sscanf(sl->str, "Hardware : %79[^\n]", system_id) == 1);
291
if(sscanf(sl->str, "Features : %1000[^\n]", features) == 1);
292
if(sscanf(sl->str, "CPU variant : 0x%x", &cpu_variation) == 1);
293
if(sscanf(sl->str, "CPU implementer : 0x%x", &vendor_id) == 1);
294
if(sscanf(sl->str, "CPU revision : %d", &cpu_revision) == 1);
293
295
if(!bogo && sscanf(sl->str, "BogoMIPS : %lg", &bogo) == 1);
294
if(strstr(sl->str, "processor\t: ") == sl->str) cpus++;
297
/* if we didn't find any cpus, we might be running under qemu.
298
So simulate just one CPU to make the rest happy. */
300
for(u = 0; u < cpus; u++) {
301
ct = new_mem(sizeof *ct);
302
ct->architecture = arch_aarch64;
303
ct->family = cpu_variation;
304
ct->model = cpu_revision;
310
if(*system_id) ct->platform = new_str(system_id);
311
if(*model_id) ct->model_name = new_str(model_id);
314
case 0x41: ct->vend_name = new_str("ARM Limited"); break;
315
case 0x44: ct->vend_name = new_str("Digital Equipment Corporation"); break;
316
case 0x4d: ct->vend_name = new_str("Motorola, Freescale Semiconductor Inc."); break;
317
case 0x51: ct->vend_name = new_str("QUALCOMM Inc."); break;
318
case 0x56: ct->vend_name = new_str("Marvell Semiconductor Inc."); break;
319
case 0x69: ct->vend_name = new_str("Intel Corporation."); break;
323
sprintf(buf, "unknown (%x)", vendor_id);
324
ct->vend_name = new_str(buf);
329
for(t0 = features; (t = strsep(&t0, " ")); ) {
330
add_str_list(&ct->features, t);
334
hd = add_hd_entry(hd_data, __LINE__, 0);
335
hd->base_class.id = bc_internal;
336
hd->sub_class.id = sc_int_cpu;
338
hd->detail = new_mem(sizeof *hd->detail);
339
hd->detail->type = hd_detail_cpu;
340
hd->detail->cpu.data = ct;
296
if(strstr(sl->str, "processor") == sl->str || !sl->next) { /* EOF */
297
if (!vendor_id) { /* pre-3.19 format */
301
if (*model_id || vendor_id) { /* at least one of those */
303
ct = new_mem(sizeof *ct);
304
ct->architecture = arch_aarch64;
305
ct->family = cpu_variation;
306
ct->model = cpu_revision;
312
if(*system_id) ct->platform = new_str(system_id);
313
if(*model_id) ct->model_name = new_str(model_id);
315
case 0x41: ct->vend_name = new_str("ARM Limited"); break;
316
case 0x44: ct->vend_name = new_str("Digital Equipment Corporation"); break;
317
case 0x4d: ct->vend_name = new_str("Motorola, Freescale Semiconductor Inc."); break;
318
case 0x51: ct->vend_name = new_str("QUALCOMM Inc."); break;
319
case 0x56: ct->vend_name = new_str("Marvell Semiconductor Inc."); break;
320
case 0x69: ct->vend_name = new_str("Intel Corporation."); break;
324
sprintf(buf, "unknown (%x)", vendor_id);
325
ct->vend_name = new_str(buf);
330
for(t0 = features; (t = strsep(&t0, " ")); ) {
331
add_str_list(&ct->features, t);
335
hd = add_hd_entry(hd_data, __LINE__, 0);
336
hd->base_class.id = bc_internal;
337
hd->sub_class.id = sc_int_cpu;
339
hd->detail = new_mem(sizeof *hd->detail);
340
hd->detail->type = hd_detail_cpu;
341
hd->detail->cpu.data = ct;
342
if (*model_id && --cpus) goto loop; /* pre-3.19 format */
342
347
#endif /* __aarch64__ */