1/* 2 * Copyright (c) 2012, 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 --- 54 unchanged lines hidden (view full) --- 63 "Trying to drain a drained system\n"); 64 65 panic_if(_count != 0, 66 "Drain counter must be zero at the start of a drain cycle\n"); 67 68 DPRINTF(Drain, "Trying to drain %u objects.\n", drainableCount()); 69 _state = DrainState::Draining; 70 for (auto *obj : _allDrainable) |
71 _count += obj->dmDrain() == DrainState::Drained ? 0 : 1; |
72 73 if (_count == 0) { 74 DPRINTF(Drain, "Drain done.\n"); 75 _state = DrainState::Drained; 76 return true; 77 } else { 78 DPRINTF(Drain, "Need another drain cycle. %u/%u objects not ready.\n", 79 _count, drainableCount()); --- 13 unchanged lines hidden (view full) --- 93 94 panic_if(_count != 0, 95 "Resume called in the middle of a drain cycle. %u objects " 96 "left to drain.\n", _count); 97 98 DPRINTF(Drain, "Resuming %u objects.\n", drainableCount()); 99 _state = DrainState::Running; 100 for (auto *obj : _allDrainable) |
101 obj->dmDrainResume(); |
102} 103 104void 105DrainManager::preCheckpointRestore() 106{ 107 panic_if(_state != DrainState::Running, 108 "preCheckpointRestore() called on a system that isn't in the " 109 "Running state.\n"); --- 45 unchanged lines hidden (view full) --- 155 _drainManager.registerDrainable(this); 156} 157 158Drainable::~Drainable() 159{ 160 _drainManager.unregisterDrainable(this); 161} 162 |
163DrainState 164Drainable::dmDrain() 165{ 166 _drainState = DrainState::Draining; 167 _drainState = drain(); 168 assert(_drainState == DrainState::Draining || 169 _drainState == DrainState::Drained); 170 171 return _drainState; 172} 173 |
174void |
175Drainable::dmDrainResume() |
176{ |
177 panic_if(_drainState != DrainState::Drained, 178 "Trying to resume an object that hasn't been drained\n"); 179 |
180 _drainState = DrainState::Running; |
181 drainResume(); |
182} |