VirtualBox

Changeset 64226 in vbox for trunk/src


Ignore:
Timestamp:
Oct 12, 2016 1:11:22 PM (8 years ago)
Author:
vboxsync
Message:

DrvSCSI: Get rid of the deprecated PDMISCSICONNECTOR and PDMISCSIPORT interfaces now that every device emulation was converted to the new interface

File:
1 edited

Legend:

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

    r64221 r64226  
    8282 * SCSI driver instance data.
    8383 *
    84  * @implements  PDMISCSICONNECTOR
    8584 * @implements  PDMIMEDIAEXPORT
    8685 * @implements  PDMIMEDIAEX
     
    10099    /** Pointer to the attached driver's mount interface. */
    101100    PPDMIMOUNT              pDrvMount;
    102     /** Pointer to the SCSI port interface of the device above. */
    103     PPDMISCSIPORT           pDevScsiPort;
    104101    /** Pointer to the extended media port interface of the device above. */
    105102    PPDMIMEDIAEXPORT        pDevMediaExPort;
     
    108105    /** pointer to the Led port interface of the dveice above. */
    109106    PPDMILEDPORTS           pLedPort;
    110     /** The scsi connector interface .*/
    111     PDMISCSICONNECTOR       ISCSIConnector;
    112107    /** The media interface for the device above. */
    113108    PDMIMEDIA               IMedia;
     
    624619}
    625620
    626 static DECLCALLBACK(void) drvscsiVScsiReqCompleted(VSCSIDEVICE hVScsiDevice, void *pVScsiDeviceUser,
    627                                                    void *pVScsiReqUser, int rcScsiCode, bool fRedoPossible, int rcReq)
    628 {
    629     RT_NOREF(hVScsiDevice);
    630     PDRVSCSI pThis = (PDRVSCSI)pVScsiDeviceUser;
    631 
    632     ASMAtomicDecU32(&pThis->StatIoDepth);
    633 
    634     pThis->pDevScsiPort->pfnSCSIRequestCompleted(pThis->pDevScsiPort, (PPDMSCSIREQUEST)pVScsiReqUser,
    635                                                  rcScsiCode, fRedoPossible, rcReq);
    636 
    637     if (RT_UNLIKELY(pThis->fDummySignal) && !pThis->StatIoDepth)
    638         PDMDrvHlpAsyncNotificationCompleted(pThis->pDrvIns);
    639 }
    640 
    641 /* -=-=-=-=- ISCSIConnector -=-=-=-=- */
    642 
    643 #ifdef DEBUG
    644 /**
    645  * Dumps a SCSI request structure for debugging purposes.
    646  *
    647  * @returns nothing.
    648  * @param   pRequest    Pointer to the request to dump.
    649  */
    650 static void drvscsiDumpScsiRequest(PPDMSCSIREQUEST pRequest)
    651 {
    652     Log(("Dump for pRequest=%#p Command: %s\n", pRequest, SCSICmdText(pRequest->pbCDB[0])));
    653     Log(("cbCDB=%u\n", pRequest->cbCDB));
    654     for (uint32_t i = 0; i < pRequest->cbCDB; i++)
    655         Log(("pbCDB[%u]=%#x\n", i, pRequest->pbCDB[i]));
    656     Log(("cbScatterGather=%u\n", pRequest->cbScatterGather));
    657     Log(("cScatterGatherEntries=%u\n", pRequest->cScatterGatherEntries));
    658     /* Print all scatter gather entries. */
    659     for (uint32_t i = 0; i < pRequest->cScatterGatherEntries; i++)
    660     {
    661         Log(("ScatterGatherEntry[%u].cbSeg=%u\n", i, pRequest->paScatterGatherHead[i].cbSeg));
    662         Log(("ScatterGatherEntry[%u].pvSeg=%#p\n", i, pRequest->paScatterGatherHead[i].pvSeg));
    663     }
    664     Log(("pvUser=%#p\n", pRequest->pvUser));
    665 }
    666 #endif
    667 
    668 /** @interface_method_impl{PDMISCSICONNECTOR,pfnSCSIRequestSend} */
    669 static DECLCALLBACK(int) drvscsiRequestSend(PPDMISCSICONNECTOR pInterface, PPDMSCSIREQUEST pSCSIRequest)
    670 {
    671     int rc;
    672     PDRVSCSI pThis = RT_FROM_MEMBER(pInterface, DRVSCSI, ISCSIConnector);
    673     VSCSIREQ hVScsiReq;
    674 
    675 #ifdef DEBUG
    676     drvscsiDumpScsiRequest(pSCSIRequest);
    677 #endif
    678 
    679     rc = VSCSIDeviceReqCreate(pThis->hVScsiDevice, &hVScsiReq,
    680                               pSCSIRequest->uLogicalUnit,
    681                               pSCSIRequest->pbCDB,
    682                               pSCSIRequest->cbCDB,
    683                               pSCSIRequest->cbScatterGather,
    684                               pSCSIRequest->cScatterGatherEntries,
    685                               pSCSIRequest->paScatterGatherHead,
    686                               pSCSIRequest->pbSenseBuffer,
    687                               pSCSIRequest->cbSenseBuffer,
    688                               pSCSIRequest);
    689     if (RT_FAILURE(rc))
    690         return rc;
    691 
    692     ASMAtomicIncU32(&pThis->StatIoDepth);
    693     rc = VSCSIDeviceReqEnqueue(pThis->hVScsiDevice, hVScsiReq);
    694 
    695     return rc;
    696 }
    697 
    698 /** @interface_method_impl{PDMISCSICONNECTOR,pfnQueryLUNType} */
    699 static DECLCALLBACK(int) drvscsiQueryLUNType(PPDMISCSICONNECTOR pInterface, uint32_t iLun, PPDMSCSILUNTYPE pLunType)
    700 {
    701     PDRVSCSI pThis = RT_FROM_MEMBER(pInterface, DRVSCSI, ISCSIConnector);
    702     VSCSILUNTYPE enmLunType;
    703 
    704     int rc = VSCSIDeviceLunQueryType(pThis->hVScsiDevice, iLun, &enmLunType);
    705     if (RT_FAILURE(rc))
    706         return rc;
    707 
    708     switch (enmLunType)
    709     {
    710     case VSCSILUNTYPE_SBC:  *pLunType = PDMSCSILUNTYPE_SBC; break;
    711     case VSCSILUNTYPE_MMC:  *pLunType = PDMSCSILUNTYPE_MMC; break;
    712     case VSCSILUNTYPE_SSC:  *pLunType = PDMSCSILUNTYPE_SSC; break;
    713     default:                *pLunType = PDMSCSILUNTYPE_INVALID;
    714     }
    715 
    716     return rc;
    717 }
    718621
    719622/* -=-=-=-=- IMedia -=-=-=-=- */
     
    1089992    Assert(RT_SUCCESS(rc) || rc == VERR_PDM_MEDIA_LOCKED || rc == VERR_PDM_MEDIA_NOT_MOUNTED);
    1090993    if (RT_SUCCESS(rc))
    1091     {
    1092         if (pThis->pDevMediaExPort)
    1093             pThis->pDevMediaExPort->pfnMediumEjected(pThis->pDevMediaExPort);
    1094     }
     994        pThis->pDevMediaExPort->pfnMediumEjected(pThis->pDevMediaExPort);
    1095995
    1096996    pEjectState->rcReq = rc;
     
    11111011    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMOUNT, pThis->pDrvMount);
    11121012    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
    1113     PDMIBASE_RETURN_INTERFACE(pszIID, PDMISCSICONNECTOR, &pThis->ISCSIConnector);
    11141013    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMEDIAEX, pThis->pDevMediaExPort ? &pThis->IMediaEx : NULL);
    11151014    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMEDIA, pThis->pDrvMedia ? &pThis->IMedia : NULL);
     
    11251024    PDRVSCSI pThis = RT_FROM_MEMBER(pInterface, DRVSCSI, IPort);
    11261025
    1127     if (pThis->pDevScsiPort)
    1128         return pThis->pDevScsiPort->pfnQueryDeviceLocation(pThis->pDevScsiPort, ppcszController,
    1129                                                            piInstance, piLUN);
    1130     if (pThis->pDevMediaPort)
    1131         return pThis->pDevMediaPort->pfnQueryDeviceLocation(pThis->pDevMediaPort, ppcszController,
    1132                                                             piInstance, piLUN);
    1133 
    1134     return VERR_NOT_SUPPORTED;
     1026    return pThis->pDevMediaPort->pfnQueryDeviceLocation(pThis->pDevMediaPort, ppcszController,
     1027                                                        piInstance, piLUN);
    11351028}
    11361029
     
    13651258     */
    13661259    pThis->pDrvIns                              = pDrvIns;
    1367     pThis->ISCSIConnector.pfnSCSIRequestSend    = drvscsiRequestSend;
    1368     pThis->ISCSIConnector.pfnQueryLUNType       = drvscsiQueryLUNType;
    13691260
    13701261    pDrvIns->IBase.pfnQueryInterface            = drvscsiQueryInterface;
     
    14201311    pThis->IPortEx.pfnIoReqStateChanged         = drvscsiIoReqStateChanged;
    14211312
    1422     /* Query the optional SCSI port interface above. */
    1423     pThis->pDevScsiPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMISCSIPORT);
    1424 
    14251313    /* Query the optional media port interface above. */
    14261314    pThis->pDevMediaPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIMEDIAPORT);
     
    14291317    pThis->pDevMediaExPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIMEDIAEXPORT);
    14301318
    1431     AssertMsgReturn(pThis->pDevScsiPort || pThis->pDevMediaExPort,
    1432                     ("Missing SCSI or extended media port interface above\n"), VERR_PDM_MISSING_INTERFACE);
     1319    AssertMsgReturn(pThis->pDevMediaExPort,
     1320                    ("Missing extended media port interface above\n"), VERR_PDM_MISSING_INTERFACE);
    14331321
    14341322    /* Query the optional LED interface above. */
     
    15061394    pThis->VScsiIoCallbacks.pfnVScsiLunMediumSetLock       = drvscsiSetLock;
    15071395
    1508     rc = VSCSIDeviceCreate(&pThis->hVScsiDevice,
    1509                              pThis->pDevMediaExPort
    1510                            ? drvscsiIoReqVScsiReqCompleted
    1511                            : drvscsiVScsiReqCompleted,
    1512                            pThis);
     1396    rc = VSCSIDeviceCreate(&pThis->hVScsiDevice, drvscsiIoReqVScsiReqCompleted, pThis);
    15131397    AssertMsgReturn(RT_SUCCESS(rc), ("Failed to create VSCSI device rc=%Rrc\n", rc), rc);
    15141398    rc = VSCSILunCreate(&pThis->hVScsiLun, enmLunType, &pThis->VScsiIoCallbacks,
     
    15381422    uint32_t iCtrlLun = 0;
    15391423
    1540     if (pThis->pDevScsiPort)
    1541         rc = pThis->pDevScsiPort->pfnQueryDeviceLocation(pThis->pDevScsiPort, &pszCtrl, &iCtrlInstance, &iCtrlLun);
    1542     if (pThis->pDevMediaPort)
    1543         rc = pThis->pDevMediaPort->pfnQueryDeviceLocation(pThis->pDevMediaPort, &pszCtrl, &iCtrlInstance, &iCtrlLun);
     1424    rc = pThis->pDevMediaPort->pfnQueryDeviceLocation(pThis->pDevMediaPort, &pszCtrl, &iCtrlInstance, &iCtrlLun);
    15441425    if (RT_SUCCESS(rc))
    15451426    {
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