[Skiboot] [PATCH v3 2/2] hdata: Make sure reserved node name starts with "ibm, "

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Fri Sep 7 15:16:55 AEST 2018


HDAT does not provide consistent label format for reserved memory label.
Few starts with "ibm," while few other starts with component name.

Lets make sure all the reserved node name starts with "ibm,".

Reported-by: Pridhiviraj Paidipeddi <ppaidipe at linux.vnet.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 hdata/memory.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/hdata/memory.c b/hdata/memory.c
index d9c9ddda9..e7566ef5a 100644
--- a/hdata/memory.c
+++ b/hdata/memory.c
@@ -565,6 +565,8 @@ static struct dt_node *dt_hb_reserves;
 
 static struct dt_node *add_hb_reserve_node(const char *name, u64 start, u64 end)
 {
+	/* label size + "ibm," + NULL */
+	char node_name[HB_RESERVE_MEM_LABEL_SIZE + 5] = { 0 };
 	struct dt_node *node, *hb;
 
 	if (!dt_hb_reserves) {
@@ -578,10 +580,15 @@ static struct dt_node *add_hb_reserve_node(const char *name, u64 start, u64 end)
 		dt_add_property_cells(dt_hb_reserves, "#address-cells", 2);
 	}
 
-	node = dt_new_addr(dt_hb_reserves, name, start);
+	/* Add "ibm," to reserved node name */
+	if (strncasecmp(name, "ibm", 3))
+		snprintf(node_name, 5, "ibm,");
+	strcat(node_name, name);
+
+	node = dt_new_addr(dt_hb_reserves, node_name, start);
 	if (!node) {
 		prerror("Unable to create node for %s@%llx\n",
-			name, (unsigned long long) start);
+			node_name, (unsigned long long) start);
 		return NULL;
 	}
 
-- 
2.14.3



More information about the Skiboot mailing list