add device model to /proc/cpuinfo
authorNick Xie <nick@khadas.com>
Tue, 11 Jun 2019 01:11:12 +0000 (09:11 +0800)
committerNick Xie <nick@khadas.com>
Tue, 11 Jun 2019 01:11:12 +0000 (09:11 +0800)
Signed-off-by: Nick Xie <nick@khadas.com>
arch/arm64/kernel/cpuinfo.c
arch/arm64/kernel/setup.c
include/linux/amlogic/cpu_version.h

index 798c0f2..3d2dc83 100644 (file)
@@ -172,7 +172,7 @@ static int c_show(struct seq_file *m, void *v)
        seq_puts(m, "\n");
 #endif
 
-       seq_printf(m, "Hardware\t: %s\n\n", "Amlogic");
+       seq_printf(m, "Hardware\t: %s\n", machine_model);
        return 0;
 }
 
index b522209..59ee72e 100644 (file)
@@ -66,6 +66,9 @@
 
 phys_addr_t __fdt_pointer __initdata;
 
+const char *machine_model;
+EXPORT_SYMBOL(machine_model);
+
 /*
  * Standard memory resources
  */
@@ -180,6 +183,7 @@ static void __init smp_build_mpidr_hash(void)
 static void __init setup_machine_fdt(phys_addr_t dt_phys)
 {
        void *dt_virt = fixmap_remap_fdt(dt_phys);
+       const char *name;
 
        if (!dt_virt || !early_init_dt_scan(dt_virt)) {
                pr_crit("\n"
@@ -192,7 +196,14 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys)
                        cpu_relax();
        }
 
-       dump_stack_set_arch_desc("%s (DT)", of_flat_dt_get_machine_name());
+       name = of_flat_dt_get_machine_name();
+       if (!name)
+               return;
+
+       machine_model = name;
+
+       pr_info("Machine model: %s\n", name);
+       dump_stack_set_arch_desc("%s (DT)", name);
 }
 
 static void __init request_standard_resources(void)
index 7a62cb1..0121103 100644 (file)
@@ -44,6 +44,8 @@
 #define MESON_CPU_VERSION_LVL_MISC     3
 #define MESON_CPU_VERSION_LVL_MAX      MESON_CPU_VERSION_LVL_MISC
 
+extern const char *machine_model;
+
 #define CHIPID_LEN 16
 void cpuinfo_get_chipid(unsigned char *cid, unsigned int size);
 int  meson_cpu_version_init(void);