summaryrefslogtreecommitdiff
path: root/arch/linux/x86
diff options
context:
space:
mode:
authorSimon Quigley <tsimonq2@ubuntu.com>2017-06-19 14:38:33 -0500
committerSimon Quigley <tsimonq2@ubuntu.com>2017-06-19 14:38:33 -0500
commit854292407779593a401a1d5ce71add51880fa84f (patch)
tree42b5f1896eda603c04a30db1effb133f10f71ca8 /arch/linux/x86
parenta08438bda21b3e0d7db2db2360d040841970104d (diff)
Import Upstream version 0.4
Diffstat (limited to 'arch/linux/x86')
l---------arch/linux/x86/alsa.h1
l---------arch/linux/x86/filesystem.h1
l---------arch/linux/x86/inputdevices.h1
l---------arch/linux/x86/loadavg.h1
l---------arch/linux/x86/memory.h1
l---------arch/linux/x86/modules.h1
l---------arch/linux/x86/net.h1
l---------arch/linux/x86/os.h1
l---------arch/linux/x86/pci.h1
-rw-r--r--arch/linux/x86/processor.h303
l---------arch/linux/x86/samba.h1
l---------arch/linux/x86/sensors.h1
l---------arch/linux/x86/storage.h1
l---------arch/linux/x86/uptime.h1
l---------arch/linux/x86/usb.h1
15 files changed, 317 insertions, 0 deletions
diff --git a/arch/linux/x86/alsa.h b/arch/linux/x86/alsa.h
new file mode 120000
index 00000000..0216845a
--- /dev/null
+++ b/arch/linux/x86/alsa.h
@@ -0,0 +1 @@
+../../linux/common/alsa.h \ No newline at end of file
diff --git a/arch/linux/x86/filesystem.h b/arch/linux/x86/filesystem.h
new file mode 120000
index 00000000..6b325b40
--- /dev/null
+++ b/arch/linux/x86/filesystem.h
@@ -0,0 +1 @@
+../../linux/common/filesystem.h \ No newline at end of file
diff --git a/arch/linux/x86/inputdevices.h b/arch/linux/x86/inputdevices.h
new file mode 120000
index 00000000..b9226a29
--- /dev/null
+++ b/arch/linux/x86/inputdevices.h
@@ -0,0 +1 @@
+../../linux/common/inputdevices.h \ No newline at end of file
diff --git a/arch/linux/x86/loadavg.h b/arch/linux/x86/loadavg.h
new file mode 120000
index 00000000..daaed6d5
--- /dev/null
+++ b/arch/linux/x86/loadavg.h
@@ -0,0 +1 @@
+../../linux/common/loadavg.h \ No newline at end of file
diff --git a/arch/linux/x86/memory.h b/arch/linux/x86/memory.h
new file mode 120000
index 00000000..5ffc013e
--- /dev/null
+++ b/arch/linux/x86/memory.h
@@ -0,0 +1 @@
+../../linux/common/memory.h \ No newline at end of file
diff --git a/arch/linux/x86/modules.h b/arch/linux/x86/modules.h
new file mode 120000
index 00000000..8ce5a808
--- /dev/null
+++ b/arch/linux/x86/modules.h
@@ -0,0 +1 @@
+../../linux/common/modules.h \ No newline at end of file
diff --git a/arch/linux/x86/net.h b/arch/linux/x86/net.h
new file mode 120000
index 00000000..72d77b26
--- /dev/null
+++ b/arch/linux/x86/net.h
@@ -0,0 +1 @@
+../../linux/common/net.h \ No newline at end of file
diff --git a/arch/linux/x86/os.h b/arch/linux/x86/os.h
new file mode 120000
index 00000000..ef547be5
--- /dev/null
+++ b/arch/linux/x86/os.h
@@ -0,0 +1 @@
+../../linux/common/os.h \ No newline at end of file
diff --git a/arch/linux/x86/pci.h b/arch/linux/x86/pci.h
new file mode 120000
index 00000000..63760048
--- /dev/null
+++ b/arch/linux/x86/pci.h
@@ -0,0 +1 @@
+../../linux/common/pci.h \ No newline at end of file
diff --git a/arch/linux/x86/processor.h b/arch/linux/x86/processor.h
new file mode 100644
index 00000000..571943f6
--- /dev/null
+++ b/arch/linux/x86/processor.h
@@ -0,0 +1,303 @@
+/*
+ * HardInfo - Displays System Information
+ * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * This function is partly based on x86cpucaps
+ * by Osamu Kayasono <jacobi@jcom.home.ne.jp>
+ */
+static void
+get_processor_strfamily(Processor *processor)
+{
+ gint family = processor->family;
+ gint model = processor->model;
+
+ if (g_str_equal(processor->vendor_id, "GenuineIntel")) {
+ if (family == 4) {
+ processor->strmodel = g_strdup("i486 series");
+ } else if (family == 5) {
+ if (model < 4) {
+ processor->strmodel = g_strdup("Pentium Classic");
+ } else {
+ processor->strmodel = g_strdup("Pentium MMX");
+ }
+ } else if (family == 6) {
+ if (model <= 1) {
+ processor->strmodel = g_strdup("Pentium Pro");
+ } else if (model < 7) {
+ processor->strmodel = g_strdup("Pentium II/Pentium II Xeon/Celeron");
+ } else if (model == 9) {
+ processor->strmodel = g_strdup("Pentium M");
+ } else {
+ processor->strmodel = g_strdup("Pentium III/Pentium III Xeon/Celeron");
+ }
+ } else if (family > 6) {
+ processor->strmodel = g_strdup("Pentium 4");
+ } else {
+ processor->strmodel = g_strdup("i386 class");
+ }
+ } else if (g_str_equal(processor->vendor_id, "AuthenticAMD")) {
+ if (family == 4) {
+ if (model <= 9) {
+ processor->strmodel = g_strdup("AMD i80486 series");
+ } else {
+ processor->strmodel = g_strdup("AMD 5x86");
+ }
+ } else if (family == 5) {
+ if (model <= 3) {
+ processor->strmodel = g_strdup("AMD K5");
+ } else if (model <= 7) {
+ processor->strmodel = g_strdup("AMD K6");
+ } else if (model == 8) {
+ processor->strmodel = g_strdup("AMD K6-2");
+ } else if (model == 9) {
+ processor->strmodel = g_strdup("AMD K6-III");
+ } else {
+ processor->strmodel = g_strdup("AMD K6-2+/III+");
+ }
+ } else if (family == 6) {
+ if (model == 1) {
+ processor->strmodel = g_strdup("AMD Athlon (K7");
+ } else if (model == 2) {
+ processor->strmodel = g_strdup("AMD Athlon (K75)");
+ } else if (model == 3) {
+ processor->strmodel = g_strdup("AMD Duron (Spitfire)");
+ } else if (model == 4) {
+ processor->strmodel = g_strdup("AMD Athlon (Thunderbird)");
+ } else if (model == 6) {
+ processor->strmodel = g_strdup("AMD Athlon XP/MP/4 (Palomino)");
+ } else if (model == 7) {
+ processor->strmodel = g_strdup("AMD Duron (Morgan)");
+ } else if (model == 8) {
+ processor->strmodel = g_strdup("AMD Athlon XP/MP (Thoroughbred)");
+ } else if (model == 10) {
+ processor->strmodel = g_strdup("AMD Athlon XP/MP (Barton)");
+ } else {
+ processor->strmodel = g_strdup("AMD Athlon (unknown)");
+ }
+ } else if (family > 6) {
+ processor->strmodel = g_strdup("AMD Opteron/Athlon64/FX");
+ } else {
+ processor->strmodel = g_strdup("AMD i386 class");
+ }
+ } else if (g_str_equal(processor->vendor_id, "CyrixInstead")) {
+ if (family == 4) {
+ processor->strmodel = g_strdup("Cyrix 5x86");
+ } else if (family == 5) {
+ processor->strmodel = g_strdup("Cyrix M1 (6x86)");
+ } else if (family == 6) {
+ if (model == 0) {
+ processor->strmodel = g_strdup("Cyrix M2 (6x86MX)");
+ } else if (model <= 5) {
+ processor->strmodel = g_strdup("VIA Cyrix III (M2 core)");
+ } else if (model == 6) {
+ processor->strmodel = g_strdup("VIA Cyrix III (WinChip C5A)");
+ } else if (model == 7) {
+ processor->strmodel = g_strdup("VIA Cyrix III (WinChip C5B/C)");
+ } else {
+ processor->strmodel = g_strdup("VIA Cyrix III (WinChip C5C-T)");
+ }
+ } else {
+ processor->strmodel = g_strdup("Cyrix i386 class");
+ }
+ } else if (g_str_equal(processor->vendor_id, "CentaurHauls")) {
+ if (family == 5) {
+ if (model <= 4) {
+ processor->strmodel = g_strdup("Centaur WinChip C6");
+ } else if (model <= 8) {
+ processor->strmodel = g_strdup("Centaur WinChip 2");
+ } else {
+ processor->strmodel = g_strdup("Centaur WinChip 2A");
+ }
+ } else {
+ processor->strmodel = g_strdup("Centaur i386 class");
+ }
+ } else if (g_str_equal(processor->vendor_id, "GenuineTMx86")) {
+ processor->strmodel = g_strdup("Transmeta Crusoe TM3x00/5x00");
+ } else {
+ processor->strmodel = g_strdup("Unknown");
+ }
+}
+
+static Processor *
+computer_get_processor(void)
+{
+ Processor *processor;
+ FILE *cpuinfo;
+ gchar buffer[128];
+
+ cpuinfo = fopen("/proc/cpuinfo", "r");
+ if (!cpuinfo)
+ return NULL;
+
+ processor = g_new0(Processor, 1);
+ while (fgets(buffer, 128, cpuinfo)) {
+ gchar **tmp = g_strsplit(buffer, ":", 2);
+
+ if (tmp[0] && tmp[1]) {
+ tmp[0] = g_strstrip(tmp[0]);
+ tmp[1] = g_strstrip(tmp[1]);
+
+ get_str("model name", processor->model_name);
+ get_str("vendor_id", processor->vendor_id);
+ get_str("flags", processor->flags);
+ get_int("cache size", processor->cache_size);
+ get_float("cpu MHz", processor->cpu_mhz);
+ get_float("bogomips", processor->bogomips);
+
+ get_str("fpu", processor->has_fpu);
+
+ get_str("fdiv_bug", processor->bug_fdiv);
+ get_str("hlt_bug", processor->bug_hlt);
+ get_str("f00f_bug", processor->bug_f00f);
+ get_str("coma_bug", processor->bug_coma);
+
+ get_int("model", processor->model);
+ get_int("cpu family", processor->family);
+ get_int("stepping", processor->stepping);
+ }
+ g_strfreev(tmp);
+ }
+
+ get_processor_strfamily(processor);
+
+ fclose(cpuinfo);
+
+ return processor;
+}
+
+static struct {
+ char *name, *meaning;
+} flag_meaning[] = {
+ { "3dnow", "3DNow! Technology" },
+ { "3dnowext", "Extended 3DNow! Technology" },
+ { "fpu", "Floating Point Unit" },
+ { "vme", "Virtual 86 Mode Extension" },
+ { "de", "Debug Extensions - I/O breakpoints" },
+ { "pse", "Page Size Extensions (4MB pages)" },
+ { "tsc", "Time Stamp Counter and RDTSC instruction" },
+ { "msr", "Model Specific Registers" },
+ { "pae", "Physical Address Extensions (36-bit address, 2MB pages)" },
+ { "mce", "Machine Check Architeture" },
+ { "cx8", "CMPXCHG8 instruction" },
+ { "apic", "Advanced Programmable Interrupt Controller" },
+ { "sep", "Fast System Call (SYSENTER/SYSEXIT instructions)" },
+ { "mtrr", "Memory Type Range Registers" },
+ { "pge", "Page Global Enable" },
+ { "mca", "Machine Check Architecture" },
+ { "cmov", "Conditional Move instruction" },
+ { "pat", "Page Attribute Table" },
+ { "pse36", "36bit Page Size Extensions" },
+ { "psn", "96 bit Processor Serial Number" },
+ { "mmx", "MMX technology" },
+ { "mmxext", "Extended MMX Technology" },
+ { "cflush", "Cache Flush" },
+ { "dtes", "Debug Trace Store" },
+ { "fxsr", "FXSAVE and FXRSTOR instructions" },
+ { "kni", "Streaming SIMD instructions" },
+ { "xmm", "Streaming SIMD instructions" },
+ { "ht", "HyperThreading" },
+ { "mp", "Multiprocessing Capable" },
+ { "sse", "SSE instructions" },
+ { "sse2", "SSE2 (WNI) instructions" },
+ { "acc", "Automatic Clock Control" },
+ { "ia64", "IA64 Instructions" },
+ { "syscall", "SYSCALL and SYSEXIT instructions" },
+ { "nx", "No-execute Page Protection" },
+ { "xd", "Execute Disable" },
+ { "clflush", "Cache Line Flush instruction" },
+ { "acpi", "Thermal Monitor and Software Controlled Clock Facilities" },
+ { "dts", "Debug Store" },
+ { "ss", "Self Snoop" },
+ { "tm", "Thermal Monitor" },
+ { "pbe", "Pending Break Enable" },
+ { "pb", "Pending Break Enable" },
+ { NULL, NULL}
+};
+
+gchar *
+processor_get_capabilities_from_flags(gchar * strflags)
+{
+ /* FIXME: * Separate between processor capabilities, additional instructions and whatnot. */
+ gchar **flags, **old;
+ gchar *tmp = "";
+ gint i;
+
+ flags = g_strsplit(strflags, " ", 0);
+ old = flags;
+
+ while (*flags) {
+ gchar *meaning = "";
+ for (i = 0; flag_meaning[i].name != NULL; i++) {
+ if (!strcmp(*flags, flag_meaning[i].name)) {
+ meaning = flag_meaning[i].meaning;
+ break;
+ }
+ }
+
+ tmp = g_strdup_printf("%s%s=%s\n", tmp, *flags, meaning);
+ *flags++;
+ }
+
+ g_strfreev(old);
+ return tmp;
+}
+
+static gchar *
+processor_get_info(Processor *processor)
+{
+ gchar *tmp = processor_get_capabilities_from_flags(processor->
+ flags);
+ gchar *ret = g_strdup_printf("[Processor]\n"
+ "Name=%s\n"
+ "Specification=%s\n"
+ "Family, model, stepping=%d, %d, %d\n"
+ "Vendor=%s\n"
+ "Cache Size=%dkb\n"
+ "Frequency=%.2fMHz\n"
+ "BogoMips=%.2f\n"
+ "Byte Order=%s\n"
+ "[Features]\n"
+ "FDIV Bug=%s\n"
+ "HLT Bug=%s\n"
+ "F00F Bug=%s\n"
+ "Coma Bug=%s\n"
+ "Has FPU=%s\n"
+ "[Capabilities]\n" "%s",
+ processor->strmodel,
+ processor->model_name,
+ processor->family,
+ processor->model,
+ processor->stepping,
+ processor->vendor_id,
+ processor->cache_size,
+ processor->cpu_mhz,
+ processor->bogomips,
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ "Little Endian",
+#else
+ "Big Endian",
+#endif
+ processor->bug_fdiv,
+ processor->bug_hlt,
+ processor->bug_f00f,
+ processor->bug_coma,
+ processor->has_fpu,
+ tmp);
+ g_free(tmp);
+ return ret;
+}
diff --git a/arch/linux/x86/samba.h b/arch/linux/x86/samba.h
new file mode 120000
index 00000000..9227f722
--- /dev/null
+++ b/arch/linux/x86/samba.h
@@ -0,0 +1 @@
+../../linux/common/samba.h \ No newline at end of file
diff --git a/arch/linux/x86/sensors.h b/arch/linux/x86/sensors.h
new file mode 120000
index 00000000..35e5f37a
--- /dev/null
+++ b/arch/linux/x86/sensors.h
@@ -0,0 +1 @@
+../../linux/common/sensors.h \ No newline at end of file
diff --git a/arch/linux/x86/storage.h b/arch/linux/x86/storage.h
new file mode 120000
index 00000000..55b68de3
--- /dev/null
+++ b/arch/linux/x86/storage.h
@@ -0,0 +1 @@
+../../linux/common/storage.h \ No newline at end of file
diff --git a/arch/linux/x86/uptime.h b/arch/linux/x86/uptime.h
new file mode 120000
index 00000000..78c026ff
--- /dev/null
+++ b/arch/linux/x86/uptime.h
@@ -0,0 +1 @@
+../../linux/common/uptime.h \ No newline at end of file
diff --git a/arch/linux/x86/usb.h b/arch/linux/x86/usb.h
new file mode 120000
index 00000000..8b8fbb5d
--- /dev/null
+++ b/arch/linux/x86/usb.h
@@ -0,0 +1 @@
+../../linux/common/usb.h \ No newline at end of file