[2/2] opal-prd: Handle SBE passthrough message passing

Message ID 20170419043337.14669-2-hegdevasant@linux.vnet.ibm.com
State New
Headers show

Commit Message

Vasant Hegde April 19, 2017, 4:33 a.m.
This patch adds support to send SBE pass through command to HBRT.

HBRT interface details provided by Daniel M. Crowell (<dcrowell@us.ibm.com>).

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 external/opal-prd/hostboot-interface.h | 15 ++++++++++++++-
 external/opal-prd/opal-prd.c           | 23 +++++++++++++++++++++++
 external/opal-prd/thunk.S              |  1 +
 3 files changed, 38 insertions(+), 1 deletion(-)

Patch

diff --git a/external/opal-prd/hostboot-interface.h b/external/opal-prd/hostboot-interface.h
index 3e73ef8..3f32c09 100644
--- a/external/opal-prd/hostboot-interface.h
+++ b/external/opal-prd/hostboot-interface.h
@@ -491,6 +491,19 @@  struct runtime_interfaces {
 	 */
 	int (*run_command)(int argc, const char **argv, char **o_outString);
 
+	/**
+	 * @brief       SBE message passing
+	 * @details     This is a blocking call that will pass an SBE message
+	 *              with a pass-through command through HBRT to code that
+	 *              will process the command and provide a response.
+	 *
+	 * @param[in]   i_procChipId Chip ID of the processor whose SBE is passing
+	 *              the message and sent the interrupt
+	 * @returns     0 on success, or return code if the command failed
+	 * @platform    FSP, OpenPOWER
+	 */
+	int (*sbe_message_passing)(uint32_t i_procChipId);
+
 	/* Reserve some space for future growth. */
-	void (*reserved[29])(void);
+	void (*reserved[28])(void);
 };
diff --git a/external/opal-prd/opal-prd.c b/external/opal-prd/opal-prd.c
index 1723924..95b9484 100644
--- a/external/opal-prd/opal-prd.c
+++ b/external/opal-prd/opal-prd.c
@@ -256,6 +256,7 @@  extern int call_mfg_htmgt_pass_thru(uint16_t i_cmdLength, uint8_t *i_cmdData,
 				uint16_t *o_rspLength, uint8_t *o_rspData);
 extern int call_apply_attr_override(uint8_t *i_data, size_t size);
 extern int call_run_command(int argc, const char **argv, char **o_outString);
+extern int call_sbe_message_passing(uint32_t i_chipId);
 
 void hservice_puts(const char *str)
 {
@@ -1207,6 +1208,25 @@  static int handle_msg_occ_reset(struct opal_prd_ctx *ctx,
 	return 0;
 }
 
+static int handle_msg_sbe_passthrough(struct opal_prd_ctx *ctx,
+				      struct opal_prd_msg *msg)
+{
+	uint32_t proc;
+
+	proc = be64toh(msg->sbe_passthrough.chip);
+
+	pr_debug("FW: firmware sent SBE pass through command for proc 0x%x\n",
+		 proc);
+
+	if (!hservice_runtime->sbe_message_passing) {
+		pr_log_nocall("sbe_message_passing");
+		return -1;
+	}
+
+	call_sbe_message_passing(proc);
+	return 0;
+}
+
 static int handle_prd_msg(struct opal_prd_ctx *ctx)
 {
 	struct opal_prd_msg msg;
@@ -1241,6 +1261,9 @@  static int handle_prd_msg(struct opal_prd_ctx *ctx)
 	case OPAL_PRD_MSG_TYPE_OCC_ERROR:
 		rc = handle_msg_occ_error(ctx, &msg);
 		break;
+	case OPAL_PRD_MSG_TYPE_SBE_PASSTHROUGH:
+		rc = handle_msg_sbe_passthrough(ctx, &msg);
+		break;
 	default:
 		pr_log(LOG_WARNING, "Invalid incoming message type 0x%x",
 				msg.hdr.type);
diff --git a/external/opal-prd/thunk.S b/external/opal-prd/thunk.S
index f355158..da22ee8 100644
--- a/external/opal-prd/thunk.S
+++ b/external/opal-prd/thunk.S
@@ -93,6 +93,7 @@  call_##name:					;\
 	CALL_THUNK(apply_attr_override, 12)
 	CALL_THUNK(mfg_htmgt_pass_thru, 13)
 	CALL_THUNK(run_command, 14)
+	CALL_THUNK(sbe_message_passing, 15)
 
 	.globl call_hbrt_init
 call_hbrt_init: