powerpc: Add device-tree model to the hardware description
authorMichael Ellerman <mpe@ellerman.id.au>
Fri, 30 Sep 2022 08:27:07 +0000 (18:27 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 30 Sep 2022 08:35:53 +0000 (18:35 +1000)
Add the model of the machine we're on to the hardware description, which
is printed at boot and in case of an oops.

eg: Hardware name: IBM,8247-22L

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220930082709.55830-4-mpe@ellerman.id.au
arch/powerpc/kernel/prom.c

index 83fc72202838b37ec744d23e27567236ae982100..1eed87d954ba8fb4129f258eb47f23bb5f6bf547 100644 (file)
@@ -715,6 +715,23 @@ static void __init tm_init(void)
 static void tm_init(void) { }
 #endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
 
+static int __init
+early_init_dt_scan_model(unsigned long node, const char *uname,
+                        int depth, void *data)
+{
+       const char *prop;
+
+       if (depth != 0)
+               return 0;
+
+       prop = of_get_flat_dt_prop(node, "model", NULL);
+       if (prop)
+               seq_buf_printf(&ppc_hw_desc, "%s ", prop);
+
+       /* break now */
+       return 1;
+}
+
 #ifdef CONFIG_PPC64
 static void __init save_fscr_to_task(void)
 {
@@ -743,6 +760,8 @@ void __init early_init_devtree(void *params)
        if (!early_init_dt_verify(params))
                panic("BUG: Failed verifying flat device tree, bad version?");
 
+       of_scan_flat_dt(early_init_dt_scan_model, NULL);
+
 #ifdef CONFIG_PPC_RTAS
        /* Some machines might need RTAS info for debugging, grab it now. */
        of_scan_flat_dt(early_init_dt_scan_rtas, NULL);