VirtualBox

Changeset 81807 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 12, 2019 3:14:37 PM (5 years ago)
Author:
vboxsync
Message:

DevBusLogic.cpp: Converting it to the new PDM device style - SSM calls. bugref:9218

File:
1 edited

Legend:

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

    r81805 r81807  
    34253425{
    34263426    RT_NOREF(uPass);
    3427     PBUSLOGIC pThis = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);
     3427    PBUSLOGIC       pThis = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);
     3428    PCPDMDEVHLPR3   pHlp = pDevIns->pHlpR3;
    34283429
    34293430    /* Save the device config. */
    34303431    for (unsigned i = 0; i < RT_ELEMENTS(pThis->aDeviceStates); i++)
    3431         SSMR3PutBool(pSSM, pThis->aDeviceStates[i].fPresent);
     3432        pHlp->pfnSSMPutBool(pSSM, pThis->aDeviceStates[i].fPresent);
    34323433
    34333434    return VINF_SSM_DONT_CALL_AGAIN;
     
    34373438static DECLCALLBACK(int) buslogicR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    34383439{
    3439     PBUSLOGIC pBusLogic = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);
    3440     uint32_t cReqsSuspended = 0;
     3440    PBUSLOGIC       pBusLogic = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);
     3441    PCPDMDEVHLPR3   pHlp = pDevIns->pHlpR3;
     3442    uint32_t        cReqsSuspended = 0;
    34413443
    34423444    /* Every device first. */
     
    34473449        AssertMsg(!pDevice->cOutstandingRequests,
    34483450                  ("There are still outstanding requests on this device\n"));
    3449         SSMR3PutBool(pSSM, pDevice->fPresent);
    3450         SSMR3PutU32(pSSM, pDevice->cOutstandingRequests);
     3451        pHlp->pfnSSMPutBool(pSSM, pDevice->fPresent);
     3452        pHlp->pfnSSMPutU32(pSSM, pDevice->cOutstandingRequests);
    34513453
    34523454        if (pDevice->fPresent)
     
    34543456    }
    34553457    /* Now the main device state. */
    3456     SSMR3PutU8    (pSSM, pBusLogic->regStatus);
    3457     SSMR3PutU8    (pSSM, pBusLogic->regInterrupt);
    3458     SSMR3PutU8    (pSSM, pBusLogic->regGeometry);
    3459     SSMR3PutMem   (pSSM, &pBusLogic->LocalRam, sizeof(pBusLogic->LocalRam));
    3460     SSMR3PutU8    (pSSM, pBusLogic->uOperationCode);
    3461     SSMR3PutMem   (pSSM, &pBusLogic->aCommandBuffer, sizeof(pBusLogic->aCommandBuffer));
    3462     SSMR3PutU8    (pSSM, pBusLogic->iParameter);
    3463     SSMR3PutU8    (pSSM, pBusLogic->cbCommandParametersLeft);
    3464     SSMR3PutBool  (pSSM, pBusLogic->fUseLocalRam);
    3465     SSMR3PutMem   (pSSM, pBusLogic->aReplyBuffer, sizeof(pBusLogic->aReplyBuffer));
    3466     SSMR3PutU8    (pSSM, pBusLogic->iReply);
    3467     SSMR3PutU8    (pSSM, pBusLogic->cbReplyParametersLeft);
    3468     SSMR3PutBool  (pSSM, pBusLogic->fIRQEnabled);
    3469     SSMR3PutU8    (pSSM, pBusLogic->uISABaseCode);
    3470     SSMR3PutU32   (pSSM, pBusLogic->cMailbox);
    3471     SSMR3PutBool  (pSSM, pBusLogic->fMbxIs24Bit);
    3472     SSMR3PutGCPhys(pSSM, pBusLogic->GCPhysAddrMailboxOutgoingBase);
    3473     SSMR3PutU32   (pSSM, pBusLogic->uMailboxOutgoingPositionCurrent);
    3474     SSMR3PutU32   (pSSM, pBusLogic->cMailboxesReady);
    3475     SSMR3PutBool  (pSSM, pBusLogic->fNotificationSent);
    3476     SSMR3PutGCPhys(pSSM, pBusLogic->GCPhysAddrMailboxIncomingBase);
    3477     SSMR3PutU32   (pSSM, pBusLogic->uMailboxIncomingPositionCurrent);
    3478     SSMR3PutBool  (pSSM, pBusLogic->fStrictRoundRobinMode);
    3479     SSMR3PutBool  (pSSM, pBusLogic->fExtendedLunCCBFormat);
     3458    pHlp->pfnSSMPutU8    (pSSM, pBusLogic->regStatus);
     3459    pHlp->pfnSSMPutU8    (pSSM, pBusLogic->regInterrupt);
     3460    pHlp->pfnSSMPutU8    (pSSM, pBusLogic->regGeometry);
     3461    pHlp->pfnSSMPutMem   (pSSM, &pBusLogic->LocalRam, sizeof(pBusLogic->LocalRam));
     3462    pHlp->pfnSSMPutU8    (pSSM, pBusLogic->uOperationCode);
     3463    pHlp->pfnSSMPutMem   (pSSM, &pBusLogic->aCommandBuffer, sizeof(pBusLogic->aCommandBuffer));
     3464    pHlp->pfnSSMPutU8    (pSSM, pBusLogic->iParameter);
     3465    pHlp->pfnSSMPutU8    (pSSM, pBusLogic->cbCommandParametersLeft);
     3466    pHlp->pfnSSMPutBool  (pSSM, pBusLogic->fUseLocalRam);
     3467    pHlp->pfnSSMPutMem   (pSSM, pBusLogic->aReplyBuffer, sizeof(pBusLogic->aReplyBuffer));
     3468    pHlp->pfnSSMPutU8    (pSSM, pBusLogic->iReply);
     3469    pHlp->pfnSSMPutU8    (pSSM, pBusLogic->cbReplyParametersLeft);
     3470    pHlp->pfnSSMPutBool  (pSSM, pBusLogic->fIRQEnabled);
     3471    pHlp->pfnSSMPutU8    (pSSM, pBusLogic->uISABaseCode);
     3472    pHlp->pfnSSMPutU32   (pSSM, pBusLogic->cMailbox);
     3473    pHlp->pfnSSMPutBool  (pSSM, pBusLogic->fMbxIs24Bit);
     3474    pHlp->pfnSSMPutGCPhys(pSSM, pBusLogic->GCPhysAddrMailboxOutgoingBase);
     3475    pHlp->pfnSSMPutU32   (pSSM, pBusLogic->uMailboxOutgoingPositionCurrent);
     3476    pHlp->pfnSSMPutU32   (pSSM, pBusLogic->cMailboxesReady);
     3477    pHlp->pfnSSMPutBool  (pSSM, pBusLogic->fNotificationSent);
     3478    pHlp->pfnSSMPutGCPhys(pSSM, pBusLogic->GCPhysAddrMailboxIncomingBase);
     3479    pHlp->pfnSSMPutU32   (pSSM, pBusLogic->uMailboxIncomingPositionCurrent);
     3480    pHlp->pfnSSMPutBool  (pSSM, pBusLogic->fStrictRoundRobinMode);
     3481    pHlp->pfnSSMPutBool  (pSSM, pBusLogic->fExtendedLunCCBFormat);
    34803482
    34813483    vboxscsiR3SaveExec(pDevIns->pHlpR3, &pBusLogic->VBoxSCSI, pSSM);
    34823484
    3483     SSMR3PutU32(pSSM, cReqsSuspended);
     3485    pHlp->pfnSSMPutU32(pSSM, cReqsSuspended);
    34843486
    34853487    /* Save the physical CCB address of all suspended requests. */
     
    35023504                for (;;)
    35033505                {
    3504                     SSMR3PutU32(pSSM, (uint32_t)pReq->GCPhysAddrCCB);
     3506                    pHlp->pfnSSMPutU32(pSSM, (uint32_t)pReq->GCPhysAddrCCB);
    35053507
    35063508                    cThisReqsSuspended--;
     
    35163518    }
    35173519
    3518     return SSMR3PutU32(pSSM, UINT32_MAX);
     3520    return pHlp->pfnSSMPutU32(pSSM, UINT32_MAX);
    35193521}
    35203522
     
    35543556static DECLCALLBACK(int) buslogicR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
    35553557{
    3556     PBUSLOGIC   pBusLogic = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);
    3557     int         rc = VINF_SUCCESS;
     3558    PBUSLOGIC       pBusLogic = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);
     3559    PCPDMDEVHLPR3   pHlp = pDevIns->pHlpR3;
     3560    int             rc = VINF_SUCCESS;
    35583561
    35593562    /* We support saved states only from this and older versions. */
     
    35693572                  ("There are still outstanding requests on this device\n"));
    35703573        bool fPresent;
    3571         rc = SSMR3GetBool(pSSM, &fPresent);
     3574        rc = pHlp->pfnSSMGetBool(pSSM, &fPresent);
    35723575        AssertRCReturn(rc, rc);
    35733576        if (pDevice->fPresent != fPresent)
    3574             return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Target %u config mismatch: config=%RTbool state=%RTbool"), i, pDevice->fPresent, fPresent);
     3577            return pHlp->pfnSSMSetCfgError(pSSM, RT_SRC_POS, N_("Target %u config mismatch: config=%RTbool state=%RTbool"), i, pDevice->fPresent, fPresent);
    35753578
    35763579        if (uPass == SSM_PASS_FINAL)
    3577             SSMR3GetU32V(pSSM, &pDevice->cOutstandingRequests);
     3580            pHlp->pfnSSMGetU32V(pSSM, &pDevice->cOutstandingRequests);
    35783581    }
    35793582
     
    35823585
    35833586    /* Now the main device state. */
    3584     SSMR3GetU8V   (pSSM, &pBusLogic->regStatus);
    3585     SSMR3GetU8V   (pSSM, &pBusLogic->regInterrupt);
    3586     SSMR3GetU8V   (pSSM, &pBusLogic->regGeometry);
    3587     SSMR3GetMem   (pSSM, &pBusLogic->LocalRam, sizeof(pBusLogic->LocalRam));
    3588     SSMR3GetU8    (pSSM, &pBusLogic->uOperationCode);
     3587    pHlp->pfnSSMGetU8V   (pSSM, &pBusLogic->regStatus);
     3588    pHlp->pfnSSMGetU8V   (pSSM, &pBusLogic->regInterrupt);
     3589    pHlp->pfnSSMGetU8V   (pSSM, &pBusLogic->regGeometry);
     3590    pHlp->pfnSSMGetMem   (pSSM, &pBusLogic->LocalRam, sizeof(pBusLogic->LocalRam));
     3591    pHlp->pfnSSMGetU8    (pSSM, &pBusLogic->uOperationCode);
    35893592    if (uVersion > BUSLOGIC_SAVED_STATE_MINOR_PRE_CMDBUF_RESIZE)
    3590         SSMR3GetMem   (pSSM, &pBusLogic->aCommandBuffer, sizeof(pBusLogic->aCommandBuffer));
     3593        pHlp->pfnSSMGetMem(pSSM, &pBusLogic->aCommandBuffer, sizeof(pBusLogic->aCommandBuffer));
    35913594    else
    3592         SSMR3GetMem   (pSSM, &pBusLogic->aCommandBuffer, BUSLOGIC_COMMAND_SIZE_OLD);
    3593     SSMR3GetU8    (pSSM, &pBusLogic->iParameter);
    3594     SSMR3GetU8    (pSSM, &pBusLogic->cbCommandParametersLeft);
    3595     SSMR3GetBool  (pSSM, &pBusLogic->fUseLocalRam);
    3596     SSMR3GetMem   (pSSM, pBusLogic->aReplyBuffer, sizeof(pBusLogic->aReplyBuffer));
    3597     SSMR3GetU8    (pSSM, &pBusLogic->iReply);
    3598     SSMR3GetU8    (pSSM, &pBusLogic->cbReplyParametersLeft);
    3599     SSMR3GetBool  (pSSM, &pBusLogic->fIRQEnabled);
    3600     SSMR3GetU8    (pSSM, &pBusLogic->uISABaseCode);
    3601     SSMR3GetU32   (pSSM, &pBusLogic->cMailbox);
     3595        pHlp->pfnSSMGetMem(pSSM, &pBusLogic->aCommandBuffer, BUSLOGIC_COMMAND_SIZE_OLD);
     3596    pHlp->pfnSSMGetU8    (pSSM, &pBusLogic->iParameter);
     3597    pHlp->pfnSSMGetU8    (pSSM, &pBusLogic->cbCommandParametersLeft);
     3598    pHlp->pfnSSMGetBool  (pSSM, &pBusLogic->fUseLocalRam);
     3599    pHlp->pfnSSMGetMem   (pSSM, pBusLogic->aReplyBuffer, sizeof(pBusLogic->aReplyBuffer));
     3600    pHlp->pfnSSMGetU8    (pSSM, &pBusLogic->iReply);
     3601    pHlp->pfnSSMGetU8    (pSSM, &pBusLogic->cbReplyParametersLeft);
     3602    pHlp->pfnSSMGetBool  (pSSM, &pBusLogic->fIRQEnabled);
     3603    pHlp->pfnSSMGetU8    (pSSM, &pBusLogic->uISABaseCode);
     3604    pHlp->pfnSSMGetU32   (pSSM, &pBusLogic->cMailbox);
    36023605    if (uVersion > BUSLOGIC_SAVED_STATE_MINOR_PRE_24BIT_MBOX)
    3603         SSMR3GetBool  (pSSM, &pBusLogic->fMbxIs24Bit);
    3604     SSMR3GetGCPhys(pSSM, &pBusLogic->GCPhysAddrMailboxOutgoingBase);
    3605     SSMR3GetU32   (pSSM, &pBusLogic->uMailboxOutgoingPositionCurrent);
    3606     SSMR3GetU32V  (pSSM, &pBusLogic->cMailboxesReady);
    3607     SSMR3GetBoolV (pSSM, &pBusLogic->fNotificationSent);
    3608     SSMR3GetGCPhys(pSSM, &pBusLogic->GCPhysAddrMailboxIncomingBase);
    3609     SSMR3GetU32   (pSSM, &pBusLogic->uMailboxIncomingPositionCurrent);
    3610     SSMR3GetBool  (pSSM, &pBusLogic->fStrictRoundRobinMode);
    3611     SSMR3GetBool  (pSSM, &pBusLogic->fExtendedLunCCBFormat);
     3606        pHlp->pfnSSMGetBool(pSSM, &pBusLogic->fMbxIs24Bit);
     3607    pHlp->pfnSSMGetGCPhys(pSSM, &pBusLogic->GCPhysAddrMailboxOutgoingBase);
     3608    pHlp->pfnSSMGetU32   (pSSM, &pBusLogic->uMailboxOutgoingPositionCurrent);
     3609    pHlp->pfnSSMGetU32V  (pSSM, &pBusLogic->cMailboxesReady);
     3610    pHlp->pfnSSMGetBoolV (pSSM, &pBusLogic->fNotificationSent);
     3611    pHlp->pfnSSMGetGCPhys(pSSM, &pBusLogic->GCPhysAddrMailboxIncomingBase);
     3612    pHlp->pfnSSMGetU32   (pSSM, &pBusLogic->uMailboxIncomingPositionCurrent);
     3613    pHlp->pfnSSMGetBool  (pSSM, &pBusLogic->fStrictRoundRobinMode);
     3614    pHlp->pfnSSMGetBool  (pSSM, &pBusLogic->fExtendedLunCCBFormat);
    36123615
    36133616    rc = vboxscsiR3LoadExec(pDevIns->pHlpR3, &pBusLogic->VBoxSCSI, pSSM);
     
    36243627        uint32_t cTasks = 0;
    36253628
    3626         SSMR3GetU32(pSSM, &cTasks);
     3629        pHlp->pfnSSMGetU32(pSSM, &cTasks);
    36273630
    36283631        if (cTasks)
     
    36373640                    uint32_t u32PhysAddrCCB;
    36383641
    3639                     rc = SSMR3GetU32(pSSM, &u32PhysAddrCCB);
     3642                    rc = pHlp->pfnSSMGetU32(pSSM, &u32PhysAddrCCB);
    36403643                    if (RT_FAILURE(rc))
    36413644                        break;
     
    36523655    {
    36533656        uint32_t u32;
    3654         rc = SSMR3GetU32(pSSM, &u32);
     3657        rc = pHlp->pfnSSMGetU32(pSSM, &u32);
    36553658        if (RT_SUCCESS(rc))
    36563659            AssertMsgReturn(u32 == UINT32_MAX, ("%#x\n", u32), VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
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