summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Bischoff <sascha.bischoff@ARM.com>2015-10-29 08:48:24 -0400
committerSascha Bischoff <sascha.bischoff@ARM.com>2015-10-29 08:48:24 -0400
commit84b3452f67007ab46e0a59f8227b42b6ec6557f0 (patch)
tree2236d0201c2459532c2bd26ed570c53a6a6fcad1
parent8427d05daa39d45598ff846fe4cf66b132b8cb78 (diff)
downloadgem5-84b3452f67007ab46e0a59f8227b42b6ec6557f0.tar.xz
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.
-rw-r--r--src/dev/arm/flash_device.cc2
-rw-r--r--src/dev/arm/ufs_device.cc4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/dev/arm/flash_device.cc b/src/dev/arm/flash_device.cc
index b651a1eeb..8e337cd86 100644
--- a/src/dev/arm/flash_device.cc
+++ b/src/dev/arm/flash_device.cc
@@ -605,7 +605,7 @@ FlashDevice::drain()
void
FlashDevice::checkDrain()
{
- if (drainState() == DrainState::Draining)
+ if (drainState() != DrainState::Draining)
return;
if (planeEvent.when() > curTick()) {
diff --git a/src/dev/arm/ufs_device.cc b/src/dev/arm/ufs_device.cc
index 61b125ef5..fbc3bd394 100644
--- a/src/dev/arm/ufs_device.cc
+++ b/src/dev/arm/ufs_device.cc
@@ -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();
}