VirtualBox

Changeset 24067 in vbox


Ignore:
Timestamp:
Oct 26, 2009 11:15:18 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53940
Message:

DevBusLogic: Don't just restore the fPresent flag, check it! Save fPresent in the first live pass.

File:
1 edited

Legend:

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

    r22793 r24067  
    11/* $Id$ */
    22/** @file
    3  *
    4  * VBox storage devices:
    5  * BusLogic SCSI host adapter BT-958
     3 * VBox storage devices: BusLogic SCSI host adapter BT-958.
    64 */
    75
     
    23102308}
    23112309
     2310static DECLCALLBACK(int) buslogicLiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass)
     2311{
     2312    PBUSLOGIC pThis = PDMINS_2_DATA(pDevIns, PBUSLOGIC);
     2313
     2314    /* Save the device config. */
     2315    for (unsigned i = 0; i < RT_ELEMENTS(pThis->aDeviceStates); i++)
     2316        SSMR3PutBool(pSSM, pThis->aDeviceStates[i].fPresent);
     2317
     2318    return VINF_SSM_DONT_CALL_AGAIN;
     2319}
     2320
    23122321static DECLCALLBACK(int) buslogicSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    23132322{
     
    23672376static DECLCALLBACK(int) buslogicLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
    23682377{
    2369     PBUSLOGIC pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC);
     2378    PBUSLOGIC   pBusLogic = PDMINS_2_DATA(pDevIns, PBUSLOGIC);
     2379    int         rc;
    23702380
    23712381    /* We support saved states only from this and older versions. */
    23722382    if (uVersion > BUSLOGIC_SAVED_STATE_MINOR_VERSION)
    23732383        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
    2374     Assert(uPass == SSM_PASS_FINAL); NOREF(uPass);
    23752384
    23762385    /* Every device first. */
     
    23812390        AssertMsg(!pDevice->cOutstandingRequests,
    23822391                  ("There are still outstanding requests on this device\n"));
    2383         SSMR3GetBool(pSSM, &pDevice->fPresent);
    2384         SSMR3GetU32(pSSM, (uint32_t *)&pDevice->cOutstandingRequests);
    2385     }
     2392        bool fPresent;
     2393        rc = SSMR3GetBool(pSSM, &fPresent);
     2394        AssertRCReturn(rc, rc);
     2395        if (pDevice->fPresent != fPresent)
     2396        {
     2397            LogRel(("BusLogic: Target %u config mismatch: config=%RTbool state=%RTbool\n", i, pDevice->fPresent, fPresent));
     2398            return VERR_SSM_LOAD_CONFIG_MISMATCH;
     2399        }
     2400
     2401        if (uPass == SSM_PASS_FINAL)
     2402            SSMR3GetU32(pSSM, (uint32_t *)&pDevice->cOutstandingRequests);
     2403    }
     2404
     2405    if (uPass != SSM_PASS_FINAL)
     2406        return VINF_SUCCESS;
     2407
    23862408    /* Now the main device state. */
    23872409    SSMR3GetU8    (pSSM, (uint8_t *)&pBusLogic->regStatus);
     
    24322454
    24332455    uint32_t u32;
    2434     int rc = SSMR3GetU32(pSSM, &u32);
     2456    rc = SSMR3GetU32(pSSM, &u32);
    24352457    if (RT_FAILURE(rc))
    24362458        return rc;
     
    26812703     * Validate and read configuration.
    26822704     */
    2683     rc = CFGMR3AreValuesValid(pCfgHandle, "GCEnabled\0"
    2684                                           "R0Enabled\0");
    2685     if (RT_FAILURE(rc))
     2705    if (!CFGMR3AreValuesValid(pCfgHandle,
     2706                              "GCEnabled\0"
     2707                              "R0Enabled\0"))
    26862708        return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
    26872709                                N_("BusLogic configuration error: unknown option specified"));
     
    27132735    PCIDevSetClassSub         (&pThis->dev, 0x00); /* SCSI */
    27142736    PCIDevSetClassBase        (&pThis->dev, 0x01); /* Mass storage */
    2715     PCIDevSetBaseAddress      (&pThis->dev, 0, true, false, false, 0x00000000);
    2716     PCIDevSetBaseAddress      (&pThis->dev, 1, false, false, false, 0x00000000);
     2737    PCIDevSetBaseAddress      (&pThis->dev, 0, true  /*IO*/, false /*Pref*/, false /*64-bit*/, 0x00000000);
     2738    PCIDevSetBaseAddress      (&pThis->dev, 1, false /*IO*/, false /*Pref*/, false /*64-bit*/, 0x00000000);
    27172739    PCIDevSetSubSystemVendorId(&pThis->dev, 0x104b);
    27182740    PCIDevSetSubSystemId      (&pThis->dev, 0x1040);
     
    28132835
    28142836    rc = PDMDevHlpSSMRegisterEx(pDevIns, BUSLOGIC_SAVED_STATE_MINOR_VERSION, sizeof(*pThis), NULL,
    2815                                 NULL, NULL, NULL,
     2837                                NULL,                 buslogicLiveExec, NULL,
    28162838                                buslogicSaveLoadPrep, buslogicSaveExec, NULL,
    28172839                                buslogicSaveLoadPrep, buslogicLoadExec, NULL);
     
    28842906#endif /* IN_RING3 */
    28852907#endif /* !VBOX_DEVICE_STRUCT_TESTCASE */
     2908
Note: See TracChangeset for help on using the changeset viewer.

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