Changeset 24099 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Oct 26, 2009 11:29:43 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 53984
- Location:
- trunk/src/VBox/Devices/Storage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevBusLogic.cpp
r24070 r24099 2261 2261 } 2262 2262 2263 static bool buslogicWaitForAsyncIOFinished(PBUSLOGIC pBusLogic, unsigned cMillies)2264 {2265 uint64_t u64Start;2266 bool fIdle;2267 2268 /*2269 * Wait for any pending async operation to finish2270 */2271 u64Start = RTTimeMilliTS();2272 for (;;)2273 {2274 fIdle = true;2275 2276 /* Check every port. */2277 for (unsigned i = 0; i < RT_ELEMENTS(pBusLogic->aDeviceStates); i++)2278 {2279 PBUSLOGICDEVICE pBusLogicDevice = &pBusLogic->aDeviceStates[i];2280 if (ASMAtomicReadU32(&pBusLogicDevice->cOutstandingRequests))2281 {2282 fIdle = false;2283 break;2284 }2285 }2286 if ( fIdle2287 || RTTimeMilliTS() - u64Start >= cMillies)2288 break;2289 2290 /* Sleep for a bit. */2291 RTThreadSleep(100); /** @todo wait on something which can be woken up. 100ms is too long for teleporting VMs! */2292 }2293 2294 return fIdle;2295 }2296 2297 2263 static DECLCALLBACK(int) buslogicLiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass) 2298 2264 { … … 2304 2270 2305 2271 return VINF_SSM_DONT_CALL_AGAIN; 2306 }2307 2308 static DECLCALLBACK(int) buslogicSaveLoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)2309 {2310 PBUSLOGIC pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC);2311 2312 /* Wait that no task is pending on any device. */2313 if (!buslogicWaitForAsyncIOFinished(pBusLogic, 20000))2314 {2315 AssertLogRelMsgFailed(("BusLogic: There are still tasks outstanding\n"));2316 return VERR_TIMEOUT;2317 }2318 2319 return VINF_SUCCESS;2320 2272 } 2321 2273 … … 2625 2577 } 2626 2578 2627 static DECLCALLBACK(void) buslogicSuspend(PPDMDEVINS pDevIns)2628 {2629 PBUSLOGIC pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC);2630 2631 /* Wait that no task is pending on any device. */2632 if (!buslogicWaitForAsyncIOFinished(pBusLogic, 20000))2633 AssertLogRelMsgFailed(("BusLogic: There are still tasks outstanding\n"));2634 }2635 2636 2579 static DECLCALLBACK(void) buslogicRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) 2637 2580 { … … 2835 2778 } 2836 2779 2837 rc = PDMDevHlpSSMRegisterEx(pDevIns, BUSLOGIC_SAVED_STATE_MINOR_VERSION, sizeof(*pThis), NULL, 2838 NULL, buslogicLiveExec, NULL, 2839 buslogicSaveLoadPrep, buslogicSaveExec, NULL, 2840 buslogicSaveLoadPrep, buslogicLoadExec, NULL); 2780 rc = PDMDevHlpSSMRegister3(pDevIns, BUSLOGIC_SAVED_STATE_MINOR_VERSION, sizeof(*pThis), 2781 buslogicLiveExec, buslogicSaveExec, buslogicLoadExec); 2841 2782 if (RT_FAILURE(rc)) 2842 2783 return PDMDEV_SET_ERROR(pDevIns, rc, N_("BusLogic cannot register save state handlers")); … … 2864 2805 "BusLogic BT-958 SCSI host adapter.\n", 2865 2806 /* fFlags */ 2866 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0 2867 | PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION 2868 | PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION, 2807 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0, 2869 2808 /* fClass */ 2870 2809 PDM_DEVREG_CLASS_STORAGE, … … 2886 2825 buslogicReset, 2887 2826 /* pfnSuspend */ 2888 buslogicSuspend,2827 NULL, 2889 2828 /* pfnResume */ 2890 2829 NULL, -
trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp
r24098 r24099 5172 5172 * in the I/O controllers and reduce the time it takes to suspend a VM a 5173 5173 * wee bit... 5174 * 5175 * DrvSCSI should implement the reset notification, then we could retire this 5176 * fun lsilogicWaitForAsyncIOFinished code. (The drivers are reset before the 5177 * device.) The deadlock trap is still there though. 5174 5178 */ 5175 5179 bool fIdle = lsilogicWaitForAsyncIOFinished(pLsiLogic, 20000); … … 5451 5455 "LSI Logic 53c1030 SCSI controller.\n", 5452 5456 /* fFlags */ 5453 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0 5454 | PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION 5455 | PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION, 5457 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0, 5456 5458 /* fClass */ 5457 5459 PDM_DEVREG_CLASS_STORAGE,
Note:
See TracChangeset
for help on using the changeset viewer.