VirtualBox

Changeset 71711 in vbox


Ignore:
Timestamp:
Apr 6, 2018 3:47:49 PM (7 years ago)
Author:
vboxsync
Message:

DevHDA: More stuff we can do in R0/RC.

Location:
trunk/src/VBox/Devices/Audio
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DevHDA.cpp

    r71710 r71711  
    541541
    542542
    543 #ifdef IN_RING3
    544 
    545543/**
    546544 * Retrieves the number of bytes of a FIFOW register.
     
    563561}
    564562
     563#ifdef IN_RING3
    565564/**
    566565 * Reschedules pending interrupts for all audio streams which have complete
     
    596595# endif
    597596}
    598 
    599597#endif /* IN_RING3 */
    600598
     
    12711269static int hdaRegWriteSDCBL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
    12721270{
    1273 #ifdef IN_RING3
    1274     DEVHDA_LOCK(pThis);
     1271    DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
    12751272
    12761273    PHDASTREAM pStream = hdaGetStreamFromSD(pThis, HDA_SD_NUM_FROM_REG(pThis, CBL, iReg));
     
    12841281                 HDA_SD_NUM_FROM_REG(pThis, CTL, iReg), u32Value));
    12851282
    1286     int rc2 = hdaRegWriteU32(pThis, iReg, u32Value);
    1287     AssertRC(rc2);
     1283    int rc = hdaRegWriteU32(pThis, iReg, u32Value);
     1284    AssertRCSuccess(rc);
    12881285
    12891286    DEVHDA_UNLOCK(pThis);
    1290     return VINF_SUCCESS; /* Always return success to the MMIO handler. */
    1291 #else  /* !IN_RING3 */
    1292     RT_NOREF_PV(pThis); RT_NOREF_PV(iReg); RT_NOREF_PV(u32Value);
    1293     return VINF_IOM_R3_MMIO_WRITE;
    1294 #endif /* IN_RING3 */
     1287    return rc;
    12951288}
    12961289
     
    15991592static int hdaRegWriteSDLVI(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
    16001593{
    1601 #ifdef IN_RING3
    1602     DEVHDA_LOCK(pThis);
     1594    DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
    16031595
    16041596    if (HDA_REG_IND(pThis, iReg) == u32Value) /* Value already set? */
     
    16141606            LogFunc(("[SD%RU8] Updating LVI to %RU16\n", uSD, pStream->u16LVI));
    16151607
    1616 # ifdef HDA_USE_DMA_ACCESS_HANDLER
     1608#ifdef HDA_USE_DMA_ACCESS_HANDLER
    16171609            if (hdaGetDirFromSD(uSD) == PDMAUDIODIR_OUT)
    16181610            {
     
    16221614                    LogFunc(("[SD%RU8] DMA logging enabled\n", pStream->u8SD));
    16231615            }
    1624 # endif
     1616#endif
    16251617        }
    16261618        else
     
    16331625    DEVHDA_UNLOCK(pThis);
    16341626    return VINF_SUCCESS; /* Always return success to the MMIO handler. */
    1635 #else  /* !IN_RING3 */
    1636     RT_NOREF_PV(pThis); RT_NOREF_PV(iReg); RT_NOREF_PV(u32Value);
    1637     return VINF_IOM_R3_MMIO_WRITE;
    1638 #endif /* IN_RING3 */
    16391627}
    16401628
    16411629static int hdaRegWriteSDFIFOW(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
    16421630{
    1643 #ifdef IN_RING3
    1644     DEVHDA_LOCK(pThis);
     1631    DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
    16451632
    16461633    uint8_t uSD = HDA_SD_NUM_FROM_REG(pThis, FIFOW, iReg);
     
    16481635    if (hdaGetDirFromSD(uSD) != PDMAUDIODIR_IN) /* FIFOW for input streams only. */
    16491636    {
     1637#ifndef IN_RING0
    16501638        LogRel(("HDA: Warning: Guest tried to write read-only FIFOW to output stream #%RU8, ignoring\n", uSD));
    1651 
    16521639        DEVHDA_UNLOCK(pThis);
    16531640        return VINF_SUCCESS;
     1641#else
     1642        DEVHDA_UNLOCK(pThis);
     1643        return VINF_IOM_R3_MMIO_WRITE;
     1644#endif
    16541645    }
    16551646
     
    16911682    DEVHDA_UNLOCK(pThis);
    16921683    return VINF_SUCCESS; /* Always return success to the MMIO handler. */
    1693 #else  /* !IN_RING3 */
    1694     RT_NOREF_PV(pThis); RT_NOREF_PV(iReg); RT_NOREF_PV(u32Value);
    1695     return VINF_IOM_R3_MMIO_WRITE;
    1696 #endif /* IN_RING3 */
    16971684}
    16981685
     
    17021689static int hdaRegWriteSDFIFOS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
    17031690{
    1704 #ifdef IN_RING3
    1705     DEVHDA_LOCK(pThis);
     1691    DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
    17061692
    17071693    uint8_t uSD = HDA_SD_NUM_FROM_REG(pThis, FIFOS, iReg);
     
    17561742    DEVHDA_UNLOCK(pThis);
    17571743    return VINF_SUCCESS; /* Always return success to the MMIO handler. */
    1758 #else  /* !IN_RING3 */
    1759     RT_NOREF_PV(pThis); RT_NOREF_PV(iReg); RT_NOREF_PV(u32Value);
    1760     return VINF_IOM_R3_MMIO_WRITE;
    1761 #endif /* IN_RING3 */
    17621744}
    17631745
  • trunk/src/VBox/Devices/Audio/DevHDACommon.cpp

    r71688 r71711  
    101101
    102102#ifdef IN_RING3
     103
    103104/**
    104105 * Sets the actual WALCLK register to the specified wall clock value.
     
    117118                                                                           u64WalClk);
    118119    const uint64_t u64FrontAbsWalClk  = hdaStreamPeriodGetAbsElapsedWalClk(&hdaGetStreamFromSink(pThis, &pThis->SinkFront)->State.Period);
    119 #ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
    120 # error "Implement me!"
    121 #endif
     120# ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
     121#  error "Implement me!"
     122# endif
    122123
    123124    const bool     fLineInPassed      = hdaStreamPeriodHasPassedAbsWalClk (&hdaGetStreamFromSink(pThis, &pThis->SinkLineIn)->State.Period, u64WalClk);
    124125    const uint64_t u64LineInAbsWalClk = hdaStreamPeriodGetAbsElapsedWalClk(&hdaGetStreamFromSink(pThis, &pThis->SinkLineIn)->State.Period);
    125 #ifdef VBOX_WITH_HDA_MIC_IN
     126# ifdef VBOX_WITH_HDA_MIC_IN
    126127    const bool     fMicInPassed       = hdaStreamPeriodHasPassedAbsWalClk (&hdaGetStreamFromSink(pThis, &pThis->SinkMicIn)->State.Period,  u64WalClk);
    127128    const uint64_t u64MicInAbsWalClk  = hdaStreamPeriodGetAbsElapsedWalClk(&hdaGetStreamFromSink(pThis, &pThis->SinkMicIn)->State.Period);
    128 #endif
    129 
    130 #ifdef VBOX_STRICT
     129# endif
     130
     131# ifdef VBOX_STRICT
    131132    const uint64_t u64WalClkCur       = ASMAtomicReadU64(&pThis->u64WalClk);
    132 #endif
     133# endif
    133134
    134135    /* Only drive the WALCLK register forward if all (active) stream periods have passed
    135136     * the specified point in time given by u64WalClk. */
    136137    if (  (   fFrontPassed
    137 #ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
    138 # error "Implement me!"
    139 #endif
     138# ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
     139#  error "Implement me!"
     140# endif
    140141           && fLineInPassed
    141 #ifdef VBOX_WITH_HDA_MIC_IN
     142# ifdef VBOX_WITH_HDA_MIC_IN
    142143           && fMicInPassed
    143 #endif
     144# endif
    144145          )
    145146       || fForce)
     
    150151             * Not the most elegant solution, but works for now ... */
    151152            u64WalClk = RT_MAX(u64WalClk, u64FrontAbsWalClk);
    152 #ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
    153 # error "Implement me!"
    154 #endif
     153# ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
     154#  error "Implement me!"
     155# endif
    155156            u64WalClk = RT_MAX(u64WalClk, u64LineInAbsWalClk);
    156 #ifdef VBOX_WITH_HDA_MIC_IN
     157# ifdef VBOX_WITH_HDA_MIC_IN
    157158            u64WalClk = RT_MAX(u64WalClk, u64MicInAbsWalClk);
    158 #endif
    159 
    160 #ifdef VBOX_STRICT
     159# endif
     160
     161# ifdef VBOX_STRICT
    161162            AssertMsg(u64WalClk >= u64WalClkCur,
    162163                      ("Setting WALCLK to a value going backwards does not make any sense (old %RU64 vs. new %RU64)\n",
     
    170171            else
    171172                pThis->u8WalClkStaleCnt = 0;
    172 #endif
     173# endif
    173174        }
    174175
     
    203204        if (uSD == uFirstSDI) /* First SDI. */
    204205            return &pThis->SinkLineIn;
    205 #ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
     206# ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
    206207        else if (uSD == uFirstSDI + 1)
    207208            return &pThis->SinkMicIn;
    208 #else
     209# else
    209210        else /* If we don't have a dedicated Mic-In sink, use the always present Line-In sink. */
    210211            return &pThis->SinkLineIn;
    211 #endif
     212# endif
    212213    }
    213214    else
     
    217218        if (uSD == uFirstSDO)
    218219            return &pThis->SinkFront;
    219 #ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
     220# ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
    220221        else if (uSD == uFirstSDO + 1)
    221222            return &pThis->SinkCenterLFE;
    222223        else if (uSD == uFirstSDO + 2)
    223224            return &pThis->SinkRear;
    224 #endif
     225# endif
    225226    }
    226227
    227228    return NULL;
    228229}
     230
     231#endif /* IN_RING */
    229232
    230233/**
     
    268271    return &pThis->aStreams[uSD];
    269272}
     273
     274#ifdef IN_RING3
    270275
    271276/**
     
    434439    return rc;
    435440}
     441
    436442#endif /* IN_RING3 */
    437443
  • trunk/src/VBox/Devices/Audio/HDAStreamPeriod.cpp

    r70125 r71711  
    412412                             /* All frames transferred? */
    413413                             && pPeriod->framesTransferred >= pPeriod->framesToTransfer;
    414 #ifdef VBOX_STRICT
     414# ifdef VBOX_STRICT
    415415    if (fIsComplete)
    416416    {
     
    418418        Assert(pPeriod->u64ElapsedWalClk  == pPeriod->u64DurationWalClk);
    419419    }
    420 #endif
     420# endif
    421421
    422422    Log3Func(("[SD%RU8] Period %s - runtime %RU64 / %RU64 (abs @ %RU64, starts @ %RU64, ends @ %RU64), %RU8 IRQs pending\n",
     
    429429    return fIsComplete;
    430430}
     431
    431432#endif /* IN_RING3 */
    432433
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