Change the main loop inside mailbox poll function from while(1) to a
retry counter named sdm_loop. This is to limit the maximum possible
looping of the function and prevent unexpected behaviour.
Signed-off-by: Abdul Halim, Muhammad Hadi Asyrafi <muhammad.hadi.asyrafi.abdul.halim@intel.com>
Change-Id: I63afad958fe5f656f6333b60d5a8b4c0ada3b23d
int resp_len)
{
uint32_t timeout = 40U;
+ uint32_t sdm_loop = 255U;
int rin = 0;
int rout = 0;
int resp_data = 0;
int ret_resp_len;
- while (1) {
+ while (sdm_loop != 0U) {
do {
if (mmio_read_32(MBOX_OFFSET + MBOX_DOORBELL_FROM_SDM)
} while (--timeout != 0U);
if (timeout == 0U) {
- INFO("Timed out waiting for SDM\n");
- return MBOX_TIMEOUT;
+ break;
}
mmio_write_32(MBOX_OFFSET + MBOX_DOORBELL_FROM_SDM, 0);
return ret_resp_len;
}
+
+ sdm_loop--;
}
+
+ INFO("Timed out waiting for SDM\n");
+ return MBOX_TIMEOUT;
}
int iterate_resp(int mbox_resp_len, uint32_t *resp_buf, int resp_len)