VirtualBox

Changeset 32052 in vbox for trunk/src


Ignore:
Timestamp:
Aug 27, 2010 2:03:57 PM (14 years ago)
Author:
vboxsync
Message:

OHCI: If the bulk list disabled, undo (abort) outstanding bulk transfers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/USB/DevOHCI.cpp

    r32010 r32052  
    346346    /** Idle detection flag; must be cleared at start of frame */
    347347    bool                fIdle;
    348 
    349     uint32_t            Alignment3;     /**< Align size on a 8 byte boundary. */
     348    /** A flag indicating that the bulk list may have in-flight URBs. */
     349    bool                fBulkNeedsCleaning;
    350350} OHCI;
    351351
     
    31573157     */
    31583158    pOhci->status &= ~OHCI_STATUS_BLF;
     3159    pOhci->fBulkNeedsCleaning = false;
    31593160    pOhci->bulk_cur = 0;
    31603161
     
    31683169        {
    31693170            pOhci->status |= OHCI_STATUS_BLF;
     3171            pOhci->fBulkNeedsCleaning = true;
    31703172
    31713173#if 1
     
    32323234}
    32333235
     3236/**
     3237 * Abort outstanding transfers on the bulk list.
     3238 *
     3239 * If the guest disabled bulk list processing, we must abort any outstanding transfers
     3240 * (that is, cancel in-flight URBs associated with the list). This is required because
     3241 * there may be outstanding read URBs that will never get a response from the device
     3242 * and would block further communication.
     3243 */
     3244static void ohciUndoBulkList(POHCI pOhci)
     3245{
     3246#ifdef LOG_ENABLED
     3247    if (g_fLogBulkEPs)
     3248        ohciDumpEdList(pOhci, pOhci->bulk_head, "Bulk before", true);
     3249    if (pOhci->bulk_cur)
     3250        Log(("ohciUndoBulkList: bulk_cur=%#010x before list processing!!! HCD has positioned us!!!\n", pOhci->bulk_cur));
     3251#endif
     3252
     3253    /* This flag follows OHCI_STATUS_BLF, but BLF doesn't change when list processing is disabled. */
     3254    pOhci->fBulkNeedsCleaning = false;
     3255
     3256    uint32_t EdAddr = pOhci->bulk_head;
     3257    while (EdAddr)
     3258    {
     3259        OHCIED Ed;
     3260        ohciReadEd(pOhci, EdAddr, &Ed);
     3261        Assert(!(Ed.hwinfo & ED_HWINFO_ISO)); /* the guest is screwing us */
     3262        if (ohciIsEdReady(&Ed))
     3263        {
     3264            uint32_t TdAddr = Ed.HeadP & ED_PTR_MASK;
     3265            if (ohciIsTdInFlight(pOhci, TdAddr))
     3266            {
     3267                LogFlow(("ohciUndoBulkList: Ed=%#010RX32 Ed.TailP=%#010RX32 UNDO\n", EdAddr, Ed.TailP));
     3268                PVUSBURB pUrb = ohciTdInFlightUrb(pOhci, TdAddr);
     3269                if (pUrb)
     3270                    pOhci->RootHub.pIRhConn->pfnCancelUrbsEp(pOhci->RootHub.pIRhConn, pUrb);
     3271            }
     3272        }
     3273        /* next endpoint */
     3274        EdAddr = Ed.NextED & ED_PTR_MASK;
     3275    }
     3276}
     3277
    32343278
    32353279/**
     
    35113555        &&  (pOhci->status & OHCI_STATUS_BLF))
    35123556        ohciServiceBulkList(pOhci);
     3557    else if ((pOhci->status & OHCI_STATUS_BLF)
     3558        &&    pOhci->fBulkNeedsCleaning)
     3559        ohciUndoBulkList(pOhci);    /* If list disabled but not empty, abort endpoints. */
    35133560
    35143561#if 1
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