dev: Fix draining for UFSHostDevice and FlashDevice

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.
This commit is contained in:
Sascha Bischoff 2015-10-29 08:48:24 -04:00
parent 8427d05daa
commit 84b3452f67
2 changed files with 5 additions and 1 deletions

View file

@ -605,7 +605,7 @@ FlashDevice::drain()
void
FlashDevice::checkDrain()
{
if (drainState() == DrainState::Draining)
if (drainState() != DrainState::Draining)
return;
if (planeEvent.when() > curTick()) {

View file

@ -1822,6 +1822,8 @@ UFSHostDevice::generateInterrupt()
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",
@ -1838,6 +1840,8 @@ UFSHostDevice::clearInterrupt()
gic->clearInt(intNum);
DPRINTF(UFSHostDevice, "Clear interrupt: 0x%8x!\n", countInt);
checkDrain();
if (!(UFSHCIMem.TRUTRLDBR)) {
idlePhaseStart = curTick();
}