File powerpc-utils-papr.drmgr-phandle.patch of Package powerpc-utils
# Bug 438685 - UPT:LTE: clashlp1: Memory add fails, responds with HSCL297A message
# - Use linux,phandle for memory add when ibm,phandle is not available.
---
cmds/drmgr/drslot_chrp_mem.c | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
--- a/cmds/drmgr/drslot_chrp_mem.c
+++ b/cmds/drmgr/drslot_chrp_mem.c
@@ -34,6 +34,29 @@ mem_usage(char **pusage)
}
/**
+ * get_phandle
+ *
+ * @param char * device tree node pointer
+ * @param int * pointer to phandle
+ */
+int get_phandle(char *path, int *phandle)
+{
+ int rc1, rc2;
+
+ /* get "linux,phandle" property */
+ rc1 = get_property(path, "linux,phandle", phandle, sizeof(*phandle));
+
+ /* overwrite with "ibm,handle" if it exists */
+ rc2 = get_property(path, "ibm,phandle", phandle, sizeof(*phandle));
+
+ /* return bad if both gets failed */
+ if (rc1 && rc2)
+ return rc1;
+ else
+ return 0;
+}
+
+/**
* free_lmbs
* @brief Free any allocated memory referenced from the list head
*
@@ -520,10 +543,11 @@ update_drconf_node(struct lmb *lmb, stru
if (prop_buf == NULL)
return -1;
- rc = get_property(lmb->ofdt_path, "ibm,phandle", &phandle,
- sizeof(phandle));
- if (rc)
+ rc = get_phandle(lmb->ofdt_path, &phandle);
+ if (rc) {
+ dbg("Failed to get phandle: %d\n", rc);
return rc;
+ }
memset(prop_buf, 0, prop_buf_sz);
tmp = prop_buf;