[PATCH v2 5/6] powerpc/powernv: Add opal details to the hardware description

2022-09-29 Thread Michael Ellerman
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: Michael Ellerman 
---
 arch/powerpc/platforms/powernv/setup.c | 22 ++
 1 file changed, 22 insertions(+)

v2: Use of_property_read_string()

diff --git a/arch/powerpc/platforms/powernv/setup.c 
b/arch/powerpc/platforms/powernv/setup.c
index dac545aa0308..61ab2d38ff4b 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -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", ) == 0 ||
+   of_property_read_string(dn, "git-id", ) == 0)
+   seq_buf_printf(_hw_desc, "opal:%s ", s);
+
+   if (of_property_read_string(dn, "mi-version", ) == 0)
+   seq_buf_printf(_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
-- 
2.37.3



[PATCH v2 5/6] powerpc/powernv: Add opal details to the hardware description

2022-09-29 Thread Michael Ellerman
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: Michael Ellerman 
---
 arch/powerpc/platforms/powernv/setup.c | 22 ++
 1 file changed, 22 insertions(+)

v2: Use of_property_read_string()

diff --git a/arch/powerpc/platforms/powernv/setup.c 
b/arch/powerpc/platforms/powernv/setup.c
index dac545aa0308..61ab2d38ff4b 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -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", ) == 0 ||
+   of_property_read_string(dn, "git-id", ) == 0)
+   seq_buf_printf(_hw_desc, "opal:%s ", s);
+
+   if (of_property_read_string(dn, "mi-version", ) == 0)
+   seq_buf_printf(_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
-- 
2.37.3