Merge tag 'powerpc-4.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[platform/kernel/linux-starfive.git] / arch / powerpc / platforms / pseries / dlpar.c
index d3a81e7..193e052 100644 (file)
@@ -354,11 +354,17 @@ static int handle_dlpar_errorlog(struct pseries_hp_errorlog *hp_elog)
        switch (hp_elog->id_type) {
        case PSERIES_HP_ELOG_ID_DRC_COUNT:
                hp_elog->_drc_u.drc_count =
-                                       be32_to_cpu(hp_elog->_drc_u.drc_count);
+                               be32_to_cpu(hp_elog->_drc_u.drc_count);
                break;
        case PSERIES_HP_ELOG_ID_DRC_INDEX:
                hp_elog->_drc_u.drc_index =
-                                       be32_to_cpu(hp_elog->_drc_u.drc_index);
+                               be32_to_cpu(hp_elog->_drc_u.drc_index);
+               break;
+       case PSERIES_HP_ELOG_ID_DRC_IC:
+               hp_elog->_drc_u.ic.count =
+                               be32_to_cpu(hp_elog->_drc_u.ic.count);
+               hp_elog->_drc_u.ic.index =
+                               be32_to_cpu(hp_elog->_drc_u.ic.index);
        }
 
        switch (hp_elog->resource) {
@@ -467,7 +473,33 @@ static int dlpar_parse_id_type(char **cmd, struct pseries_hp_errorlog *hp_elog)
        if (!arg)
                return -EINVAL;
 
-       if (sysfs_streq(arg, "index")) {
+       if (sysfs_streq(arg, "indexed-count")) {
+               hp_elog->id_type = PSERIES_HP_ELOG_ID_DRC_IC;
+               arg = strsep(cmd, " ");
+               if (!arg) {
+                       pr_err("No DRC count specified.\n");
+                       return -EINVAL;
+               }
+
+               if (kstrtou32(arg, 0, &count)) {
+                       pr_err("Invalid DRC count specified.\n");
+                       return -EINVAL;
+               }
+
+               arg = strsep(cmd, " ");
+               if (!arg) {
+                       pr_err("No DRC Index specified.\n");
+                       return -EINVAL;
+               }
+
+               if (kstrtou32(arg, 0, &index)) {
+                       pr_err("Invalid DRC Index specified.\n");
+                       return -EINVAL;
+               }
+
+               hp_elog->_drc_u.ic.count = cpu_to_be32(count);
+               hp_elog->_drc_u.ic.index = cpu_to_be32(index);
+       } else if (sysfs_streq(arg, "index")) {
                hp_elog->id_type = PSERIES_HP_ELOG_ID_DRC_INDEX;
                arg = strsep(cmd, " ");
                if (!arg) {