ACK: [SRU][Bionic/raspi2][PATCH] arch/arm64: Add Revision, Serial, Model to cpuinfo
You-Sheng Yang
vicamo.yang at canonical.com
Wed Nov 20 14:14:16 UTC 2019
Acked-By: You-Sheng Yang <vicamo.yang at canonical.com>
On 2019-11-19 19:11, Juerg Haefliger wrote:
> From: Phil Elwell <phil at raspberrypi.org>
>
> BugLink: https://bugs.launchpad.net/bugs/1823151
>
> Signed-off-by: Phil Elwell <phil at raspberrypi.org>
> (cherry picked from commit 935eb6f9a31971ef5537ac5d1b62148f8bcbad2f rpi-4.19.y)
> Signed-off-by: Juerg Haefliger <juergh at canonical.com>
> ---
> arch/arm64/kernel/cpuinfo.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
> index 1e2554543506..fe810a2e4738 100644
> --- a/arch/arm64/kernel/cpuinfo.c
> +++ b/arch/arm64/kernel/cpuinfo.c
> @@ -27,6 +27,7 @@
> #include <linux/elf.h>
> #include <linux/init.h>
> #include <linux/kernel.h>
> +#include <linux/of_platform.h>
> #include <linux/personality.h>
> #include <linux/preempt.h>
> #include <linux/printk.h>
> @@ -120,6 +121,10 @@ static int c_show(struct seq_file *m, void *v)
> {
> int i, j;
> bool compat = personality(current->personality) == PER_LINUX32;
> + struct device_node *np;
> + const char *model;
> + const char *serial;
> + u32 revision;
>
> for_each_online_cpu(i) {
> struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i);
> @@ -171,6 +176,26 @@ static int c_show(struct seq_file *m, void *v)
> seq_printf(m, "CPU revision\t: %d\n\n", MIDR_REVISION(midr));
> }
>
> + seq_printf(m, "Hardware\t: BCM2835\n");
> +
> + np = of_find_node_by_path("/system");
> + if (np) {
> + if (!of_property_read_u32(np, "linux,revision", &revision))
> + seq_printf(m, "Revision\t: %04x\n", revision);
> + of_node_put(np);
> + }
> +
> + np = of_find_node_by_path("/");
> + if (np) {
> + if (!of_property_read_string(np, "serial-number",
> + &serial))
> + seq_printf(m, "Serial\t\t: %s\n", serial);
> + if (!of_property_read_string(np, "model",
> + &model))
> + seq_printf(m, "Model\t\t: %s\n", model);
> + of_node_put(np);
> + }
> +
> return 0;
> }
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20191120/a720261b/attachment.sig>
More information about the kernel-team
mailing list