[Skiboot] [PATCH] prd: Fix FSP - HBRT firmware_notify message

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Wed Nov 6 16:45:35 AEDT 2019


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 at us.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 hw/prd.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

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)
-- 
2.21.0



More information about the Skiboot mailing list