Index: trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp
===================================================================
--- trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp	(revision 29598)
+++ trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp	(revision 29609)
@@ -273,6 +273,10 @@
     /** Status LUN: Partner of ILeds. */
     R3PTRTYPE(PPDMILEDCONNECTORS)  pLedsConnector;
-
+    /** Pointer to the configuration page area. */
     R3PTRTYPE(PMptConfigurationPagesSupported) pConfigurationPages;
+    /** Indicates that PDMDevHlpAsyncNotificationCompleted should be called when
+     * a port is entering the idle state. */
+    bool volatile                  fSignalIdle;
+
 } LSILOGISCSI, *PLSILOGICSCSI;
 
@@ -2032,4 +2036,7 @@
     RTMemCacheFree(pLsiLogic->hTaskCache, pTaskState);
 
+    if (pLsiLogicDevice->cOutstandingRequests == 0 && pLsiLogic->fSignalIdle)
+        PDMDevHlpAsyncNotificationCompleted(pLsiLogic->pDevInsR3);
+
     return VINF_SUCCESS;
 }
@@ -4344,4 +4351,72 @@
 }
 
+/* -=-=-=-=- Helper -=-=-=-=- */
+
+/**
+ * Checks if all asynchronous I/O is finished.
+ *
+ * Used by lsilogicReset, lsilogicSuspend and lsilogicPowerOff.
+ *
+ * @returns true if quiesced, false if busy.
+ * @param   pDevIns         The device instance.
+ */
+static bool lsilogicR3AllAsyncIOIsFinished(PPDMDEVINS pDevIns)
+{
+    PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);
+
+    for (uint32_t i = 0; i < pThis->cDeviceStates; i++)
+    {
+        PLSILOGICDEVICE pThisDevice = &pThis->paDeviceStates[i];
+        if (pThisDevice->pDrvBase)
+        {
+            if (pThisDevice->cOutstandingRequests != 0)
+                return false;
+        }
+    }
+
+    return true;
+}
+
+/**
+ * Callback employed by lsilogicR3Suspend and lsilogicR3PowerOff..
+ *
+ * @returns true if we've quiesced, false if we're still working.
+ * @param   pDevIns     The device instance.
+ */
+static DECLCALLBACK(bool) lsilogicR3IsAsyncSuspendOrPowerOffDone(PPDMDEVINS pDevIns)
+{
+    if (!lsilogicR3AllAsyncIOIsFinished(pDevIns))
+        return false;
+
+    PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);
+    ASMAtomicWriteBool(&pThis->fSignalIdle, false);
+    return true;
+}
+
+/**
+ * Common worker for ahciR3Suspend and ahciR3PowerOff.
+ */
+static void lsilogicR3SuspendOrPowerOff(PPDMDEVINS pDevIns)
+{
+    PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);
+
+    ASMAtomicWriteBool(&pThis->fSignalIdle, true);
+    if (!lsilogicR3AllAsyncIOIsFinished(pDevIns))
+        PDMDevHlpSetAsyncNotification(pDevIns, lsilogicR3IsAsyncSuspendOrPowerOffDone);
+    else
+        ASMAtomicWriteBool(&pThis->fSignalIdle, false);
+}
+
+/**
+ * Suspend notification.
+ *
+ * @param   pDevIns     The device instance data.
+ */
+static DECLCALLBACK(void) lsilogicSuspend(PPDMDEVINS pDevIns)
+{
+    Log(("lsilogicSuspend\n"));
+    lsilogicR3SuspendOrPowerOff(pDevIns);
+}
+
 /**
  * Detach notification.
@@ -4425,7 +4500,9 @@
 
 /**
- * @copydoc FNPDMDEVRESET
- */
-static DECLCALLBACK(void) lsilogicReset(PPDMDEVINS pDevIns)
+ * Common reset worker.
+ *
+ * @param   pDevIns     The device instance data.
+ */
+static void lsilogicR3ResetCommon(PPDMDEVINS pDevIns)
 {
     PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);
@@ -4436,4 +4513,39 @@
 
     vboxscsiInitialize(&pLsiLogic->VBoxSCSI);
+}
+
+/**
+ * Callback employed by lsilogicR3Reset.
+ *
+ * @returns true if we've quiesced, false if we're still working.
+ * @param   pDevIns     The device instance.
+ */
+static DECLCALLBACK(bool) lsilogicR3IsAsyncResetDone(PPDMDEVINS pDevIns)
+{
+    PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);
+
+    if (!lsilogicR3AllAsyncIOIsFinished(pDevIns))
+        return false;
+    ASMAtomicWriteBool(&pThis->fSignalIdle, false);
+
+    lsilogicR3ResetCommon(pDevIns);
+    return true;
+}
+
+/**
+ * @copydoc FNPDMDEVRESET
+ */
+static DECLCALLBACK(void) lsilogicReset(PPDMDEVINS pDevIns)
+{
+    PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);
+
+    ASMAtomicWriteBool(&pThis->fSignalIdle, true);
+    if (!lsilogicR3AllAsyncIOIsFinished(pDevIns))
+        PDMDevHlpSetAsyncNotification(pDevIns, lsilogicR3IsAsyncResetDone);
+    else
+    {
+        ASMAtomicWriteBool(&pThis->fSignalIdle, false);
+        lsilogicR3ResetCommon(pDevIns);
+    }
 }
 
@@ -4476,4 +4588,15 @@
 
     return rc;
+}
+
+/**
+ * Poweroff notification.
+ *
+ * @param   pDevIns Pointer to the device instance
+ */
+static DECLCALLBACK(void) lsilogicPowerOff(PPDMDEVINS pDevIns)
+{
+    Log(("lsilogicPowerOff\n"));
+    lsilogicR3SuspendOrPowerOff(pDevIns);
 }
 
@@ -4774,5 +4897,6 @@
     "LSI Logic 53c1030 SCSI controller.\n",
     /* fFlags */
-    PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0,
+    PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0 |
+    PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION | PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION,
     /* fClass */
     PDM_DEVREG_CLASS_STORAGE,
@@ -4794,5 +4918,5 @@
     lsilogicReset,
     /* pfnSuspend */
-    NULL,
+    lsilogicSuspend,
     /* pfnResume */
     NULL,
@@ -4806,5 +4930,5 @@
     NULL,
     /* pfnPowerOff */
-    NULL,
+    lsilogicPowerOff,
     /* pfnSoftReset */
     NULL,
@@ -4829,5 +4953,6 @@
     "LSI Logic SAS1068 controller.\n",
     /* fFlags */
-    PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0,
+    PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0 |
+    PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION | PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION,
     /* fClass */
     PDM_DEVREG_CLASS_STORAGE,
@@ -4849,5 +4974,5 @@
     lsilogicReset,
     /* pfnSuspend */
-    NULL,
+    lsilogicSuspend,
     /* pfnResume */
     NULL,
@@ -4861,5 +4986,5 @@
     NULL,
     /* pfnPowerOff */
-    NULL,
+    lsilogicPowerOff,
     /* pfnSoftReset */
     NULL,
Index: trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
===================================================================
--- trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp	(revision 29598)
+++ trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp	(revision 29609)
@@ -1525,4 +1525,5 @@
     GEN_CHECK_OFF(LSILOGICSCSI, pLedsConnector);
     GEN_CHECK_OFF(LSILOGICSCSI, pConfigurationPages);
+    GEN_CHECK_OFF(LSILOGICSCSI, fSignalIdle);
 #endif /* VBOX_WITH_LSILOGIC */
 
