RubyPort.cc (9208:2451e60d4555) | RubyPort.cc (9245:e215ee9db617) |
---|---|
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) { | 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 = getDrainCount(drainEvent); | 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 | 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::getDrainCount(Event *de) | 542RubyPort::getChildDrainCount(Event *de) |
543{ 544 int count = 0; | 543{ 544 int count = 0; |
545 // 546 // If the sequencer is not empty, then requests need to drain. 547 // The outstandingCount is the number of requests outstanding and thus the 548 // number of times M5's timing port will process the drain event. 549 // 550 count += outstandingCount(); | |
551 | 545 |
552 DPRINTF(Config, "outstanding count %d\n", outstandingCount()); 553 554 // To simplify the draining process, the sequencer's deadlock detection 555 // event should have been descheduled. 556 assert(isDeadlockEventScheduled() == false); 557 | |
558 if (pio_port.isConnected()) { 559 count += pio_port.drain(de); 560 DPRINTF(Config, "count after pio check %d\n", count); 561 } 562 563 for (CpuPortIter p = slave_ports.begin(); p != slave_ports.end(); ++p) { 564 count += (*p)->drain(de); 565 DPRINTF(Config, "count after slave port check %d\n", count); --- 12 unchanged lines hidden (view full) --- 578 579unsigned int 580RubyPort::drain(Event *de) 581{ 582 if (isDeadlockEventScheduled()) { 583 descheduleDeadlockEvent(); 584 } 585 | 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 |
586 int count = getDrainCount(de); | 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; |
587 | 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 |
|
588 // Set status | 587 // Set status |
589 if (count != 0) { | 588 if (need_drain) { |
590 drainEvent = de; 591 592 DPRINTF(Drain, "RubyPort not drained\n"); 593 changeState(SimObject::Draining); | 589 drainEvent = de; 590 591 DPRINTF(Drain, "RubyPort not drained\n"); 592 changeState(SimObject::Draining); |
594 return count; | 593 return child_drain_count + 1; |
595 } 596 | 594 } 595 |
596 drainEvent = NULL; |
|
597 changeState(SimObject::Drained); | 597 changeState(SimObject::Drained); |
598 return 0; | 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 --- | 599} 600 601void 602RubyPort::M5Port::hitCallback(PacketPtr pkt) 603{ 604 bool needsResponse = pkt->needsResponse(); 605 606 // --- 89 unchanged lines hidden --- |