dev: Fix draining for UFSHostDevice and FlashDevice
authorSascha Bischoff <sascha.bischoff@ARM.com>
Thu, 29 Oct 2015 12:48:24 +0000 (08:48 -0400)
committerSascha Bischoff <sascha.bischoff@ARM.com>
Thu, 29 Oct 2015 12:48:24 +0000 (08:48 -0400)
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.

src/dev/arm/flash_device.cc
src/dev/arm/ufs_device.cc

index b651a1eebedd979d3c78ad6935a43e93c10103c5..8e337cd86d478b7362a5e49afd25d8bcd17bbedf 100644 (file)
@@ -605,7 +605,7 @@ FlashDevice::drain()
 void
 FlashDevice::checkDrain()
 {
-    if (drainState() == DrainState::Draining)
+    if (drainState() != DrainState::Draining)
         return;
 
     if (planeEvent.when() > curTick()) {
index 61b125ef5186fc0dcd2eaa7f7056cbfa17635bbd..fbc3bd3944667d0524ab2f8b4d2eae78792f0294 100644 (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();
     }