Commit 37576cb0 authored by Michael Ellerman's avatar Michael Ellerman
Browse files

powerpc/powernv: Add opal details to the hardware description



Add OPAL version details to the hardware description, which is printed
at boot and in case of an oops.

eg: Hardware name: ... opal:v6.2

Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220930082709.55830-5-mpe@ellerman.id.au
parent 54122970
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <linux/console.h>
#include <linux/delay.h>
#include <linux/irq.h>
#include <linux/seq_buf.h>
#include <linux/seq_file.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
@@ -207,8 +208,29 @@ static void __init pnv_setup_arch(void)
	pnv_rng_init();
}

static void __init pnv_add_hw_description(void)
{
	struct device_node *dn;
	const char *s;

	dn = of_find_node_by_path("/ibm,opal/firmware");
	if (!dn)
		return;

	if (of_property_read_string(dn, "version", &s) == 0 ||
	    of_property_read_string(dn, "git-id", &s) == 0)
		seq_buf_printf(&ppc_hw_desc, "opal:%s ", s);

	if (of_property_read_string(dn, "mi-version", &s) == 0)
		seq_buf_printf(&ppc_hw_desc, "mi:%s ", s);

	of_node_put(dn);
}

static void __init pnv_init(void)
{
	pnv_add_hw_description();

	/*
	 * Initialize the LPC bus now so that legacy serial
	 * ports can be found on it