intel: mailbox: Read mailbox response even there is an error

Mailbox driver should read the response data if the response length
in the response header is non-zero even the response header indicates
error (non-zero).

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
Change-Id: I928f705f43c0f46ac74b84428b830276cc4c9640
This commit is contained in:
Chee Hong Ang 2020-05-11 00:40:18 +08:00 committed by Abdul Halim, Muhammad Hadi Asyrafi
parent 39aebd358e
commit 6d9f9f5ea0
1 changed files with 19 additions and 4 deletions

View File

@ -46,6 +46,7 @@ int mailbox_read_response(uint32_t *job_id, uint32_t *response, int resp_len)
int rin = 0;
int rout = 0;
int resp_data = 0;
int ret_resp_len;
if (mmio_read_32(MBOX_OFFSET + MBOX_DOORBELL_FROM_SDM))
mmio_write_32(MBOX_OFFSET + MBOX_DOORBELL_FROM_SDM, 0);
@ -67,13 +68,19 @@ int mailbox_read_response(uint32_t *job_id, uint32_t *response, int resp_len)
*job_id = MBOX_RESP_JOB_ID(resp_data);
ret_resp_len = MBOX_RESP_LEN(resp_data);
if (ret_resp_len != 0) {
ret_resp_len = iterate_resp(ret_resp_len, response,
resp_len);
}
if (MBOX_RESP_ERR(resp_data) > 0) {
INFO("Error in response: %x\n", resp_data);
return -resp_data;
}
return iterate_resp(MBOX_RESP_LEN(resp_data),
response, resp_len);
return ret_resp_len;
}
return MBOX_NO_RESPONSE;
}
@ -86,6 +93,7 @@ int mailbox_poll_response(uint32_t job_id, int urgent, uint32_t *response,
int rin = 0;
int rout = 0;
int resp_data = 0;
int ret_resp_len;
while (1) {
@ -130,13 +138,20 @@ int mailbox_poll_response(uint32_t job_id, int urgent, uint32_t *response,
|| MBOX_RESP_JOB_ID(resp_data) != job_id)
continue;
ret_resp_len = MBOX_RESP_LEN(resp_data);
if (ret_resp_len != 0) {
ret_resp_len = iterate_resp(ret_resp_len,
response,
resp_len);
}
if (MBOX_RESP_ERR(resp_data) > 0) {
INFO("Error in response: %x\n", resp_data);
return -MBOX_RESP_ERR(resp_data);
}
return iterate_resp(MBOX_RESP_LEN(resp_data),
response, resp_len);
return ret_resp_len;
}
}
}