flash_device.cc (10910:32f3d1c454ec) | flash_device.cc (10913:38dbdeea7f1f) |
---|---|
1/* 2 * Copyright (c) 2013-2015 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 --- 72 unchanged lines hidden (view full) --- 81 writeLatency(p->write_lat), 82 eraseLatency(p->erase_lat), 83 dataDistribution(p->data_distribution), 84 numPlanes(p->num_planes), 85 pagesPerBlock(0), 86 pagesPerDisk(0), 87 blocksPerDisk(0), 88 planeMask(numPlanes - 1), | 1/* 2 * Copyright (c) 2013-2015 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 --- 72 unchanged lines hidden (view full) --- 81 writeLatency(p->write_lat), 82 eraseLatency(p->erase_lat), 83 dataDistribution(p->data_distribution), 84 numPlanes(p->num_planes), 85 pagesPerBlock(0), 86 pagesPerDisk(0), 87 blocksPerDisk(0), 88 planeMask(numPlanes - 1), |
89 drainManager(NULL), | |
90 planeEventQueue(numPlanes), 91 planeEvent(this) 92{ 93 94 /* 95 * Let 'a' be a power of two of n bits, written such that a-n is the msb 96 * and a-0 is the lsb. Since it is a power of two, only one bit (a-x, 97 * with 0 <= x <= n) is set. If we subtract one from this number the bits --- 484 unchanged lines hidden (view full) --- 582 UNSERIALIZE_SCALAR(blockEmptyEntries[count]); 583 584}; 585 586/** 587 * Drain; needed to enable checkpoints 588 */ 589 | 89 planeEventQueue(numPlanes), 90 planeEvent(this) 91{ 92 93 /* 94 * Let 'a' be a power of two of n bits, written such that a-n is the msb 95 * and a-0 is the lsb. Since it is a power of two, only one bit (a-x, 96 * with 0 <= x <= n) is set. If we subtract one from this number the bits --- 484 unchanged lines hidden (view full) --- 581 UNSERIALIZE_SCALAR(blockEmptyEntries[count]); 582 583}; 584 585/** 586 * Drain; needed to enable checkpoints 587 */ 588 |
590unsigned int 591FlashDevice::drain(DrainManager *dm) | 589DrainState 590FlashDevice::drain() |
592{ | 591{ |
593 unsigned int count = 0; 594 | |
595 if (planeEvent.scheduled()) { | 592 if (planeEvent.scheduled()) { |
596 count = 1; 597 drainManager = dm; | 593 DPRINTF(Drain, "Flash device is draining...\n"); 594 return DrainState::Draining; |
598 } else { 599 DPRINTF(Drain, "Flash device in drained state\n"); | 595 } else { 596 DPRINTF(Drain, "Flash device in drained state\n"); |
597 return DrainState::Drained; |
|
600 } | 598 } |
601 602 if (count) { 603 DPRINTF(Drain, "Flash device is draining...\n"); 604 setDrainState(DrainState::Draining); 605 } else { 606 DPRINTF(Drain, "Flash device drained\n"); 607 setDrainState(DrainState::Drained); 608 } 609 return count; | |
610} 611 612/** 613 * Checkdrain; needed to enable checkpoints 614 */ 615 616void 617FlashDevice::checkDrain() 618{ | 599} 600 601/** 602 * Checkdrain; needed to enable checkpoints 603 */ 604 605void 606FlashDevice::checkDrain() 607{ |
619 if (drainManager == NULL) { | 608 if (drainState() == DrainState::Draining) |
620 return; | 609 return; |
621 } | |
622 623 if (planeEvent.when() > curTick()) { 624 DPRINTF(Drain, "Flash device is still draining\n"); 625 } else { 626 DPRINTF(Drain, "Flash device is done draining\n"); | 610 611 if (planeEvent.when() > curTick()) { 612 DPRINTF(Drain, "Flash device is still draining\n"); 613 } else { 614 DPRINTF(Drain, "Flash device is done draining\n"); |
627 drainManager->signalDrainDone(); 628 drainManager = NULL; | 615 signalDrainDone(); |
629 } 630} | 616 } 617} |