From de1d109b790c5c82ce85493e39b2c75ffafd5220 Mon Sep 17 00:00:00 2001 From: HuangXin Date: Tue, 14 Aug 2018 15:34:46 +0800 Subject: [PATCH] Add proc/cpuinfo serial and chipid information --- lichee/linux-4.9/arch/arm/kernel/setup.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lichee/linux-4.9/arch/arm/kernel/setup.c b/lichee/linux-4.9/arch/arm/kernel/setup.c index f4e54503a..a05da65fa 100644 --- a/lichee/linux-4.9/arch/arm/kernel/setup.c +++ b/lichee/linux-4.9/arch/arm/kernel/setup.c @@ -63,6 +63,8 @@ #include #include +#include + #include "atags.h" @@ -1215,6 +1217,16 @@ static int c_show(struct seq_file *m, void *v) { int i, j; u32 cpuid; + +#if defined(CONFIG_ARCH_SUNXI) + u32 serial[4]; + u32 chip_id[4] = {0}; + int ret; + + memset(serial, 0, sizeof(serial)); + ret = sunxi_get_serial((u8 *)serial); + ret = sunxi_get_soc_chipid((u8 *)chip_id); +#endif for_each_online_cpu(i) { /* @@ -1272,7 +1284,15 @@ static int c_show(struct seq_file *m, void *v) seq_printf(m, "Hardware\t: %s\n", machine_name); seq_printf(m, "Revision\t: %04x\n", system_rev); - seq_printf(m, "Serial\t\t: %s\n", system_serial); + +#if defined(CONFIG_ARCH_SUNXI) + seq_printf(m, "Serial\t\t: %04x%08x%08x\n", + serial[2], serial[1], serial[0]); + seq_printf(m, "Chipid\t\t: %08x%08x%08x%08x\n", + chip_id[3],chip_id[2], chip_id[1], chip_id[0]); +#else + seq_printf(m, "Serial\t\t: %s\n", system_serial); +#endif return 0; }