diff mbox series

prd: Fix FSP - HBRT firmware_notify message

Message ID 20191106054535.24442-1-hegdevasant@linux.vnet.ibm.com
State Accepted
Headers show
Series prd: Fix FSP - HBRT firmware_notify message | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (d75e82dbfbb9443efeb3f9a5921ac23605aab469)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Vasant Hegde Nov. 6, 2019, 5:45 a.m. UTC
Commit eb86b148 added FSP -> HBRT notify message support. I assumed that
we just need to construct `firmware notify` PRD message and pass it to
HBRT. But HBRT expects OPAL to pass `struct prd_fw_msg` message with
message type PRD_FW_MSG_TYPE_HBRT_FSP.

Fixes: eb86b148 (prd: Implement generic FSP - HBRT interface)
Cc: Daniel M. Crowell <dcrowell@us.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 hw/prd.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Oliver O'Halloran Nov. 8, 2019, 5:10 a.m. UTC | #1
On Wed, Nov 6, 2019 at 4:45 PM Vasant Hegde
<hegdevasant@linux.vnet.ibm.com> wrote:
>
> Commit eb86b148 added FSP -> HBRT notify message support. I assumed that
> we just need to construct `firmware notify` PRD message and pass it to
> HBRT. But HBRT expects OPAL to pass `struct prd_fw_msg` message with
> message type PRD_FW_MSG_TYPE_HBRT_FSP.
>
> Fixes: eb86b148 (prd: Implement generic FSP - HBRT interface)
> Cc: Daniel M. Crowell <dcrowell@us.ibm.com>
> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>

Merged as 7af08f2f094b55e9ec901429146b65f998df1838

Is there anything in op-test to exercise the FSP<->HBRT messaging?
diff mbox series

Patch

diff --git a/hw/prd.c b/hw/prd.c
index 9c4cb1f45..69cfbf9d5 100644
--- a/hw/prd.c
+++ b/hw/prd.c
@@ -370,7 +370,8 @@  void prd_fw_resp_fsp_response(int status)
 
 int prd_hbrt_fsp_msg_notify(void *data, u32 dsize)
 {
-	int size;
+	struct prd_fw_msg *fw_notify;
+	int size, fw_notify_size;
 	int rc = FSP_STATUS_GENERIC_FAILURE;
 
 	if (!prd_enabled || !prd_active) {
@@ -380,8 +381,9 @@  int prd_hbrt_fsp_msg_notify(void *data, u32 dsize)
 	}
 
 	/* Calculate prd message size */
+	fw_notify_size = PRD_FW_MSG_BASE_SIZE + dsize;
 	size =  sizeof(prd_msg->hdr) + sizeof(prd_msg->token) +
-		sizeof(prd_msg->fw_notify) + dsize;
+		sizeof(prd_msg->fw_notify) + fw_notify_size;
 
 	if (size > OPAL_PRD_MSG_SIZE_MAX) {
 		prlog(PR_DEBUG, "PRD: FSP - HBRT notify message size (0x%x)"
@@ -408,8 +410,10 @@  int prd_hbrt_fsp_msg_notify(void *data, u32 dsize)
 	prd_msg_fsp_notify->hdr.type = OPAL_PRD_MSG_TYPE_FIRMWARE_NOTIFY;
 	prd_msg_fsp_notify->hdr.size = cpu_to_be16(size);
 	prd_msg_fsp_notify->token = 0;
-	prd_msg_fsp_notify->fw_notify.len = cpu_to_be64(dsize);
-	memcpy(&(prd_msg_fsp_notify->fw_notify.data), data, dsize);
+	prd_msg_fsp_notify->fw_notify.len = cpu_to_be64(fw_notify_size);
+	fw_notify = (void *)prd_msg_fsp_notify->fw_notify.data;
+	fw_notify->type = cpu_to_be64(PRD_FW_MSG_TYPE_HBRT_FSP);
+	memcpy(&(fw_notify->mbox_msg), data, dsize);
 
 	rc = opal_queue_prd_msg(prd_msg_fsp_notify);
 	if (!rc)