Changeset 24772 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Nov 18, 2009 7:10:17 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 54982
- Location:
- trunk/src/VBox/Devices/Storage
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/ATAController.cpp
r24265 r24772 3862 3862 if ( pCtl->fSignalIdle 3863 3863 && ataAsyncIOIsIdle(pCtl, false /*fStrict*/)) 3864 { 3865 PDMDevHlpAsyncNotificationCompleted(pCtl->pDevInsR3); 3864 3866 RTThreadUserSignal(pCtl->AsyncIOThread); 3867 } 3865 3868 3866 3869 rc = RTSemMutexRelease(pCtl->AsyncIORequestMutex); AssertRC(rc); … … 4333 4336 4334 4337 /* Signal the ultimate idleness. */ 4338 if (pCtl->fSignalIdle) 4339 PDMDevHlpAsyncNotificationCompleted(pCtl->pDevInsR3); 4335 4340 RTThreadUserSignal(ThreadSelf); 4336 4341 … … 5172 5177 #endif 5173 5178 5174 /**5175 * Suspend notification.5176 *5177 * @returns VBox status.5178 * @param pDevIns The device instance data.5179 */5180 void ataControllerSuspend(PAHCIATACONTROLLER pCtl)5181 {5182 Log(("%s:\n", __FUNCTION__));5183 if (!ataWaitForAllAsyncIOIsIdle(pCtl, 20000))5184 AssertMsgFailed(("Async I/O didn't stop in 20 seconds!\n"));5185 return;5186 }5187 5188 5179 5189 5180 /** … … 5209 5200 5210 5201 /** 5211 * Power Off notification.5202 * Tests if the controller is idle, leaving the PDM notifications on if busy. 5212 5203 * 5213 * @returns VBox status.5214 * @param pCtl The controller instance.5204 * @returns true if idle, false if idle. 5205 * @param pCtl the controller instance. 5215 5206 */ 5216 void ataControllerPowerOff(PAHCIATACONTROLLER pCtl) 5217 { 5218 Log(("%s:\n", __FUNCTION__)); 5219 if (!ataWaitForAllAsyncIOIsIdle(pCtl, 20000)) 5220 AssertMsgFailed(("Async I/O didn't stop in 20 seconds!\n")); 5221 return; 5222 } 5223 5224 /** 5225 * Prepare state save and load operation. 5226 * 5227 * @returns VBox status code. 5228 * @param pDevIns Device instance of the device which registered the data unit. 5229 * @param pSSM SSM operation handle. 5230 */ 5231 static int ataSaveLoadPrep(PAHCIATACONTROLLER pCtl) 5232 { 5233 /* sanity - the suspend notification will wait on the async stuff. */ 5234 Assert(ataAsyncIOIsIdle(pCtl, false)); 5235 if (!ataAsyncIOIsIdle(pCtl, false)) 5236 return VERR_SSM_IDE_ASYNC_TIMEOUT; 5237 5238 return VINF_SUCCESS; 5239 } 5240 5241 /** 5242 * Prepare state save operation. 5243 * 5244 * @returns VBox status code. 5245 * @param pCtl The controller instance. 5246 * @param pSSM SSM operation handle. 5247 */ 5248 DECLCALLBACK(int) ataControllerSavePrep(PAHCIATACONTROLLER pCtl, PSSMHANDLE pSSM) 5249 { 5250 return ataSaveLoadPrep(pCtl); 5251 } 5252 5253 /** 5254 * Prepare state load operation. 5255 * 5256 * @returns VBox status code. 5257 * @param pCtl The controller instance. 5258 * @param pSSM SSM operation handle. 5259 */ 5260 DECLCALLBACK(int) ataControllerLoadPrep(PAHCIATACONTROLLER pCtl, PSSMHANDLE pSSM) 5261 { 5262 return ataSaveLoadPrep(pCtl); 5207 bool ataControllerIsIdle(PAHCIATACONTROLLER pCtl) 5208 { 5209 ASMAtomicWriteBool(&pCtl->fSignalIdle, true); 5210 if (ataAsyncIOIsIdle(pCtl, false /*fStrict*/)) 5211 { 5212 ASMAtomicWriteBool(&pCtl->fSignalIdle, false); 5213 return true; 5214 } 5215 return false; 5263 5216 } 5264 5217 -
trunk/src/VBox/Devices/Storage/ATAController.h
r24096 r24772 366 366 /** The position at which to get a new request for the AIO thread. */ 367 367 uint8_t AsyncIOReqTail; 368 /** Whether to call RTThreadUserSignal when idle.369 * Before setting this, call RTThreadUserReset. */368 /** Whether to call RTThreadUserSignal and PDMDevHlpAsyncNotificationCompleted 369 * when idle. Before setting this, call RTThreadUserReset. */ 370 370 bool volatile fSignalIdle; 371 371 uint8_t Alignment3[1]; /**< Explicit padding of the 1 byte gap. */ … … 435 435 436 436 /** 437 * Power off a controller.438 * 439 * @returns nothing.437 * Tests if the controller is idle, leaving the PDM notifications on if busy. 438 * 439 * @returns true if idle, false if idle. 440 440 * @param pCtl the controller instance. 441 441 */ 442 void ataControllerPowerOff(PAHCIATACONTROLLER pCtl);442 bool ataControllerIsIdle(PAHCIATACONTROLLER pCtl); 443 443 444 444 /** … … 449 449 */ 450 450 void ataControllerReset(PAHCIATACONTROLLER pCtl); 451 452 /**453 * Suspend operation of an controller.454 *455 * @returns nothing456 * @param pCtl The controller instance.457 */458 void ataControllerSuspend(PAHCIATACONTROLLER pCtl);459 451 460 452 /** … … 486 478 487 479 /** 488 * Prepare state saveoperation.480 * Excute state load operation. 489 481 * 490 482 * @returns VBox status code. … … 492 484 * @param pSSM SSM operation handle. 493 485 */ 494 int ataControllerSavePrep(PAHCIATACONTROLLER pCtl, PSSMHANDLE pSSM);495 496 /**497 * Excute state load operation.498 *499 * @returns VBox status code.500 * @param pCtl The controller instance.501 * @param pSSM SSM operation handle.502 */503 486 int ataControllerLoadExec(PAHCIATACONTROLLER pCtl, PSSMHANDLE pSSM); 504 505 /**506 * Prepare state load operation.507 *508 * @returns VBox status code.509 * @param pCtl The controller instance.510 * @param pSSM SSM operation handle.511 */512 int ataControllerLoadPrep(PAHCIATACONTROLLER pCtl, PSSMHANDLE pSSM);513 487 514 488 #endif /* IN_RING3 */ -
trunk/src/VBox/Devices/Storage/DevAHCI.cpp
r24760 r24772 5703 5703 5704 5704 /** 5705 * Checks if all asynchronous I/O is finished .5705 * Checks if all asynchronous I/O is finished, both AHCI and IDE. 5706 5706 * 5707 5707 * Used by ahciR3Reset, ahciR3Suspend and ahciR3PowerOff. ahciR3SavePrep makes … … 5729 5729 } 5730 5730 } 5731 5732 for (uint32_t i = 0; i < RT_ELEMENTS(pThis->aCts); i++) 5733 if (!ataControllerIsIdle(&pThis->aCts[i])) 5734 return false; 5735 5731 5736 return true; 5732 5737 } … … 5739 5744 static DECLCALLBACK(int) ahciR3SavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 5740 5745 { 5741 PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI);5742 5743 5746 Assert(ahciR3AllAsyncIOIsFinished(pDevIns)); 5744 5745 for (uint32_t i = 0; i < RT_ELEMENTS(pAhci->aCts); i++)5746 {5747 int rc;5748 5749 rc = ataControllerSavePrep(&pAhci->aCts[i], pSSM);5750 if (RT_FAILURE(rc))5751 return rc;5752 }5753 5754 5747 return VINF_SUCCESS; 5755 5748 } … … 5760 5753 static DECLCALLBACK(int) ahciR3LoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 5761 5754 { 5762 PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); 5763 5764 for (uint32_t i = 0; i < RT_ELEMENTS(pAhci->aCts); i++) 5765 { 5766 int rc; 5767 5768 rc = ataControllerLoadPrep(&pAhci->aCts[i], pSSM); 5769 if (RT_FAILURE(rc)) 5770 return rc; 5771 } 5772 5755 Assert(ahciR3AllAsyncIOIsFinished(pDevIns)); 5773 5756 return VINF_SUCCESS; 5774 5757 } … … 6268 6251 * Suspend notification. 6269 6252 * 6270 * @returns VBox status.6271 6253 * @param pDevIns The device instance data. 6272 6254 */ 6273 6255 static DECLCALLBACK(void) ahciR3Suspend(PPDMDEVINS pDevIns) 6274 6256 { 6275 PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); 6276 Log(("%s:\n", __FUNCTION__)); 6277 6257 Log(("ahciR3Suspend\n")); 6278 6258 ahciR3SuspendOrPowerOff(pDevIns); 6279 6280 for (uint32_t i = 0; i < RT_ELEMENTS(pAhci->aCts); i++)6281 ataControllerSuspend(&pAhci->aCts[i]);6282 6259 } 6283 6260 … … 6475 6452 * Poweroff notification. 6476 6453 * 6477 * @returns nothing6478 6454 * @param pDevIns Pointer to the device instance 6479 6455 */ 6480 6456 static DECLCALLBACK(void) ahciR3PowerOff(PPDMDEVINS pDevIns) 6481 6457 { 6482 PAHCI pAhci = PDMINS_2_DATA(pDevIns, PAHCI); 6483 6458 Log(("achiR3PowerOff\n")); 6484 6459 ahciR3SuspendOrPowerOff(pDevIns); 6485 6486 for (uint32_t i = 0; i < RT_ELEMENTS(pAhci->aCts); i++)6487 ataControllerPowerOff(&pAhci->aCts[i]);6488 6460 } 6489 6461
Note:
See TracChangeset
for help on using the changeset viewer.