VirtualBox

Changeset 64537 in vbox


Ignore:
Timestamp:
Nov 3, 2016 3:56:04 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
111718
Message:

BusLogic: Query the residual data length from the driver below when a request completes and don't guess it while copying between host and guest buffers

File:
1 edited

Legend:

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

    r64445 r64537  
    16181618            cbCopied += RT_MIN(cbDataCCB, cbCopy);
    16191619        }
    1620     }
    1621 
    1622     /* Update residual data length. */
    1623     if (   (pReq->CCBGuest.c.uOpcode == BUSLOGIC_CCB_OPCODE_INITIATOR_CCB_RESIDUAL_DATA_LENGTH)
    1624         || (pReq->CCBGuest.c.uOpcode == BUSLOGIC_CCB_OPCODE_INITIATOR_CCB_RESIDUAL_SCATTER_GATHER))
    1625     {
    1626         uint32_t    cbResidual;
    1627 
    1628         /** @todo we need to get the actual transfer length from the VSCSI layer?! */
    1629         cbResidual = 0; //LEN_TO_U32(pTaskState->CCBGuest.acbData) - ???;
    1630         if (pReq->fIs24Bit)
    1631             U32_TO_LEN(pReq->CCBGuest.o.acbData, cbResidual);
    1632         else
    1633             pReq->CCBGuest.n.cbData = cbResidual;
    16341620    }
    16351621
     
    28722858            buslogicR3SenseBufferFree(pReq, (pReq->u8ScsiSts != SCSI_STATUS_OK));
    28732859
     2860        /* Update residual data length. */
     2861        if (   (pReq->CCBGuest.c.uOpcode == BUSLOGIC_CCB_OPCODE_INITIATOR_CCB_RESIDUAL_DATA_LENGTH)
     2862            || (pReq->CCBGuest.c.uOpcode == BUSLOGIC_CCB_OPCODE_INITIATOR_CCB_RESIDUAL_SCATTER_GATHER))
     2863        {
     2864            size_t cbResidual = 0;
     2865            int rc = pTgtDev->pDrvMediaEx->pfnIoReqQueryResidual(pTgtDev->pDrvMediaEx, pReq->hIoReq, &cbResidual);
     2866            AssertRC(rc); Assert(cbResidual == (uint32_t)cbResidual);
     2867
     2868            if (pReq->fIs24Bit)
     2869                U32_TO_LEN(pReq->CCBGuest.o.acbData, (uint32_t)cbResidual);
     2870            else
     2871                pReq->CCBGuest.n.cbData = (uint32_t)cbResidual;
     2872        }
     2873
    28742874        /*
    28752875         * Save vital things from the request and free it before posting completion
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