[Skiboot] [PATCH 1/2] opal-prd: Fix occ_reset call

Daniel M Crowell dcrowell at us.ibm.com
Sat Sep 23 12:39:14 AEST 2017


Seems fine (though I don't really have the context of what function this 
is.  (I'm not fluent in patch reviews, not sure how you understand 
anything with so little context....)

--
Dan Crowell
Senior Software Engineer - Power Systems Enablement Firmware
IBM Rochester: t/l 553-2987
dcrowell at us.ibm.com



From:   Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
To:     skiboot at lists.ozlabs.org
Cc:     Vasant Hegde <hegdevasant at linux.vnet.ibm.com>, Jeremy Kerr 
<jk at ozlabs.org>, Daniel M Crowell/Rochester/IBM at IBMUS, Shilpasri G Bhat 
<shilpa.bhat at linux.vnet.ibm.com>
Date:   09/21/2017 09:20 AM
Subject:        [PATCH 1/2] opal-prd: Fix occ_reset call



HBRT OCC reset interface depends on service processor type.
  FSP -> reset_pm_complex()
  BMC -> process_occ_reset()

This patch adds logic to detect service processor type and
then make appropriate occ reset call.

CC: Jeremy Kerr <jk at ozlabs.org>
CC: Daniel M Crowell <dcrowell at us.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
Signed-off-by: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>
---
 external/opal-prd/opal-prd.c | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/external/opal-prd/opal-prd.c b/external/opal-prd/opal-prd.c
index a09a636..20ce5da 100644
--- a/external/opal-prd/opal-prd.c
+++ b/external/opal-prd/opal-prd.c
@@ -246,6 +246,21 @@ static void pr_log_daemon_init(void)
                 }
 }
 
+/* Check service processor type */
+static bool is_fsp_system(void)
+{
+                char *path;
+                int rc;
+
+                rc = asprintf(&path, "%s/fsps", devicetree_base);
+                if (rc < 0) {
+                                pr_log(LOG_ERR, "FW: error creating 
'/fsps' path %m");
+                                return false;
+                }
+
+                return access(path, F_OK) ? false : true;
+}
+
 /**
  * ABI check that we can't perform at build-time: we want to ensure that 
the
  * layout of struct host_interfaces matches that defined in the thunk.
@@ -1336,18 +1351,27 @@ static int pm_complex_reset(uint64_t chip)
 {
                 int rc;
 
-                if (hservice_runtime->reset_pm_complex) {
+                /*
+                 * FSP system -> reset_pm_complex
+                 * BMC system -> process_occ_reset
+                 */
+                if (is_fsp_system()) {
+                                if (!hservice_runtime->reset_pm_complex) 
{
+ pr_log_nocall("reset_pm_complex");
+                                                return -1;
+                                }
+
                                 pr_debug("PM: calling 
pm_complex_reset(%ld)", chip);
                                 rc = call_reset_pm_complex(chip);
+                } else {
+                                if (!hservice_runtime->process_occ_reset) 
{
+ pr_log_nocall("process_occ_reset");
+                                                return -1;
+                                }
 
-                } else if (hservice_runtime->process_occ_reset) {
                                 pr_debug("PM: calling 
process_occ_reset(%ld)", chip);
                                 call_process_occ_reset(chip);
                                 rc = 0;
-
-                } else {
- pr_log_nocall("reset_pm_complex/process_occ_reset");
-                                rc = -1;
                 }
 
                 return rc;
-- 
2.9.3





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/skiboot/attachments/20170922/0bff5c16/attachment.html>


More information about the Skiboot mailing list