Skip to content

Commit

Permalink
prd: Fix FSP - HBRT firmware_notify message
Browse files Browse the repository at this point in the history
Commit eb86b14 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: eb86b14 (prd: Implement generic FSP - HBRT interface)
Cc: Daniel M. Crowell <dcrowell@us.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
  • Loading branch information
Vasant Hegde authored and oohal committed Nov 7, 2019
1 parent 790a604 commit 7af08f2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions hw/prd.c
Expand Up @@ -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) {
Expand All @@ -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)"
Expand All @@ -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)
Expand Down

0 comments on commit 7af08f2

Please sign in to comment.