From dceed210a2bd2c4031e41d78548e6fc1f37d8f6f Mon Sep 17 00:00:00 2001
From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Date: Thu, 21 Sep 2017 19:49:48 +0530
Subject: [PATCH 2/2] opal-prd: Fix opal-prd command line options
HBRT OCC reset interface depends on service processor type.
FSP -> reset_pm_complex()
BMC -> process_occ_reset()
We have both `occ` and `pm-complex` command line interfaces.
This patch adds support to dispaly appropriate message depending
on system type.
FSP -> opal-prd occ --> display error message
FSP -> opal-prd pm-complex --> Call pm_complex_reset()
BMC -> opal-prd occ --> Call process_occ_reset()
BMC -> opal-prd pm-complex --> display error message
CC: Jeremy Kerr <jk@ozlabs.org>
CC: Daniel M Crowell <dcrowell@us.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
---
external/opal-prd/opal-prd.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/external/opal-prd/opal-prd.c b/external/opal-prd/opal-prd.c
index 20ce5dac..c26cc951 100644
--- a/external/opal-prd/opal-prd.c
+++ b/external/opal-prd/opal-prd.c
@@ -1584,7 +1584,7 @@ static void handle_prd_control_occ_reset(struct control_msg *send_msg,
chip = msg->occ_reset.chip;
/* do reset */
- pr_debug("CTRL: resetting PM complex on chip %ld", chip);
+ pr_debug("CTRL: Calling OCC reset on chip %ld", chip);
pm_complex_reset(chip);
send_msg->data_len = 0;
@@ -2326,9 +2326,24 @@ static int parse_action(const char *str, enum action *action)
{
int rc;
- if (!strcmp(str, "occ") || !strcmp(str, "pm-complex")) {
+ if (!strcmp(str, "occ")) {
*action = ACTION_OCC_CONTROL;
rc = 0;
+
+ if (is_fsp_system()) {
+ pr_log(LOG_ERR, "CTRL: occ commands are not "
+ "supported on this system");
+ rc = -1;
+ }
+ } else if (!strcmp(str, "pm-complex")) {
+ *action = ACTION_OCC_CONTROL;
+ rc = 0;
+
+ if (!is_fsp_system()) {
+ pr_log(LOG_ERR, "CTRL: pm-complex commands are not "
+ "supported on this system");
+ rc = -1;
+ }
} else if (!strcmp(str, "daemon")) {
*action = ACTION_RUN_DAEMON;
rc = 0;
--
2.13.5