Changeset 29614 in vbox for trunk/src/VBox/Devices
- Timestamp:
- May 18, 2010 11:48:31 AM (15 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevBusLogic.cpp
r29250 r29614 381 381 /** Partner of ILeds. */ 382 382 R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector; 383 384 #if HC_ARCH_BITS == 64 385 uint32_t Alignment3; 386 #endif 387 388 /** Indicates that PDMDevHlpAsyncNotificationCompleted should be called when 389 * a port is entering the idle state. */ 390 bool volatile fSignalIdle; 391 383 392 } BUSLOGIC, *PBUSLOGIC; 384 393 … … 1987 1996 /* Add task to the cache. */ 1988 1997 RTMemCacheFree(pBusLogic->hTaskCache, pTaskState); 1998 1999 if (pBusLogicDevice->cOutstandingRequests == 0 && pBusLogic->fSignalIdle) 2000 PDMDevHlpAsyncNotificationCompleted(pBusLogic->pDevInsR3); 2001 1989 2002 return VINF_SUCCESS; 1990 2003 } … … 2386 2399 } 2387 2400 2401 /* -=-=-=-=- Helper -=-=-=-=- */ 2402 2403 /** 2404 * Checks if all asynchronous I/O is finished. 2405 * 2406 * Used by lsilogicReset, lsilogicSuspend and lsilogicPowerOff. 2407 * 2408 * @returns true if quiesced, false if busy. 2409 * @param pDevIns The device instance. 2410 */ 2411 static bool buslogicR3AllAsyncIOIsFinished(PPDMDEVINS pDevIns) 2412 { 2413 PBUSLOGIC pThis = PDMINS_2_DATA(pDevIns, PBUSLOGIC); 2414 2415 for (uint32_t i = 0; i < RT_ELEMENTS(pThis->aDeviceStates); i++) 2416 { 2417 PBUSLOGICDEVICE pThisDevice = &pThis->aDeviceStates[i]; 2418 if (pThisDevice->pDrvBase) 2419 { 2420 if (pThisDevice->cOutstandingRequests != 0) 2421 return false; 2422 } 2423 } 2424 2425 return true; 2426 } 2427 2428 /** 2429 * Callback employed by lsilogicR3Suspend and lsilogicR3PowerOff.. 2430 * 2431 * @returns true if we've quiesced, false if we're still working. 2432 * @param pDevIns The device instance. 2433 */ 2434 static DECLCALLBACK(bool) buslogicR3IsAsyncSuspendOrPowerOffDone(PPDMDEVINS pDevIns) 2435 { 2436 if (!buslogicR3AllAsyncIOIsFinished(pDevIns)) 2437 return false; 2438 2439 PBUSLOGIC pThis = PDMINS_2_DATA(pDevIns, PBUSLOGIC); 2440 ASMAtomicWriteBool(&pThis->fSignalIdle, false); 2441 return true; 2442 } 2443 2444 /** 2445 * Common worker for ahciR3Suspend and ahciR3PowerOff. 2446 */ 2447 static void buslogicR3SuspendOrPowerOff(PPDMDEVINS pDevIns) 2448 { 2449 PBUSLOGIC pThis = PDMINS_2_DATA(pDevIns, PBUSLOGIC); 2450 2451 ASMAtomicWriteBool(&pThis->fSignalIdle, true); 2452 if (!buslogicR3AllAsyncIOIsFinished(pDevIns)) 2453 PDMDevHlpSetAsyncNotification(pDevIns, buslogicR3IsAsyncSuspendOrPowerOffDone); 2454 else 2455 ASMAtomicWriteBool(&pThis->fSignalIdle, false); 2456 } 2457 2458 /** 2459 * Suspend notification. 2460 * 2461 * @param pDevIns The device instance data. 2462 */ 2463 static DECLCALLBACK(void) buslogicSuspend(PPDMDEVINS pDevIns) 2464 { 2465 Log(("buslogicSuspend\n")); 2466 buslogicR3SuspendOrPowerOff(pDevIns); 2467 } 2468 2388 2469 /** 2389 2470 * Detach notification. … … 2462 2543 } 2463 2544 2545 /** 2546 * Callback employed by buslogicR3Reset. 2547 * 2548 * @returns true if we've quiesced, false if we're still working. 2549 * @param pDevIns The device instance. 2550 */ 2551 static DECLCALLBACK(bool) buslogicR3IsAsyncResetDone(PPDMDEVINS pDevIns) 2552 { 2553 PBUSLOGIC pThis = PDMINS_2_DATA(pDevIns, PBUSLOGIC); 2554 2555 if (!buslogicR3AllAsyncIOIsFinished(pDevIns)) 2556 return false; 2557 ASMAtomicWriteBool(&pThis->fSignalIdle, false); 2558 2559 buslogicHwReset(pThis); 2560 return true; 2561 } 2562 2563 /** 2564 * @copydoc FNPDMDEVRESET 2565 */ 2566 static DECLCALLBACK(void) buslogicReset(PPDMDEVINS pDevIns) 2567 { 2568 PBUSLOGIC pThis = PDMINS_2_DATA(pDevIns, PBUSLOGIC); 2569 2570 ASMAtomicWriteBool(&pThis->fSignalIdle, true); 2571 if (!buslogicR3AllAsyncIOIsFinished(pDevIns)) 2572 PDMDevHlpSetAsyncNotification(pDevIns, buslogicR3IsAsyncResetDone); 2573 else 2574 { 2575 ASMAtomicWriteBool(&pThis->fSignalIdle, false); 2576 buslogicHwReset(pThis); 2577 } 2578 } 2579 2464 2580 static DECLCALLBACK(void) buslogicRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) 2465 2581 { … … 2480 2596 2481 2597 /** 2482 * Reset notification. 2483 * 2484 * @returns VBox status. 2485 * @param pDevIns The device instance data. 2486 */ 2487 static DECLCALLBACK(void) buslogicReset(PPDMDEVINS pDevIns) 2488 { 2489 PBUSLOGIC pThis = PDMINS_2_DATA(pDevIns, PBUSLOGIC); 2490 2491 buslogicHwReset(pThis); 2598 * Poweroff notification. 2599 * 2600 * @param pDevIns Pointer to the device instance 2601 */ 2602 static DECLCALLBACK(void) buslogicPowerOff(PPDMDEVINS pDevIns) 2603 { 2604 Log(("buslogicPowerOff\n")); 2605 buslogicR3SuspendOrPowerOff(pDevIns); 2492 2606 } 2493 2607 … … 2682 2796 "BusLogic BT-958 SCSI host adapter.\n", 2683 2797 /* fFlags */ 2684 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0, 2798 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0 | 2799 PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION | PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION, 2685 2800 /* fClass */ 2686 2801 PDM_DEVREG_CLASS_STORAGE, … … 2702 2817 buslogicReset, 2703 2818 /* pfnSuspend */ 2704 NULL,2819 buslogicSuspend, 2705 2820 /* pfnResume */ 2706 2821 NULL, … … 2714 2829 NULL, 2715 2830 /* pfnPowerOff */ 2716 NULL,2831 buslogicPowerOff, 2717 2832 /* pfnSoftReset */ 2718 2833 NULL, -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
r29609 r29614 1459 1459 GEN_CHECK_OFF(BUSLOGIC, ILeds); 1460 1460 GEN_CHECK_OFF(BUSLOGIC, pLedsConnector); 1461 GEN_CHECK_OFF(BUSLOGIC, fSignalIdle); 1461 1462 #endif /* VBOX_WITH_BUSLOGIC */ 1462 1463
Note:
See TracChangeset
for help on using the changeset viewer.