Add proc/cpuinfo serial and chipid information

This commit is contained in:
HuangXin 2018-08-14 15:34:46 +08:00
parent 7550320002
commit de1d109b79
1 changed files with 21 additions and 1 deletions

View File

@ -63,6 +63,8 @@
#include <asm/memblock.h>
#include <asm/virt.h>
#include <mach/sunxi-chip.h>
#include "atags.h"
@ -1216,6 +1218,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) {
/*
* glibc reads /proc/cpuinfo to determine the number of
@ -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;
}