diff options
| author | Burt P <pburt0@gmail.com> | 2017-07-09 22:27:07 -0500 | 
|---|---|---|
| committer | Leandro Pereira <leandro@hardinfo.org> | 2017-07-12 19:38:41 -0700 | 
| commit | 269b16b3801c0e3fd05eb7d8c9d1551ea8172529 (patch) | |
| tree | e372474fafde6e2a92304f9fa091f349f51e0786 | |
| parent | ac9072baaa41c5bb0879da73bb2603dbb018b3fc (diff) | |
ia64: fixes, add test
Signed-off-by: Burt P <pburt0@gmail.com>
| -rw-r--r-- | includes/ia64/processor-platform.h | 3 | ||||
| -rw-r--r-- | modules/devices/ia64/processor.c | 34 | ||||
| -rw-r--r-- | test/data/ia64_x2_cpuinfo | 27 | ||||
| -rw-r--r-- | test/test.sh | 4 | 
4 files changed, 57 insertions, 11 deletions
diff --git a/includes/ia64/processor-platform.h b/includes/ia64/processor-platform.h index 1e30c5fc..ad44a1f1 100644 --- a/includes/ia64/processor-platform.h +++ b/includes/ia64/processor-platform.h @@ -24,6 +24,9 @@ struct _Processor {      gchar *vendor_id;      gfloat bogomips, cpu_mhz;      gchar *strmodel; + +    gchar *family, *arch; +    gint model, revision;  };  #endif	/* __PROCESSOR_PLATFORM_H__ */ diff --git a/modules/devices/ia64/processor.c b/modules/devices/ia64/processor.c index 57cc94e0..6076fed8 100644 --- a/modules/devices/ia64/processor.c +++ b/modules/devices/ia64/processor.c @@ -37,6 +37,7 @@ processor_scan(void)      Processor *processor;      FILE *cpuinfo;      gchar buffer[128]; +    gchar *toss = NULL;      cpuinfo = fopen(PROC_CPUINFO, "r");      if (!cpuinfo) @@ -50,16 +51,21 @@ processor_scan(void)              tmp[0] = g_strstrip(tmp[0]);              tmp[1] = g_strstrip(tmp[1]); -            get_str("vendor", processor->model_name); -            get_str("arch", processor->vendor_id); -            get_str("family", processor->strmodel); +            get_str("archrev", toss); /* ignore this or "arch" will catch it below */ + +            get_str("vendor", processor->vendor_id); +            get_str("arch", processor->arch); +            get_str("family", processor->family); +            get_int("model", processor->model); +            get_int("revision", processor->revision);              get_float("BogoMIPS", processor->bogomips); +            get_float("cpu MHz", processor->cpu_mhz);          }          g_strfreev(tmp);      } -    processor->cpu_mhz = 0.0f; +    processor->model_name = _("IA64 Processor");      fclose(cpuinfo); @@ -72,15 +78,23 @@ processor_get_info(GSList *processors)      Processor *processor = (Processor *)processors->data;      return g_strdup_printf("[%s]\n" -                        "%s=%s\n" -                        "%s=%s\n" -                        "%s=%s %s\n" +                        "%s=%s\n"      /* name */ +                        "%s=%s\n"      /* vendor */ +                        "%s=%s\n"      /* arch */ +                        "%s=%s\n"      /* family */ +                        "%s=%d\n"      /* model no. */ +                        "%s=%d\n"      /* revision */ +                        "%s=%.2f %s\n" /* frequency */                          "%s=%.2f\n"    /* bogomips */                          "%s=%s\n",     /* byte order */                      _("Processor"), -                    _("Model"), processor->model_name, -                    _("Architecture"), processor->vendor_id,    /* ?? */ -                    _("Family"), processor->strmodel, _("MHz"), /* MHz?? */ +                    _("Name"), processor->model_name, +                    _("Vendor"), processor->vendor_id, +                    _("Architecture"), processor->arch, +                    _("Family"), processor->family, +                    _("Model"), processor->model, +                    _("Revision"), processor->revision, +                    _("Frequency"), processor->cpu_mhz, _("MHz"),                      _("BogoMips"), processor->bogomips,                      _("Byte Order"), byte_order_str()                                ); diff --git a/test/data/ia64_x2_cpuinfo b/test/data/ia64_x2_cpuinfo new file mode 100644 index 00000000..f355d80e --- /dev/null +++ b/test/data/ia64_x2_cpuinfo @@ -0,0 +1,27 @@ +processor  : 0 +vendor     : GenuineIntel +arch       : IA-64 +family     : Itanium +model      : 0 +revision   : 6 +archrev    : 0 +features   : standard +cpu number : 0 +cpu regs   : 4 +cpu MHz    : 733.433976 +itc MHz    : 733.433976 +BogoMIPS   : 517.99 + +processor  : 1 +vendor     : GenuineIntel +arch       : IA-64 +family     : Itanium +model      : 0 +revision   : 6 +archrev    : 0 +features   : standard +cpu number : 0 +cpu regs   : 4 +cpu MHz    : 733.433976 +itc MHz    : 733.433976 +BogoMIPS : 729.80 diff --git a/test/test.sh b/test/test.sh index 9c1f0692..c0d6080b 100644 --- a/test/test.sh +++ b/test/test.sh @@ -17,6 +17,8 @@ do_test() {  #do_test sparc data/sparc_m7_cpuinfo  #do_test mips data/mips_loongson_cpuinfo  #do_test alpha data/alpha_as_cpuinfo -do_test parisc data/parisc_hppa_fortex4_cpuinfo +#do_test parisc data/parisc_hppa_fortex4_cpuinfo +do_test ia64 data/ia64_x2_cpuinfo +  | 
