nvme: Stop CPU properly on shutdown

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2022-03-10 04:01:15 +09:00
parent 82ec1695ba
commit d161de0037
3 changed files with 7 additions and 0 deletions

View file

@ -69,6 +69,11 @@ void asc_cpu_start(asc_dev_t *asc)
set32(asc->cpu_base + ASC_CPU_CONTROL, ASC_CPU_CONTROL_START);
}
void asc_cpu_stop(asc_dev_t *asc)
{
clear32(asc->cpu_base + ASC_CPU_CONTROL, ASC_CPU_CONTROL_START);
}
bool asc_can_recv(asc_dev_t *asc)
{
return !(read32(asc->base + ASC_MBOX_I2A_CONTROL) & ASC_MBOX_CONTROL_EMPTY);

View file

@ -18,6 +18,7 @@ void asc_free(asc_dev_t *asc);
int asc_get_iop_node(asc_dev_t *asc);
void asc_cpu_start(asc_dev_t *asc);
void asc_cpu_stop(asc_dev_t *asc);
bool asc_can_recv(asc_dev_t *asc);
bool asc_can_send(asc_dev_t *asc);

View file

@ -442,6 +442,7 @@ void nvme_shutdown(void)
printf("nvme: timeout while waiting for CSTS.RDY to clear\n");
rtkit_sleep(nvme_rtkit);
asc_cpu_stop(nvme_asc);
pmgr_reset("ANS2");
rtkit_free(nvme_rtkit);
sart_free(nvme_sart);