summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys-utils/Makemodule.am2
-rw-r--r--sys-utils/lscpu-arm.c (renamed from sys-utils/lscpu-arm.h)46
-rw-r--r--sys-utils/lscpu.c42
-rw-r--r--sys-utils/lscpu.h1
4 files changed, 44 insertions, 47 deletions
diff --git a/sys-utils/Makemodule.am b/sys-utils/Makemodule.am
index b8486e836..c2e99ca2d 100644
--- a/sys-utils/Makemodule.am
+++ b/sys-utils/Makemodule.am
@@ -357,7 +357,7 @@ usrbin_exec_PROGRAMS += lscpu
lscpu_SOURCES = \
sys-utils/lscpu.c \
sys-utils/lscpu.h \
- sys-utils/lscpu-arm.h \
+ sys-utils/lscpu-arm.c \
sys-utils/lscpu-dmi.c
lscpu_LDADD = $(LDADD) libcommon.la libsmartcols.la $(RTAS_LIBS)
lscpu_CFLAGS = $(AM_CFLAGS) -I$(ul_libsmartcols_incdir)
diff --git a/sys-utils/lscpu-arm.h b/sys-utils/lscpu-arm.c
index 289a900f1..9cc9362ef 100644
--- a/sys-utils/lscpu-arm.h
+++ b/sys-utils/lscpu-arm.c
@@ -1,5 +1,5 @@
/*
- * lscpu-arm.h - ARM CPU identification tables
+ * lscpu-arm.c - ARM CPU identification tables
*
* Copyright (C) 2018 Riku Voipio <riku.voipio@iki.fi>
*
@@ -23,8 +23,7 @@
* - GCC sources: config/arch/arch-cores.def
* - Ancient wisdom
*/
-#ifndef LSCPU_ARM_H
-#define LSCPU_ARM_H
+#include "lscpu.h"
struct id_part {
const int id;
@@ -186,4 +185,43 @@ static const struct hw_impl hw_implementer[] = {
{ -1, unknown_part, "unknown" },
};
-#endif /* LSCPU_ARM_H */
+void arm_cpu_decode(struct lscpu_desc *desc)
+{
+ int j, impl, part;
+ const struct id_part *parts = NULL;
+ char buf[8];
+ if (desc->vendor == NULL || desc->model == NULL)
+ return;
+ if ((strncmp(desc->vendor,"0x",2) ||
+ strncmp(desc->model,"0x",2) ))
+ return;
+
+ impl=(int)strtol(desc->vendor, NULL, 0);
+ part=(int)strtol(desc->model, NULL, 0);
+
+ for (j = 0; hw_implementer[j].id != -1; j++) {
+ if (hw_implementer[j].id == impl) {
+ parts = hw_implementer[j].parts;
+ desc->vendor = (char *)hw_implementer[j].name;
+ break;
+ }
+ }
+ if ( parts == NULL)
+ return;
+
+ for (j = 0; parts[j].id != -1; j++) {
+ if (parts[j].id == part) {
+ desc->modelname = (char *)parts[j].name;
+ break;
+ }
+ }
+
+ /* Print out the rXpY string for ARM cores */
+ if (impl == 0x41 && desc->revision != NULL &&
+ desc->stepping != NULL) {
+ int revision = atoi(desc->revision);
+ int variant = (int)strtol(desc->stepping, NULL, 0);
+ snprintf(buf, sizeof(buf), "r%dp%d", variant, revision );
+ desc->stepping=xstrdup(buf);
+ }
+}
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 08e5df5bc..6d1fde555 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -62,7 +62,6 @@
#include "optutils.h"
#include "lscpu.h"
-#include "lscpu-arm.h"
#define CACHE_MAX 100
@@ -386,47 +385,6 @@ static void read_physical_info_powerpc(
}
#endif
-static void
-arm_cpu_decode(struct lscpu_desc *desc)
-{
- int j, impl, part;
- const struct id_part *parts = NULL;
- char buf[8];
- if (desc->vendor == NULL || desc->model == NULL)
- return;
- if ((strncmp(desc->vendor,"0x",2) ||
- strncmp(desc->model,"0x",2) ))
- return;
-
- impl=(int)strtol(desc->vendor, NULL, 0);
- part=(int)strtol(desc->model, NULL, 0);
-
- for (j = 0; hw_implementer[j].id != -1; j++) {
- if (hw_implementer[j].id == impl) {
- parts = hw_implementer[j].parts;
- desc->vendor = (char *)hw_implementer[j].name;
- break;
- }
- }
- if ( parts == NULL)
- return;
-
- for (j = 0; parts[j].id != -1; j++) {
- if (parts[j].id == part) {
- desc->modelname = (char *)parts[j].name;
- break;
- }
- }
-
- /* Print out the rXpY string for ARM cores */
- if (impl == 0x41 && desc->revision != NULL &&
- desc->stepping != NULL) {
- int revision = atoi(desc->revision);
- int variant = (int)strtol(desc->stepping, NULL, 0);
- snprintf(buf, sizeof(buf), "r%dp%d", variant, revision );
- desc->stepping=xstrdup(buf);
- }
-}
static void
read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod)
diff --git a/sys-utils/lscpu.h b/sys-utils/lscpu.h
index 1aa546138..3d1885a3e 100644
--- a/sys-utils/lscpu.h
+++ b/sys-utils/lscpu.h
@@ -183,5 +183,6 @@ struct lscpu_modifier {
};
extern int read_hypervisor_dmi(void);
+extern void arm_cpu_decode(struct lscpu_desc *desc);
#endif /* LSCPU_H */