Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: 8355/1: arch: Show the serial number from devicetree in cpuinfo

This grabs the serial number shown in cpuinfo from the serial-number device-tree
property in priority. When booting with ATAGs (and without device-tree), the
provided number is still shown instead.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Paul Kocialkowski and committed by
Russell King
3f599875 13dd92bb

+22 -2
+1
arch/arm/include/asm/system_info.h
··· 17 17 18 18 /* information about the system we're running on */ 19 19 extern unsigned int system_rev; 20 + extern const char *system_serial; 20 21 extern unsigned int system_serial_low; 21 22 extern unsigned int system_serial_high; 22 23 extern unsigned int mem_fclk_21285;
+21 -2
arch/arm/kernel/setup.c
··· 93 93 unsigned int system_rev; 94 94 EXPORT_SYMBOL(system_rev); 95 95 96 + const char *system_serial; 97 + EXPORT_SYMBOL(system_serial); 98 + 96 99 unsigned int system_serial_low; 97 100 EXPORT_SYMBOL(system_serial_low); 98 101 ··· 842 839 843 840 static int __init init_machine_late(void) 844 841 { 842 + struct device_node *root; 843 + int ret; 844 + 845 845 if (machine_desc->init_late) 846 846 machine_desc->init_late(); 847 + 848 + root = of_find_node_by_path("/"); 849 + if (root) { 850 + ret = of_property_read_string(root, "serial-number", 851 + &system_serial); 852 + if (ret) 853 + system_serial = NULL; 854 + } 855 + 856 + if (!system_serial) 857 + system_serial = kasprintf(GFP_KERNEL, "%08x%08x", 858 + system_serial_high, 859 + system_serial_low); 860 + 847 861 return 0; 848 862 } 849 863 late_initcall(init_machine_late); ··· 1129 1109 1130 1110 seq_printf(m, "Hardware\t: %s\n", machine_name); 1131 1111 seq_printf(m, "Revision\t: %04x\n", system_rev); 1132 - seq_printf(m, "Serial\t\t: %08x%08x\n", 1133 - system_serial_high, system_serial_low); 1112 + seq_printf(m, "Serial\t\t: %s\n", system_serial); 1134 1113 1135 1114 return 0; 1136 1115 }