This patch fixes the drain logic for the UFSHostDevice and the
FlashDevice. In the case of the FlashDevice, the logic for CheckDrain
needed to be reversed, whilst in the case of the UFSHostDevice check
drain was never being called. In both cases the system would never
complete draining if the initial attampt to drain failed.
void
FlashDevice::checkDrain()
{
- if (drainState() == DrainState::Draining)
+ if (drainState() != DrainState::Draining)
return;
if (planeEvent.when() > curTick()) {
pendingDoorbells = 0;
DPRINTF(UFSHostDevice, "Clear doorbell %X\n", UFSHCIMem.TRUTRLDBR);
+ checkDrain();
+
/**step6 raise interrupt*/
gic->sendInt(intNum);
DPRINTF(UFSHostDevice, "Send interrupt @ transaction: 0x%8x!\n",
gic->clearInt(intNum);
DPRINTF(UFSHostDevice, "Clear interrupt: 0x%8x!\n", countInt);
+ checkDrain();
+
if (!(UFSHCIMem.TRUTRLDBR)) {
idlePhaseStart = curTick();
}