VirtualBox

Changeset 90131 in vbox for trunk


Ignore:
Timestamp:
Jul 9, 2021 2:38:20 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145633
Message:

DevHdaCodec: Removed most of the leftovers from the attempt to run the codec emulation in ring-0. bugref:9890

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

Legend:

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

    r90128 r90131  
    5353
    5454
    55 /* STAC9220 - Nodes IDs / names. */
     55/** @name STAC9220 - Nodes IDs / Names.
     56 * @{  */
    5657#define STAC9220_NID_ROOT                                  0x0  /* Root node */
    5758#define STAC9220_NID_AFG                                   0x1  /* Audio Configuration Group */
     
    9091/** Number of total nodes emulated. */
    9192#define STAC9221_NUM_NODES                                 0x1C
     93/** @} */
    9294
    9395
     
    134136*   Global Variables                                                                                                             *
    135137*********************************************************************************************************************************/
    136 #ifdef IN_RING3
    137 
    138 /* STAC9220 - Referenced through STAC9220WIDGET in the constructor below. */
     138/** @name STAC9220 Values
     139 * @note Referenced through STAC9220WIDGET in the constructor below
     140 * @{ */
    139141static uint8_t const g_abStac9220Ports[]      = { STAC9220_NID_PIN_HEADPHONE0, STAC9220_NID_PIN_B, STAC9220_NID_PIN_C, STAC9220_NID_PIN_HEADPHONE1, STAC9220_NID_PIN_E, STAC9220_NID_PIN_F, 0 };
    140142static uint8_t const g_abStac9220Dacs[]       = { STAC9220_NID_DAC0, STAC9220_NID_DAC1, STAC9220_NID_DAC2, STAC9220_NID_DAC3, 0 };
     
    149151static uint8_t const g_abStac9220Cds[]        = { STAC9220_NID_PIN_CD, 0 };
    150152static uint8_t const g_abStac9220VolKnobs[]   = { STAC9220_NID_VOL_KNOB, 0 };
    151 /* STAC 9221. */
     153/** @} */
     154
     155/** @name STAC 9221 Values.
     156 * @note Referenced through STAC9220WIDGET in the constructor below
     157 * @{ */
    152158/** @todo Is STAC9220_NID_SPDIF_IN really correct for reserved nodes? */
    153159static uint8_t const g_abStac9220Reserveds[]  = { STAC9220_NID_SPDIF_IN, STAC9221_NID_ADAT_OUT, STAC9221_NID_I2S_OUT, STAC9221_NID_PIN_I2S_OUT, 0 };
     160/** @} */
     161
    154162
    155163/** SSM description of CODECCOMMONNODE. */
     
    176184};
    177185
    178 #endif /* IN_RING3 */
    179186
    180187
     
    780787}
    781788
    782 #ifdef IN_RING3
    783789
    784790static int stac9220Construct(PHDACODEC pThis)
     
    840846    return VINF_SUCCESS;
    841847}
    842 
    843 #endif /* IN_RING3 */
    844848
    845849
     
    887891HDA_CODEC_IS_NODE_OF_TYPE_FUNC(Reserved)
    888892
    889 #ifdef IN_RING3
    890893
    891894/*
     
    940943}
    941944
    942 #endif /* IN_RING3 */
    943945
    944946DECLINLINE(void) hdaCodecSetRegister(uint32_t *pu32Reg, uint32_t u32Cmd, uint8_t u8Offset, uint32_t mask)
     
    20792081}
    20802082
    2081 #ifdef IN_RING3
    20822083
    20832084/**
     
    22222223}
    22232224
    2224 #endif /* IN_RING3 */
    22252225
    22262226
     
    22352235       ---------- --------------------- ------------------------------------------------------------------- */
    22362236    { 0x00020000, CODEC_VERB_16BIT_CMD, vrbProcSetConverterFormat                , "SetConverterFormat    " },
    2237     { 0x00030000, CODEC_VERB_16BIT_CMD, CTX_EXPR(vrbProcR3SetAmplifier,NULL,NULL), "SetAmplifier          " },
     2237    { 0x00030000, CODEC_VERB_16BIT_CMD, vrbProcR3SetAmplifier                    , "SetAmplifier          " },
    22382238    { 0x00070100, CODEC_VERB_8BIT_CMD , vrbProcSetConSelectCtrl                  , "SetConSelectCtrl      " },
    22392239    { 0x00070300, CODEC_VERB_8BIT_CMD , vrbProcSetProcessingState                , "SetProcessingState    " },
    22402240    { 0x00070400, CODEC_VERB_8BIT_CMD , vrbProcSetSDISelect                      , "SetSDISelect          " },
    22412241    { 0x00070500, CODEC_VERB_8BIT_CMD , vrbProcSetPowerState                     , "SetPowerState         " },
    2242     { 0x00070600, CODEC_VERB_8BIT_CMD , CTX_EXPR(vrbProcR3SetStreamId,NULL,NULL) , "SetStreamId           " },
     2242    { 0x00070600, CODEC_VERB_8BIT_CMD , vrbProcR3SetStreamId                    , "SetStreamId           " },
    22432243    { 0x00070700, CODEC_VERB_8BIT_CMD , vrbProcSetPinCtrl                        , "SetPinCtrl            " },
    22442244    { 0x00070800, CODEC_VERB_8BIT_CMD , vrbProcSetUnsolicitedEnabled             , "SetUnsolicitedEnabled " },
     
    23382338             * Found it!  Run the callback and return.
    23392339             */
    2340 #ifndef IN_RING3
    2341             if (!g_aCodecVerbs[iCur].pfn)
    2342             {
    2343                 Log3Func(("[NID0x%02x] (0x%x) %s: 0x%x -> VERR_INVALID_CONTEXT\n", /* -> ring-3 */
    2344                           CODEC_NID(uCmd), g_aCodecVerbs[iCur].uVerb, g_aCodecVerbs[iCur].pszName, CODEC_VERB_PAYLOAD8(uCmd)));
    2345                 return VERR_INVALID_CONTEXT;
    2346             }
    2347 #endif
    23482340            AssertPtrReturn(g_aCodecVerbs[iCur].pfn, VERR_INTERNAL_ERROR_5); /* Paranoia^2. */
    23492341
     
    23732365*   Debug                                                                                                                        *
    23742366*********************************************************************************************************************************/
    2375 #ifdef IN_RING3
    2376 
    23772367/**
    23782368 * CODEC debug info item printing state.
     
    23902380typedef CODECDEBUG *PCODECDEBUG;
    23912381
    2392 # define CODECDBG_INDENT        pInfo->uLevel++;
    2393 # define CODECDBG_UNINDENT      if (pInfo->uLevel) pInfo->uLevel--;
    2394 
    2395 # define CODECDBG_PRINT(...)    pInfo->pHlp->pfnPrintf(pInfo->pHlp, __VA_ARGS__)
    2396 # define CODECDBG_PRINTI(...)   codecDbgPrintf(pInfo, __VA_ARGS__)
     2382#define CODECDBG_INDENT         pInfo->uLevel++;
     2383#define CODECDBG_UNINDENT       if (pInfo->uLevel) pInfo->uLevel--;
     2384
     2385#define CODECDBG_PRINT(...)     pInfo->pHlp->pfnPrintf(pInfo->pHlp, __VA_ARGS__)
     2386#define CODECDBG_PRINTI(...)    codecDbgPrintf(pInfo, __VA_ARGS__)
    23972387
    23982388
     
    24492439static void codecDbgPrintNodeAmp(PCODECDEBUG pInfo, uint32_t *paReg, uint8_t uIdx, uint8_t uDir)
    24502440{
    2451 # define CODECDBG_AMP(reg, chan) \
     2441#define CODECDBG_AMP(reg, chan) \
    24522442        codecDbgPrintf(pInfo, "Amp %RU8 %s %s: In=%RTbool, Out=%RTbool, Left=%RTbool, Right=%RTbool, Idx=%RU8, fMute=%RTbool, uGain=%RU8\n", \
    24532443                       uIdx, chan, uDir == AMPLIFIER_IN ? "In" : "Out", \
     
    24612451    CODECDBG_AMP(regAmp, "Right");
    24622452
    2463 # undef CODECDBG_AMP
    2464 }
    2465 
    2466 
    2467 # if 0 /* unused */
     2453#undef CODECDBG_AMP
     2454}
     2455
     2456
     2457#if 0 /* unused */
    24682458static void codecDbgPrintNodeConnections(PCODECDEBUG pInfo, PCODECNODE pNode)
    24692459{
     
    24742464    }
    24752465}
    2476 # endif
     2466#endif
    24772467
    24782468
     
    25522542    if (fRecursive)
    25532543    {
    2554 # define CODECDBG_PRINT_CONLIST_ENTRY(_aNode, _aEntry) \
     2544#define CODECDBG_PRINT_CONLIST_ENTRY(_aNode, _aEntry) \
    25552545            if (cCnt >= _aEntry) \
    25562546            { \
     
    25792569        }
    25802570
    2581 # undef CODECDBG_PRINT_CONLIST_ENTRY
     2571#undef CODECDBG_PRINT_CONLIST_ENTRY
    25822572   }
    25832573}
     
    26162606
    26172607
    2618 # if 0 /* unused */
     2608#if 0 /* unused */
    26192609static DECLCALLBACK(void) stac9220DbgNodes(PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs)
    26202610{
     
    26322622    }
    26332623}
    2634 # endif
    2635 
    2636 #endif /* IN_RING3 */
    2637 
     2624#endif
    26382625
    26392626
     
    26412628*   DevHDA API                                                                                                                   *
    26422629*********************************************************************************************************************************/
    2643 
    2644 #ifdef IN_RING3
    26452630
    26462631int hdaR3CodecAddStream(PHDACODECR3 pThisCC, PDMAUDIOMIXERCTL enmMixerCtl, PPDMAUDIOSTREAMCFG pCfg)
     
    28542839    AssertRCReturn(rc, rc);
    28552840
    2856 # ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
    2857 #  error "Implement mic-in support!"
    2858 # endif
     2841#ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
     2842# error "Implement mic-in support!"
     2843#endif
    28592844
    28602845    /*
     
    28622847     */
    28632848    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatLookupsR3, STAMTYPE_COUNTER, "Codec/LookupsR0", STAMUNIT_OCCURENCES, "Number of R0 codecLookup calls");
    2864 # if 0 /* Codec is not yet kosher enough for ring-0.  @bugref{9890c64} */
     2849#if 0 /* Codec is not yet kosher enough for ring-0.  @bugref{9890c64} */
    28652850    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatLookupsR0, STAMTYPE_COUNTER, "Codec/LookupsR3", STAMUNIT_OCCURENCES, "Number of R3 codecLookup calls");
    2866 # endif
     2851#endif
    28672852
    28682853    return rc;
    28692854}
    28702855
    2871 #else /* IN_RING0 */
    2872 
    2873 /**
    2874  * Constructs a codec (ring-0).
    2875  *
    2876  * @returns VBox status code.
    2877  * @param   pDevIns             Associated device instance.
    2878  * @param   pThis               Shared codec data beteen r0/r3.
    2879  * @param   pThisCC             Context-specific codec data (ring-0).
    2880  */
    2881 int hdaR0CodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, PHDACODECR0 pThisCC)
    2882 {
    2883     AssertPtrReturn(pDevIns, VERR_INVALID_POINTER);
    2884     AssertPtrReturn(pThis,   VERR_INVALID_POINTER);
    2885     AssertPtrReturn(pThisCC, VERR_INVALID_POINTER);
    2886 
    2887     pThisCC->pfnLookup = codecLookup;
    2888 
    2889     /* Note: Everything else is done in the R3 part. */
    2890 
    2891     return VINF_SUCCESS;
    2892 }
    2893 
    2894 #endif /* IN_RING0 */
    28952856
    28962857/**
     
    29092870}
    29102871
     2872
    29112873/**
    29122874 * Resets a codec.
  • trunk/src/VBox/Devices/Audio/DevHdaCodec.h

    r90128 r90131  
    3232/** The ICH HDA (Intel) common codec state. */
    3333typedef struct HDACODEC *PHDACODEC;
    34 /** The ICH HDA (Intel) ring-0 codec state. */
    35 typedef struct HDACODECR0 *PHDACODECR0;
    3634/** The ICH HDA (Intel) ring-3 codec state. */
    3735typedef struct HDACODECR3 *PHDACODECR3;
     36#ifdef IN_RING3 /* (A leftover from attempt at running the codec in ring-0.  Deemed unsafe
     37                    and not help with performance when it mattered.) */
    3838/** The ICH HDA (Intel) current context codec state. */
    3939typedef CTX_SUFF(PHDACODEC) PHDACODECCC;
     40#endif
    4041
    4142/**
     
    841842} HDACODEC;
    842843
    843 /**
    844  * HDA codec state (ring-0).
    845  */
    846 typedef struct HDACODECR0
    847 {
    848     /** @name Public codec functions.
    849      *  @{  */
    850 #if 0 /** @todo r=bird: why can I just disable these and not get compile errors?  Unfinished code?  No comments.  Not at all amused! */
    851     DECLR0CALLBACKMEMBER(void, pfnReset, (PHDACODEC pThis, PHDACODECR0 pThisCC));
    852     DECLR0CALLBACKMEMBER(int,  pfnNodeReset, (PHDACODEC pThis, uint8_t nID, PCODECNODE pNode));
    853 #endif
    854     DECLR0CALLBACKMEMBER(int,  pfnLookup, (PHDACODEC pThis, PHDACODECR0 pThisCC, uint32_t uVerb, uint64_t *puResp));
    855     /** @} */
    856 } HDACODECR0;
    857 
    858 int hdaR0CodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, PHDACODECR0 pThisCC);
    859844
    860845/**
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