1/* 2 * Copyright (c) 2012 ARM Limited 3 * All rights reserved. 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 513 unchanged lines hidden (view full) --- 522 testDrainComplete(); 523} 524 525void 526RubyPort::testDrainComplete() 527{ 528 //If we weren't able to drain before, we might be able to now. 529 if (drainEvent != NULL) { |
530 unsigned int drainCount = outstandingCount(); |
531 DPRINTF(Drain, "Drain count: %u\n", drainCount); 532 if (drainCount == 0) { 533 DPRINTF(Drain, "RubyPort done draining, processing drain event\n"); 534 drainEvent->process(); 535 // Clear the drain event once we're done with it. 536 drainEvent = NULL; 537 } 538 } 539} 540 541unsigned int |
542RubyPort::getChildDrainCount(Event *de) |
543{ 544 int count = 0; |
545 |
546 if (pio_port.isConnected()) { 547 count += pio_port.drain(de); 548 DPRINTF(Config, "count after pio check %d\n", count); 549 } 550 551 for (CpuPortIter p = slave_ports.begin(); p != slave_ports.end(); ++p) { 552 count += (*p)->drain(de); 553 DPRINTF(Config, "count after slave port check %d\n", count); --- 12 unchanged lines hidden (view full) --- 566 567unsigned int 568RubyPort::drain(Event *de) 569{ 570 if (isDeadlockEventScheduled()) { 571 descheduleDeadlockEvent(); 572 } 573 |
574 // 575 // If the RubyPort is not empty, then it needs to clear all outstanding 576 // requests before it should call drainEvent->process() 577 // 578 DPRINTF(Config, "outstanding count %d\n", outstandingCount()); 579 bool need_drain = outstandingCount() > 0; |
580 |
581 // 582 // Also, get the number of child ports that will also need to clear 583 // their buffered requests before they call drainEvent->process() 584 // 585 unsigned int child_drain_count = getChildDrainCount(de); 586 |
587 // Set status |
588 if (need_drain) { |
589 drainEvent = de; 590 591 DPRINTF(Drain, "RubyPort not drained\n"); 592 changeState(SimObject::Draining); |
593 return child_drain_count + 1; |
594 } 595 |
596 drainEvent = NULL; |
597 changeState(SimObject::Drained); |
598 return child_drain_count; |
599} 600 601void 602RubyPort::M5Port::hitCallback(PacketPtr pkt) 603{ 604 bool needsResponse = pkt->needsResponse(); 605 606 // --- 89 unchanged lines hidden --- |