Index: trunk/src/VBox/Devices/Audio/DevHda.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DevHda.cpp	(revision 90146)
+++ trunk/src/VBox/Devices/Audio/DevHda.cpp	(revision 90147)
@@ -4991,8 +4991,8 @@
     /* ICH6 datasheet defines 0 values for SVID and SID (18.1.14-15), which together with values returned for
        verb F20 should provide device/codec recognition. */
-    Assert(pThisCC->Codec.idVendor);
-    Assert(pThisCC->Codec.idDevice);
-    PDMPciDevSetSubSystemVendorId(pPciDev, pThisCC->Codec.idVendor); /* 2c ro - intel.) */
-    PDMPciDevSetSubSystemId(      pPciDev, pThisCC->Codec.idDevice); /* 2e ro. */
+    Assert(pThisCC->Codec.Cfg.idVendor);
+    Assert(pThisCC->Codec.Cfg.idDevice);
+    PDMPciDevSetSubSystemVendorId(pPciDev, pThisCC->Codec.Cfg.idVendor); /* 2c ro - intel.) */
+    PDMPciDevSetSubSystemId(      pPciDev, pThisCC->Codec.Cfg.idDevice); /* 2e ro. */
 
     /*
Index: trunk/src/VBox/Devices/Audio/DevHdaCodec.cpp
===================================================================
--- trunk/src/VBox/Devices/Audio/DevHdaCodec.cpp	(revision 90146)
+++ trunk/src/VBox/Devices/Audio/DevHdaCodec.cpp	(revision 90147)
@@ -189,13 +189,15 @@
  * Resets a single node of the codec.
  *
- * @param   pThis               HDA codec of node to reset.
- * @param   uNID                Node ID to set node to.
- * @param   pNode               Node to reset.
- */
-static void stac9220NodeReset(PHDACODECR3 pThis, uint8_t uNID, PCODECNODE pNode)
+ * @param   pThis       HDA codec of node to reset.
+ * @param   uNID        Node ID to set node to.
+ * @param   pNode       Node to reset.
+ * @param   fInReset    Set if we're called from hdaCodecReset via
+ *                      stac9220Reset, clear if called from stac9220Construct.
+ */
+static void stac9220NodeReset(PHDACODECR3 pThis, uint8_t uNID, PCODECNODE pNode, bool const fInReset)
 {
     LogFlowFunc(("NID=0x%x (%RU8)\n", uNID, uNID));
 
-    if (   !pThis->fInReset
+    if (   !fInReset
         && (   uNID != STAC9220_NID_ROOT
             && uNID != STAC9220_NID_AFG)
@@ -391,5 +393,5 @@
             pNode->port.node.au32F02_param[0]   = STAC9220_NID_DAC0;
 
-            if (!pThis->fInReset)
+            if (!fInReset)
                 pNode->port.u32F1c_param = CODEC_MAKE_F1C(CODEC_F1C_PORT_COMPLEX,
                                                           CODEC_F1C_LOCATION_FRONT,
@@ -415,5 +417,5 @@
             pNode->port.node.au32F02_param[0]   = STAC9220_NID_DAC2;
 
-            if (!pThis->fInReset)
+            if (!fInReset)
                 pNode->port.u32F1c_param = CODEC_MAKE_F1C(CODEC_F1C_PORT_COMPLEX,
                                                           CODEC_F1C_LOCATION_REAR,
@@ -439,5 +441,5 @@
             pNode->port.node.au32F02_param[0x0] = STAC9220_NID_DAC1;
 
-            if (!pThis->fInReset)
+            if (!fInReset)
                 pNode->port.u32F1c_param = CODEC_MAKE_F1C(CODEC_F1C_PORT_COMPLEX,
                                                           CODEC_F1C_LOCATION_REAR,
@@ -464,5 +466,5 @@
             pNode->port.node.au32F02_param[0x0] = STAC9220_NID_DAC0;
 
-            if (!pThis->fInReset)
+            if (!fInReset)
                 pNode->port.u32F1c_param = CODEC_MAKE_F1C(CODEC_F1C_PORT_COMPLEX,
                                                           CODEC_F1C_LOCATION_FRONT,
@@ -505,5 +507,5 @@
                                                 | CODEC_F00_0C_CAP_PRESENCE_DETECT;
 
-            if (!pThis->fInReset)
+            if (!fInReset)
                 pNode->port.u32F1c_param = CODEC_MAKE_F1C(CODEC_F1C_PORT_COMPLEX,
                                                           CODEC_F1C_LOCATION_REAR,
@@ -535,5 +537,5 @@
             pNode->port.node.au32F02_param[0x0] = STAC9220_NID_DAC3;
 
-            if (!pThis->fInReset)
+            if (!fInReset)
                 pNode->port.u32F1c_param = CODEC_MAKE_F1C(CODEC_F1C_PORT_COMPLEX,
                                                           CODEC_F1C_LOCATION_INTERNAL,
@@ -561,5 +563,5 @@
             pNode->digout.node.au32F02_param[0x0] = RT_MAKE_U32_FROM_U8(STAC9220_NID_SPDIF_OUT,
                                                                         STAC9220_NID_AMP_ADC0, STAC9221_NID_ADAT_OUT, 0);
-            if (!pThis->fInReset)
+            if (!fInReset)
                 pNode->digout.u32F1c_param = CODEC_MAKE_F1C(CODEC_F1C_PORT_COMPLEX,
                                                             CODEC_F1C_LOCATION_REAR,
@@ -589,5 +591,5 @@
                                                  | CODEC_F00_0C_CAP_INPUT
                                                  | CODEC_F00_0C_CAP_PRESENCE_DETECT;
-            if (!pThis->fInReset)
+            if (!fInReset)
                 pNode->digin.u32F1c_param = CODEC_MAKE_F1C(CODEC_F1C_PORT_COMPLEX,
                                                            CODEC_F1C_LOCATION_REAR,
@@ -656,5 +658,5 @@
             pNode->cdnode.node.au32F00_param[0xC] = CODEC_F00_0C_CAP_INPUT;
 
-            if (!pThis->fInReset)
+            if (!fInReset)
                 pNode->cdnode.u32F1c_param = CODEC_MAKE_F1C(CODEC_F1C_PORT_FIXED,
                                                             CODEC_F1C_LOCATION_INTERNAL,
@@ -745,5 +747,5 @@
             pNode->node.au32F02_param[0]   = STAC9221_NID_I2S_OUT;
 
-            if (!pThis->fInReset)
+            if (!fInReset)
                 pNode->reserved.u32F1c_param = CODEC_MAKE_F1C(CODEC_F1C_PORT_NO_PHYS,
                                                               CODEC_F1C_LOCATION_NA,
@@ -774,17 +776,12 @@
     LogRel(("HDA: Codec reset\n"));
 
-    pThis->fInReset = true;
-
-    uint8_t const cTotalNodes = (uint8_t)RT_MIN(pThis->cTotalNodes, RT_ELEMENTS(pThis->aNodes));
+    uint8_t const cTotalNodes = (uint8_t)RT_MIN(pThis->Cfg.cTotalNodes, RT_ELEMENTS(pThis->aNodes));
     for (uint8_t i = 0; i < cTotalNodes; i++)
-        stac9220NodeReset(pThis, i, &pThis->aNodes[i]);
-
-    pThis->fInReset = false;
-}
-
-
-static int stac9220Construct(PHDACODECR3 pThis)
-{
-    pThis->idVendor     = 0x8384; /* SigmaTel */
+        stac9220NodeReset(pThis, i, &pThis->aNodes[i], true /*fInReset*/);
+}
+
+
+static int stac9220Construct(PHDACODECR3 pThis, HDACODECCFG *pCfg)
+{
     /*
      * Note: The Linux kernel uses "patch_stac922x" for the fixups,
@@ -792,26 +789,30 @@
      *       defaults tweaking in sound/pci/hda/patch_sigmatel.c.
      */
-    pThis->idDevice     = 0x7680; /* STAC9221 A1 */
-    pThis->bBSKU        = 0x76;
-    pThis->idAssembly   = 0x80;
-
-    pThis->fInReset = false;
-
-    uint16_t *pafNodeClassifications = (uint16_t *)&pThis->afNodeClassifications[0];
+    pCfg->idVendor          = 0x8384; /* SigmaTel */
+    pCfg->idDevice          = 0x7680; /* STAC9221 A1 */
+    pCfg->bBSKU             = 0x76;
+    pCfg->idAssembly        = 0x80;
+
+    AssertCompile(STAC9221_NUM_NODES <= RT_ELEMENTS(pThis->aNodes));
+    pCfg->cTotalNodes       = STAC9221_NUM_NODES;
+    pCfg->u8AdcVolsLineIn   = STAC9220_NID_AMP_ADC0;
+    pCfg->u8DacLineOut      = STAC9220_NID_DAC1;
+
+    /* Copy over the node class lists and popuplate afNodeClassifications. */
 #define STAC9220WIDGET(a_Type) do { \
-            AssertCompile(RT_ELEMENTS(g_abStac9220##a_Type##s) <= RT_ELEMENTS(pThis->ab##a_Type##s)); \
-            uint8_t  *pbDst = (uint8_t *)&pThis->ab##a_Type##s[0]; \
+            AssertCompile(RT_ELEMENTS(g_abStac9220##a_Type##s) <= RT_ELEMENTS(pCfg->ab##a_Type##s)); \
+            uint8_t  *pbDst = (uint8_t *)&pCfg->ab##a_Type##s[0]; \
             uintptr_t i; \
             for (i = 0; i < RT_ELEMENTS(g_abStac9220##a_Type##s); i++) \
             { \
                 uint8_t const idNode = g_abStac9220##a_Type##s[i]; \
-                if (idNode != 0) \
-                { \
-                    AssertReturn(idNode < RT_ELEMENTS(pThis->aNodes), VERR_INTERNAL_ERROR_3); \
-                    pafNodeClassifications[idNode] |= RT_CONCAT(CODEC_NODE_CLS_,a_Type); \
-                } \
+                if (idNode == 0) \
+                    break; \
+                AssertReturn(idNode < RT_ELEMENTS(pThis->aNodes), VERR_INTERNAL_ERROR_3); \
+                pCfg->afNodeClassifications[idNode] |= RT_CONCAT(CODEC_NODE_CLS_,a_Type); \
                 pbDst[i] = idNode; \
             } \
-            for (; i < RT_ELEMENTS(pThis->ab##a_Type##s); i++) \
+            Assert(i + 1 == RT_ELEMENTS(g_abStac9220##a_Type##s)); \
+            for (; i < RT_ELEMENTS(pCfg->ab##a_Type##s); i++) \
                 pbDst[i] = 0; \
         } while (0)
@@ -831,10 +832,4 @@
 #undef STAC9220WIDGET
 
-    AssertCompile(STAC9221_NUM_NODES <= RT_ELEMENTS(pThis->aNodes));
-    pThis->cTotalNodes = STAC9221_NUM_NODES;
-
-    pThis->u8AdcVolsLineIn = STAC9220_NID_AMP_ADC0;
-    pThis->u8DacLineOut    = STAC9220_NID_DAC1;
-
     /*
      * Initialize all codec nodes.
@@ -845,8 +840,8 @@
      */
     for (uint8_t i = 0; i < STAC9221_NUM_NODES; i++)
-        stac9220NodeReset(pThis, i, &pThis->aNodes[i]);
+        stac9220NodeReset(pThis, i, &pThis->aNodes[i], false /*fInReset*/);
 
     /* Common root node initializers. */
-    pThis->aNodes[STAC9220_NID_ROOT].root.node.au32F00_param[0] = CODEC_MAKE_F00_00(pThis->idVendor, pThis->idDevice);
+    pThis->aNodes[STAC9220_NID_ROOT].root.node.au32F00_param[0] = CODEC_MAKE_F00_00(pCfg->idVendor, pCfg->idDevice);
     pThis->aNodes[STAC9220_NID_ROOT].root.node.au32F00_param[4] = CODEC_MAKE_F00_04(0x1, 0x1);
 
@@ -855,5 +850,5 @@
     pThis->aNodes[STAC9220_NID_AFG].afg.node.au32F00_param[0x5] = CODEC_MAKE_F00_05(1, CODEC_F00_05_AFG);
     pThis->aNodes[STAC9220_NID_AFG].afg.node.au32F00_param[0xA] = CODEC_F00_0A_44_1KHZ | CODEC_F00_0A_16_BIT;
-    pThis->aNodes[STAC9220_NID_AFG].afg.u32F20_param = CODEC_MAKE_F20(pThis->idVendor, pThis->bBSKU, pThis->idAssembly);
+    pThis->aNodes[STAC9220_NID_AFG].afg.u32F20_param = CODEC_MAKE_F20(pCfg->idVendor, pCfg->bBSKU, pCfg->idAssembly);
 
     return VINF_SUCCESS;
@@ -871,8 +866,8 @@
     DECLINLINE(bool) hdaCodecIs##a_Type##Node(PHDACODECR3 pThis, uint8_t idNode) \
     { \
-        Assert(idNode < RT_ELEMENTS(pThis->afNodeClassifications)); \
-        Assert(   (memchr(&pThis->RT_CONCAT3(ab,a_Type,s)[0], idNode, sizeof(pThis->RT_CONCAT3(ab,a_Type,s))) != NULL) \
-               == RT_BOOL(pThis->afNodeClassifications[idNode] & RT_CONCAT(CODEC_NODE_CLS_,a_Type))); \
-        return RT_BOOL(pThis->afNodeClassifications[idNode] & RT_CONCAT(CODEC_NODE_CLS_,a_Type)); \
+        Assert(idNode < RT_ELEMENTS(pThis->Cfg.afNodeClassifications)); \
+        Assert(   (memchr(&pThis->Cfg.RT_CONCAT3(ab,a_Type,s)[0], idNode, sizeof(pThis->Cfg.RT_CONCAT3(ab,a_Type,s))) != NULL) \
+               == RT_BOOL(pThis->Cfg.afNodeClassifications[idNode] & RT_CONCAT(CODEC_NODE_CLS_,a_Type))); \
+        return RT_BOOL(pThis->Cfg.afNodeClassifications[idNode] & RT_CONCAT(CODEC_NODE_CLS_,a_Type)); \
     }
 /* hdaCodecIsPortNode */
@@ -1376,6 +1371,6 @@
 static DECLCALLBACK(int) vrbProcGetSubId(PHDACODECR3 pThis, uint32_t uCmd, uint64_t *puResp)
 {
-    Assert(CODEC_CAD(uCmd) == pThis->id);
-    uint8_t const cTotalNodes = (uint8_t)RT_MIN(pThis->cTotalNodes, RT_ELEMENTS(pThis->aNodes));
+    Assert(CODEC_CAD(uCmd) == pThis->Cfg.id);
+    uint8_t const cTotalNodes = (uint8_t)RT_MIN(pThis->Cfg.cTotalNodes, RT_ELEMENTS(pThis->aNodes));
     Assert(CODEC_NID(uCmd) < cTotalNodes);
     if (CODEC_NID(uCmd) >= cTotalNodes)
@@ -1395,6 +1390,6 @@
 static int codecSetSubIdX(PHDACODECR3 pThis, uint32_t uCmd, uint8_t u8Offset)
 {
-    Assert(CODEC_CAD(uCmd) == pThis->id);
-    uint8_t const cTotalNodes = (uint8_t)RT_MIN(pThis->cTotalNodes, RT_ELEMENTS(pThis->aNodes));
+    Assert(CODEC_CAD(uCmd) == pThis->Cfg.id);
+    uint8_t const cTotalNodes = (uint8_t)RT_MIN(pThis->Cfg.cTotalNodes, RT_ELEMENTS(pThis->aNodes));
     Assert(CODEC_NID(uCmd) < cTotalNodes);
     if (CODEC_NID(uCmd) >= cTotalNodes)
@@ -1458,7 +1453,7 @@
 static DECLCALLBACK(int) vrbProcReset(PHDACODECR3 pThis, uint32_t uCmd, uint64_t *puResp)
 {
-    Assert(CODEC_CAD(uCmd) == pThis->id);
-
-    if (pThis->enmType == CODECTYPE_STAC9220)
+    Assert(CODEC_CAD(uCmd) == pThis->Cfg.id);
+
+    if (pThis->Cfg.enmType == CODECTYPE_STAC9220)
     {
         Assert(CODEC_NID(uCmd) == STAC9220_NID_AFG);
@@ -1580,11 +1575,11 @@
         } while (0)
 
-        PROPAGATE_PWR_STATE(pThis->abDacs,       dac);
-        PROPAGATE_PWR_STATE(pThis->abAdcs,       adc);
-        PROPAGATE_PWR_STATE(pThis->abDigInPins,  digin);
-        PROPAGATE_PWR_STATE(pThis->abDigOutPins, digout);
-        PROPAGATE_PWR_STATE(pThis->abSpdifIns,   spdifin);
-        PROPAGATE_PWR_STATE(pThis->abSpdifOuts,  spdifout);
-        PROPAGATE_PWR_STATE(pThis->abReserveds,  reserved);
+        PROPAGATE_PWR_STATE(pThis->Cfg.abDacs,       dac);
+        PROPAGATE_PWR_STATE(pThis->Cfg.abAdcs,       adc);
+        PROPAGATE_PWR_STATE(pThis->Cfg.abDigInPins,  digin);
+        PROPAGATE_PWR_STATE(pThis->Cfg.abDigOutPins, digout);
+        PROPAGATE_PWR_STATE(pThis->Cfg.abSpdifIns,   spdifin);
+        PROPAGATE_PWR_STATE(pThis->Cfg.abSpdifOuts,  spdifout);
+        PROPAGATE_PWR_STATE(pThis->Cfg.abReserveds,  reserved);
 
 #undef PROPAGATE_PWR_STATE
@@ -1625,6 +1620,6 @@
 static DECLCALLBACK(int) vrbProcSetPowerState(PHDACODECR3 pThis, uint32_t uCmd, uint64_t *puResp)
 {
-    Assert(CODEC_CAD(uCmd) == pThis->id);
-    uint8_t const cTotalNodes = (uint8_t)RT_MIN(pThis->cTotalNodes, RT_ELEMENTS(pThis->aNodes));
+    Assert(CODEC_CAD(uCmd) == pThis->Cfg.id);
+    uint8_t const cTotalNodes = (uint8_t)RT_MIN(pThis->Cfg.cTotalNodes, RT_ELEMENTS(pThis->aNodes));
     Assert(CODEC_NID(uCmd) < cTotalNodes);
     if (CODEC_NID(uCmd) >= cTotalNodes)
@@ -2101,5 +2096,5 @@
             hdaCodecSetRegisterU8(&AMPLIFIER_REGISTER(*pAmplifier, AMPLIFIER_IN, AMPLIFIER_RIGHT, u8Index), uCmd, 0);
 
-    //    if (CODEC_NID(uCmd) == pThis->u8AdcVolsLineIn)
+    //    if (CODEC_NID(uCmd) == pThis->Cfg.u8AdcVolsLineIn)
     //    {
             hdaR3CodecToAudVolume(pThis, pNode, pAmplifier, PDMAUDIOMIXERCTL_LINE_IN);
@@ -2113,5 +2108,5 @@
             hdaCodecSetRegisterU8(&AMPLIFIER_REGISTER(*pAmplifier, AMPLIFIER_OUT, AMPLIFIER_RIGHT, u8Index), uCmd, 0);
 
-        if (CODEC_NID(uCmd) == pThis->u8DacLineOut)
+        if (CODEC_NID(uCmd) == pThis->Cfg.u8DacLineOut)
             hdaR3CodecToAudVolume(pThis, pNode, pAmplifier, PDMAUDIOMIXERCTL_FRONT);
     }
@@ -2269,10 +2264,10 @@
     *puResp = 0;
     AssertPtr(pThis);
-    AssertMsgReturn(CODEC_CAD(uCmd) == pThis->id,
+    AssertMsgReturn(CODEC_CAD(uCmd) == pThis->Cfg.id,
                     ("Unknown codec address 0x%x\n", CODEC_CAD(uCmd)),
                     VERR_INVALID_PARAMETER);
     uint32_t const uCmdData = CODEC_VERBDATA(uCmd);
     AssertMsgReturn(   uCmdData != 0
-                    && CODEC_NID(uCmd) < RT_MIN(pThis->cTotalNodes, RT_ELEMENTS(pThis->aNodes)),
+                    && CODEC_NID(uCmd) < RT_MIN(pThis->Cfg.cTotalNodes, RT_ELEMENTS(pThis->aNodes)),
                     ("[NID0x%02x] Unknown / invalid node or data (0x%x)\n", CODEC_NID(uCmd), uCmdData),
                     VERR_INVALID_PARAMETER);
@@ -2521,5 +2516,5 @@
 
         /* Slow recursion, but this is debug stuff anyway. */
-        for (uint8_t i = 0; i < pInfo->pThis->cTotalNodes; i++)
+        for (uint8_t i = 0; i < pInfo->pThis->Cfg.cTotalNodes; i++)
         {
             const PCODECNODE pSubNode = &pInfo->pThis->aNodes[i];
@@ -2561,5 +2556,5 @@
 
     CODECDBG_INDENT
-        for (uint8_t i = 0; i < pThis->cTotalNodes; i++)
+        for (uint8_t i = 0; i < pThis->Cfg.cTotalNodes; i++)
         {
             PCODECNODE pNode = &pThis->aNodes[i];
@@ -2586,5 +2581,5 @@
 {
     RT_NOREF(pszArgs);
-    uint8_t const cTotalNodes = RT_MIN(pThis->cTotalNodes, RT_ELEMENTS(pThis->aNodes));
+    uint8_t const cTotalNodes = RT_MIN(pThis->Cfg.cTotalNodes, RT_ELEMENTS(pThis->aNodes));
     for (uint8_t i = 1; i < cTotalNodes; i++)
     {
@@ -2664,8 +2659,8 @@
 {
     PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3;
-    AssertLogRelMsgReturn(pThis->cTotalNodes == STAC9221_NUM_NODES, ("cTotalNodes=%#x, should be 0x1c", pThis->cTotalNodes),
+    AssertLogRelMsgReturn(pThis->Cfg.cTotalNodes == STAC9221_NUM_NODES, ("cTotalNodes=%#x, should be 0x1c", pThis->Cfg.cTotalNodes),
                           VERR_INTERNAL_ERROR);
-    pHlp->pfnSSMPutU32(pSSM, pThis->cTotalNodes);
-    for (unsigned idxNode = 0; idxNode < pThis->cTotalNodes; ++idxNode)
+    pHlp->pfnSSMPutU32(pSSM, pThis->Cfg.cTotalNodes);
+    for (unsigned idxNode = 0; idxNode < pThis->Cfg.cTotalNodes; ++idxNode)
         pHlp->pfnSSMPutStructEx(pSSM, &pThis->aNodes[idxNode].SavedState, sizeof(pThis->aNodes[idxNode].SavedState),
                                 0 /*fFlags*/, g_aCodecNodeFields, NULL /*pvUser*/);
@@ -2695,5 +2690,5 @@
         AssertRCReturn(rc2, rc2);
         AssertReturn(cNodes == 0x1c, VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
-        AssertReturn(pThis->cTotalNodes == 0x1c, VERR_INTERNAL_ERROR);
+        AssertReturn(pThis->Cfg.cTotalNodes == 0x1c, VERR_INTERNAL_ERROR);
 
         pFields = g_aCodecNodeFields;
@@ -2702,5 +2697,5 @@
     else if (uVersion >= HDA_SAVED_STATE_VERSION_2)
     {
-        AssertReturn(pThis->cTotalNodes == 0x1c, VERR_INTERNAL_ERROR);
+        AssertReturn(pThis->Cfg.cTotalNodes == 0x1c, VERR_INTERNAL_ERROR);
         pFields = g_aCodecNodeFields;
         fFlags  = SSMSTRUCT_FLAGS_MEM_BAND_AID_RELAXED;
@@ -2708,5 +2703,5 @@
     else if (uVersion >= HDA_SAVED_STATE_VERSION_1)
     {
-        AssertReturn(pThis->cTotalNodes == 0x1c, VERR_INTERNAL_ERROR);
+        AssertReturn(pThis->Cfg.cTotalNodes == 0x1c, VERR_INTERNAL_ERROR);
         pFields = g_aCodecNodeFieldsV1;
         fFlags  = SSMSTRUCT_FLAGS_MEM_BAND_AID_RELAXED;
@@ -2715,5 +2710,5 @@
         AssertFailedReturn(VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
 
-    for (unsigned idxNode = 0; idxNode < pThis->cTotalNodes; ++idxNode)
+    for (unsigned idxNode = 0; idxNode < pThis->Cfg.cTotalNodes; ++idxNode)
     {
         uint8_t idOld = pThis->aNodes[idxNode].SavedState.Core.uID;
@@ -2730,16 +2725,16 @@
      */
     PCODECNODE pNode;
-    if (hdaCodecIsDacNode(pThis, pThis->u8DacLineOut))
-    {
-        pNode = &pThis->aNodes[pThis->u8DacLineOut];
+    if (hdaCodecIsDacNode(pThis, pThis->Cfg.u8DacLineOut))
+    {
+        pNode = &pThis->aNodes[pThis->Cfg.u8DacLineOut];
         hdaR3CodecToAudVolume(pThis, pNode, &pNode->dac.B_params, PDMAUDIOMIXERCTL_FRONT);
     }
-    else if (hdaCodecIsSpdifOutNode(pThis, pThis->u8DacLineOut))
-    {
-        pNode = &pThis->aNodes[pThis->u8DacLineOut];
+    else if (hdaCodecIsSpdifOutNode(pThis, pThis->Cfg.u8DacLineOut))
+    {
+        pNode = &pThis->aNodes[pThis->Cfg.u8DacLineOut];
         hdaR3CodecToAudVolume(pThis, pNode, &pNode->spdifout.B_params, PDMAUDIOMIXERCTL_FRONT);
     }
 
-    pNode = &pThis->aNodes[pThis->u8AdcVolsLineIn];
+    pNode = &pThis->aNodes[pThis->Cfg.u8AdcVolsLineIn];
     hdaR3CodecToAudVolume(pThis, pNode, &pNode->adcvol.B_params, PDMAUDIOMIXERCTL_LINE_IN);
 
@@ -2791,15 +2786,16 @@
     AssertPtrReturn(pThis,   VERR_INVALID_POINTER);
     AssertPtrReturn(pCfg,    VERR_INVALID_POINTER);
-
-    pThis->id      = uLUN;
-    pThis->enmType = CODECTYPE_STAC9220; /** @todo Make this dynamic. */
+    HDACODECCFG *pCodecCfg = (HDACODECCFG *)&pThis->Cfg;
+
+    pCodecCfg->id      = uLUN;
+    pCodecCfg->enmType = CODECTYPE_STAC9220; /** @todo Make this dynamic. */
 
     int rc;
 
-    switch (pThis->enmType)
+    switch (pCodecCfg->enmType)
     {
         case CODECTYPE_STAC9220:
         {
-            rc = stac9220Construct(pThis);
+            rc = stac9220Construct(pThis, pCodecCfg);
             AssertRCReturn(rc, rc);
             break;
@@ -2814,9 +2810,9 @@
      * Set initial volume.
      */
-    PCODECNODE pNode = &pThis->aNodes[pThis->u8DacLineOut];
+    PCODECNODE pNode = &pThis->aNodes[pCodecCfg->u8DacLineOut];
     rc = hdaR3CodecToAudVolume(pThis, pNode, &pNode->dac.B_params, PDMAUDIOMIXERCTL_FRONT);
     AssertRCReturn(rc, rc);
 
-    pNode = &pThis->aNodes[pThis->u8AdcVolsLineIn];
+    pNode = &pThis->aNodes[pCodecCfg->u8AdcVolsLineIn];
     rc = hdaR3CodecToAudVolume(pThis, pNode, &pNode->adcvol.B_params, PDMAUDIOMIXERCTL_LINE_IN);
     AssertRCReturn(rc, rc);
@@ -2859,5 +2855,5 @@
 void hdaCodecReset(PHDACODECR3 pThis)
 {
-    switch (pThis->enmType)
+    switch (pThis->Cfg.enmType)
     {
         case CODECTYPE_STAC9220:
Index: trunk/src/VBox/Devices/Audio/DevHdaCodec.h
===================================================================
--- trunk/src/VBox/Devices/Audio/DevHdaCodec.h	(revision 90146)
+++ trunk/src/VBox/Devices/Audio/DevHdaCodec.h	(revision 90147)
@@ -807,9 +807,12 @@
 /** @} */
 
-
 /**
- * HDA codec state (ring-3, no shared state).
+ * Code configuration.
+ *
+ * This will not change after construction and is therefore kept in a const
+ * member of HDACODECR3 to encourage compiler optimizations and avoid accidental
+ * modification.
  */
-typedef struct HDACODECR3
+typedef struct HDACODECCFG
 {
     /** Codec implementation type. */
@@ -822,6 +825,4 @@
     uint8_t         idAssembly;
 
-    bool            fInReset;
-
     uint8_t         cTotalNodes;
     uint8_t         u8AdcVolsLineIn;
@@ -830,5 +831,5 @@
     /** Align the lists below so they don't cross cache lines (assumes
      *  CODEC_NODES_MAX is 32). */
-    uint8_t const   abPadding1[CODEC_NODES_MAX - 16];
+    uint8_t const   abPadding1[CODEC_NODES_MAX - 15];
 
     /** @name Node classifications.
@@ -837,29 +838,40 @@
      *       nodes.
      * @{ */
-    uint8_t const   abPorts[CODEC_NODES_MAX];
-    uint8_t const   abDacs[CODEC_NODES_MAX];
-    uint8_t const   abAdcVols[CODEC_NODES_MAX];
-    uint8_t const   abAdcs[CODEC_NODES_MAX];
-    uint8_t const   abAdcMuxs[CODEC_NODES_MAX];
-    uint8_t const   abPcbeeps[CODEC_NODES_MAX];
-    uint8_t const   abSpdifIns[CODEC_NODES_MAX];
-    uint8_t const   abSpdifOuts[CODEC_NODES_MAX];
-    uint8_t const   abDigInPins[CODEC_NODES_MAX];
-    uint8_t const   abDigOutPins[CODEC_NODES_MAX];
-    uint8_t const   abCds[CODEC_NODES_MAX];
-    uint8_t const   abVolKnobs[CODEC_NODES_MAX];
-    uint8_t const   abReserveds[CODEC_NODES_MAX];
+    uint8_t         abPorts[CODEC_NODES_MAX];
+    uint8_t         abDacs[CODEC_NODES_MAX];
+    uint8_t         abAdcVols[CODEC_NODES_MAX];
+    uint8_t         abAdcs[CODEC_NODES_MAX];
+    uint8_t         abAdcMuxs[CODEC_NODES_MAX];
+    uint8_t         abPcbeeps[CODEC_NODES_MAX];
+    uint8_t         abSpdifIns[CODEC_NODES_MAX];
+    uint8_t         abSpdifOuts[CODEC_NODES_MAX];
+    uint8_t         abDigInPins[CODEC_NODES_MAX];
+    uint8_t         abDigOutPins[CODEC_NODES_MAX];
+    uint8_t         abCds[CODEC_NODES_MAX];
+    uint8_t         abVolKnobs[CODEC_NODES_MAX];
+    uint8_t         abReserveds[CODEC_NODES_MAX];
     /** @} */
 
     /** The CODEC_NODE_CLS_XXX flags for each node. */
-    uint16_t const  afNodeClassifications[CODEC_NODES_MAX];
-
-    CODECNODE       aNodes[CODEC_NODES_MAX];
-
-    STAMCOUNTER     StatLookupsR3;
-    uint64_t const  au64Padding3[7];
+    uint16_t        afNodeClassifications[CODEC_NODES_MAX];
+} HDACODECCFG;
+AssertCompileMemberAlignment(HDACODECCFG, abPorts, CODEC_NODES_MAX);
+
+
+/**
+ * HDA codec state (ring-3, no shared state).
+ */
+typedef struct HDACODECR3
+{
+    /** The codec configuration - initialized at construction time. */
+    HDACODECCFG const   Cfg;
+    /** The node data. */
+    CODECNODE           aNodes[CODEC_NODES_MAX];
+    /** Statistics. */
+    STAMCOUNTER         StatLookupsR3;
+    /** Size alignment padding. */
+    uint64_t const      au64Padding1[7];
 } HDACODECR3;
 AssertCompile(RT_IS_POWER_OF_TWO(CODEC_NODES_MAX));
-AssertCompileMemberAlignment(HDACODECR3, abPorts, CODEC_NODES_MAX);
 AssertCompileMemberAlignment(HDACODECR3, aNodes, 64);
 AssertCompileSizeAlignment(HDACODECR3, 8);
