[Skiboot] [PATCH v2 03/12] OPAL: Validate before creating opal device tree node

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Mon Apr 6 18:30:29 AEST 2015


On FSP based machine, attention LED location code is passed to OPAL
via HDAT. We want to populate this information in device tree under
led node, so that LED driver can use this information.

Presently we are creating '/ibm,opal' node after parsing hdata
information. This patch validates '/ibm,opal' node before creating.
So on FSP based machine we can create this node in hdata itself
without breaking.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 core/opal.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/core/opal.c b/core/opal.c
index 45ee2e2..5776e61 100644
--- a/core/opal.c
+++ b/core/opal.c
@@ -143,7 +143,11 @@ void add_opal_node(void)
 	size = (CPU_STACKS_BASE +
 		(cpu_max_pir + 1) * STACK_SIZE) - SKIBOOT_BASE;
 
-	opal_node = dt_new(dt_root, "ibm,opal");
+	if (!opal_node) {
+		opal_node = dt_new(dt_root, "ibm,opal");
+		assert(opal_node);
+	}
+
 	dt_add_property_cells(opal_node, "#address-cells", 0);
 	dt_add_property_cells(opal_node, "#size-cells", 0);
 	dt_add_property_strings(opal_node, "compatible", "ibm,opal-v2",



More information about the Skiboot mailing list