VirtualBox

Changeset 28786 in vbox for trunk/src


Ignore:
Timestamp:
Apr 27, 2010 12:12:36 AM (15 years ago)
Author:
vboxsync
Message:

AHCI: Report errors of completed requests to the guest (not tested yet)

File:
1 edited

Legend:

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

    r28784 r28786  
    48554855 * @param pAhciPort             Pointer to the port where to request completed.
    48564856 * @param pAhciPortTaskState    Pointer to the task which finished.
    4857  */
    4858 static int ahciTransferComplete(PAHCIPort pAhciPort, PAHCIPORTTASKSTATE pAhciPortTaskState)
     4857 * @param rcReq                 IPRT status code of the completed request.
     4858 */
     4859static int ahciTransferComplete(PAHCIPort pAhciPort, PAHCIPORTTASKSTATE pAhciPortTaskState, int rcReq)
    48594860{
    48604861    /* Free system resources occupied by the scatter gather list. */
     
    48624863        ahciScatterGatherListDestroy(pAhciPort, pAhciPortTaskState);
    48634864
    4864     pAhciPortTaskState->cmdHdr.u32PRDBC = pAhciPortTaskState->cbTransfer;
    4865 
    4866     pAhciPortTaskState->uATARegError = 0;
    4867     pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_SEEK;
     4865    if (RT_FAILURE(rcReq))
     4866    {
     4867        pAhciPortTaskState->cmdHdr.u32PRDBC = 0;
     4868        pAhciPortTaskState->uATARegError = ID_ERR;
     4869        pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_ERR;
     4870
     4871        /* Log the error. */
     4872        if (pAhciPort->cErrors++ < MAX_LOG_REL_ERRORS)
     4873        {
     4874            if (pAhciPortTaskState->enmTxDir == AHCITXDIR_FLUSH)
     4875                LogRel(("AHCI#%u: Flush returned rc=%Rrc\n",
     4876                        pAhciPort->iLUN, rcReq));
     4877            else
     4878                LogRel(("AHCI#%u: %s at offset %llu (%u bytes left) returned rc=%Rrc\n",
     4879                        pAhciPort->iLUN,
     4880                        pAhciPortTaskState->enmTxDir == AHCITXDIR_READ
     4881                        ? "Read"
     4882                        : "Write",
     4883                        pAhciPortTaskState->uOffset,
     4884                        pAhciPortTaskState->cbTransfer, rcReq));
     4885        }
     4886    }
     4887    else
     4888    {
     4889        pAhciPortTaskState->cmdHdr.u32PRDBC = pAhciPortTaskState->cbTransfer;
     4890
     4891        pAhciPortTaskState->uATARegError = 0;
     4892        pAhciPortTaskState->uATARegStatus = ATA_STAT_READY | ATA_STAT_SEEK;
     4893    }
     4894
    48684895    /* Write updated command header into memory of the guest. */
    48694896    PDMDevHlpPhysWrite(pAhciPort->CTX_SUFF(pDevIns), pAhciPortTaskState->GCPhysCmdHdrAddr,
     
    49304957             __FUNCTION__, pInterface, pvUser, pAhciPortTaskState->uTag));
    49314958
    4932     int rc = ahciTransferComplete(pAhciPort, pAhciPortTaskState);
     4959    int rc = ahciTransferComplete(pAhciPort, pAhciPortTaskState, rcReq);
    49334960
    49344961    if (pAhciPort->uActTasksActive == 0 && pAhciPort->pAhciR3->fSignalIdle)
     
    53545381            }
    53555382            if (rc == VINF_VD_ASYNC_IO_FINISHED)
    5356                 rc = ahciTransferComplete(pAhciPort, pAhciPortTaskState);
     5383                rc = ahciTransferComplete(pAhciPort, pAhciPortTaskState, VINF_SUCCESS);
    53575384
    53585385            if (RT_FAILURE(rc) && rc != VERR_VD_ASYNC_IO_IN_PROGRESS)
    5359                 AssertMsgFailed(("%s: Failed to enqueue command %Rrc\n", __FUNCTION__, rc));
     5386                rc = ahciTransferComplete(pAhciPort, pAhciPortTaskState, rc);
    53605387        }
    53615388        else
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