530c530
< unsigned int drainCount = getDrainCount(drainEvent);
---
> unsigned int drainCount = outstandingCount();
542c542
< RubyPort::getDrainCount(Event *de)
---
> RubyPort::getChildDrainCount(Event *de)
545,550d544
< //
< // If the sequencer is not empty, then requests need to drain.
< // The outstandingCount is the number of requests outstanding and thus the
< // number of times M5's timing port will process the drain event.
< //
< count += outstandingCount();
552,557d545
< DPRINTF(Config, "outstanding count %d\n", outstandingCount());
<
< // To simplify the draining process, the sequencer's deadlock detection
< // event should have been descheduled.
< assert(isDeadlockEventScheduled() == false);
<
586c574,579
< int count = getDrainCount(de);
---
> //
> // If the RubyPort is not empty, then it needs to clear all outstanding
> // requests before it should call drainEvent->process()
> //
> DPRINTF(Config, "outstanding count %d\n", outstandingCount());
> bool need_drain = outstandingCount() > 0;
587a581,586
> //
> // Also, get the number of child ports that will also need to clear
> // their buffered requests before they call drainEvent->process()
> //
> unsigned int child_drain_count = getChildDrainCount(de);
>
589c588
< if (count != 0) {
---
> if (need_drain) {
594c593
< return count;
---
> return child_drain_count + 1;
596a596
> drainEvent = NULL;
598c598
< return 0;
---
> return child_drain_count;