Changeset 29609 in vbox for trunk/src/VBox
- Timestamp:
- May 18, 2010 10:08:16 AM (15 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp
r29588 r29609 273 273 /** Status LUN: Partner of ILeds. */ 274 274 R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector; 275 275 /** Pointer to the configuration page area. */ 276 276 R3PTRTYPE(PMptConfigurationPagesSupported) pConfigurationPages; 277 /** Indicates that PDMDevHlpAsyncNotificationCompleted should be called when 278 * a port is entering the idle state. */ 279 bool volatile fSignalIdle; 280 277 281 } LSILOGISCSI, *PLSILOGICSCSI; 278 282 … … 2032 2036 RTMemCacheFree(pLsiLogic->hTaskCache, pTaskState); 2033 2037 2038 if (pLsiLogicDevice->cOutstandingRequests == 0 && pLsiLogic->fSignalIdle) 2039 PDMDevHlpAsyncNotificationCompleted(pLsiLogic->pDevInsR3); 2040 2034 2041 return VINF_SUCCESS; 2035 2042 } … … 4344 4351 } 4345 4352 4353 /* -=-=-=-=- Helper -=-=-=-=- */ 4354 4355 /** 4356 * Checks if all asynchronous I/O is finished. 4357 * 4358 * Used by lsilogicReset, lsilogicSuspend and lsilogicPowerOff. 4359 * 4360 * @returns true if quiesced, false if busy. 4361 * @param pDevIns The device instance. 4362 */ 4363 static bool lsilogicR3AllAsyncIOIsFinished(PPDMDEVINS pDevIns) 4364 { 4365 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 4366 4367 for (uint32_t i = 0; i < pThis->cDeviceStates; i++) 4368 { 4369 PLSILOGICDEVICE pThisDevice = &pThis->paDeviceStates[i]; 4370 if (pThisDevice->pDrvBase) 4371 { 4372 if (pThisDevice->cOutstandingRequests != 0) 4373 return false; 4374 } 4375 } 4376 4377 return true; 4378 } 4379 4380 /** 4381 * Callback employed by lsilogicR3Suspend and lsilogicR3PowerOff.. 4382 * 4383 * @returns true if we've quiesced, false if we're still working. 4384 * @param pDevIns The device instance. 4385 */ 4386 static DECLCALLBACK(bool) lsilogicR3IsAsyncSuspendOrPowerOffDone(PPDMDEVINS pDevIns) 4387 { 4388 if (!lsilogicR3AllAsyncIOIsFinished(pDevIns)) 4389 return false; 4390 4391 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 4392 ASMAtomicWriteBool(&pThis->fSignalIdle, false); 4393 return true; 4394 } 4395 4396 /** 4397 * Common worker for ahciR3Suspend and ahciR3PowerOff. 4398 */ 4399 static void lsilogicR3SuspendOrPowerOff(PPDMDEVINS pDevIns) 4400 { 4401 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 4402 4403 ASMAtomicWriteBool(&pThis->fSignalIdle, true); 4404 if (!lsilogicR3AllAsyncIOIsFinished(pDevIns)) 4405 PDMDevHlpSetAsyncNotification(pDevIns, lsilogicR3IsAsyncSuspendOrPowerOffDone); 4406 else 4407 ASMAtomicWriteBool(&pThis->fSignalIdle, false); 4408 } 4409 4410 /** 4411 * Suspend notification. 4412 * 4413 * @param pDevIns The device instance data. 4414 */ 4415 static DECLCALLBACK(void) lsilogicSuspend(PPDMDEVINS pDevIns) 4416 { 4417 Log(("lsilogicSuspend\n")); 4418 lsilogicR3SuspendOrPowerOff(pDevIns); 4419 } 4420 4346 4421 /** 4347 4422 * Detach notification. … … 4425 4500 4426 4501 /** 4427 * @copydoc FNPDMDEVRESET 4428 */ 4429 static DECLCALLBACK(void) lsilogicReset(PPDMDEVINS pDevIns) 4502 * Common reset worker. 4503 * 4504 * @param pDevIns The device instance data. 4505 */ 4506 static void lsilogicR3ResetCommon(PPDMDEVINS pDevIns) 4430 4507 { 4431 4508 PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); … … 4436 4513 4437 4514 vboxscsiInitialize(&pLsiLogic->VBoxSCSI); 4515 } 4516 4517 /** 4518 * Callback employed by lsilogicR3Reset. 4519 * 4520 * @returns true if we've quiesced, false if we're still working. 4521 * @param pDevIns The device instance. 4522 */ 4523 static DECLCALLBACK(bool) lsilogicR3IsAsyncResetDone(PPDMDEVINS pDevIns) 4524 { 4525 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 4526 4527 if (!lsilogicR3AllAsyncIOIsFinished(pDevIns)) 4528 return false; 4529 ASMAtomicWriteBool(&pThis->fSignalIdle, false); 4530 4531 lsilogicR3ResetCommon(pDevIns); 4532 return true; 4533 } 4534 4535 /** 4536 * @copydoc FNPDMDEVRESET 4537 */ 4538 static DECLCALLBACK(void) lsilogicReset(PPDMDEVINS pDevIns) 4539 { 4540 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 4541 4542 ASMAtomicWriteBool(&pThis->fSignalIdle, true); 4543 if (!lsilogicR3AllAsyncIOIsFinished(pDevIns)) 4544 PDMDevHlpSetAsyncNotification(pDevIns, lsilogicR3IsAsyncResetDone); 4545 else 4546 { 4547 ASMAtomicWriteBool(&pThis->fSignalIdle, false); 4548 lsilogicR3ResetCommon(pDevIns); 4549 } 4438 4550 } 4439 4551 … … 4476 4588 4477 4589 return rc; 4590 } 4591 4592 /** 4593 * Poweroff notification. 4594 * 4595 * @param pDevIns Pointer to the device instance 4596 */ 4597 static DECLCALLBACK(void) lsilogicPowerOff(PPDMDEVINS pDevIns) 4598 { 4599 Log(("lsilogicPowerOff\n")); 4600 lsilogicR3SuspendOrPowerOff(pDevIns); 4478 4601 } 4479 4602 … … 4774 4897 "LSI Logic 53c1030 SCSI controller.\n", 4775 4898 /* fFlags */ 4776 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0, 4899 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0 | 4900 PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION | PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION, 4777 4901 /* fClass */ 4778 4902 PDM_DEVREG_CLASS_STORAGE, … … 4794 4918 lsilogicReset, 4795 4919 /* pfnSuspend */ 4796 NULL,4920 lsilogicSuspend, 4797 4921 /* pfnResume */ 4798 4922 NULL, … … 4806 4930 NULL, 4807 4931 /* pfnPowerOff */ 4808 NULL,4932 lsilogicPowerOff, 4809 4933 /* pfnSoftReset */ 4810 4934 NULL, … … 4829 4953 "LSI Logic SAS1068 controller.\n", 4830 4954 /* fFlags */ 4831 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0, 4955 PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0 | 4956 PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION | PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION, 4832 4957 /* fClass */ 4833 4958 PDM_DEVREG_CLASS_STORAGE, … … 4849 4974 lsilogicReset, 4850 4975 /* pfnSuspend */ 4851 NULL,4976 lsilogicSuspend, 4852 4977 /* pfnResume */ 4853 4978 NULL, … … 4861 4986 NULL, 4862 4987 /* pfnPowerOff */ 4863 NULL,4988 lsilogicPowerOff, 4864 4989 /* pfnSoftReset */ 4865 4990 NULL, -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
r29435 r29609 1525 1525 GEN_CHECK_OFF(LSILOGICSCSI, pLedsConnector); 1526 1526 GEN_CHECK_OFF(LSILOGICSCSI, pConfigurationPages); 1527 GEN_CHECK_OFF(LSILOGICSCSI, fSignalIdle); 1527 1528 #endif /* VBOX_WITH_LSILOGIC */ 1528 1529
Note:
See TracChangeset
for help on using the changeset viewer.