[Skiboot] [PATCH] hdata: Make sure reserved node name starts with "ibm, "
Vasant Hegde
hegdevasant at linux.vnet.ibm.com
Sat Jun 23 16:23:34 AEST 2018
HDAT does not use 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>
---
@Stewart,
This fixes https://github.com/open-power/boston-openpower/issues/675
-Vasant
hdata/memory.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/hdata/memory.c b/hdata/memory.c
index ecce881d1..c0c30066e 100644
--- a/hdata/memory.c
+++ b/hdata/memory.c
@@ -27,6 +27,8 @@
#include "spira.h"
#include "hdata.h"
+#define FW_RESERVE_NODE_PREFIX "ibm,"
+
struct HDIF_ram_area_id {
__be16 id;
#define RAM_AREA_INSTALLED 0x8000
@@ -595,7 +597,7 @@ static void get_hb_reserved_mem(struct HDIF_common_hdr *ms_vpd)
const struct msvpd_hb_reserved_mem *hb_resv_mem;
u64 start_addr, end_addr, label_size;
struct dt_node *node;
- int count, i;
+ int count, i, label_offset;
char *label;
/*
@@ -643,11 +645,19 @@ static void get_hb_reserved_mem(struct HDIF_common_hdr *ms_vpd)
if (label_size > 64)
label_size = 64;
- label = malloc(label_size+1);
+ /* Accommodate "ibm," */
+ label_offset = 0;
+ label = malloc(label_size + strlen(FW_RESERVE_NODE_PREFIX) + 1);
assert(label);
- memcpy(label, hb_resv_mem->label, label_size);
- label[label_size] = '\0';
+ /* Add "ibm," to reserved node name */
+ if (strncasecmp(hb_resv_mem->label, "ibm", 3)) {
+ memcpy(label, FW_RESERVE_NODE_PREFIX,
+ strlen(FW_RESERVE_NODE_PREFIX));
+ label_offset = strlen(FW_RESERVE_NODE_PREFIX);
+ }
+ memcpy(label + label_offset, hb_resv_mem->label, label_size);
+ label[label_size + label_offset] = '\0';
/* Unnamed reservations are always broken. Ignore them. */
if (strlen(label) == 0) {
--
2.14.3
More information about the Skiboot
mailing list