VirtualBox

Changeset 91737 in vbox for trunk/src/VBox/Devices/USB


Ignore:
Timestamp:
Oct 14, 2021 6:41:12 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
147477
Message:

OHCI: Straightened out ED/TD iteration limits (see bugref:10103).

File:
1 edited

Legend:

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

    r90447 r91737  
    17791779{
    17801780    uint32_t GCPhys = GCPhysHead;
    1781     int cMax = 100;
     1781    int cIterations = 128;
    17821782    for (;;)
    17831783    {
     
    18061806        GCPhys = Td.NextTD & ED_PTR_MASK;
    18071807        Assert(GCPhys != GCPhysHead);
    1808         Assert(cMax-- > 0); NOREF(cMax);
     1808        if (!--cIterations)
     1809            break;
    18091810    }
    18101811}
     
    18281829    RT_NOREF(fFull);
    18291830    uint32_t GCPhys = GCPhysHead;
    1830     int cMax = 100;
     1831    int cIterations = 100;
    18311832    for (;;)
    18321833    {
     
    18551856        GCPhys = ITd.NextTD & ED_PTR_MASK;
    18561857        Assert(GCPhys != GCPhysHead);
    1857         Assert(cMax-- > 0); NOREF(cMax);
     1858        if (!--cIterations)
     1859            break;
    18581860    }
    18591861}
     
    22472249    AssertMsgReturn(LastTdAddr != TdAddr, ("TdAddr=%#010RX32\n", TdAddr), false);
    22482250
    2249     uint32_t cMax = 256;
     2251    uint32_t cIterations = 256;
    22502252    uint32_t CurTdAddr = pEd->HeadP & ED_PTR_MASK;
    22512253    while (     CurTdAddr != LastTdAddr
    2252            &&   cMax-- > 0)
     2254           &&   cIterations-- > 0)
    22532255    {
    22542256        OHCIITD ITd;
     
    22662268    }
    22672269
    2268     Log(("ohciUnlinkIsocTdInList: TdAddr=%#010RX32 wasn't found in the list!!! (cMax=%d)\n", TdAddr, cMax));
     2270    Log(("ohciUnlinkIsocTdInList: TdAddr=%#010RX32 wasn't found in the list!!! (cIterations=%d)\n", TdAddr, cIterations));
    22692271    return false;
    22702272}
     
    22792281    AssertMsgReturn(LastTdAddr != TdAddr, ("TdAddr=%#010RX32\n", TdAddr), false);
    22802282
    2281     uint32_t cMax = 256;
     2283    uint32_t cIterations = 256;
    22822284    uint32_t CurTdAddr = pEd->HeadP & ED_PTR_MASK;
    22832285    while (     CurTdAddr != LastTdAddr
    2284            &&   cMax-- > 0)
     2286           &&   cIterations-- > 0)
    22852287    {
    22862288        OHCITD Td;
     
    22982300    }
    22992301
    2300     Log(("ohciR3UnlinkGeneralTdInList: TdAddr=%#010RX32 wasn't found in the list!!! (cMax=%d)\n", TdAddr, cMax));
     2302    Log(("ohciR3UnlinkGeneralTdInList: TdAddr=%#010RX32 wasn't found in the list!!! (cIterations=%d)\n", TdAddr, cIterations));
    23012303    return false;
    23022304}
     
    37393741
    37403742    uint32_t EdAddr = pThis->bulk_head;
    3741     while (EdAddr && (pThis->ctl & OHCI_CTL_BLE))
     3743    uint32_t cIterations = 256;
     3744    while (EdAddr
     3745        && (pThis->ctl & OHCI_CTL_BLE)
     3746        && (cIterations-- > 0))
    37423747    {
    37433748        OHCIED Ed;
     
    38413846
    38423847    uint32_t EdAddr = pThis->bulk_head;
    3843     while (EdAddr)
     3848    uint32_t cIterations = 256;
     3849    while (EdAddr
     3850        && (cIterations-- > 0))
    38443851    {
    38453852        OHCIED Ed;
     
    38923899
    38933900    uint32_t EdAddr = pThis->ctrl_head;
    3894     while (EdAddr && (pThis->ctl & OHCI_CTL_CLE))
     3901    uint32_t cIterations = 256;
     3902    while ( EdAddr
     3903        && (pThis->ctl & OHCI_CTL_CLE)
     3904        && (cIterations-- > 0))
    38953905    {
    38963906        OHCIED Ed;
     
    39713981     * Iterate the endpoint list.
    39723982     */
    3973     while (EdAddr && (pThis->ctl & OHCI_CTL_PLE))
     3983    unsigned cIterations = 128;
     3984    while (EdAddr
     3985        && (pThis->ctl & OHCI_CTL_PLE)
     3986        && (cIterations-- > 0))
    39743987    {
    39753988        OHCIED Ed;
     
    41444157            break;
    41454158        }
    4146         while (EdAddr)
     4159
     4160        unsigned cIterED = 128;
     4161        while ( EdAddr
     4162            && (cIterED-- > 0))
    41474163        {
    41484164            OHCIED Ed;
     
    41524168            uint32_t TdAddr = Ed.HeadP & ED_PTR_MASK;
    41534169            uint32_t TailP  = Ed.TailP & ED_PTR_MASK;
    4154             unsigned k = 0;
     4170            unsigned cIterTD = 0;
    41554171            if (  !(Ed.hwinfo & ED_HWINFO_SKIP)
    41564172                && (TdAddr != TailP))
     
    41764192                        break;
    41774193                    /* Failsafe for temporarily looped lists. */
    4178                     if (++k == 128)
     4194                    if (++cIterTD == 128)
    41794195                        break;
    41804196                } while (TdAddr != (Ed.TailP & ED_PTR_MASK));
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