summaryrefslogtreecommitdiff
path: root/src/mem/bus.cc
diff options
context:
space:
mode:
authorAndreas Sandberg <Andreas.Sandberg@arm.com>2012-11-02 11:32:01 -0500
committerAndreas Sandberg <Andreas.Sandberg@arm.com>2012-11-02 11:32:01 -0500
commitb81a977e6ab7dbfd122cb778cfe3d40ca7451198 (patch)
tree09804c27367de8cf93623ec4644bf47abf316bf9 /src/mem/bus.cc
parenteb703a4b4e167e4d45f92203a1e0849f19cdba6d (diff)
downloadgem5-b81a977e6ab7dbfd122cb778cfe3d40ca7451198.tar.xz
sim: Move the draining interface into a separate base class
This patch moves the draining interface from SimObject to a separate class that can be used by any object needing draining. However, objects not visible to the Python code (i.e., objects not deriving from SimObject) still depend on their parents informing them when to drain. This patch also gets rid of the CountedDrainEvent (which isn't really an event) and replaces it with a DrainManager.
Diffstat (limited to 'src/mem/bus.cc')
-rw-r--r--src/mem/bus.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mem/bus.cc b/src/mem/bus.cc
index a0db6e52a..ddbdcb136 100644
--- a/src/mem/bus.cc
+++ b/src/mem/bus.cc
@@ -161,7 +161,8 @@ BaseBus::calcPacketTiming(PacketPtr pkt)
template <typename PortClass>
BaseBus::Layer<PortClass>::Layer(BaseBus& _bus, const std::string& _name,
Tick _clock) :
- bus(_bus), _name(_name), state(IDLE), clock(_clock), drainEvent(NULL),
+ Drainable(),
+ bus(_bus), _name(_name), state(IDLE), clock(_clock), drainManager(NULL),
releaseEvent(this)
{
}
@@ -266,12 +267,12 @@ BaseBus::Layer<PortClass>::releaseLayer()
// busy, and in the latter case the bus may be released before
// we see a retry from the destination
retryWaiting();
- } else if (drainEvent) {
- DPRINTF(Drain, "Bus done draining, processing drain event\n");
+ } else if (drainManager) {
+ DPRINTF(Drain, "Bus done draining, signaling drain manager\n");
//If we weren't able to drain before, do it now.
- drainEvent->process();
+ drainManager->signalDrainDone();
// Clear the drain event once we're done with it.
- drainEvent = NULL;
+ drainManager = NULL;
}
}
@@ -522,14 +523,14 @@ BaseBus::deviceBlockSize() const
template <typename PortClass>
unsigned int
-BaseBus::Layer<PortClass>::drain(Event * de)
+BaseBus::Layer<PortClass>::drain(DrainManager *dm)
{
//We should check that we're not "doing" anything, and that noone is
//waiting. We might be idle but have someone waiting if the device we
//contacted for a retry didn't actually retry.
if (!retryList.empty() || state != IDLE) {
DPRINTF(Drain, "Bus not drained\n");
- drainEvent = de;
+ drainManager = dm;
return 1;
}
return 0;