Blame SOURCES/0001-opal-prd-Fix-occ_reset-call.patch

802f9d
From e2ab540ac169cac9737ff09605182a333086f848 Mon Sep 17 00:00:00 2001
802f9d
From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
802f9d
Date: Thu, 21 Sep 2017 19:49:47 +0530
802f9d
Subject: [PATCH 1/2] opal-prd: Fix occ_reset call
802f9d
802f9d
HBRT OCC reset interface depends on service processor type.
802f9d
  FSP -> reset_pm_complex()
802f9d
  BMC -> process_occ_reset()
802f9d
802f9d
This patch adds logic to detect service processor type and
802f9d
then make appropriate occ reset call.
802f9d
802f9d
CC: Jeremy Kerr <jk@ozlabs.org>
802f9d
CC: Daniel M Crowell <dcrowell@us.ibm.com>
802f9d
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
802f9d
Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
802f9d
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
802f9d
Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
802f9d
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
802f9d
---
802f9d
 external/opal-prd/opal-prd.c | 36 ++++++++++++++++++++++++++++++------
802f9d
 1 file changed, 30 insertions(+), 6 deletions(-)
802f9d
802f9d
diff --git a/external/opal-prd/opal-prd.c b/external/opal-prd/opal-prd.c
802f9d
index a09a6366..20ce5dac 100644
802f9d
--- a/external/opal-prd/opal-prd.c
802f9d
+++ b/external/opal-prd/opal-prd.c
802f9d
@@ -246,6 +246,21 @@ static void pr_log_daemon_init(void)
802f9d
 	}
802f9d
 }
802f9d
 
802f9d
+/* Check service processor type */
802f9d
+static bool is_fsp_system(void)
802f9d
+{
802f9d
+	char *path;
802f9d
+	int rc;
802f9d
+
802f9d
+	rc = asprintf(&path, "%s/fsps", devicetree_base);
802f9d
+	if (rc < 0) {
802f9d
+		pr_log(LOG_ERR, "FW: error creating '/fsps' path %m");
802f9d
+		return false;
802f9d
+	}
802f9d
+
802f9d
+	return access(path, F_OK) ? false : true;
802f9d
+}
802f9d
+
802f9d
 /**
802f9d
  * ABI check that we can't perform at build-time: we want to ensure that the
802f9d
  * layout of struct host_interfaces matches that defined in the thunk.
802f9d
@@ -1336,18 +1351,27 @@ static int pm_complex_reset(uint64_t chip)
802f9d
 {
802f9d
 	int rc;
802f9d
 
802f9d
-	if (hservice_runtime->reset_pm_complex) {
802f9d
+	/*
802f9d
+	 * FSP system -> reset_pm_complex
802f9d
+	 * BMC system -> process_occ_reset
802f9d
+	 */
802f9d
+	if (is_fsp_system()) {
802f9d
+		if (!hservice_runtime->reset_pm_complex) {
802f9d
+			pr_log_nocall("reset_pm_complex");
802f9d
+			return -1;
802f9d
+		}
802f9d
+
802f9d
 		pr_debug("PM: calling pm_complex_reset(%ld)", chip);
802f9d
 		rc = call_reset_pm_complex(chip);
802f9d
+	} else {
802f9d
+		if (!hservice_runtime->process_occ_reset) {
802f9d
+			pr_log_nocall("process_occ_reset");
802f9d
+			return -1;
802f9d
+		}
802f9d
 
802f9d
-	} else if (hservice_runtime->process_occ_reset) {
802f9d
 		pr_debug("PM: calling process_occ_reset(%ld)", chip);
802f9d
 		call_process_occ_reset(chip);
802f9d
 		rc = 0;
802f9d
-
802f9d
-	} else {
802f9d
-		pr_log_nocall("reset_pm_complex/process_occ_reset");
802f9d
-		rc = -1;
802f9d
 	}
802f9d
 
802f9d
 	return rc;
802f9d
-- 
802f9d
2.13.5
802f9d