Index: trunk/src/VBox/Devices/Audio/DevHdaCodec.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DevHdaCodec.cpp	(revision 90130)
+++ trunk/src/VBox/Devices/Audio/DevHdaCodec.cpp	(revision 90131)
@@ -53,5 +53,6 @@
 
 
-/* STAC9220 - Nodes IDs / names. */
+/** @name STAC9220 - Nodes IDs / Names.
+ * @{  */
 #define STAC9220_NID_ROOT                                  0x0  /* Root node */
 #define STAC9220_NID_AFG                                   0x1  /* Audio Configuration Group */
@@ -90,4 +91,5 @@
 /** Number of total nodes emulated. */
 #define STAC9221_NUM_NODES                                 0x1C
+/** @} */
 
 
@@ -134,7 +136,7 @@
 *   Global Variables                                                                                                             *
 *********************************************************************************************************************************/
-#ifdef IN_RING3
-
-/* STAC9220 - Referenced through STAC9220WIDGET in the constructor below. */
+/** @name STAC9220 Values
+ * @note Referenced through STAC9220WIDGET in the constructor below
+ * @{ */
 static 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 };
 static uint8_t const g_abStac9220Dacs[]       = { STAC9220_NID_DAC0, STAC9220_NID_DAC1, STAC9220_NID_DAC2, STAC9220_NID_DAC3, 0 };
@@ -149,7 +151,13 @@
 static uint8_t const g_abStac9220Cds[]        = { STAC9220_NID_PIN_CD, 0 };
 static uint8_t const g_abStac9220VolKnobs[]   = { STAC9220_NID_VOL_KNOB, 0 };
-/* STAC 9221. */
+/** @} */
+
+/** @name STAC 9221 Values.
+ * @note Referenced through STAC9220WIDGET in the constructor below
+ * @{ */
 /** @todo Is STAC9220_NID_SPDIF_IN really correct for reserved nodes? */
 static uint8_t const g_abStac9220Reserveds[]  = { STAC9220_NID_SPDIF_IN, STAC9221_NID_ADAT_OUT, STAC9221_NID_I2S_OUT, STAC9221_NID_PIN_I2S_OUT, 0 };
+/** @} */
+
 
 /** SSM description of CODECCOMMONNODE. */
@@ -176,5 +184,4 @@
 };
 
-#endif /* IN_RING3 */
 
 
@@ -780,5 +787,4 @@
 }
 
-#ifdef IN_RING3
 
 static int stac9220Construct(PHDACODEC pThis)
@@ -840,6 +846,4 @@
     return VINF_SUCCESS;
 }
-
-#endif /* IN_RING3 */
 
 
@@ -887,5 +891,4 @@
 HDA_CODEC_IS_NODE_OF_TYPE_FUNC(Reserved)
 
-#ifdef IN_RING3
 
 /*
@@ -940,5 +943,4 @@
 }
 
-#endif /* IN_RING3 */
 
 DECLINLINE(void) hdaCodecSetRegister(uint32_t *pu32Reg, uint32_t u32Cmd, uint8_t u8Offset, uint32_t mask)
@@ -2079,5 +2081,4 @@
 }
 
-#ifdef IN_RING3
 
 /**
@@ -2222,5 +2223,4 @@
 }
 
-#endif /* IN_RING3 */
 
 
@@ -2235,10 +2235,10 @@
        ---------- --------------------- ------------------------------------------------------------------- */
     { 0x00020000, CODEC_VERB_16BIT_CMD, vrbProcSetConverterFormat                , "SetConverterFormat    " },
-    { 0x00030000, CODEC_VERB_16BIT_CMD, CTX_EXPR(vrbProcR3SetAmplifier,NULL,NULL), "SetAmplifier          " },
+    { 0x00030000, CODEC_VERB_16BIT_CMD, vrbProcR3SetAmplifier                    , "SetAmplifier          " },
     { 0x00070100, CODEC_VERB_8BIT_CMD , vrbProcSetConSelectCtrl                  , "SetConSelectCtrl      " },
     { 0x00070300, CODEC_VERB_8BIT_CMD , vrbProcSetProcessingState                , "SetProcessingState    " },
     { 0x00070400, CODEC_VERB_8BIT_CMD , vrbProcSetSDISelect                      , "SetSDISelect          " },
     { 0x00070500, CODEC_VERB_8BIT_CMD , vrbProcSetPowerState                     , "SetPowerState         " },
-    { 0x00070600, CODEC_VERB_8BIT_CMD , CTX_EXPR(vrbProcR3SetStreamId,NULL,NULL) , "SetStreamId           " },
+    { 0x00070600, CODEC_VERB_8BIT_CMD , vrbProcR3SetStreamId                     , "SetStreamId           " },
     { 0x00070700, CODEC_VERB_8BIT_CMD , vrbProcSetPinCtrl                        , "SetPinCtrl            " },
     { 0x00070800, CODEC_VERB_8BIT_CMD , vrbProcSetUnsolicitedEnabled             , "SetUnsolicitedEnabled " },
@@ -2338,12 +2338,4 @@
              * Found it!  Run the callback and return.
              */
-#ifndef IN_RING3
-            if (!g_aCodecVerbs[iCur].pfn)
-            {
-                Log3Func(("[NID0x%02x] (0x%x) %s: 0x%x -> VERR_INVALID_CONTEXT\n", /* -> ring-3 */
-                          CODEC_NID(uCmd), g_aCodecVerbs[iCur].uVerb, g_aCodecVerbs[iCur].pszName, CODEC_VERB_PAYLOAD8(uCmd)));
-                return VERR_INVALID_CONTEXT;
-            }
-#endif
             AssertPtrReturn(g_aCodecVerbs[iCur].pfn, VERR_INTERNAL_ERROR_5); /* Paranoia^2. */
 
@@ -2373,6 +2365,4 @@
 *   Debug                                                                                                                        *
 *********************************************************************************************************************************/
-#ifdef IN_RING3
-
 /**
  * CODEC debug info item printing state.
@@ -2390,9 +2380,9 @@
 typedef CODECDEBUG *PCODECDEBUG;
 
-# define CODECDBG_INDENT        pInfo->uLevel++;
-# define CODECDBG_UNINDENT      if (pInfo->uLevel) pInfo->uLevel--;
-
-# define CODECDBG_PRINT(...)    pInfo->pHlp->pfnPrintf(pInfo->pHlp, __VA_ARGS__)
-# define CODECDBG_PRINTI(...)   codecDbgPrintf(pInfo, __VA_ARGS__)
+#define CODECDBG_INDENT         pInfo->uLevel++;
+#define CODECDBG_UNINDENT       if (pInfo->uLevel) pInfo->uLevel--;
+
+#define CODECDBG_PRINT(...)     pInfo->pHlp->pfnPrintf(pInfo->pHlp, __VA_ARGS__)
+#define CODECDBG_PRINTI(...)    codecDbgPrintf(pInfo, __VA_ARGS__)
 
 
@@ -2449,5 +2439,5 @@
 static void codecDbgPrintNodeAmp(PCODECDEBUG pInfo, uint32_t *paReg, uint8_t uIdx, uint8_t uDir)
 {
-# define CODECDBG_AMP(reg, chan) \
+#define CODECDBG_AMP(reg, chan) \
         codecDbgPrintf(pInfo, "Amp %RU8 %s %s: In=%RTbool, Out=%RTbool, Left=%RTbool, Right=%RTbool, Idx=%RU8, fMute=%RTbool, uGain=%RU8\n", \
                        uIdx, chan, uDir == AMPLIFIER_IN ? "In" : "Out", \
@@ -2461,9 +2451,9 @@
     CODECDBG_AMP(regAmp, "Right");
 
-# undef CODECDBG_AMP
-}
-
-
-# if 0 /* unused */
+#undef CODECDBG_AMP
+}
+
+
+#if 0 /* unused */
 static void codecDbgPrintNodeConnections(PCODECDEBUG pInfo, PCODECNODE pNode)
 {
@@ -2474,5 +2464,5 @@
     }
 }
-# endif
+#endif
 
 
@@ -2552,5 +2542,5 @@
     if (fRecursive)
     {
-# define CODECDBG_PRINT_CONLIST_ENTRY(_aNode, _aEntry) \
+#define CODECDBG_PRINT_CONLIST_ENTRY(_aNode, _aEntry) \
             if (cCnt >= _aEntry) \
             { \
@@ -2579,5 +2569,5 @@
         }
 
-# undef CODECDBG_PRINT_CONLIST_ENTRY
+#undef CODECDBG_PRINT_CONLIST_ENTRY
    }
 }
@@ -2616,5 +2606,5 @@
 
 
-# if 0 /* unused */
+#if 0 /* unused */
 static DECLCALLBACK(void) stac9220DbgNodes(PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs)
 {
@@ -2632,8 +2622,5 @@
     }
 }
-# endif
-
-#endif /* IN_RING3 */
-
+#endif
 
 
@@ -2641,6 +2628,4 @@
 *   DevHDA API                                                                                                                   *
 *********************************************************************************************************************************/
-
-#ifdef IN_RING3
 
 int hdaR3CodecAddStream(PHDACODECR3 pThisCC, PDMAUDIOMIXERCTL enmMixerCtl, PPDMAUDIOSTREAMCFG pCfg)
@@ -2854,7 +2839,7 @@
     AssertRCReturn(rc, rc);
 
-# ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
-#  error "Implement mic-in support!"
-# endif
+#ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
+# error "Implement mic-in support!"
+#endif
 
     /*
@@ -2862,35 +2847,11 @@
      */
     PDMDevHlpSTAMRegister(pDevIns, &pThis->StatLookupsR3, STAMTYPE_COUNTER, "Codec/LookupsR0", STAMUNIT_OCCURENCES, "Number of R0 codecLookup calls");
-# if 0 /* Codec is not yet kosher enough for ring-0.  @bugref{9890c64} */
+#if 0 /* Codec is not yet kosher enough for ring-0.  @bugref{9890c64} */
     PDMDevHlpSTAMRegister(pDevIns, &pThis->StatLookupsR0, STAMTYPE_COUNTER, "Codec/LookupsR3", STAMUNIT_OCCURENCES, "Number of R3 codecLookup calls");
-# endif
+#endif
 
     return rc;
 }
 
-#else /* IN_RING0 */
-
-/**
- * Constructs a codec (ring-0).
- *
- * @returns VBox status code.
- * @param   pDevIns             Associated device instance.
- * @param   pThis               Shared codec data beteen r0/r3.
- * @param   pThisCC             Context-specific codec data (ring-0).
- */
-int hdaR0CodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, PHDACODECR0 pThisCC)
-{
-    AssertPtrReturn(pDevIns, VERR_INVALID_POINTER);
-    AssertPtrReturn(pThis,   VERR_INVALID_POINTER);
-    AssertPtrReturn(pThisCC, VERR_INVALID_POINTER);
-
-    pThisCC->pfnLookup = codecLookup;
-
-    /* Note: Everything else is done in the R3 part. */
-
-    return VINF_SUCCESS;
-}
-
-#endif /* IN_RING0 */
 
 /**
@@ -2909,4 +2870,5 @@
 }
 
+
 /**
  * Resets a codec.
Index: trunk/src/VBox/Devices/Audio/DevHdaCodec.h
===================================================================
--- trunk/src/VBox/Devices/Audio/DevHdaCodec.h	(revision 90130)
+++ trunk/src/VBox/Devices/Audio/DevHdaCodec.h	(revision 90131)
@@ -32,10 +32,11 @@
 /** The ICH HDA (Intel) common codec state. */
 typedef struct HDACODEC *PHDACODEC;
-/** The ICH HDA (Intel) ring-0 codec state. */
-typedef struct HDACODECR0 *PHDACODECR0;
 /** The ICH HDA (Intel) ring-3 codec state. */
 typedef struct HDACODECR3 *PHDACODECR3;
+#ifdef IN_RING3 /* (A leftover from attempt at running the codec in ring-0.  Deemed unsafe
+                    and not help with performance when it mattered.) */
 /** The ICH HDA (Intel) current context codec state. */
 typedef CTX_SUFF(PHDACODEC) PHDACODECCC;
+#endif
 
 /**
@@ -841,20 +842,4 @@
 } HDACODEC;
 
-/**
- * HDA codec state (ring-0).
- */
-typedef struct HDACODECR0
-{
-    /** @name Public codec functions.
-     *  @{  */
-#if 0 /** @todo r=bird: why can I just disable these and not get compile errors?  Unfinished code?  No comments.  Not at all amused! */
-    DECLR0CALLBACKMEMBER(void, pfnReset, (PHDACODEC pThis, PHDACODECR0 pThisCC));
-    DECLR0CALLBACKMEMBER(int,  pfnNodeReset, (PHDACODEC pThis, uint8_t nID, PCODECNODE pNode));
-#endif
-    DECLR0CALLBACKMEMBER(int,  pfnLookup, (PHDACODEC pThis, PHDACODECR0 pThisCC, uint32_t uVerb, uint64_t *puResp));
-    /** @} */
-} HDACODECR0;
-
-int hdaR0CodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, PHDACODECR0 pThisCC);
 
 /**
