- Timestamp:
- Oct 26, 2009 12:42:49 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp
r23814 r24071 1 1 /* $Id$ */ 2 2 /** @file 3 * 4 * VBox storage devices: 5 * LsiLogic LSI53c1030 SCSI controller. 3 * VBox storage devices: LsiLogic LSI53c1030 SCSI controller. 6 4 */ 7 5 … … 21 19 * additional information or have any questions. 22 20 */ 21 23 22 //#define DEBUG 24 23 #define LOG_GROUP LOG_GROUP_DEV_LSILOGICSCSI … … 65 64 #define LSILOGICSCSI_PCI_SUBSYSTEM_ID (0x8000) 66 65 67 #define LSILOGIC_SAVED_STATE_MINOR_VERSION 1 66 /** The current saved state version. */ 67 #define LSILOGIC_SAVED_STATE_VERSION 2 68 /** The saved state version used by VirtualBox 3.0 and earlier. It does not 69 * include the device config part. */ 70 #define LSILOGIC_SAVED_STATE_VERSION_VBOX_30 1 68 71 69 72 /** … … 4794 4797 */ 4795 4798 u64Start = RTTimeMilliTS(); 4796 do4799 for (;;) 4797 4800 { 4798 4801 fIdle = true; … … 4808 4811 } 4809 4812 } 4810 if (RTTimeMilliTS() - u64Start >= cMillies) 4813 if ( fIdle 4814 || RTTimeMilliTS() - u64Start >= cMillies) 4811 4815 break; 4812 4816 4813 4817 /* Sleep for a bit. */ 4814 RTThreadSleep(100); 4815 } while (!fIdle);4818 RTThreadSleep(100); /** @todo wait on something which can be woken up. 100ms is too long for teleporting VMs! */ 4819 } 4816 4820 4817 4821 return fIdle; 4822 } 4823 4824 static DECLCALLBACK(int) lsilogicLiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass) 4825 { 4826 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 4827 4828 /* Save the device config. */ 4829 for (unsigned i = 0; i < RT_ELEMENTS(pThis->aDeviceStates); i++) 4830 SSMR3PutBool(pSSM, pThis->aDeviceStates[i].pDrvBase != NULL); 4831 4832 return VINF_SSM_DONT_CALL_AGAIN; 4818 4833 } 4819 4834 … … 4837 4852 4838 4853 /* Every device first. */ 4854 lsilogicSaveLoadPrep(pDevIns, pSSM); 4839 4855 for (unsigned i = 0; i < RT_ELEMENTS(pLsiLogic->aDeviceStates); i++) 4840 4856 { … … 4896 4912 static DECLCALLBACK(int) lsilogicLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 4897 4913 { 4898 PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 4899 4900 /* We support saved states only from this and older versions. */ 4901 if (uVersion > LSILOGIC_SAVED_STATE_MINOR_VERSION) 4914 PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 4915 int rc; 4916 4917 if ( uVersion != LSILOGIC_SAVED_STATE_VERSION 4918 && uVersion != LSILOGIC_SAVED_STATE_VERSION_VBOX_30) 4902 4919 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 4903 Assert(uPass == SSM_PASS_FINAL); NOREF(uPass); 4920 4921 /* device config */ 4922 if (uVersion > LSILOGIC_SAVED_STATE_VERSION_VBOX_30) 4923 { 4924 for (unsigned i = 0; i < RT_ELEMENTS(pLsiLogic->aDeviceStates); i++) 4925 { 4926 bool fPresent; 4927 rc = SSMR3GetBool(pSSM, &fPresent); 4928 AssertRCReturn(rc, rc); 4929 if (fPresent != (pLsiLogic->aDeviceStates[i].pDrvBase != NULL)) 4930 { 4931 LogRel(("LsiLogic: Target %u config mismatch: config=%RTbool state=%RTbool\n", 4932 i, pLsiLogic->aDeviceStates[i].pDrvBase != NULL, fPresent)); 4933 return VERR_SSM_LOAD_CONFIG_MISMATCH; 4934 } 4935 } 4936 } 4937 if (uPass != SSM_PASS_FINAL) 4938 return VINF_SUCCESS; 4904 4939 4905 4940 /* Every device first. */ … … 4968 5003 4969 5004 uint32_t u32; 4970 intrc = SSMR3GetU32(pSSM, &u32);5005 rc = SSMR3GetU32(pSSM, &u32); 4971 5006 if (RT_FAILURE(rc)) 4972 5007 return rc; … … 5414 5449 5415 5450 /* Register save state handlers. */ 5416 rc = PDMDevHlpSSMRegisterEx(pDevIns, LSILOGIC_SAVED_STATE_ MINOR_VERSION, sizeof(*pThis), NULL,5417 NULL, NULL, NULL,5451 rc = PDMDevHlpSSMRegisterEx(pDevIns, LSILOGIC_SAVED_STATE_VERSION, sizeof(*pThis), NULL, 5452 NULL, lsilogicLiveExec, NULL, 5418 5453 lsilogicSaveLoadPrep, lsilogicSaveExec, NULL, 5419 5454 lsilogicSaveLoadPrep, lsilogicLoadExec, NULL); … … 5489 5524 #endif /* IN_RING3 */ 5490 5525 #endif /* !VBOX_DEVICE_STRUCT_TESTCASE */ 5526
Note:
See TracChangeset
for help on using the changeset viewer.