VirtualBox

Changeset 24071 in vbox for trunk/src


Ignore:
Timestamp:
Oct 26, 2009 12:42:49 PM (15 years ago)
Author:
vboxsync
Message:

DevLsiLogic: Changed saved to save & verify device presence, version bumped. Not tested. Fixed bug in lsilogicWaitForAsyncIOFinished causing an unnecessary 100ms delay on a number of operations requiring a quiescent controller.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp

    r23814 r24071  
    11/* $Id$ */
    22/** @file
    3  *
    4  * VBox storage devices:
    5  * LsiLogic LSI53c1030 SCSI controller.
     3 * VBox storage devices: LsiLogic LSI53c1030 SCSI controller.
    64 */
    75
     
    2119 * additional information or have any questions.
    2220 */
     21
    2322//#define DEBUG
    2423#define LOG_GROUP LOG_GROUP_DEV_LSILOGICSCSI
     
    6564#define LSILOGICSCSI_PCI_SUBSYSTEM_ID         (0x8000)
    6665
    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
    6871
    6972/**
     
    47944797     */
    47954798    u64Start = RTTimeMilliTS();
    4796     do
     4799    for (;;)
    47974800    {
    47984801        fIdle = true;
     
    48084811            }
    48094812        }
    4810         if (RTTimeMilliTS() - u64Start >= cMillies)
     4813        if (   fIdle
     4814            || RTTimeMilliTS() - u64Start >= cMillies)
    48114815            break;
    48124816
    48134817        /* 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    }
    48164820
    48174821    return fIdle;
     4822}
     4823
     4824static 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;
    48184833}
    48194834
     
    48374852
    48384853    /* Every device first. */
     4854    lsilogicSaveLoadPrep(pDevIns, pSSM);
    48394855    for (unsigned i = 0; i < RT_ELEMENTS(pLsiLogic->aDeviceStates); i++)
    48404856    {
     
    48964912static DECLCALLBACK(int) lsilogicLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
    48974913{
    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)
    49024919        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;
    49044939
    49054940    /* Every device first. */
     
    49685003
    49695004    uint32_t u32;
    4970     int rc = SSMR3GetU32(pSSM, &u32);
     5005    rc = SSMR3GetU32(pSSM, &u32);
    49715006    if (RT_FAILURE(rc))
    49725007        return rc;
     
    54145449
    54155450    /* 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,
    54185453                                lsilogicSaveLoadPrep, lsilogicSaveExec, NULL,
    54195454                                lsilogicSaveLoadPrep, lsilogicLoadExec, NULL);
     
    54895524#endif /* IN_RING3 */
    54905525#endif /* !VBOX_DEVICE_STRUCT_TESTCASE */
     5526
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette