VirtualBox

Changeset 56399 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jun 12, 2015 10:34:27 PM (10 years ago)
Author:
vboxsync
Message:

nits

File:
1 edited

Legend:

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

    r56394 r56399  
    704704static void ataAsyncIOClearRequests(PATACONTROLLER pCtl)
    705705{
    706     int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VERR_IGNORED);
     706    int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VINF_SUCCESS);
    707707    AssertRC(rc);
    708708
     
    717717static void ataAsyncIOPutRequest(PATACONTROLLER pCtl, const ATARequest *pReq)
    718718{
    719     int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VERR_IGNORED);
     719    int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VINF_SUCCESS);
    720720    AssertRC(rc);
    721721
     
    741741    const ATARequest *pReq;
    742742
    743     int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VERR_IGNORED);
     743    int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VINF_SUCCESS);
    744744    AssertRC(rc);
    745745
     
    765765static void ataAsyncIORemoveCurrentRequest(PATACONTROLLER pCtl, ATAAIO ReqType)
    766766{
    767     int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VERR_IGNORED);
     767    int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VINF_SUCCESS);
    768768    AssertRC(rc);
    769769
     
    788788static void ataAsyncIODumpRequests(PATACONTROLLER pCtl)
    789789{
    790     int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VERR_IGNORED);
     790    int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VINF_SUCCESS);
    791791    AssertRC(rc);
    792792
     
    837837static bool ataAsyncIOIsIdle(PATACONTROLLER pCtl, bool fStrict)
    838838{
    839     int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VERR_IGNORED);
     839    int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VINF_SUCCESS);
    840840    AssertRC(rc);
    841841
     
    45594559#ifndef IN_RING3
    45604560    if ((val ^ pCtl->aIfs[0].uATARegDevCtl) & ATA_DEVCTL_RESET)
    4561         return VINF_IOM_R3_IOPORT_WRITE; /* The RESET stuff is too complicated for GC. */
     4561        return VINF_IOM_R3_IOPORT_WRITE; /* The RESET stuff is too complicated for RC+R0. */
    45624562#endif /* !IN_RING3 */
    45634563
    45644564    Log2(("%s: addr=%#x val=%#04x\n", __FUNCTION__, addr, val));
    45654565    /* RESET is common for both drives attached to a controller. */
    4566     if (!(pCtl->aIfs[0].uATARegDevCtl & ATA_DEVCTL_RESET) &&
    4567             (val & ATA_DEVCTL_RESET))
     4566    if (   !(pCtl->aIfs[0].uATARegDevCtl & ATA_DEVCTL_RESET)
     4567        && (val & ATA_DEVCTL_RESET))
    45684568    {
    45694569#ifdef IN_RING3
    45704570        /* Software RESET low to high */
    4571         int32_t uCmdWait0 = -1, uCmdWait1 = -1;
     4571        int32_t uCmdWait0 = -1;
     4572        int32_t uCmdWait1 = -1;
    45724573        uint64_t uNow = RTTimeNanoTS();
    45734574        if (pCtl->aIfs[0].u64CmdTS)
     
    45764577            uCmdWait1 = (uNow - pCtl->aIfs[1].u64CmdTS) / 1000;
    45774578        LogRel(("PIIX3 ATA: Ctl#%d: RESET, DevSel=%d AIOIf=%d CmdIf0=%#04x (%d usec ago) CmdIf1=%#04x (%d usec ago)\n",
    4578                     ATACONTROLLER_IDX(pCtl), pCtl->iSelectedIf, pCtl->iAIOIf,
    4579                     pCtl->aIfs[0].uATARegCommand, uCmdWait0,
    4580                     pCtl->aIfs[1].uATARegCommand, uCmdWait1));
     4579                ATACONTROLLER_IDX(pCtl), pCtl->iSelectedIf, pCtl->iAIOIf,
     4580                pCtl->aIfs[0].uATARegCommand, uCmdWait0,
     4581                pCtl->aIfs[1].uATARegCommand, uCmdWait1));
    45814582        pCtl->fReset = true;
    45824583        /* Everything must be done after the reset flag is set, otherwise
     
    46104611#endif /* IN_RING3 */
    46114612    }
    4612     else if ((pCtl->aIfs[0].uATARegDevCtl & ATA_DEVCTL_RESET) &&
    4613                !(val & ATA_DEVCTL_RESET))
     4613    else if (   (pCtl->aIfs[0].uATARegDevCtl & ATA_DEVCTL_RESET)
     4614             && !(val & ATA_DEVCTL_RESET))
    46144615    {
    46154616#ifdef IN_RING3
     
    46304631    /* Change of interrupt disable flag. Update interrupt line if interrupt
    46314632     * is pending on the current interface. */
    4632     if ((val ^ pCtl->aIfs[0].uATARegDevCtl) & ATA_DEVCTL_DISABLE_IRQ
    4633         &&  pCtl->aIfs[pCtl->iSelectedIf].fIrqPending)
     4633    if (   ((val ^ pCtl->aIfs[0].uATARegDevCtl) & ATA_DEVCTL_DISABLE_IRQ)
     4634        && pCtl->aIfs[pCtl->iSelectedIf].fIrqPending)
    46344635    {
    46354636        if (!(val & ATA_DEVCTL_DISABLE_IRQ))
     
    47894790        else
    47904791            return VINF_IOM_R3_IOPORT_WRITE;
    4791 #else /* IN_RING3 */
     4792#else  /* IN_RING3 */
    47924793        memcpy(p, pbBuf, cbSize);
    47934794        s->iIOBufferPIODataStart += cbSize;
    47944795        if (s->iIOBufferPIODataStart >= s->iIOBufferPIODataEnd)
    47954796            ataPIOTransferFinish(pCtl, s);
    4796 #endif /* !IN_RING3 */
     4797#endif /* IN_RING3 */
    47974798    }
    47984799    else
     
    48124813        p = s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart;
    48134814#ifndef IN_RING3
    4814         /* All but the last transfer unit is simple enough for GC, but
     4815        /* All but the last transfer unit is simple enough for RC, but
    48154816         * sending a request to the async IO thread is too complicated. */
    48164817        if (s->iIOBufferPIODataStart + cbSize < s->iIOBufferPIODataEnd)
     
    48214822        else
    48224823            return VINF_IOM_R3_IOPORT_READ;
    4823 #else /* IN_RING3 */
     4824#else  /* IN_RING3 */
    48244825        memcpy(pbBuf, p, cbSize);
    48254826        s->iIOBufferPIODataStart += cbSize;
    48264827        if (s->iIOBufferPIODataStart >= s->iIOBufferPIODataEnd)
    48274828            ataPIOTransferFinish(pCtl, s);
    4828 #endif /* !IN_RING3 */
     4829#endif /* IN_RING3 */
    48294830    }
    48304831    else
     
    50405041     * unnecessary work and racing ataR3WaitForAsyncIOIsIdle.
    50415042     */
    5042     int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VERR_IGNORED);
     5043    int rc = PDMCritSectEnter(&pCtl->AsyncIORequestLock, VINF_SUCCESS);
    50435044    AssertRC(rc);
    50445045
     
    50545055}
    50555056
    5056 /** Async I/O thread for an interface. Once upon a time this was readable
    5057  * code with several loops and a different semaphore for each purpose. But
    5058  * then came the "how can one save the state in the middle of a PIO transfer"
    5059  * question. The solution was to use an ASM, which is what's there now. */
    5060 static DECLCALLBACK(int) ataAsyncIOLoop(RTTHREAD ThreadSelf, void *pvUser)
     5057/**
     5058 * Async I/O thread for an interface.
     5059 *
     5060 * Once upon a time this was readable code with several loops and a different
     5061 * semaphore for each purpose. But then came the "how can one save the state in
     5062 * the middle of a PIO transfer" question.  The solution was to use an ASM,
     5063 * which is what's there now.
     5064 */
     5065static DECLCALLBACK(int) ataR3AsyncIOThread(RTTHREAD ThreadSelf, void *pvUser)
    50615066{
    50625067    const ATARequest *pReq;
     
    51405145#if defined(DEBUG) || defined(VBOX_WITH_STATISTICS)
    51415146            STAM_PROFILE_ADV_START(&pCtl->StatAsyncTime, a);
    5142 #endif /* DEBUG || VBOX_WITH_STATISTICS */
     5147#endif
    51435148        }
    51445149
     
    54785483        if (pCtl->uAsyncIOState == ATA_AIO_NEW && !pCtl->fChainedTransfer)
    54795484        {
    5480 #if defined(DEBUG) || defined(VBOX_WITH_STATISTICS)
     5485# if defined(DEBUG) || defined(VBOX_WITH_STATISTICS)
    54815486            STAM_PROFILE_ADV_STOP(&pCtl->StatAsyncTime, a);
    5482 #endif /* DEBUG || VBOX_WITH_STATISTICS */
     5487# endif
    54835488
    54845489            u64TS = RTTimeNanoTS() - u64TS;
     
    55205525            }
    55215526
    5522 #if defined(DEBUG) || defined(VBOX_WITH_STATISTICS)
     5527# if defined(DEBUG) || defined(VBOX_WITH_STATISTICS)
    55235528            if (uWait < pCtl->StatAsyncMinWait || !pCtl->StatAsyncMinWait)
    55245529                pCtl->StatAsyncMinWait = uWait;
     
    55285533            STAM_COUNTER_ADD(&pCtl->StatAsyncTimeUS, uWait);
    55295534            STAM_COUNTER_INC(&pCtl->StatAsyncOps);
    5530 #endif /* DEBUG || VBOX_WITH_STATISTICS */
     5535# endif /* DEBUG || VBOX_WITH_STATISTICS */
    55315536        }
    55325537
     
    74177422
    74187423        ataAsyncIOClearRequests(pCtl);
    7419         rc = RTThreadCreateF(&pCtl->AsyncIOThread, ataAsyncIOLoop, (void *)pCtl, 128*1024 /*cbStack*/,
     7424        rc = RTThreadCreateF(&pCtl->AsyncIOThread, ataR3AsyncIOThread, (void *)pCtl, 128*1024 /*cbStack*/,
    74207425                             RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "ATA-%u", i);
    74217426        AssertLogRelRCReturn(rc, rc);
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