VirtualBox

Changeset 59704 in vbox for trunk


Ignore:
Timestamp:
Feb 16, 2016 2:13:25 PM (9 years ago)
Author:
vboxsync
Message:

VUSB: Some structural cleanup (#3 Make the VUSB URB specific data private to the VUSB stack, some interface changes required for XHCI because it previously required access to some VUsb members)

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vusb.h

    r59700 r59704  
    684684     * @param   pInterface  Pointer to this struct.
    685685     * @param   DstAddress  The destination address of the URB.
     686     * @param   pDev        Optional device pointer the URB is for.
    686687     * @param   enmType     Type of the URB.
    687688     * @param   enmDir      Data transfer direction.
     
    690691     * @param   pszTag      Custom URB tag assigned by the caller, only for
    691692     *                      logged builds and optional.
    692      */
    693     DECLR3CALLBACKMEMBER(PVUSBURB, pfnNewUrb,(PVUSBIROOTHUBCONNECTOR pInterface, uint8_t DstAddress, VUSBXFERTYPE enmType,
    694                                               VUSBDIRECTION enmDir, uint32_t cbData, uint32_t cTds, const char *pszTag));
     693     *
     694     * @note pDev should be NULL in most cases. The only useful case is for USB3 where
     695     *       it is required for the SET_ADDRESS request because USB3 uses unicast traffic.
     696     */
     697    DECLR3CALLBACKMEMBER(PVUSBURB, pfnNewUrb,(PVUSBIROOTHUBCONNECTOR pInterface, uint8_t DstAddress, PVUSBIDEVICE pDev,
     698                                              VUSBXFERTYPE enmType, VUSBDIRECTION enmDir, uint32_t cbData, uint32_t cTds, const char *pszTag));
     699
     700    /**
     701     * Free an URB not submitted yet.
     702     *
     703     * @returns VBox status code.
     704     * @param   pInterface  Pointer to this struct.
     705     * @param   pUrb        Pointer to the URB to free returned by VUSBIROOTHUBCONNECTOR::pfnNewUrb.
     706     */
     707    DECLR3CALLBACKMEMBER(int, pfnFreeUrb, (PVUSBIROOTHUBCONNECTOR pInterface, PVUSBURB pUrb));
    695708
    696709    /**
     
    778791} VUSBIROOTHUBCONNECTOR;
    779792/** VUSBIROOTHUBCONNECTOR interface ID. */
    780 #define VUSBIROOTHUBCONNECTOR_IID               "481d7f23-f180-4fde-b636-094253eaf537"
     793#define VUSBIROOTHUBCONNECTOR_IID               "a593cc64-a821-4e57-af2d-f86b2a052ea4"
    781794
    782795
     
    789802
    790803/** @copydoc VUSBIROOTHUBCONNECTOR::pfnNewUrb */
    791 DECLINLINE(PVUSBURB) VUSBIRhNewUrb(PVUSBIROOTHUBCONNECTOR pInterface, uint32_t DstAddress, VUSBXFERTYPE enmType,
    792                                    VUSBDIRECTION enmDir, uint32_t cbData, uint32_t cTds, const char *pszTag)
    793 {
    794     return pInterface->pfnNewUrb(pInterface, DstAddress, enmType, enmDir, cbData, cTds, pszTag);
     804DECLINLINE(PVUSBURB) VUSBIRhNewUrb(PVUSBIROOTHUBCONNECTOR pInterface, uint32_t DstAddress, PVUSBIDEVICE pDev,
     805                                   VUSBXFERTYPE enmType, VUSBDIRECTION enmDir, uint32_t cbData, uint32_t cTds, const char *pszTag)
     806{
     807    return pInterface->pfnNewUrb(pInterface, DstAddress, pDev, enmType, enmDir, cbData, cTds, pszTag);
     808}
     809
     810/** @copydoc VUSBIROOTHUBCONNECTOR::pfnSubmitUrb */
     811DECLINLINE(int) VUSBIRhFreeUrb(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBURB pUrb)
     812{
     813    return pInterface->pfnFreeUrb(pInterface, pUrb);
    795814}
    796815
     
    948967} VUSBIDEVICE;
    949968/** VUSBIDEVICE interface ID. */
    950 #define VUSBIDEVICE_IID                         "79a31188-043d-432c-82ac-9485c9ab9a49"
     969#define VUSBIDEVICE_IID                         "af576b38-e8ca-4db7-810a-2596d8d57ca0"
    951970
    952971
     
    11151134/** Private controller emulation specific TD data. */
    11161135typedef struct VUSBURBHCITDINT *PVUSBURBHCITD;
     1136/** Private VUSB/roothub related state for the associated URB. */
     1137typedef struct VUSBURBVUSBINT *PVUSBURBVUSB;
    11171138
    11181139/**
     
    11431164#endif
    11441165
    1145     /** The VUSB data. */
    1146     struct VUSBURBVUSB
    1147     {
    1148         /** URB chain pointer. */
    1149         PVUSBURB        pNext;
    1150         /** URB chain pointer. */
    1151         PVUSBURB       *ppPrev;
    1152         /** Pointer to the original for control messages. */
    1153         PVUSBURB        pCtrlUrb;
    1154         /** Pointer to the VUSB device.
    1155          * This may be NULL if the destination address is invalid. */
    1156         struct VUSBDEV *pDev;
    1157         /** Specific to the pfnFree function. */
    1158         void           *pvFreeCtx;
    1159         /**
    1160          * Callback which will free the URB once it's reaped and completed.
    1161          * @param   pUrb    The URB.
    1162          */
    1163         DECLCALLBACKMEMBER(void, pfnFree)(PVUSBURB pUrb);
    1164         /** Submit timestamp. (logging only) */
    1165         uint64_t        u64SubmitTS;
    1166         /** The allocated data length. */
    1167         uint32_t        cbDataAllocated;
    1168         /** Opaque data holder when this is a read-ahead URB. */
    1169         void            *pvReadAhead;
    1170     } VUsb;
    1171 
     1166    /** The VUSB stack private data. */
     1167    PVUSBURBVUSB        pVUsb;
    11721168    /** Private host controller data associated with this URB. */
    11731169    PVUSBURBHCI         pHci;
  • trunk/src/VBox/Devices/USB/DevOHCI.cpp

    r59700 r59704  
    27612761     * Allocate and initialize a new URB.
    27622762     */
    2763     PVUSBURB pUrb = VUSBIRhNewUrb(pThis->RootHub.pIRhConn, pEd->hwinfo & ED_HWINFO_FUNCTION, enmType,
    2764                                   enmDir, Buf.cbTotal, 1, NULL);
     2763    PVUSBURB pUrb = VUSBIRhNewUrb(pThis->RootHub.pIRhConn, pEd->hwinfo & ED_HWINFO_FUNCTION, NULL,
     2764                                  enmType, enmDir, Buf.cbTotal, 1, NULL);
    27652765    if (!pUrb)
    27662766        return false;                   /* retry later... */
     
    29132913     * Allocate and initialize a new URB.
    29142914     */
    2915     PVUSBURB pUrb = VUSBIRhNewUrb(pThis->RootHub.pIRhConn, pEd->hwinfo & ED_HWINFO_FUNCTION, enmType,
    2916                                   enmDir, cbTotal, cTds, "ohciServiceTdMultiple");
     2915    PVUSBURB pUrb = VUSBIRhNewUrb(pThis->RootHub.pIRhConn, pEd->hwinfo & ED_HWINFO_FUNCTION, NULL,
     2916                                  enmType, enmDir, cbTotal, cTds, "ohciServiceTdMultiple");
    29172917    if (!pUrb)
    29182918        /* retry later... */
     
    31213121     * Allocate and initialize a new URB.
    31223122     */
    3123     PVUSBURB pUrb = VUSBIRhNewUrb(pThis->RootHub.pIRhConn, pEd->hwinfo & ED_HWINFO_FUNCTION, VUSBXFERTYPE_ISOC,
    3124                                   enmDir, cbTotal, 1, NULL);
     3123    PVUSBURB pUrb = VUSBIRhNewUrb(pThis->RootHub.pIRhConn, pEd->hwinfo & ED_HWINFO_FUNCTION, NULL,
     3124                                  VUSBXFERTYPE_ISOC, enmDir, cbTotal, 1, NULL);
    31253125    if (!pUrb)
    31263126        /* retry later... */
  • trunk/src/VBox/Devices/USB/DrvVUSBRootHub.cpp

    r59700 r59704  
    338338     */
    339339    vusbUrbAssert(pUrb);
    340     PVUSBROOTHUB pRh = (PVUSBROOTHUB)pUrb->VUsb.pvFreeCtx;
     340    PVUSBROOTHUB pRh = (PVUSBROOTHUB)pUrb->pVUsb->pvFreeCtx;
    341341    Assert(pRh);
    342342
     
    356356    RTCritSectEnter(&pRh->CritSectFreeUrbs);
    357357    pUrb->enmState = VUSBURBSTATE_FREE;
    358     pUrb->VUsb.ppPrev = NULL;
    359     pUrb->VUsb.pNext = pRh->pFreeUrbs;
     358    pUrb->pVUsb->ppPrev = NULL;
     359    pUrb->pVUsb->pNext = pRh->pFreeUrbs;
    360360    pRh->pFreeUrbs = pUrb;
    361361    Assert(pRh->pFreeUrbs->enmState == VUSBURBSTATE_FREE);
     
    367367 * Worker routine for vusbRhConnNewUrb() and vusbDevNewIsocUrb().
    368368 */
    369 PVUSBURB vusbRhNewUrb(PVUSBROOTHUB pRh, uint8_t DstAddress, VUSBXFERTYPE enmType,
     369PVUSBURB vusbRhNewUrb(PVUSBROOTHUB pRh, uint8_t DstAddress, PVUSBDEV pDev, VUSBXFERTYPE enmType,
    370370                      VUSBDIRECTION enmDir, uint32_t cbData, uint32_t cTds, const char *pszTag)
    371371{
     
    374374     */
    375375    /* Get the required amount of additional memory to allocate the whole state. */
    376     size_t cbMem = RT_ALIGN_32(cbData, 16) + pRh->cbHci + cTds * pRh->cbHciTd;
     376    size_t cbMem = cbData + sizeof(VUSBURBVUSBINT) + pRh->cbHci + cTds * pRh->cbHciTd;
     377    uint32_t cbDataAllocated = 0;
    377378
    378379    /** @todo try find a best fit, MSD which submits rather big URBs intermixed with small control
     
    386387    while (pUrb)
    387388    {
    388         if (pUrb->VUsb.cbDataAllocated >= cbData)
     389        if (pUrb->pVUsb->cbDataAllocated >= cbData)
    389390        {
    390391            /* Unlink and verify part of the state. */
    391392            if (pUrbPrev)
    392                 pUrbPrev->VUsb.pNext = pUrb->VUsb.pNext;
     393                pUrbPrev->pVUsb->pNext = pUrb->pVUsb->pNext;
    393394            else
    394                 pRh->pFreeUrbs = pUrb->VUsb.pNext;
     395                pRh->pFreeUrbs = pUrb->pVUsb->pNext;
    395396            Assert(pUrb->u32Magic == VUSBURB_MAGIC);
    396             Assert(pUrb->VUsb.pvFreeCtx == pRh);
    397             Assert(pUrb->VUsb.pfnFree == vusbRhFreeUrb);
     397            Assert(pUrb->pVUsb->pvFreeCtx == pRh);
     398            Assert(pUrb->pVUsb->pfnFree == vusbRhFreeUrb);
    398399            Assert(pUrb->enmState == VUSBURBSTATE_FREE);
    399             Assert(!pUrb->VUsb.pNext || pUrb->VUsb.pNext->enmState == VUSBURBSTATE_FREE);
     400            Assert(!pUrb->pVUsb->pNext || pUrb->pVUsb->pNext->enmState == VUSBURBSTATE_FREE);
     401            cbDataAllocated = pUrb->pVUsb->cbDataAllocated;
    400402            break;
    401403        }
    402404        pUrbPrev = pUrb;
    403         pUrb = pUrb->VUsb.pNext;
     405        pUrb = pUrb->pVUsb->pNext;
    404406    }
    405407
     
    407409    {
    408410        /* allocate a new one. */
    409         uint32_t cbDataAllocated = cbMem <= _4K  ? RT_ALIGN_32(cbMem, _1K)
    410                                  : cbMem <= _32K ? RT_ALIGN_32(cbMem, _4K)
    411                                                  : RT_ALIGN_32(cbMem, 16*_1K);
    412 
    413         pUrb = (PVUSBURB)RTMemAlloc(RT_OFFSETOF(VUSBURB, abData[cbDataAllocated]));
     411        cbDataAllocated = cbMem <= _4K  ? RT_ALIGN_32(cbMem, _1K)
     412                        : cbMem <= _32K ? RT_ALIGN_32(cbMem, _4K)
     413                                        : RT_ALIGN_32(cbMem, 16*_1K);
     414
     415        pUrb = (PVUSBURB)RTMemAllocZ(RT_OFFSETOF(VUSBURB, abData[cbDataAllocated]));
    414416        if (RT_UNLIKELY(!pUrb))
    415417        {
     
    419421
    420422        pRh->cUrbsInPool++;
    421         pUrb->u32Magic = VUSBURB_MAGIC;
    422         pUrb->VUsb.pvFreeCtx = pRh;
    423         pUrb->VUsb.pfnFree = vusbRhFreeUrb;
    424         pUrb->VUsb.cbDataAllocated = cbDataAllocated;
     423        pUrb->u32Magic               = VUSBURB_MAGIC;
     424
    425425    }
    426426    RTCritSectLeave(&pRh->CritSectFreeUrbs);
     
    429429     * (Re)init the URB
    430430     */
    431     pUrb->enmState         = VUSBURBSTATE_ALLOCATED;
    432     pUrb->fCompleting      = false;
    433     pUrb->pszDesc          = NULL;
    434     pUrb->VUsb.pNext       = NULL;
    435     pUrb->VUsb.ppPrev      = NULL;
    436     pUrb->VUsb.pCtrlUrb    = NULL;
    437     pUrb->VUsb.u64SubmitTS = 0;
    438     pUrb->VUsb.pvReadAhead = NULL;
    439     pUrb->VUsb.pDev        = vusbRhFindDevByAddress(pRh, DstAddress);
    440     pUrb->Dev.pvPrivate    = NULL;
    441     pUrb->Dev.pNext        = NULL;
    442     pUrb->DstAddress       = DstAddress;
    443     pUrb->EndPt            = ~0;
    444     pUrb->enmType          = enmType;
    445     pUrb->enmDir           = enmDir;
    446     pUrb->fShortNotOk      = false;
    447     pUrb->enmStatus        = VUSBSTATUS_INVALID;
    448     pUrb->cbData           = cbData;
    449     pUrb->pHci             = pRh->cbHci ? (PVUSBURBHCI)&pUrb->abData[cbData] : NULL;
    450     pUrb->paTds            = (pRh->cbHciTd && cTds) ? (PVUSBURBHCITD)&pUrb->abData[cbData + pRh->cbHci] : NULL;
     431    uint32_t offAlloc = cbData;
     432    pUrb->enmState               = VUSBURBSTATE_ALLOCATED;
     433    pUrb->fCompleting            = false;
     434    pUrb->pszDesc                = NULL;
     435    pUrb->pVUsb                  = (PVUSBURBVUSB)&pUrb->abData[offAlloc];
     436    offAlloc += sizeof(VUSBURBVUSBINT);
     437    pUrb->pVUsb->pvFreeCtx       = pRh;
     438    pUrb->pVUsb->pfnFree         = vusbRhFreeUrb;
     439    pUrb->pVUsb->cbDataAllocated = cbDataAllocated;
     440    pUrb->pVUsb->pNext           = NULL;
     441    pUrb->pVUsb->ppPrev          = NULL;
     442    pUrb->pVUsb->pCtrlUrb        = NULL;
     443    pUrb->pVUsb->u64SubmitTS     = 0;
     444    pUrb->pVUsb->pvReadAhead     = NULL;
     445    pUrb->pVUsb->pDev            = pDev ? pDev : vusbRhFindDevByAddress(pRh, DstAddress);
     446    pUrb->Dev.pvPrivate          = NULL;
     447    pUrb->Dev.pNext              = NULL;
     448    pUrb->DstAddress             = DstAddress;
     449    pUrb->EndPt                  = ~0;
     450    pUrb->enmType                = enmType;
     451    pUrb->enmDir                 = enmDir;
     452    pUrb->fShortNotOk            = false;
     453    pUrb->enmStatus              = VUSBSTATUS_INVALID;
     454    pUrb->cbData                 = cbData;
     455    pUrb->pHci                   = pRh->cbHci ? (PVUSBURBHCI)&pUrb->abData[offAlloc] : NULL;
     456    offAlloc += pRh->cbHci;
     457    pUrb->paTds              = (pRh->cbHciTd && cTds) ? (PVUSBURBHCITD)&pUrb->abData[offAlloc] : NULL;
    451458
    452459#ifdef LOG_ENABLED
     
    495502
    496503/** @copydoc VUSBIROOTHUBCONNECTOR::pfnNewUrb */
    497 static DECLCALLBACK(PVUSBURB) vusbRhConnNewUrb(PVUSBIROOTHUBCONNECTOR pInterface, uint8_t DstAddress, VUSBXFERTYPE enmType,
     504static DECLCALLBACK(PVUSBURB) vusbRhConnNewUrb(PVUSBIROOTHUBCONNECTOR pInterface, uint8_t DstAddress, PVUSBIDEVICE pDev, VUSBXFERTYPE enmType,
    498505                                               VUSBDIRECTION enmDir, uint32_t cbData, uint32_t cTds, const char *pszTag)
    499506{
    500507    PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
    501     return vusbRhNewUrb(pRh, DstAddress, enmType, enmDir, cbData, cTds, pszTag);
     508    return vusbRhNewUrb(pRh, DstAddress, (PVUSBDEV)pDev, enmType, enmDir, cbData, cTds, pszTag);
     509}
     510
     511
     512/** @copydoc VUSBIROOTHUBCONNECTOR::pfnFreeUrb */
     513static DECLCALLBACK(int) vusbRhFreeUrb(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBURB pUrb)
     514{
     515    PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
     516
     517    pUrb->pVUsb->pfnFree(pUrb);
     518    return VINF_SUCCESS;
    502519}
    503520
     
    553570     */
    554571    int rc;
    555     if (   pUrb->VUsb.pDev
    556         && pUrb->VUsb.pDev->pUsbIns)
     572    if (   pUrb->pVUsb->pDev
     573        && pUrb->pVUsb->pDev->pUsbIns)
    557574    {
    558575        switch (pUrb->enmDir)
     
    576593        {
    577594            LogFlow(("vusbRhSubmitUrb: freeing pUrb=%p\n", pUrb));
    578             pUrb->VUsb.pfnFree(pUrb);
     595            pUrb->pVUsb->pfnFree(pUrb);
    579596        }
    580597    }
    581598    else
    582599    {
    583         pUrb->VUsb.pDev = &pRh->Hub.Dev;
     600        pUrb->pVUsb->pDev = &pRh->Hub.Dev;
    584601        Log(("vusb: pRh=%p: SUBMIT: Address %i not found!!!\n", pRh, pUrb->DstAddress));
    585602
     
    667684    while (pUrb)
    668685    {
    669         PVUSBURB pNext = pUrb->VUsb.pNext;
     686        PVUSBURB pNext = pUrb->pVUsb->pNext;
    670687        /* Call the worker directly. */
    671688        vusbUrbCancelWorker(pUrb, CANCELMODE_FAIL);
     
    708725    while (pUrb)
    709726    {
    710         PVUSBURB pNext = pUrb->VUsb.pNext;
    711 
    712         Assert(pUrb->VUsb.pDev == pDev);
     727        PVUSBURB pNext = pUrb->pVUsb->pNext;
     728
     729        Assert(pUrb->pVUsb->pDev == pDev);
    713730
    714731        if (pUrb->EndPt == EndPt && pUrb->enmDir == enmDir)
     
    976993    {
    977994        PVUSBURB pUrb = pRh->pFreeUrbs;
    978         pRh->pFreeUrbs = pUrb->VUsb.pNext;
     995        pRh->pFreeUrbs = pUrb->pVUsb->pNext;
    979996
    980997        pUrb->u32Magic = 0;
    981998        pUrb->enmState = VUSBURBSTATE_INVALID;
    982         pUrb->VUsb.pNext = NULL;
     999        pUrb->pVUsb->pNext = NULL;
    9831000        RTMemFree(pUrb);
    9841001    }
  • trunk/src/VBox/Devices/USB/USBProxyDevice.cpp

    r59700 r59704  
    7979        Urb.enmDir        = VUSBDIRECTION_IN;
    8080        Urb.fShortNotOk   = false;
    81         Urb.VUsb.pCtrlUrb = NULL;
    8281        Urb.enmStatus     = VUSBSTATUS_INVALID;
     82        Urb.pVUsb         = NULL;
    8383        cbHint = RT_MIN(cbHint, sizeof(Urb.abData) - sizeof(VUSBSETUP));
    8484        Urb.cbData = cbHint + sizeof(VUSBSETUP);
  • trunk/src/VBox/Devices/USB/VUSBDevice.cpp

    r59615 r59704  
    10521052    while (pUrb)
    10531053    {
    1054         PVUSBURB pNext = pUrb->VUsb.pNext;
    1055 
    1056         Assert(pUrb->VUsb.pDev == pDev);
     1054        PVUSBURB pNext = pUrb->pVUsb->pNext;
     1055
     1056        Assert(pUrb->pVUsb->pDev == pDev);
    10571057
    10581058        LogFlow(("%s: vusbDevCancelAllUrbs: CANCELING URB\n", pUrb->pszDesc));
     
    10731073        while (pUrb)
    10741074        {
    1075             PVUSBURB pNext = pUrb->VUsb.pNext;
    1076             Assert(pUrb->VUsb.pDev == pDev);
     1075            PVUSBURB pNext = pUrb->pVUsb->pNext;
     1076            Assert(pUrb->pVUsb->pDev == pDev);
    10771077
    10781078            PVUSBURB pRipe = NULL;
     
    10911091            {
    10921092                if (pRipe == pNext)
    1093                     pNext = pNext->VUsb.pNext;
     1093                    pNext = pNext->pVUsb->pNext;
    10941094                vusbUrbRipe(pRipe);
    10951095                cReaped++;
     
    11081108        while (pUrb)
    11091109        {
    1110             PVUSBURB pNext = pUrb->VUsb.pNext;
    1111             Assert(pUrb->VUsb.pDev == pDev);
     1110            PVUSBURB pNext = pUrb->pVUsb->pNext;
     1111            Assert(pUrb->pVUsb->pDev == pDev);
    11121112
    11131113            AssertMsgFailed(("%s: Leaking left over URB! state=%d pDev=%p[%s]\n",
     
    11181118             * it breaks anything, please add comment here, why we should unlink only.
    11191119             */
    1120             pUrb->VUsb.pfnFree(pUrb);
     1120            pUrb->pVUsb->pfnFree(pUrb);
    11211121            pUrb = pNext;
    11221122        }
  • trunk/src/VBox/Devices/USB/VUSBInternal.h

    r59701 r59704  
    6666/** Maximum number of endpoint addresses */
    6767#define VUSB_PIPE_MAX           16
     68
     69/**
     70 * The VUSB URB data.
     71 */
     72typedef struct VUSBURBVUSBINT
     73{
     74    /** URB chain pointer. */
     75    PVUSBURB        pNext;
     76    /** URB chain pointer. */
     77    PVUSBURB       *ppPrev;
     78    /** Pointer to the original for control messages. */
     79    PVUSBURB        pCtrlUrb;
     80    /** Pointer to the VUSB device.
     81     * This may be NULL if the destination address is invalid. */
     82    PVUSBDEV        pDev;
     83    /** Specific to the pfnFree function. */
     84    void           *pvFreeCtx;
     85    /**
     86     * Callback which will free the URB once it's reaped and completed.
     87     * @param   pUrb    The URB.
     88     */
     89    DECLCALLBACKMEMBER(void, pfnFree)(PVUSBURB pUrb);
     90    /** Submit timestamp. (logging only) */
     91    uint64_t        u64SubmitTS;
     92    /** The allocated data length. */
     93    uint32_t        cbDataAllocated;
     94    /** Opaque data holder when this is a read-ahead URB. */
     95    void            *pvReadAhead;
     96} VUSBURBVUSBINT;
    6897
    6998/**
     
    449478int  vusbUrbQueueAsyncRh(PVUSBURB pUrb);
    450479int  vusbUrbSubmitBufferedRead(PVUSBURB pUrb, VUSBREADAHEAD hReadAhead);
    451 PVUSBURB vusbRhNewUrb(PVUSBROOTHUB pRh, uint8_t DstAddress, VUSBXFERTYPE enmType, VUSBDIRECTION enmDir,
    452                       uint32_t cbData, uint32_t cTds, const char *pszTag);
     480PVUSBURB vusbRhNewUrb(PVUSBROOTHUB pRh, uint8_t DstAddress, PVUSBDEV pDev, VUSBXFERTYPE enmType,
     481                      VUSBDIRECTION enmDir, uint32_t cbData, uint32_t cTds, const char *pszTag);
    453482
    454483
    455484DECLINLINE(void) vusbUrbUnlink(PVUSBURB pUrb)
    456485{
    457     PVUSBDEV pDev = pUrb->VUsb.pDev;
     486    PVUSBDEV pDev = pUrb->pVUsb->pDev;
    458487
    459488    RTCritSectEnter(&pDev->CritSectAsyncUrbs);
    460     *pUrb->VUsb.ppPrev = pUrb->VUsb.pNext;
    461     if (pUrb->VUsb.pNext)
    462         pUrb->VUsb.pNext->VUsb.ppPrev = pUrb->VUsb.ppPrev;
    463     pUrb->VUsb.pNext = NULL;
    464     pUrb->VUsb.ppPrev = NULL;
     489    *pUrb->pVUsb->ppPrev = pUrb->pVUsb->pNext;
     490    if (pUrb->pVUsb->pNext)
     491        pUrb->pVUsb->pNext->pVUsb->ppPrev = pUrb->pVUsb->ppPrev;
     492    pUrb->pVUsb->pNext = NULL;
     493    pUrb->pVUsb->ppPrev = NULL;
    465494    RTCritSectLeave(&pDev->CritSectAsyncUrbs);
    466495}
  • trunk/src/VBox/Devices/USB/VUSBReadAhead.cpp

    r59700 r59704  
    110110        return NULL;
    111111
    112     pUrb = vusbRhNewUrb(pRh, pDev->u8Address, VUSBXFERTYPE_ISOC, VUSBDIRECTION_IN, cbTotal, 1, "prab");
     112    pUrb = vusbRhNewUrb(pRh, pDev->u8Address, NULL, VUSBXFERTYPE_ISOC, VUSBDIRECTION_IN, cbTotal, 1, "prab");
    113113    if (!pUrb)
    114114        /* not much we can do here... */
     
    216216            Assert(pUrb->enmState == VUSBURBSTATE_ALLOCATED);
    217217
    218             pUrb->VUsb.pvReadAhead = pvUser;
     218            pUrb->pVUsb->pvReadAhead = pvUser;
    219219            pUrb->enmState = VUSBURBSTATE_IN_FLIGHT;
    220220            rc = vusbUrbQueueAsyncRh(pUrb);
     
    224224                Log(("vusb: read-ahead thread failed to queue URB with %Rrc; exiting\n", rc));
    225225                pThis->cUrbsMax = pThis->cSubmitted;
    226                 pUrb->VUsb.pfnFree(pUrb);
     226                pUrb->pVUsb->pfnFree(pUrb);
    227227                break;
    228228            }
     
    250250        PVUSBURB pBufferedUrb = pThis->pBuffUrbHead;
    251251
    252         pThis->pBuffUrbHead = (PVUSBURB)pBufferedUrb->VUsb.pvReadAhead;
    253         pBufferedUrb->VUsb.pfnFree(pBufferedUrb);
     252        pThis->pBuffUrbHead = (PVUSBURB)pBufferedUrb->pVUsb->pvReadAhead;
     253        pBufferedUrb->pVUsb->pfnFree(pBufferedUrb);
    254254    }
    255255
     
    269269{
    270270    Assert(pUrb);
    271     Assert(pUrb->VUsb.pvReadAhead);
    272     PVUSBREADAHEADINT pThis = (PVUSBREADAHEADINT)pUrb->VUsb.pvReadAhead;
     271    Assert(pUrb->pVUsb->pvReadAhead);
     272    PVUSBREADAHEADINT pThis = (PVUSBREADAHEADINT)pUrb->pVUsb->pvReadAhead;
    273273    PVUSBPIPE         pPipe = pThis->pPipe;
    274274    Assert(pPipe);
    275275
    276276    RTCritSectEnter(&pThis->CritSectBuffUrbList);
    277     pUrb->VUsb.pvReadAhead = NULL;
     277    pUrb->pVUsb->pvReadAhead = NULL;
    278278    if (pThis->pBuffUrbHead == NULL)
    279279    {
     
    286286        // Some URBs are queued already
    287287        Assert(pThis->pBuffUrbTail);
    288         Assert(!pThis->pBuffUrbTail->VUsb.pvReadAhead);
    289         pThis->pBuffUrbTail->VUsb.pvReadAhead = pUrb;
     288        Assert(!pThis->pBuffUrbTail->pVUsb->pvReadAhead);
     289        pThis->pBuffUrbTail->pVUsb->pvReadAhead = pUrb;
    290290        pThis->pBuffUrbTail = pUrb;
    291291    }
     
    318318
    319319        // There's a URB available in the read-ahead buffer; use it
    320         pThis->pBuffUrbHead = (PVUSBURB)pBufferedUrb->VUsb.pvReadAhead;
     320        pThis->pBuffUrbHead = (PVUSBURB)pBufferedUrb->pVUsb->pvReadAhead;
    321321        if (pThis->pBuffUrbHead == NULL)
    322322            pThis->pBuffUrbTail = NULL;
     
    344344            pUrb->aIsocPkts[i].enmStatus = pBufferedUrb->aIsocPkts[i].enmStatus;
    345345            cbTotal += len;
    346             Assert(pUrb->VUsb.cbDataAllocated >= cbTotal);
     346            Assert(pUrb->pVUsb->cbDataAllocated >= cbTotal);
    347347            memcpy(&pUrb->abData[off], &pBufferedUrb->abData[off], len);
    348348        }
     
    353353        Assert(pBufferedUrb->enmState == VUSBURBSTATE_REAPED);
    354354        LogFlow(("%s: vusbUrbSubmitBufferedRead: Freeing buffered URB\n", pBufferedUrb->pszDesc));
    355         pBufferedUrb->VUsb.pfnFree(pBufferedUrb);
     355        pBufferedUrb->pVUsb->pfnFree(pBufferedUrb);
    356356        // This assertion is wrong as the URB could be re-allocated in the meantime by the EMT (race)
    357357        // Assert(pBufferedUrb->enmState == VUSBURBSTATE_FREE);
  • trunk/src/VBox/Devices/USB/VUSBUrb.cpp

    r59700 r59704  
    162162 * Logs an URB.
    163163 *
    164  * Note that pUrb->VUsb.pDev and pUrb->VUsb.pDev->pUsbIns can all be NULL.
     164 * Note that pUrb->pVUsb->pDev and pUrb->pVUsb->pDev->pUsbIns can all be NULL.
    165165 */
    166166void vusbUrbTrace(PVUSBURB pUrb, const char *pszMsg, bool fComplete)
    167167{
    168     PVUSBDEV        pDev   = pUrb->VUsb.pDev; /* Can be NULL when called from usbProxyConstruct and friends. */
     168    PVUSBDEV        pDev   = pUrb->pVUsb ? pUrb->pVUsb->pDev : NULL; /* Can be NULL when called from usbProxyConstruct and friends. */
    169169    PVUSBPIPE       pPipe  = &pDev->aPipes[pUrb->EndPt];
    170170    const uint8_t  *pbData = pUrb->abData;
     
    180180         pUrb->pszDesc, s_cchMaxMsg, pszMsg,
    181181         pDev,
    182          pUrb->VUsb.pDev ? pUrb->VUsb.pDev->pUsbIns->pszName : "",
     182         pUrb->pVUsb && pUrb->pVUsb->pDev ? pUrb->pVUsb->pDev->pUsbIns->pszName : "",
    183183         vusbUrbStatusName(pUrb->enmStatus),
    184184         pDev ? pDev->u8Address : -1,
     
    188188         pUrb->cbData,
    189189         pUrb->cbData,
    190          pUrb->VUsb.u64SubmitTS,
    191          RTTimeNanoTS() - pUrb->VUsb.u64SubmitTS,
     190         pUrb->pVUsb ? pUrb->pVUsb->u64SubmitTS : 0,
     191         pUrb->pVUsb ? RTTimeNanoTS() - pUrb->pVUsb->u64SubmitTS : 0,
    192192         pUrb->fShortNotOk ? "ShortNotOk" : "ShortOk"));
    193193
     
    823823        Log3(("%16.*Rhxd\n", cbData, pbData));
    824824#endif
    825     if (pUrb->enmType == VUSBXFERTYPE_MSG && pUrb->VUsb.pCtrlUrb)
    826         vusbUrbTrace(pUrb->VUsb.pCtrlUrb, "NESTED MSG", fComplete);
     825    if (pUrb->enmType == VUSBXFERTYPE_MSG && pUrb->pVUsb && pUrb->pVUsb->pCtrlUrb)
     826        vusbUrbTrace(pUrb->pVUsb->pCtrlUrb, "NESTED MSG", fComplete);
    827827}
    828828#endif /* LOG_ENABLED */
     
    837837static void vusbMsgSetupCompletion(PVUSBURB pUrb)
    838838{
    839     PVUSBDEV        pDev   = pUrb->VUsb.pDev;
     839    PVUSBDEV        pDev   = pUrb->pVUsb->pDev;
    840840    PVUSBPIPE       pPipe  = &pDev->aPipes[pUrb->EndPt];
    841841    PVUSBCTRLEXTRA  pExtra = pPipe->pCtrl;
     
    856856static void vusbMsgDataCompletion(PVUSBURB pUrb)
    857857{
    858     PVUSBDEV        pDev   = pUrb->VUsb.pDev;
     858    PVUSBDEV        pDev   = pUrb->pVUsb->pDev;
    859859    PVUSBPIPE       pPipe  = &pDev->aPipes[pUrb->EndPt];
    860860    PVUSBCTRLEXTRA  pExtra = pPipe->pCtrl;
     
    875875static void vusbMsgStatusCompletion(PVUSBURB pUrb)
    876876{
    877     PVUSBDEV        pDev = pUrb->VUsb.pDev;
     877    PVUSBDEV        pDev = pUrb->pVUsb->pDev;
    878878    PVUSBPIPE       pPipe = &pDev->aPipes[pUrb->EndPt];
    879879    PVUSBCTRLEXTRA  pExtra = pPipe->pCtrl;
     
    916916static void vusbCtrlCompletion(PVUSBURB pUrb)
    917917{
    918     PVUSBDEV        pDev = pUrb->VUsb.pDev;
     918    PVUSBDEV        pDev = pUrb->pVUsb->pDev;
    919919    PVUSBPIPE       pPipe = &pDev->aPipes[pUrb->EndPt];
    920920    PVUSBCTRLEXTRA  pExtra = pPipe->pCtrl;
     
    943943static void vusbMsgCompletion(PVUSBURB pUrb)
    944944{
    945     PVUSBDEV        pDev   = pUrb->VUsb.pDev;
     945    PVUSBDEV        pDev   = pUrb->pVUsb->pDev;
    946946    PVUSBPIPE       pPipe  = &pDev->aPipes[pUrb->EndPt];
    947947
     
    965965     * Complete the original URB.
    966966     */
    967     PVUSBURB pCtrlUrb = pUrb->VUsb.pCtrlUrb;
     967    PVUSBURB pCtrlUrb = pUrb->pVUsb->pCtrlUrb;
    968968    pCtrlUrb->enmState = VUSBURBSTATE_REAPED;
    969969    vusbCtrlCompletion(pCtrlUrb);
     
    994994int vusbUrbErrorRh(PVUSBURB pUrb)
    995995{
    996     PVUSBDEV pDev = pUrb->VUsb.pDev;
     996    PVUSBDEV pDev = pUrb->pVUsb->pDev;
    997997    PVUSBROOTHUB pRh = vusbDevGetRh(pDev);
    998998    AssertPtrReturn(pRh, VERR_VUSB_DEVICE_NOT_ATTACHED);
     
    10131013              || pUrb->enmState == VUSBURBSTATE_CANCELLED, ("%d\n", pUrb->enmState));
    10141014
    1015     if (   pUrb->VUsb.pDev
    1016         && pUrb->VUsb.pDev->hSniffer)
    1017     {
    1018         int rc = VUSBSnifferRecordEvent(pUrb->VUsb.pDev->hSniffer, pUrb,
     1015    if (   pUrb->pVUsb->pDev
     1016        && pUrb->pVUsb->pDev->hSniffer)
     1017    {
     1018        int rc = VUSBSnifferRecordEvent(pUrb->pVUsb->pDev->hSniffer, pUrb,
    10191019                                          pUrb->enmStatus == VUSBSTATUS_OK
    10201020                                        ? VUSBSNIFFEREVENT_COMPLETE
     
    10241024    }
    10251025
    1026     PVUSBROOTHUB pRh = vusbDevGetRh(pUrb->VUsb.pDev);
     1026    PVUSBROOTHUB pRh = vusbDevGetRh(pUrb->pVUsb->pDev);
    10271027    AssertPtrReturnVoid(pRh);
    10281028
     
    11481148    {
    11491149        LogFlow(("%s: vusbUrbCompletionRh: Freeing URB\n", pUrb->pszDesc));
    1150         pUrb->VUsb.pfnFree(pUrb);
     1150        pUrb->pVUsb->pfnFree(pUrb);
    11511151    }
    11521152}
     
    11681168            return  pUrb->EndPt != 0                   /* not default control pipe */
    11691169                ||  pSetup->wValue != 0                /* not ENDPOINT_HALT */
    1170                 ||  !pUrb->VUsb.pDev->pUsbIns->pReg->pfnUsbClearHaltedEndpoint; /* not special need for backend */
     1170                ||  !pUrb->pVUsb->pDev->pUsbIns->pReg->pfnUsbClearHaltedEndpoint; /* not special need for backend */
    11711171        case VUSB_REQ_SET_ADDRESS:
    11721172        case VUSB_REQ_SET_CONFIGURATION:
     
    11821182         */
    11831183        case VUSB_REQ_GET_DESCRIPTOR:
    1184             if (    !pUrb->VUsb.pDev->pDescCache->fUseCachedDescriptors
     1184            if (    !pUrb->pVUsb->pDev->pDescCache->fUseCachedDescriptors
    11851185                ||  (pSetup->bmRequestType & VUSB_RECIP_MASK) != VUSB_TO_DEVICE)
    11861186                return true;
     
    11911191                    return false;
    11921192                case VUSB_DT_STRING:
    1193                     return !pUrb->VUsb.pDev->pDescCache->fUseCachedStringsDescriptors;
     1193                    return !pUrb->pVUsb->pDev->pDescCache->fUseCachedStringsDescriptors;
    11941194                default:
    11951195                    return true;
     
    12171217    /* Immediately return in case of error.
    12181218     * XXX There is still a race: The Rh might vanish after this point! */
    1219     PVUSBDEV pDev = pUrb->VUsb.pDev;
     1219    PVUSBDEV pDev = pUrb->pVUsb->pDev;
    12201220    PVUSBROOTHUB pRh = vusbDevGetRh(pDev);
    12211221    if (!pRh)
     
    12371237
    12381238    /* Queue the pUrb on the roothub */
    1239     pUrb->VUsb.pNext = pDev->pAsyncUrbHead;
     1239    pUrb->pVUsb->pNext = pDev->pAsyncUrbHead;
    12401240    if (pDev->pAsyncUrbHead)
    1241         pDev->pAsyncUrbHead->VUsb.ppPrev = &pUrb->VUsb.pNext;
     1241        pDev->pAsyncUrbHead->pVUsb->ppPrev = &pUrb->pVUsb->pNext;
    12421242    pDev->pAsyncUrbHead = pUrb;
    1243     pUrb->VUsb.ppPrev = &pDev->pAsyncUrbHead;
     1243    pUrb->pVUsb->ppPrev = &pDev->pAsyncUrbHead;
    12441244    RTCritSectLeave(&pDev->CritSectAsyncUrbs);
    12451245
     
    12541254static void vusbMsgSubmitSynchronously(PVUSBURB pUrb, bool fSafeRequest)
    12551255{
    1256     PVUSBDEV        pDev   = pUrb->VUsb.pDev;
     1256    PVUSBDEV        pDev   = pUrb->pVUsb->pDev;
    12571257    Assert(pDev);
    12581258    PVUSBPIPE       pPipe  = &pDev->aPipes[pUrb->EndPt];
     
    13291329 * If a new message urb comes up while it's in the CANCELLED state, we will
    13301330 * orphan it and it will be freed here in vusbMsgFreeUrb. We indicate this
    1331  * by setting VUsb.pvFreeCtx to NULL.
     1331 * by setting pVUsb->pvFreeCtx to NULL.
    13321332 *
    13331333 * If we have to free the message state structure because of device destruction,
    13341334 * configuration changes, or similar, we will orphan the message pipe state in
    1335  * the same way by setting VUsb.pvFreeCtx to NULL and let this function free it.
     1335 * the same way by setting pVUsb->pvFreeCtx to NULL and let this function free it.
    13361336 *
    13371337 * @param   pUrb
     
    13421342    PVUSBCTRLEXTRA pExtra = (PVUSBCTRLEXTRA)((uint8_t *)pUrb - RT_OFFSETOF(VUSBCTRLEXTRA, Urb));
    13431343    if (    pUrb->enmState == VUSBURBSTATE_CANCELLED
    1344         &&  !pUrb->VUsb.pvFreeCtx)
     1344        &&  !pUrb->pVUsb->pvFreeCtx)
    13451345    {
    13461346        LogFlow(("vusbMsgFreeUrb: Freeing orphan: %p (pUrb=%p)\n", pExtra, pUrb));
     
    13491349    else
    13501350    {
    1351         Assert(pUrb->VUsb.pvFreeCtx == &pExtra->Urb);
     1351        Assert(pUrb->pVUsb->pvFreeCtx == &pExtra->Urb);
    13521352        pUrb->enmState = VUSBURBSTATE_ALLOCATED;
    13531353        pUrb->fCompleting = false;
     
    13731373    }
    13741374    else
    1375         pExtra->Urb.VUsb.pvFreeCtx = NULL; /* see vusbMsgFreeUrb */
     1375        pExtra->Urb.pVUsb->pvFreeCtx = NULL; /* see vusbMsgFreeUrb */
    13761376}
    13771377
     
    13871387/** @todo reuse these? */
    13881388    PVUSBCTRLEXTRA pExtra;
    1389     const size_t cbMax = sizeof(pExtra->Urb.abData) + sizeof(VUSBSETUP);
     1389    const size_t cbMax = sizeof(VUSBURBVUSBINT) + sizeof(pExtra->Urb.abData) + sizeof(VUSBSETUP);
    13901390    pExtra = (PVUSBCTRLEXTRA)RTMemAllocZ(RT_OFFSETOF(VUSBCTRLEXTRA, Urb.abData[cbMax]));
    13911391    if (pExtra)
     
    14051405        RTStrAPrintf(&pExtra->Urb.pszDesc, "URB %p msg->%p", &pExtra->Urb, pUrb);
    14061406#endif
    1407         //pExtra->Urb.VUsb.pCtrlUrb = NULL;
    1408         //pExtra->Urb.VUsb.pNext = NULL;
    1409         //pExtra->Urb.VUsb.ppPrev = NULL;
    1410         pExtra->Urb.VUsb.pDev = pUrb->VUsb.pDev;
    1411         pExtra->Urb.VUsb.pfnFree = vusbMsgFreeUrb;
    1412         pExtra->Urb.VUsb.pvFreeCtx = &pExtra->Urb;
     1407        pExtra->Urb.pVUsb = (PVUSBURBVUSB)&pExtra->Urb.abData[sizeof(pExtra->Urb.abData) + sizeof(VUSBSETUP)];
     1408        //pExtra->Urb.pVUsb->pCtrlUrb = NULL;
     1409        //pExtra->Urb.pVUsb->pNext = NULL;
     1410        //pExtra->Urb.pVUsb->ppPrev = NULL;
     1411        pExtra->Urb.pVUsb->pDev = pUrb->pVUsb->pDev;
     1412        pExtra->Urb.pVUsb->pfnFree = vusbMsgFreeUrb;
     1413        pExtra->Urb.pVUsb->pvFreeCtx = &pExtra->Urb;
    14131414        //pExtra->Urb.Hci = {0};
    14141415        //pExtra->Urb.Dev.pvProxyUrb = NULL;
     
    14621463            return false;
    14631464        }
    1464         pExtra->Urb.VUsb.pvFreeCtx = NULL;
     1465        pExtra->Urb.pVUsb->pvFreeCtx = NULL;
    14651466        LogFlow(("vusbMsgSetup: Replacing canceled pExtra=%p with %p.\n", pExtra, pvNew));
    14661467        pPipe->pCtrl = pExtra = (PVUSBCTRLEXTRA)pvNew;
     
    15431544    pExtra->Urb.enmDir  = (pSetup->bmRequestType & VUSB_DIR_TO_HOST) ? VUSBDIRECTION_IN : VUSBDIRECTION_OUT;
    15441545    pExtra->Urb.cbData  = pSetup->wLength + sizeof(*pSetup);
    1545     pExtra->Urb.VUsb.pCtrlUrb = pUrb;
     1546    pExtra->Urb.pVUsb->pCtrlUrb = pUrb;
    15461547    int rc = vusbUrbQueueAsyncRh(&pExtra->Urb);
    15471548    if (RT_FAILURE(rc))
     
    15701571static int vusbMsgStall(PVUSBURB pUrb)
    15711572{
    1572     PVUSBPIPE       pPipe = &pUrb->VUsb.pDev->aPipes[pUrb->EndPt];
     1573    PVUSBPIPE       pPipe = &pUrb->pVUsb->pDev->aPipes[pUrb->EndPt];
    15731574    PVUSBCTRLEXTRA  pExtra = pPipe->pCtrl;
    15741575    LogFlow(("%s: vusbMsgStall: pPipe=%p err=STALL stage %s->SETUP\n",
     
    16011602    vusbUrbTrace(pUrb, "vusbUrbSubmitCtrl", false);
    16021603#endif
    1603     PVUSBDEV        pDev = pUrb->VUsb.pDev;
     1604    PVUSBDEV        pDev = pUrb->pVUsb->pDev;
    16041605    PVUSBPIPE       pPipe = &pDev->aPipes[pUrb->EndPt];
    16051606
     
    18571858    vusbUrbAssert(pUrb);
    18581859    Assert(pUrb->enmState == VUSBURBSTATE_ALLOCATED);
    1859     PVUSBDEV pDev = pUrb->VUsb.pDev;
     1860    PVUSBDEV pDev = pUrb->pVUsb->pDev;
    18601861    PVUSBPIPE pPipe = NULL;
    18611862    Assert(pDev);
     
    18751876#ifdef LOG_ENABLED
    18761877    /* stamp it */
    1877     pUrb->VUsb.u64SubmitTS = RTTimeNanoTS();
     1878    pUrb->pVUsb->u64SubmitTS = RTTimeNanoTS();
    18781879#endif
    18791880
     
    20032004    {
    20042005        vusbUrbAssert(pUrb);
    2005         PVUSBURB pUrbNext = pUrb->VUsb.pNext;
    2006         PVUSBDEV pDev = pUrb->VUsb.pDev;
     2006        PVUSBURB pUrbNext = pUrb->pVUsb->pNext;
     2007        PVUSBDEV pDev = pUrb->pVUsb->pDev;
    20072008
    20082009        /* Don't touch resetting devices - paranoid safety precaution. */
     
    20242025                vusbUrbAssert(pRipe);
    20252026                if (pRipe == pUrbNext)
    2026                     pUrbNext = pUrbNext->VUsb.pNext;
     2027                    pUrbNext = pUrbNext->pVUsb->pNext;
    20272028                vusbUrbRipe(pRipe);
    20282029            }
     
    20752076static void vusbUrbCompletion(PVUSBURB pUrb)
    20762077{
    2077     Assert(pUrb->VUsb.pDev->aPipes);
    2078     ASMAtomicDecU32(&pUrb->VUsb.pDev->aPipes[pUrb->EndPt].async);
     2078    Assert(pUrb->pVUsb->pDev->aPipes);
     2079    ASMAtomicDecU32(&pUrb->pVUsb->pDev->aPipes[pUrb->EndPt].async);
    20792080
    20802081    if (pUrb->enmState == VUSBURBSTATE_REAPED)
     
    20822083#ifdef VBOX_WITH_USB
    20832084    // Read-ahead URBs are handled differently
    2084     if (pUrb->VUsb.pvReadAhead)
     2085    if (pUrb->pVUsb->pvReadAhead)
    20852086        vusbUrbCompletionReadAhead(pUrb);
    20862087    else
     
    21002101    vusbUrbAssert(pUrb);
    21012102#ifdef VBOX_WITH_STATISTICS
    2102     PVUSBROOTHUB pRh = vusbDevGetRh(pUrb->VUsb.pDev);
     2103    PVUSBROOTHUB pRh = vusbDevGetRh(pUrb->pVUsb->pDev);
    21032104#endif
    21042105    if (pUrb->enmState == VUSBURBSTATE_IN_FLIGHT)
     
    21132114
    21142115        pUrb->enmState = VUSBURBSTATE_CANCELLED;
    2115         PPDMUSBINS pUsbIns = pUrb->VUsb.pDev->pUsbIns;
     2116        PPDMUSBINS pUsbIns = pUrb->pVUsb->pDev->pUsbIns;
    21162117        pUsbIns->pReg->pfnUrbCancel(pUsbIns, pUrb);
    21172118        Assert(pUrb->enmState == VUSBURBSTATE_CANCELLED || pUrb->enmState == VUSBURBSTATE_REAPED);
     
    21782179void vusbUrbCancel(PVUSBURB pUrb, CANCELMODE mode)
    21792180{
    2180     int rc = vusbDevIoThreadExecSync(pUrb->VUsb.pDev, (PFNRT)vusbUrbCancelWorker, 2, pUrb, mode);
     2181    int rc = vusbDevIoThreadExecSync(pUrb->pVUsb->pDev, (PFNRT)vusbUrbCancelWorker, 2, pUrb, mode);
    21812182    AssertRC(rc);
    21822183}
     
    21912192    if (!ASMAtomicXchgBool(&pUrb->fCompleting, true))
    21922193    {
    2193         int rc = vusbDevIoThreadExec(pUrb->VUsb.pDev, 0 /* fFlags */, (PFNRT)vusbUrbCancelWorker, 2, pUrb, mode);
     2194        int rc = vusbDevIoThreadExec(pUrb->pVUsb->pDev, 0 /* fFlags */, (PFNRT)vusbUrbCancelWorker, 2, pUrb, mode);
    21942195        AssertRC(rc);
    21952196    }
     
    22192220        vusbUrbUnlink(pUrb);
    22202221        LogFlow(("%s: vusbUrbRipe: Freeing cancelled URB\n", pUrb->pszDesc));
    2221         pUrb->VUsb.pfnFree(pUrb);
     2222        pUrb->pVUsb->pfnFree(pUrb);
    22222223    }
    22232224    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