Skip to content

Commit 3f59987

Browse files
paulkocialkowskiRussell King
authored and
Russell King
committed
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 <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent 13dd92b commit 3f59987

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

arch/arm/include/asm/system_info.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
/* information about the system we're running on */
1919
extern unsigned int system_rev;
20+
extern const char *system_serial;
2021
extern unsigned int system_serial_low;
2122
extern unsigned int system_serial_high;
2223
extern unsigned int mem_fclk_21285;

arch/arm/kernel/setup.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ unsigned int __atags_pointer __initdata;
9393
unsigned int system_rev;
9494
EXPORT_SYMBOL(system_rev);
9595

96+
const char *system_serial;
97+
EXPORT_SYMBOL(system_serial);
98+
9699
unsigned int system_serial_low;
97100
EXPORT_SYMBOL(system_serial_low);
98101

@@ -839,8 +842,25 @@ arch_initcall(customize_machine);
839842

840843
static int __init init_machine_late(void)
841844
{
845+
struct device_node *root;
846+
int ret;
847+
842848
if (machine_desc->init_late)
843849
machine_desc->init_late();
850+
851+
root = of_find_node_by_path("/");
852+
if (root) {
853+
ret = of_property_read_string(root, "serial-number",
854+
&system_serial);
855+
if (ret)
856+
system_serial = NULL;
857+
}
858+
859+
if (!system_serial)
860+
system_serial = kasprintf(GFP_KERNEL, "%08x%08x",
861+
system_serial_high,
862+
system_serial_low);
863+
844864
return 0;
845865
}
846866
late_initcall(init_machine_late);
@@ -1109,8 +1129,7 @@ static int c_show(struct seq_file *m, void *v)
11091129

11101130
seq_printf(m, "Hardware\t: %s\n", machine_name);
11111131
seq_printf(m, "Revision\t: %04x\n", system_rev);
1112-
seq_printf(m, "Serial\t\t: %08x%08x\n",
1113-
system_serial_high, system_serial_low);
1132+
seq_printf(m, "Serial\t\t: %s\n", system_serial);
11141133

11151134
return 0;
11161135
}

0 commit comments

Comments
 (0)