VirtualBox

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


Ignore:
Timestamp:
Apr 9, 2018 9:32:41 AM (7 years ago)
Author:
vboxsync
Message:

DevIchAc97: Injected 'R3' into function prefixes where relevant and fixed preprocessor indentation.

File:
1 edited

Legend:

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

    r71753 r71756  
    582582*********************************************************************************************************************************/
    583583#ifdef IN_RING3
    584 static int                ichac97StreamCreate(PAC97STATE pThis, PAC97STREAM pStream, uint8_t u8Strm);
    585 static void               ichac97StreamDestroy(PAC97STATE pThis, PAC97STREAM pStream);
    586 static int                ichac97StreamOpen(PAC97STATE pThis, PAC97STREAM pStream);
    587 static int                ichac97StreamReOpen(PAC97STATE pThis, PAC97STREAM pStream);
    588 static int                ichac97StreamClose(PAC97STATE pThis, PAC97STREAM pStream);
    589 static void               ichac97StreamReset(PAC97STATE pThis, PAC97STREAM pStream);
    590 static void               ichac97StreamLock(PAC97STREAM pStream);
    591 static void               ichac97StreamUnlock(PAC97STREAM pStream);
    592 static uint32_t           ichac97StreamGetUsed(PAC97STREAM pStream);
    593 static uint32_t           ichac97StreamGetFree(PAC97STREAM pStream);
    594 static int                ichac97StreamTransfer(PAC97STATE pThis, PAC97STREAM pStream, uint32_t cbToProcessMax);
    595 static void               ichac97StreamUpdate(PAC97STATE pThis, PAC97STREAM pStream, bool fInTimer);
    596 
    597 static DECLCALLBACK(void) ichac97Reset(PPDMDEVINS pDevIns);
     584static int                ichac97R3StreamCreate(PAC97STATE pThis, PAC97STREAM pStream, uint8_t u8Strm);
     585static void               ichac97R3StreamDestroy(PAC97STATE pThis, PAC97STREAM pStream);
     586static int                ichac97R3StreamOpen(PAC97STATE pThis, PAC97STREAM pStream);
     587static int                ichac97R3StreamReOpen(PAC97STATE pThis, PAC97STREAM pStream);
     588static int                ichac97R3StreamClose(PAC97STATE pThis, PAC97STREAM pStream);
     589static void               ichac97R3StreamReset(PAC97STATE pThis, PAC97STREAM pStream);
     590static void               ichac97R3StreamLock(PAC97STREAM pStream);
     591static void               ichac97R3StreamUnlock(PAC97STREAM pStream);
     592static uint32_t           ichac97R3StreamGetUsed(PAC97STREAM pStream);
     593static uint32_t           ichac97R3StreamGetFree(PAC97STREAM pStream);
     594static int                ichac97R3StreamTransfer(PAC97STATE pThis, PAC97STREAM pStream, uint32_t cbToProcessMax);
     595static void               ichac97R3StreamUpdate(PAC97STATE pThis, PAC97STREAM pStream, bool fInTimer);
     596
     597static DECLCALLBACK(void) ichac97R3Reset(PPDMDEVINS pDevIns);
    598598# ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS
    599 static int                ichac97TimerStart(PAC97STATE pThis);
    600 static int                ichac97TimerMaybeStart(PAC97STATE pThis);
    601 static int                ichac97TimerStop(PAC97STATE pThis);
    602 static int                ichac97TimerMaybeStop(PAC97STATE pThis);
    603 static void               ichac97TimerMain(PAC97STATE pThis);
    604 static DECLCALLBACK(void) ichac97Timer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser);
     599static int                ichac97R3TimerStart(PAC97STATE pThis);
     600static int                ichac97R3TimerMaybeStart(PAC97STATE pThis);
     601static int                ichac97R3TimerStop(PAC97STATE pThis);
     602static int                ichac97R3TimerMaybeStop(PAC97STATE pThis);
     603static void               ichac97R3TimerMain(PAC97STATE pThis);
     604static DECLCALLBACK(void) ichac97R3Timer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser);
    605605# endif
    606 static void               ichac97DoTransfers(PAC97STATE pThis);
    607 
    608 static int                ichac97MixerAddDrvStream(PAC97STATE pThis, PAUDMIXSINK pMixSink, PPDMAUDIOSTREAMCFG pCfg, PAC97DRIVER pDrv);
    609 static int                ichac97MixerAddDrvStreams(PAC97STATE pThis, PAUDMIXSINK pMixSink, PPDMAUDIOSTREAMCFG pCfg);
    610 static void               ichac97MixerRemoveDrvStream(PAC97STATE pThis, PAUDMIXSINK pMixSink, PDMAUDIODIR enmDir, PDMAUDIODESTSOURCE dstSrc, PAC97DRIVER pDrv);
    611 static void               ichac97MixerRemoveDrvStreams(PAC97STATE pThis, PAUDMIXSINK pMixSink, PDMAUDIODIR enmDir, PDMAUDIODESTSOURCE dstSrc);
     606static void               ichac97R3DoTransfers(PAC97STATE pThis);
     607
     608static int                ichac97R3MixerAddDrvStream(PAC97STATE pThis, PAUDMIXSINK pMixSink, PPDMAUDIOSTREAMCFG pCfg, PAC97DRIVER pDrv);
     609static int                ichac97R3MixerAddDrvStreams(PAC97STATE pThis, PAUDMIXSINK pMixSink, PPDMAUDIOSTREAMCFG pCfg);
     610static void               ichac97R3MixerRemoveDrvStream(PAC97STATE pThis, PAUDMIXSINK pMixSink, PDMAUDIODIR enmDir, PDMAUDIODESTSOURCE dstSrc, PAC97DRIVER pDrv);
     611static void               ichac97R3MixerRemoveDrvStreams(PAC97STATE pThis, PAUDMIXSINK pMixSink, PDMAUDIODIR enmDir, PDMAUDIODESTSOURCE dstSrc);
    612612
    613613# ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    614 static DECLCALLBACK(int)  ichac97StreamAsyncIOThread(RTTHREAD hThreadSelf, void *pvUser);
    615 static int                ichac97StreamAsyncIOCreate(PAC97STATE pThis, PAC97STREAM pStream);
    616 static int                ichac97StreamAsyncIODestroy(PAC97STATE pThis, PAC97STREAM pStream);
    617 static int                ichac97StreamAsyncIONotify(PAC97STATE pThis, PAC97STREAM pStream);
    618 static void               ichac97StreamAsyncIOLock(PAC97STREAM pStream);
    619 static void               ichac97StreamAsyncIOUnlock(PAC97STREAM pStream);
    620 static void               ichac97StreamAsyncIOEnable(PAC97STREAM pStream, bool fEnable);
     614static DECLCALLBACK(int)  ichac97R3StreamAsyncIOThread(RTTHREAD hThreadSelf, void *pvUser);
     615static int                ichac97R3StreamAsyncIOCreate(PAC97STATE pThis, PAC97STREAM pStream);
     616static int                ichac97R3StreamAsyncIODestroy(PAC97STATE pThis, PAC97STREAM pStream);
     617static int                ichac97R3StreamAsyncIONotify(PAC97STATE pThis, PAC97STREAM pStream);
     618static void               ichac97R3StreamAsyncIOLock(PAC97STREAM pStream);
     619static void               ichac97R3StreamAsyncIOUnlock(PAC97STREAM pStream);
     620static void               ichac97R3StreamAsyncIOEnable(PAC97STREAM pStream, bool fEnable);
    621621# endif
    622622#endif /* IN_RING3 */
     
    642642 * @param   uIndex              Stream index to get audio mixer sink for.
    643643 */
    644 DECLINLINE(PAUDMIXSINK) ichac97IndexToSink(PAC97STATE pThis, uint8_t uIndex)
     644DECLINLINE(PAUDMIXSINK) ichac97R3IndexToSink(PAC97STATE pThis, uint8_t uIndex)
    645645{
    646646    AssertPtrReturn(pThis, NULL);
     
    667667 * @remark  Uses CIV as BDLE index.
    668668 */
    669 static void ichac97StreamFetchBDLE(PAC97STATE pThis, PAC97STREAM pStream)
     669static void ichac97R3StreamFetchBDLE(PAC97STATE pThis, PAC97STREAM pStream)
    670670{
    671671    PPDMDEVINS  pDevIns = ICHAC97STATE_2_DEVINS(pThis);
     
    676676    PDMDevHlpPhysRead(pDevIns, pRegs->bdbar + pRegs->civ * 8, &u32[0], sizeof(u32));
    677677    pRegs->bd_valid   = 1;
    678 #ifndef RT_LITTLE_ENDIAN
    679 # error "Please adapt the code (audio buffers are little endian)!"
    680 #else
     678# ifndef RT_LITTLE_ENDIAN
     679#  error "Please adapt the code (audio buffers are little endian)!"
     680# else
    681681    pRegs->bd.addr    = RT_H2LE_U32(u32[0] & ~3);
    682682    pRegs->bd.ctl_len = RT_H2LE_U32(u32[1]);
    683 #endif
     683# endif
    684684    pRegs->picb       = pRegs->bd.ctl_len & AC97_BD_LEN_MASK;
    685685    LogFlowFunc(("bd %2d addr=%#x ctl=%#06x len=%#x(%d bytes)\n",
     
    756756 * @param   pStream             Stream to return status for.
    757757 */
    758 static bool ichac97StreamIsEnabled(PAC97STATE pThis, PAC97STREAM pStream)
     758static bool ichac97R3StreamIsEnabled(PAC97STATE pThis, PAC97STREAM pStream)
    759759{
    760760    AssertPtrReturn(pThis,   false);
    761761    AssertPtrReturn(pStream, false);
    762762
    763     PAUDMIXSINK pSink = ichac97IndexToSink(pThis, pStream->u8SD);
     763    PAUDMIXSINK pSink = ichac97R3IndexToSink(pThis, pStream->u8SD);
    764764    bool fIsEnabled = RT_BOOL(AudioMixerSinkGetStatus(pSink) & AUDMIXSINK_STS_RUNNING);
    765765
     
    777777 *
    778778 */
    779 static int ichac97StreamEnable(PAC97STATE pThis, PAC97STREAM pStream, bool fEnable)
     779static int ichac97R3StreamEnable(PAC97STATE pThis, PAC97STREAM pStream, bool fEnable)
    780780{
    781781    AssertPtrReturn(pThis,   VERR_INVALID_POINTER);
    782782    AssertPtrReturn(pStream, VERR_INVALID_POINTER);
    783783
    784     ichac97StreamLock(pStream);
     784    ichac97R3StreamLock(pStream);
    785785
    786786    int rc = VINF_SUCCESS;
    787787
    788 #ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
     788# ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    789789    if (fEnable)
    790         rc = ichac97StreamAsyncIOCreate(pThis, pStream);
     790        rc = ichac97R3StreamAsyncIOCreate(pThis, pStream);
    791791    if (RT_SUCCESS(rc))
    792792    {
    793         ichac97StreamAsyncIOLock(pStream);
    794         ichac97StreamAsyncIOEnable(pStream, fEnable);
    795     }
    796 #endif
     793        ichac97R3StreamAsyncIOLock(pStream);
     794        ichac97R3StreamAsyncIOEnable(pStream, fEnable);
     795    }
     796# endif
    797797
    798798    if (fEnable)
     
    801801            RTCircBufReset(pStream->State.pCircBuf);
    802802
    803         rc = ichac97StreamOpen(pThis, pStream);
     803        rc = ichac97R3StreamOpen(pThis, pStream);
    804804    }
    805805    else
    806         rc = ichac97StreamClose(pThis, pStream);
     806        rc = ichac97R3StreamClose(pThis, pStream);
    807807
    808808    if (RT_SUCCESS(rc))
    809809    {
    810810        /* First, enable or disable the stream and the stream's sink, if any. */
    811         rc = AudioMixerSinkCtl(ichac97IndexToSink(pThis, pStream->u8SD),
     811        rc = AudioMixerSinkCtl(ichac97R3IndexToSink(pThis, pStream->u8SD),
    812812                               fEnable ? AUDMIXSINKCMD_ENABLE : AUDMIXSINKCMD_DISABLE);
    813813    }
    814814
    815 #ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    816     ichac97StreamAsyncIOUnlock(pStream);
    817 #endif
     815# ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
     816    ichac97R3StreamAsyncIOUnlock(pStream);
     817# endif
    818818
    819819    /* Make sure to leave the lock before (eventually) starting the timer. */
    820     ichac97StreamUnlock(pStream);
    821 
    822 #ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS
     820    ichac97R3StreamUnlock(pStream);
     821
     822# ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS
    823823    /* Second, see if we need to start or stop the timer. */
    824824    if (!fEnable)
    825         ichac97TimerMaybeStop(pThis);
     825        ichac97R3TimerMaybeStop(pThis);
    826826    else
    827         ichac97TimerMaybeStart(pThis);
    828 #endif
     827        ichac97R3TimerMaybeStart(pThis);
     828# endif
    829829
    830830    LogFunc(("[SD%RU8] cStreamsActive=%RU8, fEnable=%RTbool, rc=%Rrc\n", pStream->u8SD, pThis->cStreamsActive, fEnable, rc));
     
    839839 *
    840840 */
    841 static void ichac97StreamReset(PAC97STATE pThis, PAC97STREAM pStream)
     841static void ichac97R3StreamReset(PAC97STATE pThis, PAC97STREAM pStream)
    842842{
    843843    AssertPtrReturnVoid(pThis);
    844844    AssertPtrReturnVoid(pStream);
    845845
    846     ichac97StreamLock(pStream);
     846    ichac97R3StreamLock(pStream);
    847847
    848848    LogFunc(("[SD%RU8]\n", pStream->u8SD));
     
    864864    RT_ZERO(pThis->silence);
    865865
    866     ichac97StreamUnlock(pStream);
     866    ichac97R3StreamUnlock(pStream);
    867867}
    868868
     
    875875 * @param   u8Strm              Stream ID to assign AC'97 stream to.
    876876 */
    877 static int ichac97StreamCreate(PAC97STATE pThis, PAC97STREAM pStream, uint8_t u8Strm)
     877static int ichac97R3StreamCreate(PAC97STATE pThis, PAC97STREAM pStream, uint8_t u8Strm)
    878878{
    879879    RT_NOREF(pThis);
     
    900900 * @param   pStream             AC'97 stream to destroy.
    901901 */
    902 static void ichac97StreamDestroy(PAC97STATE pThis, PAC97STREAM pStream)
     902static void ichac97R3StreamDestroy(PAC97STATE pThis, PAC97STREAM pStream)
    903903{
    904904    LogFlowFunc(("[SD%RU8]\n", pStream->u8SD));
     
    913913    }
    914914
    915 #ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    916     rc2 = ichac97StreamAsyncIODestroy(pThis, pStream);
     915# ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
     916    rc2 = ichac97R3StreamAsyncIODestroy(pThis, pStream);
    917917    AssertRC(rc2);
    918 #else
     918# else
    919919    RT_NOREF(pThis);
    920 #endif
     920# endif
    921921
    922922    LogFlowFuncLeave();
     
    928928 * @param   pThis               AC'97 state.
    929929 */
    930 static void ichac97StreamsDestroy(PAC97STATE pThis)
     930static void ichac97R3StreamsDestroy(PAC97STATE pThis)
    931931{
    932932    LogFlowFuncEnter();
     
    936936     */
    937937
    938     ichac97StreamDestroy(pThis, &pThis->StreamLineIn);
    939     ichac97StreamDestroy(pThis, &pThis->StreamMicIn);
    940     ichac97StreamDestroy(pThis, &pThis->StreamOut);
     938    ichac97R3StreamDestroy(pThis, &pThis->StreamLineIn);
     939    ichac97R3StreamDestroy(pThis, &pThis->StreamMicIn);
     940    ichac97R3StreamDestroy(pThis, &pThis->StreamOut);
    941941
    942942    /*
     
    948948    {
    949949        dstSrc.Source = PDMAUDIORECSOURCE_LINE;
    950         ichac97MixerRemoveDrvStreams(pThis, pThis->pSinkLineIn, PDMAUDIODIR_IN, dstSrc);
     950        ichac97R3MixerRemoveDrvStreams(pThis, pThis->pSinkLineIn, PDMAUDIODIR_IN, dstSrc);
    951951
    952952        AudioMixerSinkDestroy(pThis->pSinkLineIn);
     
    957957    {
    958958        dstSrc.Source = PDMAUDIORECSOURCE_MIC;
    959         ichac97MixerRemoveDrvStreams(pThis, pThis->pSinkMicIn, PDMAUDIODIR_IN, dstSrc);
     959        ichac97R3MixerRemoveDrvStreams(pThis, pThis->pSinkMicIn, PDMAUDIODIR_IN, dstSrc);
    960960
    961961        AudioMixerSinkDestroy(pThis->pSinkMicIn);
     
    966966    {
    967967        dstSrc.Dest = PDMAUDIOPLAYBACKDEST_FRONT;
    968         ichac97MixerRemoveDrvStreams(pThis, pThis->pSinkOut, PDMAUDIODIR_OUT, dstSrc);
     968        ichac97R3MixerRemoveDrvStreams(pThis, pThis->pSinkOut, PDMAUDIODIR_OUT, dstSrc);
    969969
    970970        AudioMixerSinkDestroy(pThis->pSinkOut);
     
    983983 * @param   pcbWritten          Number of bytes written. Optional.
    984984 */
    985 static int ichac97StreamWrite(PAC97STATE pThis, PAC97STREAM pDstStream, PAUDMIXSINK pSrcMixSink, uint32_t cbToWrite,
    986                               uint32_t *pcbWritten)
     985static int ichac97R3StreamWrite(PAC97STATE pThis, PAC97STREAM pDstStream, PAUDMIXSINK pSrcMixSink, uint32_t cbToWrite,
     986                                uint32_t *pcbWritten)
    987987{
    988988    RT_NOREF(pThis);
     
    10071007        AssertRC(rc2);
    10081008
    1009 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA
     1009# ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA
    10101010        RTFILE fh;
    10111011        RTFileOpen(&fh, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "ichac97StreamWrite.pcm",
     
    10131013        RTFileWrite(fh, pvDst, cbRead, NULL);
    10141014        RTFileClose(fh);
    1015 #endif
     1015# endif
    10161016    }
    10171017
     
    10341034 * @param   pcbRead             Number of bytes read. Optional.
    10351035 */
    1036 static int ichac97StreamRead(PAC97STATE pThis, PAC97STREAM pSrcStream, PAUDMIXSINK pDstMixSink, uint32_t cbToRead,
    1037                              uint32_t *pcbRead)
     1036static int ichac97R3StreamRead(PAC97STATE pThis, PAC97STREAM pSrcStream, PAUDMIXSINK pDstMixSink, uint32_t cbToRead,
     1037                               uint32_t *pcbRead)
    10381038{
    10391039    RT_NOREF(pThis);
     
    10611061        if (cbSrc)
    10621062        {
    1063 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA
     1063# ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA
    10641064            RTFILE fh;
    10651065            RTFileOpen(&fh, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "ac97StreamRead.pcm",
     
    10671067            RTFileWrite(fh, pvSrc, cbSrc, NULL);
    10681068            RTFileClose(fh);
    1069 #endif
     1069# endif
    10701070            rc = AudioMixerSinkWrite(pDstMixSink, AUDMIXOP_COPY, pvSrc, (uint32_t)cbSrc, &cbWritten);
    10711071            if (RT_SUCCESS(rc))
     
    10961096}
    10971097
    1098 #ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
     1098# ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    10991099
    11001100/**
     
    11061106 * @param   pvUser              User argument. Must be of type PAC97STREAMTHREADCTX.
    11071107 */
    1108 static DECLCALLBACK(int) ichac97StreamAsyncIOThread(RTTHREAD hThreadSelf, void *pvUser)
     1108static DECLCALLBACK(int) ichac97R3StreamAsyncIOThread(RTTHREAD hThreadSelf, void *pvUser)
    11091109{
    11101110    PAC97STREAMTHREADCTX pCtx = (PAC97STREAMTHREADCTX)pvUser;
     
    11221122    AssertPtr(pCircBuf);
    11231123
    1124     PAUDMIXSINK pMixSink = ichac97IndexToSink(pThis, pStream->u8SD);
     1124    PAUDMIXSINK pMixSink = ichac97R3IndexToSink(pThis, pStream->u8SD);
    11251125    AssertPtr(pMixSink);
    11261126
     
    11511151            }
    11521152
    1153             ichac97StreamUpdate(pThis, pStream, false /* fInTimer */);
     1153            ichac97R3StreamUpdate(pThis, pStream, false /* fInTimer */);
    11541154
    11551155            int rc3 = RTCritSectLeave(&pAIO->CritSect);
     
    11741174 * @param   pStream             AC'97 audio stream to create the async I/O thread for.
    11751175 */
    1176 static int ichac97StreamAsyncIOCreate(PAC97STATE pThis, PAC97STREAM pStream)
     1176static int ichac97R3StreamAsyncIOCreate(PAC97STATE pThis, PAC97STREAM pStream)
    11771177{
    11781178    PAC97STREAMSTATEAIO pAIO = &pStream->State.AIO;
     
    12161216 * @param   pStream             AC'97 audio stream to destroy the async I/O thread for.
    12171217 */
    1218 static int ichac97StreamAsyncIODestroy(PAC97STATE pThis, PAC97STREAM pStream)
     1218static int ichac97R3StreamAsyncIODestroy(PAC97STATE pThis, PAC97STREAM pStream)
    12191219{
    12201220    PAC97STREAMSTATEAIO pAIO = &pStream->State.AIO;
     
    12251225    ASMAtomicWriteBool(&pAIO->fShutdown, true);
    12261226
    1227     int rc = ichac97StreamAsyncIONotify(pThis, pStream);
     1227    int rc = ichac97R3StreamAsyncIONotify(pThis, pStream);
    12281228    AssertRC(rc);
    12291229
     
    12561256 * @param   pStream             AC'97 stream to notify async I/O thread for.
    12571257 */
    1258 static int ichac97StreamAsyncIONotify(PAC97STATE pThis, PAC97STREAM pStream)
     1258static int ichac97R3StreamAsyncIONotify(PAC97STATE pThis, PAC97STREAM pStream)
    12591259{
    12601260    RT_NOREF(pThis);
     
    12691269 * @param   pStream             AC'97 stream to lock async I/O thread for.
    12701270 */
    1271 static void ichac97StreamAsyncIOLock(PAC97STREAM pStream)
     1271static void ichac97R3StreamAsyncIOLock(PAC97STREAM pStream)
    12721272{
    12731273    PAC97STREAMSTATEAIO pAIO = &pStream->State.AIO;
     
    12851285 * @param   pStream             AC'97 stream to unlock async I/O thread for.
    12861286 */
    1287 static void ichac97StreamAsyncIOUnlock(PAC97STREAM pStream)
     1287static void ichac97R3StreamAsyncIOUnlock(PAC97STREAM pStream)
    12881288{
    12891289    PAC97STREAMSTATEAIO pAIO = &pStream->State.AIO;
     
    13041304 * @remarks Does not do locking.
    13051305 */
    1306 static void ichac97StreamAsyncIOEnable(PAC97STREAM pStream, bool fEnable)
     1306static void ichac97R3StreamAsyncIOEnable(PAC97STREAM pStream, bool fEnable)
    13071307{
    13081308    PAC97STREAMSTATEAIO pAIO = &pStream->State.AIO;
     
    13101310}
    13111311
    1312 #endif /* VBOX_WITH_AUDIO_AC97_ASYNC_IO */
     1312# endif /* VBOX_WITH_AUDIO_AC97_ASYNC_IO */
    13131313
    13141314/**
     
    13231323 *                              context or an asynchronous I/O stream thread (if supported).
    13241324 */
    1325 static void ichac97StreamUpdate(PAC97STATE pThis, PAC97STREAM pStream, bool fInTimer)
    1326 {
    1327     PAUDMIXSINK pSink = ichac97IndexToSink(pThis, pStream->u8SD);
     1325static void ichac97R3StreamUpdate(PAC97STATE pThis, PAC97STREAM pStream, bool fInTimer)
     1326{
     1327    PAUDMIXSINK pSink = ichac97R3IndexToSink(pThis, pStream->u8SD);
    13281328    AssertPtr(pSink);
    13291329
     
    13361336    {
    13371337        /* Is the AC'97 stream ready to be written (guest output data) to? If so, by how much? */
    1338         const uint32_t cbFree = ichac97StreamGetFree(pStream);
     1338        const uint32_t cbFree = ichac97R3StreamGetFree(pStream);
    13391339
    13401340        if (   fInTimer
     
    13441344
    13451345            /* Do the DMA transfer. */
    1346             rc2 = ichac97StreamTransfer(pThis, pStream, cbFree);
     1346            rc2 = ichac97R3StreamTransfer(pThis, pStream, cbFree);
    13471347            AssertRC(rc2);
    13481348        }
    13491349
    13501350        /* How much (guest output) data is available at the moment for the AC'97 stream? */
    1351         uint32_t cbUsed = ichac97StreamGetUsed(pStream);
    1352 
    1353 #ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
     1351        uint32_t cbUsed = ichac97R3StreamGetUsed(pStream);
     1352
     1353# ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    13541354        if (   fInTimer
    13551355            && cbUsed)
    13561356        {
    1357             rc2 = ichac97StreamAsyncIONotify(pThis, pStream);
     1357            rc2 = ichac97R3StreamAsyncIONotify(pThis, pStream);
    13581358            AssertRC(rc2);
    13591359        }
    13601360        else
    1361 #endif
     1361# endif
    13621362        {
    13631363            const uint32_t cbSinkWritable = AudioMixerSinkGetWritable(pSink);
     
    13721372                /* Read (guest output) data and write it to the stream's sink. */
    13731373                uint32_t cbRead;
    1374                 rc2 = ichac97StreamRead(pThis, pStream, pSink, cbUsed, &cbRead);
     1374                rc2 = ichac97R3StreamRead(pThis, pStream, pSink, cbUsed, &cbRead);
    13751375                AssertRC(rc2);
    13761376
     
    13881388    else /* Input (SDI). */
    13891389    {
    1390 #ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
     1390# ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    13911391        if (fInTimer)
    13921392        {
    1393             rc2 = ichac97StreamAsyncIONotify(pThis, pStream);
     1393            rc2 = ichac97R3StreamAsyncIONotify(pThis, pStream);
    13941394            AssertRC(rc2);
    13951395        }
    13961396        else
    1397 #endif
     1397# endif
    13981398        {
    13991399            rc2 = AudioMixerSinkUpdate(pSink);
     
    14041404
    14051405            /* How much (guest input) data is free at the moment? */
    1406             uint32_t cbFree = ichac97StreamGetFree(pStream);
     1406            uint32_t cbFree = ichac97R3StreamGetFree(pStream);
    14071407
    14081408            Log3Func(("[SD%RU8] cbReadable=%RU32, cbFree=%RU32\n", pStream->u8SD, cbReadable, cbFree));
     
    14161416            {
    14171417                /* Write (guest input) data to the stream which was read from stream's sink before. */
    1418                 rc2 = ichac97StreamWrite(pThis, pStream, pSink, cbFree, NULL /* pcbWritten */);
     1418                rc2 = ichac97R3StreamWrite(pThis, pStream, pSink, cbFree, NULL /* pcbWritten */);
    14191419                AssertRC(rc2);
    14201420            }
    14211421        }
    14221422
    1423 #ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
     1423# ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    14241424        if (fInTimer)
    1425 #endif
    1426         {
    1427             const uint32_t cbToTransfer = ichac97StreamGetUsed(pStream);
     1425# endif
     1426        {
     1427            const uint32_t cbToTransfer = ichac97R3StreamGetUsed(pStream);
    14281428            if (cbToTransfer)
    14291429            {
    14301430                /* When running synchronously, do the DMA data transfers here.
    14311431                 * Otherwise this will be done in the stream's async I/O thread. */
    1432                 rc2 = ichac97StreamTransfer(pThis, pStream, cbToTransfer);
     1432                rc2 = ichac97R3StreamTransfer(pThis, pStream, cbToTransfer);
    14331433                AssertRC(rc2);
    14341434            }
     
    14811481 * @param   dstSrc              Stream destination / source to retrieve.
    14821482 */
    1483 static PAC97DRIVERSTREAM ichac97MixerGetDrvStream(PAC97STATE pThis, PAC97DRIVER pDrv,
    1484                                                   PDMAUDIODIR enmDir, PDMAUDIODESTSOURCE dstSrc)
     1483static PAC97DRIVERSTREAM ichac97R3MixerGetDrvStream(PAC97STATE pThis, PAC97DRIVER pDrv,
     1484                                                    PDMAUDIODIR enmDir, PDMAUDIODESTSOURCE dstSrc)
    14851485{
    14861486    RT_NOREF(pThis);
     
    15341534 * @param   pDrv                Driver stream to add.
    15351535 */
    1536 static int ichac97MixerAddDrvStream(PAC97STATE pThis, PAUDMIXSINK pMixSink, PPDMAUDIOSTREAMCFG pCfg, PAC97DRIVER pDrv)
     1536static int ichac97R3MixerAddDrvStream(PAC97STATE pThis, PAUDMIXSINK pMixSink, PPDMAUDIOSTREAMCFG pCfg, PAC97DRIVER pDrv)
    15371537{
    15381538    AssertPtrReturn(pThis,    VERR_INVALID_POINTER);
     
    15541554    int rc;
    15551555
    1556     PAC97DRIVERSTREAM pDrvStream = ichac97MixerGetDrvStream(pThis, pDrv, pStreamCfg->enmDir, pStreamCfg->DestSource);
     1556    PAC97DRIVERSTREAM pDrvStream = ichac97R3MixerGetDrvStream(pThis, pDrv, pStreamCfg->enmDir, pStreamCfg->DestSource);
    15571557    if (pDrvStream)
    15581558    {
     
    15911591 * @param   pCfg                Stream configuration to use.
    15921592 */
    1593 static int ichac97MixerAddDrvStreams(PAC97STATE pThis, PAUDMIXSINK pMixSink, PPDMAUDIOSTREAMCFG pCfg)
     1593static int ichac97R3MixerAddDrvStreams(PAC97STATE pThis, PAUDMIXSINK pMixSink, PPDMAUDIOSTREAMCFG pCfg)
    15941594{
    15951595    AssertPtrReturn(pThis,    VERR_INVALID_POINTER);
     
    16071607    RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
    16081608    {
    1609         int rc2 = ichac97MixerAddDrvStream(pThis, pMixSink, pCfg, pDrv);
     1609        int rc2 = ichac97R3MixerAddDrvStream(pThis, pMixSink, pCfg, pDrv);
    16101610        if (RT_FAILURE(rc2))
    16111611            LogFunc(("Attaching stream failed with %Rrc\n", rc2));
     
    16281628 * @param   pDrv                Driver stream to remove.
    16291629 */
    1630 static void ichac97MixerRemoveDrvStream(PAC97STATE pThis, PAUDMIXSINK pMixSink,
    1631                                         PDMAUDIODIR enmDir, PDMAUDIODESTSOURCE dstSrc, PAC97DRIVER pDrv)
     1630static void ichac97R3MixerRemoveDrvStream(PAC97STATE pThis, PAUDMIXSINK pMixSink,
     1631                                          PDMAUDIODIR enmDir, PDMAUDIODESTSOURCE dstSrc, PAC97DRIVER pDrv)
    16321632{
    16331633    AssertPtrReturnVoid(pThis);
    16341634    AssertPtrReturnVoid(pMixSink);
    16351635
    1636     PAC97DRIVERSTREAM pDrvStream = ichac97MixerGetDrvStream(pThis, pDrv, enmDir, dstSrc);
     1636    PAC97DRIVERSTREAM pDrvStream = ichac97R3MixerGetDrvStream(pThis, pDrv, enmDir, dstSrc);
    16371637    if (pDrvStream)
    16381638    {
     
    16551655 * @param   dstSrc              Stream destination / source to remove.
    16561656 */
    1657 static void ichac97MixerRemoveDrvStreams(PAC97STATE pThis, PAUDMIXSINK pMixSink,
    1658                                          PDMAUDIODIR enmDir, PDMAUDIODESTSOURCE dstSrc)
     1657static void ichac97R3MixerRemoveDrvStreams(PAC97STATE pThis, PAUDMIXSINK pMixSink,
     1658                                           PDMAUDIODIR enmDir, PDMAUDIODESTSOURCE dstSrc)
    16591659{
    16601660    AssertPtrReturnVoid(pThis);
     
    16631663    PAC97DRIVER pDrv;
    16641664    RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
    1665         ichac97MixerRemoveDrvStream(pThis, pMixSink, enmDir, dstSrc, pDrv);
     1665    {
     1666        ichac97R3MixerRemoveDrvStream(pThis, pMixSink, enmDir, dstSrc, pDrv);
     1667    }
    16661668}
    16671669
     
    16761678 * @param   pStream             AC'97 Stream to open.
    16771679 */
    1678 static int ichac97StreamOpen(PAC97STATE pThis, PAC97STREAM pStream)
     1680static int ichac97R3StreamOpen(PAC97STATE pThis, PAC97STREAM pStream)
    16791681{
    16801682    int rc = VINF_SUCCESS;
     
    17331735    if (RT_SUCCESS(rc))
    17341736    {
    1735         ichac97MixerRemoveDrvStreams(pThis, pMixSink, pCfg->enmDir, pCfg->DestSource);
     1737        ichac97R3MixerRemoveDrvStreams(pThis, pMixSink, pCfg->enmDir, pCfg->DestSource);
    17361738
    17371739        if (pCfg->Props.uHz)
     
    17441746            pCfg->Props.cShift    = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfg->Props.cBits, pCfg->Props.cChannels);
    17451747
    1746             rc = ichac97MixerAddDrvStreams(pThis, pMixSink, pCfg);
     1748            rc = ichac97R3MixerAddDrvStreams(pThis, pMixSink, pCfg);
    17471749        }
    17481750    }
     
    17591761 * @param   pStream             AC'97 stream to close.
    17601762 */
    1761 static int ichac97StreamClose(PAC97STATE pThis, PAC97STREAM pStream)
     1763static int ichac97R3StreamClose(PAC97STATE pThis, PAC97STREAM pStream)
    17621764{
    17631765    RT_NOREF(pThis);
     
    17771779 * @param   pStream             AC'97 stream to re-open.
    17781780 */
    1779 static int ichac97StreamReOpen(PAC97STATE pThis, PAC97STREAM pStream)
     1781static int ichac97R3StreamReOpen(PAC97STATE pThis, PAC97STREAM pStream)
    17801782{
    17811783    LogFlowFunc(("[SD%RU8]\n", pStream->u8SD));
    17821784
    1783     int rc = ichac97StreamClose(pThis, pStream);
     1785    int rc = ichac97R3StreamClose(pThis, pStream);
    17841786    if (RT_SUCCESS(rc))
    1785         rc = ichac97StreamOpen(pThis, pStream);
     1787        rc = ichac97R3StreamOpen(pThis, pStream);
    17861788
    17871789    return rc;
     
    17941796 * @param   pStream             AC'97 stream to lock.
    17951797 */
    1796 static void ichac97StreamLock(PAC97STREAM pStream)
     1798static void ichac97R3StreamLock(PAC97STREAM pStream)
    17971799{
    17981800    AssertPtrReturnVoid(pStream);
     
    18071809 * @param   pStream             AC'97 stream to unlock.
    18081810 */
    1809 static void ichac97StreamUnlock(PAC97STREAM pStream)
     1811static void ichac97R3StreamUnlock(PAC97STREAM pStream)
    18101812{
    18111813    AssertPtrReturnVoid(pStream);
     
    18201822 * @param   pStream             AC'97 stream to retrieve size for.
    18211823 */
    1822 static uint32_t ichac97StreamGetUsed(PAC97STREAM pStream)
     1824static uint32_t ichac97R3StreamGetUsed(PAC97STREAM pStream)
    18231825{
    18241826    AssertPtrReturn(pStream, 0);
     
    18361838 * @param   pStream             AC'97 stream to retrieve size for.
    18371839 */
    1838 static uint32_t ichac97StreamGetFree(PAC97STREAM pStream)
     1840static uint32_t ichac97R3StreamGetFree(PAC97STREAM pStream)
    18391841{
    18401842    AssertPtrReturn(pStream, 0);
     
    18571859 * @param   uVal                Volume value to set.
    18581860 */
    1859 static int ichac97MixerSetVolume(PAC97STATE pThis, int index, PDMAUDIOMIXERCTL enmMixerCtl, uint32_t uVal)
     1861static int ichac97R3MixerSetVolume(PAC97STATE pThis, int index, PDMAUDIOMIXERCTL enmMixerCtl, uint32_t uVal)
    18601862{
    18611863    /*
     
    18831885    if (index != AC97_Master_Volume_Mute && index != AC97_Headphone_Volume_Mute)
    18841886    {
    1885 #ifndef VBOX_WITH_AC97_GAIN_SUPPORT
     1887# ifndef VBOX_WITH_AC97_GAIN_SUPPORT
    18861888        /* NB: Currently there is no gain support, only attenuation. */
    18871889        uCtlAttLeft  = uCtlAttLeft  < 8 ? 0 : uCtlAttLeft  - 8;
    18881890        uCtlAttRight = uCtlAttRight < 8 ? 0 : uCtlAttRight - 8;
    1889 #endif
     1891# endif
    18901892    }
    18911893    Assert(uCtlAttLeft  <= 255 / AC97_DB_FACTOR);
     
    19541956 * @param   uIdx                AC'97 index to convert.
    19551957 */
    1956 static PDMAUDIORECSOURCE ichac97IdxToRecSource(uint8_t uIdx)
     1958static PDMAUDIORECSOURCE ichac97R3IdxToRecSource(uint8_t uIdx)
    19571959{
    19581960    switch (uIdx)
     
    19781980 * @param   enmRecSrc           PDM audio recording source to convert.
    19791981 */
    1980 static uint8_t ichac97RecSourceToIdx(PDMAUDIORECSOURCE enmRecSrc)
     1982static uint8_t ichac97R3RecSourceToIdx(PDMAUDIORECSOURCE enmRecSrc)
    19811983{
    19821984    switch (enmRecSrc)
     
    20262028 * @param   val                 AC'97 recording source index to set.
    20272029 */
    2028 static void ichac97MixerRecordSelect(PAC97STATE pThis, uint32_t val)
     2030static void ichac97R3MixerRecordSelect(PAC97STATE pThis, uint32_t val)
    20292031{
    20302032    uint8_t rs = val & AC97_REC_MASK;
    20312033    uint8_t ls = (val >> 8) & AC97_REC_MASK;
    2032     PDMAUDIORECSOURCE ars = ichac97IdxToRecSource(rs);
    2033     PDMAUDIORECSOURCE als = ichac97IdxToRecSource(ls);
    2034     rs = ichac97RecSourceToIdx(ars);
    2035     ls = ichac97RecSourceToIdx(als);
     2034    PDMAUDIORECSOURCE ars = ichac97R3IdxToRecSource(rs);
     2035    PDMAUDIORECSOURCE als = ichac97R3IdxToRecSource(ls);
     2036    rs = ichac97R3RecSourceToIdx(ars);
     2037    ls = ichac97R3RecSourceToIdx(als);
    20362038    ichac97MixerSet(pThis, AC97_Record_Select, rs | (ls << 8));
    20372039}
     
    20432045 * @param   pThis               AC'97 state.
    20442046 */
    2045 static int ichac97MixerReset(PAC97STATE pThis)
     2047static int ichac97R3MixerReset(PAC97STATE pThis)
    20462048{
    20472049    AssertPtrReturn(pThis, VERR_INVALID_PARAMETER);
     
    20942096        ichac97MixerSet(pThis, AC97_Vendor_ID2              , 0x7600); /* 7608 */
    20952097    }
    2096     ichac97MixerRecordSelect(pThis, 0);
     2098    ichac97R3MixerRecordSelect(pThis, 0);
    20972099
    20982100    /* The default value is 8000h, which corresponds to 0 dB attenuation with mute on. */
    2099     ichac97MixerSetVolume(pThis, AC97_Master_Volume_Mute,  PDMAUDIOMIXERCTL_VOLUME_MASTER, 0x8000);
     2101    ichac97R3MixerSetVolume(pThis, AC97_Master_Volume_Mute,  PDMAUDIOMIXERCTL_VOLUME_MASTER, 0x8000);
    21002102
    21012103    /* The default value for stereo registers is 8808h, which corresponds to 0 dB gain with mute on.*/
    2102     ichac97MixerSetVolume(pThis, AC97_PCM_Out_Volume_Mute, PDMAUDIOMIXERCTL_FRONT,         0x8808);
    2103     ichac97MixerSetVolume(pThis, AC97_Line_In_Volume_Mute, PDMAUDIOMIXERCTL_LINE_IN,       0x8808);
    2104     ichac97MixerSetVolume(pThis, AC97_Mic_Volume_Mute,     PDMAUDIOMIXERCTL_MIC_IN,        0x8808);
     2104    ichac97R3MixerSetVolume(pThis, AC97_PCM_Out_Volume_Mute, PDMAUDIOMIXERCTL_FRONT,         0x8808);
     2105    ichac97R3MixerSetVolume(pThis, AC97_Line_In_Volume_Mute, PDMAUDIOMIXERCTL_LINE_IN,       0x8808);
     2106    ichac97R3MixerSetVolume(pThis, AC97_Mic_Volume_Mute,     PDMAUDIOMIXERCTL_MIC_IN,        0x8808);
    21052107
    21062108    return VINF_SUCCESS;
    21072109}
    21082110
    2109 /* Unused */
    2110 #if 0
    2111 static void ichac97WriteBUP(PAC97STATE pThis, uint32_t cbElapsed)
     2111# if 0 /* Unused */
     2112static void ichac97R3WriteBUP(PAC97STATE pThis, uint32_t cbElapsed)
    21122113{
    21132114    LogFlowFunc(("cbElapsed=%RU32\n", cbElapsed));
     
    21472148    }
    21482149}
    2149 #endif /* Unused */
    2150 
    2151 #ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS
     2150# endif /* Unused */
     2151
     2152# ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS
    21522153
    21532154/**
     
    21572158 * @param   pThis               AC'97 state.
    21582159 */
    2159 static int  ichac97TimerStart(PAC97STATE pThis)
     2160static int  ichac97R3TimerStart(PAC97STATE pThis)
    21602161{
    21612162    LogFlowFuncEnter();
     
    21722173
    21732174        /* Start transfers. */
    2174         ichac97TimerMain(pThis);
     2175        ichac97R3TimerMain(pThis);
    21752176    }
    21762177
     
    21862187 * @param   pThis               AC'97 state.
    21872188 */
    2188 static int ichac97TimerMaybeStart(PAC97STATE pThis)
     2189static int ichac97R3TimerMaybeStart(PAC97STATE pThis)
    21892190{
    21902191    LogFlowFuncEnter();
     
    21972198    /* Only start the timer at the first active stream. */
    21982199    if (pThis->cStreamsActive == 1)
    2199         return ichac97TimerStart(pThis);
     2200        return ichac97R3TimerStart(pThis);
    22002201
    22012202    return VINF_SUCCESS;
     
    22082209 * @param   pThis               AC'97 state.
    22092210 */
    2210 static int ichac97TimerStop(PAC97STATE pThis)
     2211static int ichac97R3TimerStop(PAC97STATE pThis)
    22112212{
    22122213    LogFlowFuncEnter();
     
    22412242 * @param   pThis               AC'97 state.
    22422243 */
    2243 static int ichac97TimerMaybeStop(PAC97STATE pThis)
     2244static int ichac97R3TimerMaybeStop(PAC97STATE pThis)
    22442245{
    22452246    LogFlowFuncEnter();
     
    22532254
    22542255        if (pThis->cStreamsActive == 0)
    2255             return ichac97TimerStop(pThis);
     2256            return ichac97R3TimerStop(pThis);
    22562257    }
    22572258
     
    22642265 * @param   pThis               AC'97 state.
    22652266 */
    2266 static void ichac97TimerMain(PAC97STATE pThis)
     2267static void ichac97R3TimerMain(PAC97STATE pThis)
    22672268{
    22682269    STAM_PROFILE_START(&pThis->StatTimer, a);
     
    22782279    bool fArmTimer = false;
    22792280
    2280     ichac97DoTransfers(pThis);
     2281    ichac97R3DoTransfers(pThis);
    22812282
    22822283    /* Do we need to arm the timer again? */
    2283     if (   AudioMixerSinkIsActive(ichac97IndexToSink(pThis, pThis->StreamLineIn.u8SD))
    2284         || AudioMixerSinkIsActive(ichac97IndexToSink(pThis, pThis->StreamMicIn.u8SD))
    2285         || AudioMixerSinkIsActive(ichac97IndexToSink(pThis, pThis->StreamOut.u8SD)))
     2284    if (   AudioMixerSinkIsActive(ichac97R3IndexToSink(pThis, pThis->StreamLineIn.u8SD))
     2285        || AudioMixerSinkIsActive(ichac97R3IndexToSink(pThis, pThis->StreamMicIn.u8SD))
     2286        || AudioMixerSinkIsActive(ichac97R3IndexToSink(pThis, pThis->StreamOut.u8SD)))
    22862287    {
    22872288        fArmTimer = true;
     
    23172318 * @param   pvUser              User argument as PAC97STATE.
    23182319 */
    2319 static DECLCALLBACK(void) ichac97Timer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
     2320static DECLCALLBACK(void) ichac97R3Timer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
    23202321{
    23212322    RT_NOREF(pDevIns, pTimer);
     
    23252326    AssertPtr(pThis);
    23262327
    2327     ichac97TimerMain(pThis);
    2328 }
    2329 
    2330 #endif /* !VBOX_WITH_AUDIO_AC97_CALLBACKS */
     2328    ichac97R3TimerMain(pThis);
     2329}
     2330
     2331# endif /* !VBOX_WITH_AUDIO_AC97_CALLBACKS */
    23312332
    23322333/**
     
    23362337 * @param   pThis               AC'97 state.
    23372338 */
    2338 static void ichac97DoTransfers(PAC97STATE pThis)
     2339static void ichac97R3DoTransfers(PAC97STATE pThis)
    23392340{
    23402341    AssertPtrReturnVoid(pThis);
    23412342
    2342     ichac97StreamUpdate(pThis, &pThis->StreamLineIn, true /* fInTimer */);
    2343     ichac97StreamUpdate(pThis, &pThis->StreamMicIn,  true /* fInTimer */);
    2344     ichac97StreamUpdate(pThis, &pThis->StreamOut,    true /* fInTimer */);
     2343    ichac97R3StreamUpdate(pThis, &pThis->StreamLineIn, true /* fInTimer */);
     2344    ichac97R3StreamUpdate(pThis, &pThis->StreamMicIn,  true /* fInTimer */);
     2345    ichac97R3StreamUpdate(pThis, &pThis->StreamOut,    true /* fInTimer */);
    23452346}
    23462347
     
    23592360 * @param   cbToProcessMax      Maximum of data (in bytes) to process.
    23602361 */
    2361 static int ichac97StreamTransfer(PAC97STATE pThis, PAC97STREAM pStream, uint32_t cbToProcessMax)
     2362static int ichac97R3StreamTransfer(PAC97STATE pThis, PAC97STREAM pStream, uint32_t cbToProcessMax)
    23622363{
    23632364    AssertPtrReturn(pThis,       VERR_INVALID_POINTER);
     
    23652366    AssertReturn(cbToProcessMax, VERR_INVALID_PARAMETER);
    23662367
    2367     ichac97StreamLock(pStream);
     2368    ichac97R3StreamLock(pStream);
    23682369
    23692370    PAC97BMREGS pRegs = &pStream->Regs;
     
    23762377            {
    23772378                case AC97SOUNDSOURCE_PO_INDEX:
    2378                     /*ichac97WriteBUP(pThis, cbToProcess);*/
     2379                    /*ichac97R3WriteBUP(pThis, cbToProcess);*/
    23792380                    break;
    23802381
     
    23842385        }
    23852386
    2386         ichac97StreamUnlock(pStream);
     2387        ichac97R3StreamUnlock(pStream);
    23872388        return VINF_SUCCESS;
    23882389    }
     
    23932394        Log3Func(("[SD%RU8] BCIS set\n", pStream->u8SD));
    23942395
    2395         ichac97StreamUnlock(pStream);
     2396        ichac97R3StreamUnlock(pStream);
    23962397        return VINF_SUCCESS;
    23972398    }
     
    24122413        {
    24132414            Log3Func(("Invalid buffer descriptor, fetching next one ...\n"));
    2414             ichac97StreamFetchBDLE(pThis, pStream);
     2415            ichac97R3StreamFetchBDLE(pThis, pStream);
    24152416        }
    24162417
     
    24322433            pRegs->piv = (pRegs->piv + 1) % AC97_MAX_BDLE;
    24332434
    2434             ichac97StreamFetchBDLE(pThis, pStream);
     2435            ichac97R3StreamFetchBDLE(pThis, pStream);
    24352436            continue;
    24362437        }
     
    24532454                    AssertRC(rc2);
    24542455
    2455 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA
     2456# ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA
    24562457                    RTFILE fh;
    24572458                    RTFileOpen(&fh,  VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "ac97DMARead.pcm",
     
    24592460                    RTFileWrite(fh, pvDst, cbDst, NULL);
    24602461                    RTFileClose(fh);
    2461 #endif
     2462# endif
    24622463                }
    24632464
     
    24832484                    AssertRC(rc2);
    24842485
    2485 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA
     2486# ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA
    24862487                    RTFILE fh;
    24872488                    RTFileOpen(&fh,  VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "ac97DMAWrite.pcm",
     
    24892490                    RTFileWrite(fh, pvSrc, cbSrc, NULL);
    24902491                    RTFileClose(fh);
    2491 #endif
     2492# endif
    24922493                }
    24932494
     
    25452546                pRegs->civ = pRegs->piv;
    25462547                pRegs->piv = (pRegs->piv + 1) % AC97_MAX_BDLE;
    2547                 ichac97StreamFetchBDLE(pThis, pStream);
     2548                ichac97R3StreamFetchBDLE(pThis, pStream);
    25482549            }
    25492550
     
    25602561    }
    25612562
    2562     ichac97StreamUnlock(pStream);
     2563    ichac97R3StreamUnlock(pStream);
    25632564
    25642565    LogFlowFuncLeaveRC(rc);
     
    27912792                        pRegs->piv = (pRegs->piv + 1) % AC97_MAX_BDLE;
    27922793
    2793                         ichac97StreamFetchBDLE(pThis, pStream);
     2794                        ichac97R3StreamFetchBDLE(pThis, pStream);
    27942795#else
    27952796                        rc = VINF_IOM_R3_IOPORT_WRITE;
     
    28172818                        Assert((pRegs->cr & AC97_CR_RPBM) == 0);
    28182819
    2819                         ichac97StreamEnable(pThis, pStream, false /* fEnable */);
    2820                         ichac97StreamReset(pThis, pStream);
     2820                        ichac97R3StreamEnable(pThis, pStream, false /* fEnable */);
     2821                        ichac97R3StreamReset(pThis, pStream);
    28212822
    28222823                        ichac97StreamUpdateSR(pThis, pStream, AC97_SR_DCH); /** @todo Do we need to do that? */
     
    28302831                            Log3Func(("[SD%RU8] Disable\n", pStream->u8SD));
    28312832
    2832                             ichac97StreamEnable(pThis, pStream, false /* fEnable */);
     2833                            ichac97R3StreamEnable(pThis, pStream, false /* fEnable */);
    28332834
    28342835                            pRegs->sr |= AC97_SR_DCH;
     
    28442845
    28452846                            /* Fetch the initial BDLE descriptor. */
    2846                             ichac97StreamFetchBDLE(pThis, pStream);
    2847 
    2848                             ichac97StreamEnable(pThis, pStream, true /* fEnable */);
     2847                            ichac97R3StreamFetchBDLE(pThis, pStream);
     2848
     2849                            ichac97R3StreamEnable(pThis, pStream, true /* fEnable */);
    28492850                        }
    28502851                    }
     
    30373038                case AC97_Reset:
    30383039#ifdef IN_RING3
    3039                     ichac97Reset(pThis->CTX_SUFF(pDevIns));
     3040                    ichac97R3Reset(pThis->CTX_SUFF(pDevIns));
    30403041#else
    30413042                    rc = VINF_IOM_R3_IOPORT_WRITE;
     
    30543055                    }
    30553056#ifdef IN_RING3
    3056                     ichac97MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_VOLUME_MASTER, u32Val);
     3057                    ichac97R3MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_VOLUME_MASTER, u32Val);
    30573058#else
    30583059                    rc = VINF_IOM_R3_IOPORT_WRITE;
     
    30663067                            /* Register controls PCM (front) outputs. */
    30673068#ifdef IN_RING3
    3068                             ichac97MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_VOLUME_MASTER, u32Val);
     3069                            ichac97R3MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_VOLUME_MASTER, u32Val);
    30693070#else
    30703071                            rc = VINF_IOM_R3_IOPORT_WRITE;
     
    30753076                case AC97_PCM_Out_Volume_Mute:
    30763077#ifdef IN_RING3
    3077                     ichac97MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_FRONT, u32Val);
     3078                    ichac97R3MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_FRONT, u32Val);
    30783079#else
    30793080                    rc = VINF_IOM_R3_IOPORT_WRITE;
     
    30823083                case AC97_Line_In_Volume_Mute:
    30833084#ifdef IN_RING3
    3084                     ichac97MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_LINE_IN, u32Val);
     3085                    ichac97R3MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_LINE_IN, u32Val);
    30853086#else
    30863087                    rc = VINF_IOM_R3_IOPORT_WRITE;
     
    30893090                case AC97_Record_Select:
    30903091#ifdef IN_RING3
    3091                     ichac97MixerRecordSelect(pThis, u32Val);
     3092                    ichac97R3MixerRecordSelect(pThis, u32Val);
    30923093#else
    30933094                    rc = VINF_IOM_R3_IOPORT_WRITE;
     
    30983099                    /* Newer Ubuntu guests rely on that when controlling gain and muting
    30993100                     * the recording (capturing) levels. */
    3100                     ichac97MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_LINE_IN, u32Val);
     3101                    ichac97R3MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_LINE_IN, u32Val);
    31013102#else
    31023103                    rc = VINF_IOM_R3_IOPORT_WRITE;
     
    31063107#ifdef IN_RING3
    31073108                    /* Ditto; see note above. */
    3108                     ichac97MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_MIC_IN,  u32Val);
     3109                    ichac97R3MixerSetVolume(pThis, uPortIdx, PDMAUDIOMIXERCTL_MIC_IN,  u32Val);
    31093110#else
    31103111                    rc = VINF_IOM_R3_IOPORT_WRITE;
     
    31233124                    {
    31243125                        ichac97MixerSet(pThis, AC97_PCM_Front_DAC_Rate, 48000);
    3125                         ichac97StreamReOpen(pThis, &pThis->StreamOut);
     3126                        ichac97R3StreamReOpen(pThis, &pThis->StreamOut);
    31263127
    31273128                        ichac97MixerSet(pThis, AC97_PCM_LR_ADC_Rate,    48000);
    3128                         ichac97StreamReOpen(pThis, &pThis->StreamLineIn);
     3129                        ichac97R3StreamReOpen(pThis, &pThis->StreamLineIn);
    31293130                    }
    31303131                    else
     
    31343135                    {
    31353136                        ichac97MixerSet(pThis, AC97_MIC_ADC_Rate,       48000);
    3136                         ichac97StreamReOpen(pThis, &pThis->StreamMicIn);
     3137                        ichac97R3StreamReOpen(pThis, &pThis->StreamMicIn);
    31373138                    }
    31383139                    else
     
    31513152                        ichac97MixerSet(pThis, uPortIdx, u32Val);
    31523153                        LogFunc(("Set front DAC rate to %RU32\n", u32Val));
    3153                         ichac97StreamReOpen(pThis, &pThis->StreamOut);
     3154                        ichac97R3StreamReOpen(pThis, &pThis->StreamOut);
    31543155#else
    31553156                        rc = VINF_IOM_R3_IOPORT_WRITE;
     
    31653166                        ichac97MixerSet(pThis, uPortIdx, u32Val);
    31663167                        LogFunc(("Set MIC ADC rate to %RU32\n", u32Val));
    3167                         ichac97StreamReOpen(pThis, &pThis->StreamMicIn);
     3168                        ichac97R3StreamReOpen(pThis, &pThis->StreamMicIn);
    31683169#else
    31693170                        rc = VINF_IOM_R3_IOPORT_WRITE;
     
    31793180                        ichac97MixerSet(pThis, uPortIdx, u32Val);
    31803181                        LogFunc(("Set front LR ADC rate to %RU32\n", u32Val));
    3181                         ichac97StreamReOpen(pThis, &pThis->StreamLineIn);
     3182                        ichac97R3StreamReOpen(pThis, &pThis->StreamLineIn);
    31823183#else
    31833184                        rc = VINF_IOM_R3_IOPORT_WRITE;
     
    32173218 * @callback_method_impl{FNPCIIOREGIONMAP}
    32183219 */
    3219 static DECLCALLBACK(int) ichac97IOPortMap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion,
    3220                                           RTGCPHYS GCPhysAddress, RTGCPHYS cb, PCIADDRESSSPACE enmType)
     3220static DECLCALLBACK(int) ichac97R3IOPortMap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion,
     3221                                            RTGCPHYS GCPhysAddress, RTGCPHYS cb, PCIADDRESSSPACE enmType)
    32213222{
    32223223    RT_NOREF(cb, enmType);
     
    32773278 * @param   pStream             AC'97 stream to save.
    32783279 */
    3279 static int ichac97SaveStream(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, PAC97STREAM pStream)
     3280static int ichac97R3SaveStream(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, PAC97STREAM pStream)
    32803281{
    32813282    RT_NOREF(pDevIns);
     
    32993300 * @callback_method_impl{FNSSMDEVSAVEEXEC}
    33003301 */
    3301 static DECLCALLBACK(int) ichac97SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     3302static DECLCALLBACK(int) ichac97R3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    33023303{
    33033304    PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE);
     
    33113312    /** @todo r=andy For the next saved state version, add unique stream identifiers and a stream count. */
    33123313    /* Note: The order the streams are saved here is critical, so don't touch. */
    3313     int rc2 = ichac97SaveStream(pDevIns, pSSM, &pThis->StreamLineIn);
     3314    int rc2 = ichac97R3SaveStream(pDevIns, pSSM, &pThis->StreamLineIn);
    33143315    AssertRC(rc2);
    3315     rc2 = ichac97SaveStream(pDevIns, pSSM, &pThis->StreamOut);
     3316    rc2 = ichac97R3SaveStream(pDevIns, pSSM, &pThis->StreamOut);
    33163317    AssertRC(rc2);
    3317     rc2 = ichac97SaveStream(pDevIns, pSSM, &pThis->StreamMicIn);
     3318    rc2 = ichac97R3SaveStream(pDevIns, pSSM, &pThis->StreamMicIn);
    33183319    AssertRC(rc2);
    33193320
     
    33223323    uint8_t active[AC97SOUNDSOURCE_END_INDEX];
    33233324
    3324     active[AC97SOUNDSOURCE_PI_INDEX] = ichac97StreamIsEnabled(pThis, &pThis->StreamLineIn) ? 1 : 0;
    3325     active[AC97SOUNDSOURCE_PO_INDEX] = ichac97StreamIsEnabled(pThis, &pThis->StreamOut)    ? 1 : 0;
    3326     active[AC97SOUNDSOURCE_MC_INDEX] = ichac97StreamIsEnabled(pThis, &pThis->StreamMicIn)  ? 1 : 0;
     3325    active[AC97SOUNDSOURCE_PI_INDEX] = ichac97R3StreamIsEnabled(pThis, &pThis->StreamLineIn) ? 1 : 0;
     3326    active[AC97SOUNDSOURCE_PO_INDEX] = ichac97R3StreamIsEnabled(pThis, &pThis->StreamOut)    ? 1 : 0;
     3327    active[AC97SOUNDSOURCE_MC_INDEX] = ichac97R3StreamIsEnabled(pThis, &pThis->StreamMicIn)  ? 1 : 0;
    33273328
    33283329    SSMR3PutMem(pSSM, active, sizeof(active));
     
    33363337 *
    33373338 * @returns IPRT status code.
    3338  * @param   pDevIns             Device instance.
    33393339 * @param   pSSM                Saved state manager (SSM) handle to use.
    33403340 * @param   pStream             AC'97 stream to load.
    33413341 */
    3342 static int ichac97LoadStream(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, PAC97STREAM pStream)
    3343 {
    3344     RT_NOREF(pDevIns);
     3342static int ichac97R3LoadStream(PSSMHANDLE pSSM, PAC97STREAM pStream)
     3343{
    33453344    PAC97BMREGS pRegs = &pStream->Regs;
    33463345
     
    33543353    SSMR3GetS32(pSSM, &pRegs->bd_valid);
    33553354    SSMR3GetU32(pSSM, &pRegs->bd.addr);
    3356     SSMR3GetU32(pSSM, &pRegs->bd.ctl_len);
    3357 
    3358     return VINF_SUCCESS;
     3355    return SSMR3GetU32(pSSM, &pRegs->bd.ctl_len);
    33593356}
    33603357
     
    33623359 * @callback_method_impl{FNSSMDEVLOADEXEC}
    33633360 */
    3364 static DECLCALLBACK(int) ichac97LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
     3361static DECLCALLBACK(int) ichac97R3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
    33653362{
    33663363    PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE);
     
    33773374    /** @todo r=andy For the next saved state version, add unique stream identifiers and a stream count. */
    33783375    /* Note: The order the streams are loaded here is critical, so don't touch. */
    3379     int rc2 = ichac97LoadStream(pDevIns, pSSM, &pThis->StreamLineIn);
    3380     AssertRC(rc2);
    3381     rc2 = ichac97LoadStream(pDevIns, pSSM, &pThis->StreamOut);
    3382     AssertRC(rc2);
    3383     rc2 = ichac97LoadStream(pDevIns, pSSM, &pThis->StreamMicIn);
    3384     AssertRC(rc2);
     3376    int rc2 = ichac97R3LoadStream(pSSM, &pThis->StreamLineIn);
     3377    AssertRCReturn(rc2, rc2);
     3378    rc2 = ichac97R3LoadStream(pSSM, &pThis->StreamOut);
     3379    AssertRCReturn(rc2, rc2);
     3380    rc2 = ichac97R3LoadStream(pSSM, &pThis->StreamMicIn);
     3381    AssertRCReturn(rc2, rc2);
    33853382
    33863383    SSMR3GetMem(pSSM, pThis->mixer_data, sizeof(pThis->mixer_data));
     
    33883385    /** @todo r=andy Stream IDs are hardcoded to certain streams. */
    33893386    uint8_t uaStrmsActive[AC97SOUNDSOURCE_END_INDEX];
    3390     SSMR3GetMem(pSSM, uaStrmsActive, sizeof(uaStrmsActive));
    3391 
    3392     ichac97MixerRecordSelect(pThis, ichac97MixerGet(pThis, AC97_Record_Select));
    3393 # define V_(a, b) ichac97MixerSetVolume(pThis, a, b, ichac97MixerGet(pThis, a))
     3387    rc2 = SSMR3GetMem(pSSM, uaStrmsActive, sizeof(uaStrmsActive));
     3388    AssertRCReturn(rc2, rc2);
     3389
     3390    ichac97R3MixerRecordSelect(pThis, ichac97MixerGet(pThis, AC97_Record_Select));
     3391# define V_(a, b) ichac97R3MixerSetVolume(pThis, a, b, ichac97MixerGet(pThis, a))
    33943392    V_(AC97_Master_Volume_Mute,  PDMAUDIOMIXERCTL_VOLUME_MASTER);
    33953393    V_(AC97_PCM_Out_Volume_Mute, PDMAUDIOMIXERCTL_FRONT);
     
    33993397    if (pThis->uCodecModel == AC97_CODEC_AD1980)
    34003398        if (ichac97MixerGet(pThis, AC97_AD_Misc) & AC97_AD_MISC_HPSEL)
    3401             ichac97MixerSetVolume(pThis, AC97_Headphone_Volume_Mute, PDMAUDIOMIXERCTL_VOLUME_MASTER,
    3402                              ichac97MixerGet(pThis, AC97_Headphone_Volume_Mute));
     3399            ichac97R3MixerSetVolume(pThis, AC97_Headphone_Volume_Mute, PDMAUDIOMIXERCTL_VOLUME_MASTER,
     3400                                    ichac97MixerGet(pThis, AC97_Headphone_Volume_Mute));
    34033401
    34043402    /** @todo r=andy Stream IDs are hardcoded to certain streams. */
    3405     rc2 = ichac97StreamEnable(pThis, &pThis->StreamLineIn,    RT_BOOL(uaStrmsActive[AC97SOUNDSOURCE_PI_INDEX]));
     3403    rc2 = ichac97R3StreamEnable(pThis, &pThis->StreamLineIn,    RT_BOOL(uaStrmsActive[AC97SOUNDSOURCE_PI_INDEX]));
    34063404    if (RT_SUCCESS(rc2))
    3407         rc2 = ichac97StreamEnable(pThis, &pThis->StreamMicIn, RT_BOOL(uaStrmsActive[AC97SOUNDSOURCE_MC_INDEX]));
     3405        rc2 = ichac97R3StreamEnable(pThis, &pThis->StreamMicIn, RT_BOOL(uaStrmsActive[AC97SOUNDSOURCE_MC_INDEX]));
    34083406    if (RT_SUCCESS(rc2))
    3409         rc2 = ichac97StreamEnable(pThis, &pThis->StreamOut,   RT_BOOL(uaStrmsActive[AC97SOUNDSOURCE_PO_INDEX]));
     3407        rc2 = ichac97R3StreamEnable(pThis, &pThis->StreamOut,   RT_BOOL(uaStrmsActive[AC97SOUNDSOURCE_PO_INDEX]));
    34103408
    34113409    pThis->bup_flag  = 0;
     
    34193417 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    34203418 */
    3421 static DECLCALLBACK(void *) ichac97QueryInterface(struct PDMIBASE *pInterface, const char *pszIID)
     3419static DECLCALLBACK(void *) ichac97R3QueryInterface(struct PDMIBASE *pInterface, const char *pszIID)
    34223420{
    34233421    PAC97STATE pThis = RT_FROM_MEMBER(pInterface, AC97STATE, IBase);
     
    34343432 * @param   pDevIns             Device instance to power off.
    34353433 */
    3436 static DECLCALLBACK(void) ichac97PowerOff(PPDMDEVINS pDevIns)
     3434static DECLCALLBACK(void) ichac97R3PowerOff(PPDMDEVINS pDevIns)
    34373435{
    34383436    PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE);
     
    34413439
    34423440    /* Note: Involves mixer stream / sink destruction, so also do this here
    3443      *       instead of in ichac97Destruct(). */
    3444     ichac97StreamsDestroy(pThis);
     3441     *       instead of in ichac97R3Destruct(). */
     3442    ichac97R3StreamsDestroy(pThis);
    34453443
    34463444    /**
    3447      * Note: Destroy the mixer while powering off and *not* in ichac97Destruct,
     3445     * Note: Destroy the mixer while powering off and *not* in ichac97R3Destruct,
    34483446     *       giving the mixer the chance to release any references held to
    34493447     *       PDM audio streams it maintains.
     
    34633461 *          make sense to me so we'll do it.
    34643462 */
    3465 static DECLCALLBACK(void) ichac97Reset(PPDMDEVINS pDevIns)
     3463static DECLCALLBACK(void) ichac97R3Reset(PPDMDEVINS pDevIns)
    34663464{
    34673465    PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE);
     
    34743472     * the codec manually.
    34753473     */
    3476     ichac97MixerReset(pThis);
     3474    ichac97R3MixerReset(pThis);
    34773475
    34783476    /*
    34793477     * Reset all streams.
    34803478     */
    3481     ichac97StreamEnable(pThis, &pThis->StreamLineIn, false /* fEnable */);
    3482     ichac97StreamReset(pThis, &pThis->StreamLineIn);
    3483 
    3484     ichac97StreamEnable(pThis, &pThis->StreamMicIn, false /* fEnable */);
    3485     ichac97StreamReset(pThis, &pThis->StreamMicIn);
    3486 
    3487     ichac97StreamEnable(pThis, &pThis->StreamOut, false /* fEnable */);
    3488     ichac97StreamReset(pThis, &pThis->StreamOut);
     3479    ichac97R3StreamEnable(pThis, &pThis->StreamLineIn, false /* fEnable */);
     3480    ichac97R3StreamReset(pThis, &pThis->StreamLineIn);
     3481
     3482    ichac97R3StreamEnable(pThis, &pThis->StreamMicIn, false /* fEnable */);
     3483    ichac97R3StreamReset(pThis, &pThis->StreamMicIn);
     3484
     3485    ichac97R3StreamEnable(pThis, &pThis->StreamOut, false /* fEnable */);
     3486    ichac97R3StreamReset(pThis, &pThis->StreamOut);
    34893487
    34903488    /*
    34913489     * Reset mixer sinks.
    34923490     *
    3493      * Do the reset here instead of in ichac97StreamReset();
     3491     * Do the reset here instead of in ichac97R3StreamReset();
    34943492     * the mixer sink(s) might still have data to be processed when an audio stream gets reset.
    34953493     */
     
    35023500     * Stop the timer, if any.
    35033501     */
    3504     ichac97TimerStop(pThis);
     3502    ichac97R3TimerStop(pThis);
    35053503
    35063504    pThis->cStreamsActive = 0;
     
    35223520 * @param   ppDrv       Attached driver instance on success. Optional.
    35233521 */
    3524 static int ichac97AttachInternal(PAC97STATE pThis, unsigned uLUN, uint32_t fFlags, PAC97DRIVER *ppDrv)
     3522static int ichac97R3AttachInternal(PAC97STATE pThis, unsigned uLUN, uint32_t fFlags, PAC97DRIVER *ppDrv)
    35253523{
    35263524    RT_NOREF(fFlags);
     
    35943592 * @param   fFlags      Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
    35953593 */
    3596 static int ichac97DetachInternal(PAC97STATE pThis, PAC97DRIVER pDrv, uint32_t fFlags)
     3594static int ichac97R3DetachInternal(PAC97STATE pThis, PAC97DRIVER pDrv, uint32_t fFlags)
    35973595{
    35983596    RT_NOREF(fFlags);
     
    36193617 * @interface_method_impl{PDMDEVREG,pfnAttach}
    36203618 */
    3621 static DECLCALLBACK(int) ichac97Attach(PPDMDEVINS pDevIns, unsigned uLUN, uint32_t fFlags)
     3619static DECLCALLBACK(int) ichac97R3Attach(PPDMDEVINS pDevIns, unsigned uLUN, uint32_t fFlags)
    36223620{
    36233621    PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE);
     
    36283626
    36293627    PAC97DRIVER pDrv;
    3630     int rc2 = ichac97AttachInternal(pThis, uLUN, fFlags, &pDrv);
     3628    int rc2 = ichac97R3AttachInternal(pThis, uLUN, fFlags, &pDrv);
    36313629    if (RT_SUCCESS(rc2))
    36323630    {
    36333631        if (DrvAudioHlpStreamCfgIsValid(&pThis->StreamLineIn.State.Cfg))
    3634             ichac97MixerAddDrvStream(pThis, pThis->pSinkLineIn, &pThis->StreamLineIn.State.Cfg, pDrv);
     3632            ichac97R3MixerAddDrvStream(pThis, pThis->pSinkLineIn, &pThis->StreamLineIn.State.Cfg, pDrv);
    36353633
    36363634        if (DrvAudioHlpStreamCfgIsValid(&pThis->StreamMicIn.State.Cfg))
    3637             ichac97MixerAddDrvStream(pThis, pThis->pSinkMicIn,  &pThis->StreamMicIn.State.Cfg, pDrv);
     3635            ichac97R3MixerAddDrvStream(pThis, pThis->pSinkMicIn,  &pThis->StreamMicIn.State.Cfg, pDrv);
    36383636
    36393637        if (DrvAudioHlpStreamCfgIsValid(&pThis->StreamOut.State.Cfg))
    3640             ichac97MixerAddDrvStream(pThis, pThis->pSinkOut,    &pThis->StreamOut.State.Cfg, pDrv);
     3638            ichac97R3MixerAddDrvStream(pThis, pThis->pSinkOut,    &pThis->StreamOut.State.Cfg, pDrv);
    36413639    }
    36423640
     
    36493647 * @interface_method_impl{PDMDEVREG,pfnDetach}
    36503648 */
    3651 static DECLCALLBACK(void) ichac97Detach(PPDMDEVINS pDevIns, unsigned uLUN, uint32_t fFlags)
     3649static DECLCALLBACK(void) ichac97R3Detach(PPDMDEVINS pDevIns, unsigned uLUN, uint32_t fFlags)
    36523650{
    36533651    PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE);
     
    36623660        if (pDrv->uLUN == uLUN)
    36633661        {
    3664             int rc2 = ichac97DetachInternal(pThis, pDrv, fFlags);
     3662            int rc2 = ichac97R3DetachInternal(pThis, pDrv, fFlags);
    36653663            if (RT_SUCCESS(rc2))
    36663664            {
     
    36873685 * @param   pszDriver   New driver name to attach.
    36883686 */
    3689 static int ichac97ReattachInternal(PAC97STATE pThis, PAC97DRIVER pDrv, uint8_t uLUN, const char *pszDriver)
     3687static int ichac97R3ReattachInternal(PAC97STATE pThis, PAC97DRIVER pDrv, uint8_t uLUN, const char *pszDriver)
    36903688{
    36913689    AssertPtrReturn(pThis,     VERR_INVALID_POINTER);
     
    36963694    if (pDrv)
    36973695    {
    3698         rc = ichac97DetachInternal(pThis, pDrv, 0 /* fFlags */);
     3696        rc = ichac97R3DetachInternal(pThis, pDrv, 0 /* fFlags */);
    36993697        if (RT_SUCCESS(rc))
    37003698            rc = PDMDevHlpDriverDetach(pThis->pDevInsR3, PDMIBASE_2_PDMDRV(pDrv->pDrvBase), 0 /* fFlags */);
     
    37133711    CFGMR3RemoveNode(CFGMR3GetChildF(pDev0, "LUN#%u/", uLUN));
    37143712
    3715 #define RC_CHECK() if (RT_FAILURE(rc)) { AssertReleaseRC(rc); break; }
     3713# define RC_CHECK() if (RT_FAILURE(rc)) { AssertReleaseRC(rc); break; }
    37163714
    37173715    do
     
    37323730
    37333731    if (RT_SUCCESS(rc))
    3734         rc = ichac97AttachInternal(pThis, uLUN, 0 /* fFlags */, NULL /* ppDrv */);
     3732        rc = ichac97R3AttachInternal(pThis, uLUN, 0 /* fFlags */, NULL /* ppDrv */);
    37353733
    37363734    LogFunc(("pThis=%p, uLUN=%u, pszDriver=%s, rc=%Rrc\n", pThis, uLUN, pszDriver, rc));
    37373735
    3738 #undef RC_CHECK
     3736# undef RC_CHECK
    37393737
    37403738    return rc;
     
    37443742 * @interface_method_impl{PDMDEVREG,pfnRelocate}
    37453743 */
    3746 static DECLCALLBACK(void) ichac97Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
     3744static DECLCALLBACK(void) ichac97R3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
    37473745{
    37483746    NOREF(offDelta);
    37493747    PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE);
    37503748    pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    3751 #ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS
     3749# ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS
    37523750    pThis->pTimerRC = TMTimerRCPtr(pThis->pTimerR3);
    3753 #endif
     3751# endif
    37543752}
    37553753
     
    37573755 * @interface_method_impl{PDMDEVREG,pfnDestruct}
    37583756 */
    3759 static DECLCALLBACK(int) ichac97Destruct(PPDMDEVINS pDevIns)
     3757static DECLCALLBACK(int) ichac97R3Destruct(PPDMDEVINS pDevIns)
    37603758{
    37613759    PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns); /* this shall come first */
     
    37803778 * @interface_method_impl{PDMDEVREG,pfnConstruct}
    37813779 */
    3782 static DECLCALLBACK(int) ichac97Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
     3780static DECLCALLBACK(int) ichac97R3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
    37833781{
    37843782    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); /* this shall come first */
     
    37923790    pThis->pDevInsR0                = PDMDEVINS_2_R0PTR(pDevIns);
    37933791    pThis->pDevInsRC                = PDMDEVINS_2_RCPTR(pDevIns);
    3794     pThis->IBase.pfnQueryInterface  = ichac97QueryInterface;
     3792    pThis->IBase.pfnQueryInterface  = ichac97R3QueryInterface;
    37953793    RTListInit(&pThis->lstDrv);
    37963794
     
    38193817                                N_("AC'97 configuration error: Querying \"Codec\" as string failed"));
    38203818
    3821 #ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS
     3819# ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS
    38223820    uint16_t uTimerHz;
    38233821    rc = CFGMR3QueryU16Def(pCfg, "TimerHz", &uTimerHz, AC97_TIMER_HZ /* Default value, if not set. */);
     
    38253823        return PDMDEV_SET_ERROR(pDevIns, rc,
    38263824                                N_("AC'97 configuration error: failed to read Hertz (Hz) rate as unsigned integer"));
    3827 #endif
     3825# endif
    38283826
    38293827    /*
     
    38973895        return rc;
    38983896
    3899     rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, 256, PCI_ADDRESS_SPACE_IO, ichac97IOPortMap);
     3897    rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, 256, PCI_ADDRESS_SPACE_IO, ichac97R3IOPortMap);
    39003898    if (RT_FAILURE(rc))
    39013899        return rc;
    39023900
    3903     rc = PDMDevHlpPCIIORegionRegister(pDevIns, 1, 64, PCI_ADDRESS_SPACE_IO, ichac97IOPortMap);
     3901    rc = PDMDevHlpPCIIORegionRegister(pDevIns, 1, 64, PCI_ADDRESS_SPACE_IO, ichac97R3IOPortMap);
    39043902    if (RT_FAILURE(rc))
    39053903        return rc;
    39063904
    3907     rc = PDMDevHlpSSMRegister(pDevIns, AC97_SSM_VERSION, sizeof(*pThis), ichac97SaveExec, ichac97LoadExec);
     3905    rc = PDMDevHlpSSMRegister(pDevIns, AC97_SSM_VERSION, sizeof(*pThis), ichac97R3SaveExec, ichac97R3LoadExec);
    39083906    if (RT_FAILURE(rc))
    39093907        return rc;
    39103908
    3911 #ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
     3909# ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    39123910    LogRel(("AC97: Asynchronous I/O enabled\n"));
    3913 #endif
     3911# endif
    39143912
    39153913    /*
     
    39203918    {
    39213919        LogFunc(("Trying to attach driver for LUN #%RU8 ...\n", uLUN));
    3922         rc = ichac97AttachInternal(pThis, uLUN, 0 /* fFlags */, NULL /* ppDrv */);
     3920        rc = ichac97R3AttachInternal(pThis, uLUN, 0 /* fFlags */, NULL /* ppDrv */);
    39233921        if (RT_FAILURE(rc))
    39243922        {
     
    39273925            else if (rc == VERR_AUDIO_BACKEND_INIT_FAILED)
    39283926            {
    3929                 ichac97ReattachInternal(pThis, NULL /* pDrv */, uLUN, "NullAudio");
     3927                ichac97R3ReattachInternal(pThis, NULL /* pDrv */, uLUN, "NullAudio");
    39303928                PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
    39313929                        N_("Host audio backend initialization has failed. Selecting the NULL audio backend "
     
    39593957         * Create all hardware streams.
    39603958         */
    3961         rc = ichac97StreamCreate(pThis, &pThis->StreamLineIn, AC97SOUNDSOURCE_PI_INDEX);
     3959        rc = ichac97R3StreamCreate(pThis, &pThis->StreamLineIn, AC97SOUNDSOURCE_PI_INDEX);
    39623960        if (RT_SUCCESS(rc))
    39633961        {
    3964             rc = ichac97StreamCreate(pThis, &pThis->StreamMicIn, AC97SOUNDSOURCE_MC_INDEX);
     3962            rc = ichac97R3StreamCreate(pThis, &pThis->StreamMicIn, AC97SOUNDSOURCE_MC_INDEX);
    39653963            if (RT_SUCCESS(rc))
    3966                 rc = ichac97StreamCreate(pThis, &pThis->StreamOut, AC97SOUNDSOURCE_PO_INDEX);
    3967         }
    3968 
    3969 #ifdef VBOX_WITH_AUDIO_AC97_ONETIME_INIT
     3964                rc = ichac97R3StreamCreate(pThis, &pThis->StreamOut, AC97SOUNDSOURCE_PO_INDEX);
     3965        }
     3966
     3967# ifdef VBOX_WITH_AUDIO_AC97_ONETIME_INIT
    39703968        PAC97DRIVER pDrv;
    39713969        RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
     
    39913989                LogRel(("AC97: Falling back to NULL backend (no sound audible)\n"));
    39923990
    3993                 ichac97Reset(pDevIns);
    3994                 ichac97ReattachInternal(pThis, pDrv, pDrv->uLUN, "NullAudio");
     3991                ichac97R3Reset(pDevIns);
     3992                ichac97R3ReattachInternal(pThis, pDrv, pDrv->uLUN, "NullAudio");
    39953993
    39963994                PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
     
    40624060            }
    40634061        }
    4064 #endif /* VBOX_WITH_AUDIO_AC97_ONETIME_INIT */
     4062# endif /* VBOX_WITH_AUDIO_AC97_ONETIME_INIT */
    40654063    }
    40664064
    40674065    if (RT_SUCCESS(rc))
    4068         ichac97Reset(pDevIns);
    4069 
    4070 #ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS
     4066        ichac97R3Reset(pDevIns);
     4067
     4068# ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS
    40714069    if (RT_SUCCESS(rc))
    40724070    {
     
    40774075         *        instead of the LPIB registers.
    40784076         */
    4079         rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, ichac97Timer, pThis,
     4077        rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, ichac97R3Timer, pThis,
    40804078                                    TMTIMER_FLAGS_NO_CRIT_SECT, "AC'97 Timer", &pThis->pTimerR3);
    40814079        AssertRCReturn(rc, rc);
     
    40924090        LogFunc(("Timer ticks=%RU64 (%RU16 Hz)\n", pThis->cTimerTicks, uTimerHz));
    40934091    }
    4094 #else /* !VBOX_WITH_AUDIO_AC97_CALLBACKS */
     4092# else /* !VBOX_WITH_AUDIO_AC97_CALLBACKS */
    40954093    if (RT_SUCCESS(rc))
    40964094    {
     
    41224120        }
    41234121    }
    4124 #endif /* VBOX_WITH_AUDIO_AC97_CALLBACKS */
    4125 
    4126 #ifdef VBOX_WITH_STATISTICS
     4122# endif /* VBOX_WITH_AUDIO_AC97_CALLBACKS */
     4123
     4124# ifdef VBOX_WITH_STATISTICS
    41274125    if (RT_SUCCESS(rc))
    41284126    {
     
    41364134        PDMDevHlpSTAMRegister(pDevIns, &pThis->StatBytesWritten, STAMTYPE_COUNTER, "/Devices/AC97/BytesWritten", STAMUNIT_BYTES,          "Bytes written to AC97 emulation.");
    41374135    }
    4138 #endif
    4139 
    4140 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA
     4136# endif
     4137
     4138# ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA
    41414139    RTFileDelete(VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "ac97DMARead.pcm");
    41424140    RTFileDelete(VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "ac97DMAWrite.pcm");
    41434141    RTFileDelete(VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "ac97StreamRead.pcm");
    41444142    RTFileDelete(VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "ac97StreamWrite.pcm");
    4145 #endif
     4143# endif
    41464144
    41474145    LogFlowFuncLeaveRC(rc);
     
    41734171    sizeof(AC97STATE),
    41744172    /* pfnConstruct */
    4175     ichac97Construct,
     4173    ichac97R3Construct,
    41764174    /* pfnDestruct */
    4177     ichac97Destruct,
     4175    ichac97R3Destruct,
    41784176    /* pfnRelocate */
    4179     ichac97Relocate,
     4177    ichac97R3Relocate,
    41804178    /* pfnMemSetup */
    41814179    NULL,
     
    41834181    NULL,
    41844182    /* pfnReset */
    4185     ichac97Reset,
     4183    ichac97R3Reset,
    41864184    /* pfnSuspend */
    41874185    NULL,
     
    41894187    NULL,
    41904188    /* pfnAttach */
    4191     ichac97Attach,
     4189    ichac97R3Attach,
    41924190    /* pfnDetach */
    4193     ichac97Detach,
     4191    ichac97R3Detach,
    41944192    /* pfnQueryInterface. */
    41954193    NULL,
     
    41974195    NULL,
    41984196    /* pfnPowerOff */
    4199     ichac97PowerOff,
     4197    ichac97R3PowerOff,
    42004198    /* pfnSoftReset */
    42014199    NULL,
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