Customize I2S virtual bus ID for different boards.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: zwei4 <david....@intel.com>
---
 .../BensonGlacier/BoardInitPostMem/BoardGpios.c    | 10 -------
 .../BensonGlacier/BoardInitPostMem/BoardGpios.h    | 10 -------
 .../BensonGlacier/BoardInitPostMem/BoardInit.c     |  9 ++++++
 .../BoardInitPostMem/BoardInitPostMem.inf          |  5 ++++
 .../Board/LeafHill/BoardInitPostMem/BoardInit.c    |  9 ++++++
 .../LeafHill/BoardInitPostMem/BoardInitPostMem.inf |  5 ++++
 .../MinnowBoard3/BoardInitPostMem/BoardGpios.c     | 10 -------
 .../MinnowBoard3/BoardInitPostMem/BoardGpios.h     | 10 -------
 .../MinnowBoard3/BoardInitPostMem/BoardInit.c      |  9 ++++++
 .../BoardInitPostMem/BoardInitPostMem.inf          |  5 ++++
 .../PlatformSetupDxe/SouthClusterConfig.vfi        |  4 +--
 Silicon/BroxtonSoC/BroxtonSiPkg/BroxtonSiPkg.dec   | 12 ++++++++
 .../Library/Private/DxeScHdaLib/DxeScHdaLib.inf    |  5 ++++
 .../Library/Private/DxeScHdaLib/ScHdaLib.c         | 25 ++++++----------
 .../BroxtonSiPkg/SouthCluster/ScInit/Dxe/ScHda.c   | 33 ++++++++++++++++++++++
 15 files changed, 102 insertions(+), 59 deletions(-)

diff --git 
a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardGpios.c 
b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardGpios.c
index df11c8bbd..f7ae62114 100644
--- 
a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardGpios.c
+++ 
b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardGpios.c
@@ -204,16 +204,6 @@ BensonMultiPlatformGpioProgram (
     GpioPadConfigTable (sizeof (mBenson_GpioInitData_W) / sizeof 
(mBenson_GpioInitData_W[0]), PlatformInfoHob->PlatformGpioSetting_W);
     GpioPadConfigTable (sizeof (mBenson_GpioInitData_SW) / sizeof 
(mBenson_GpioInitData_SW[0]), PlatformInfoHob->PlatformGpioSetting_SW);
 
-    //
-    // Note1: This BXT BIOS WA needs to be applied after PAD programming to 
overwrite the GPIO setting to take effect.
-    // Note2: Enable TDO in BIOS SETUP as default for BXT Power-On only, need 
to set to AUTO prior to deliver to customer.
-    // For BXT A0 Stepping only, to disable TDO GPIO to save power.
-    //
-    if (PlatformInfoHob->FABID == FAB2) {
-      DEBUG ((DEBUG_INFO, "FAB ID: FAB2\n"));
-      
GpioPadConfigTable(sizeof(mBenson_GpioInitData_FAB2)/sizeof(mBenson_GpioInitData_FAB2[0]),
 mBenson_GpioInitData_FAB2);
-    }
-
     if (SystemConfiguration.TDO == 2) {  //Auto
       if (BxtA0 == BxtStepping()) {
         DEBUG ((DEBUG_INFO, " BxtA0 TDO disable\n" ));
diff --git 
a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardGpios.h 
b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardGpios.h
index 5adc8e546..e4c1c2ee1 100644
--- 
a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardGpios.h
+++ 
b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardGpios.h
@@ -345,16 +345,6 @@ BXT_GPIO_PAD_INIT  mBenson_GpioInitData_Audio_SSP6 []=
   BXT_GPIO_PAD_CONF(L"GPIO_192 DBI_SCL",         M0  ,     HI_Z  ,GPIO_D,   HI 
   ,   NA      ,  Wake_Disabled,  P_2K_H,   NA    ,    NA,NA        ,  NA  ,  
GPIO_PADBAR+0x0028,  NORTHWEST),//Feature: Codec Power Down PD Net in Sch: 
SOC_CODEC_PD_N
 };
 
-BXT_GPIO_PAD_INIT  mBenson_GpioInitData_FAB2[] =
-{
-  //
-  //                  Group Pin#:  pad_name,    
PMode,GPIO_Config,HostSw,GPO_STATE,INT_Trigger,  Wake_Enabled 
,Term_H_L,Inverted, GPI_ROUT, IOSstae, IOSTerm,     MMIO_Offset  ,Community
-  //
-  BXT_GPIO_PAD_CONF(L"GPIO_76 AVS_I2S1_WS_SYNC", M0   ,    GPI   ,GPIO_D,   NA 
   ,   Level   ,  Wake_Disabled, P_20K_L,   NA    ,IOAPIC,    TxDRxE,    NA,  
GPIO_PADBAR+0x0120,  NORTHWEST),//Feature:SSIC_WWAN_Wake
-  BXT_GPIO_PAD_CONF(L"GPIO_6",                   M0   ,    GPI   ,GPIO_D,   NA 
   ,   Level    , Wake_Disabled, P_20K_L,   NA    ,IOAPIC,    TxDRxE,    NA,  
GPIO_PADBAR+0x0030,  NORTH),    //Feature:DGPU Power OK
-  BXT_GPIO_PAD_CONF(L"GPIO_217 CNV_BRI_RSP",     M0   ,    GPO   ,GPIO_D,   LO 
   ,   NA       , Wake_Disabled, P_20K_L,   NA    ,    NA,        NA,    NA,  
GPIO_PADBAR+0x0240,  NORTH),    //Feature:DGPU_SEL
-};
-
 //
 // GPIO 191 is only used if EPI reworks are applied on the board. This GPIO 
switches between SD Card data (if set to 1) and EPI data (if set to 0).
 //
diff --git 
a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInit.c 
b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInit.c
index 74245de12..aabb350e8 100644
--- 
a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInit.c
+++ 
b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInit.c
@@ -135,6 +135,15 @@ BensonGlacierPostMemInitCallback (
   //
   PcdSet8 (PcdeMMCHostMaxSpeed, (UINT8) 
(SystemConfiguration.ScceMMCHostMaxSpeed));
 
+  //
+  // I2S NHLT Virtual Bus ID
+  //
+  PcdSet8(HdaEndpointBtRenderVirtualBusId, 0x0F);  // N/A
+  PcdSet8(HdaEndpointBtCaptureVirtualBusId, 0x0F); // N/A
+  PcdSet8(HdaEndpointI2sRenderSKPVirtualBusId, 1); // I2S2
+  PcdSet8(HdaEndpointI2sRenderHPVirtualBusId, 1);  // I2S2
+  PcdSet8(HdaEndpointI2sCaptureVirtualBusId, 1);   // I2S2
+
   //
   // Add init steps here
   //
diff --git 
a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInitPostMem.inf
 
b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInitPostMem.inf
index 0f1d55563..c7499b564 100644
--- 
a/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInitPostMem.inf
+++ 
b/Platform/BroxtonPlatformPkg/Board/BensonGlacier/BoardInitPostMem/BoardInitPostMem.inf
@@ -67,6 +67,11 @@
   gPlatformModuleTokenSpaceGuid.PcdMaxPkgCState
   gPlatformModuleTokenSpaceGuid.PcdTi3100AudioCodecEnable
   gPlatformModuleTokenSpaceGuid.PcdeMMCHostMaxSpeed
+  gEfiBxtTokenSpaceGuid.HdaEndpointBtRenderVirtualBusId
+  gEfiBxtTokenSpaceGuid.HdaEndpointBtCaptureVirtualBusId
+  gEfiBxtTokenSpaceGuid.HdaEndpointI2sRenderSKPVirtualBusId
+  gEfiBxtTokenSpaceGuid.HdaEndpointI2sRenderHPVirtualBusId
+  gEfiBxtTokenSpaceGuid.HdaEndpointI2sCaptureVirtualBusId
 
 [Guids]
   gEfiPlatformInfoGuid
diff --git 
a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInit.c 
b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInit.c
index ca49dfe0f..fdf2c7eaa 100644
--- a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInit.c
+++ b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInit.c
@@ -141,6 +141,15 @@ LeafHillPostMemInitCallback (
   //
   PcdSet64 (PcdHdaVerbTablePtr, (UINT64) (UINTN) &HdaVerbTableAlc662);
   PcdSet8(HdaVerbTableEntryNum, 1);
+
+  //
+  // I2S NHLT Virtual Bus ID
+  //
+  PcdSet8(HdaEndpointBtRenderVirtualBusId, 2);     //I2S3
+  PcdSet8(HdaEndpointBtCaptureVirtualBusId, 2);    //I2S3
+  PcdSet8(HdaEndpointI2sRenderSKPVirtualBusId, 5); //I2S6
+  PcdSet8(HdaEndpointI2sRenderHPVirtualBusId, 5);  //I2S6
+  PcdSet8(HdaEndpointI2sCaptureVirtualBusId, 5);   //I2S6
   
   //
   // Add init steps here
diff --git 
a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf
 
b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf
index 5154235f8..9b6b3c93d 100644
--- 
a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf
+++ 
b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf
@@ -67,6 +67,11 @@
   gPlatformModuleTokenSpaceGuid.PcdeMMCHostMaxSpeed
   gPlatformModuleTokenSpaceGuid.PcdHdaVerbTablePtr
   gPlatformModuleTokenSpaceGuid.HdaVerbTableEntryNum
+  gEfiBxtTokenSpaceGuid.HdaEndpointBtRenderVirtualBusId
+  gEfiBxtTokenSpaceGuid.HdaEndpointBtCaptureVirtualBusId
+  gEfiBxtTokenSpaceGuid.HdaEndpointI2sRenderSKPVirtualBusId
+  gEfiBxtTokenSpaceGuid.HdaEndpointI2sRenderHPVirtualBusId
+  gEfiBxtTokenSpaceGuid.HdaEndpointI2sCaptureVirtualBusId
   
 [Guids]
   gEfiPlatformInfoGuid
diff --git 
a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardGpios.c 
b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardGpios.c
index 096d0e862..e54bd1719 100644
--- 
a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardGpios.c
+++ 
b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardGpios.c
@@ -204,16 +204,6 @@ Minnow3MultiPlatformGpioProgram (
     GpioPadConfigTable (sizeof (mMinnow3_GpioInitData_W) / sizeof 
(mMinnow3_GpioInitData_W[0]), PlatformInfoHob->PlatformGpioSetting_W);
     GpioPadConfigTable (sizeof (mMinnow3_GpioInitData_SW) / sizeof 
(mMinnow3_GpioInitData_SW[0]), PlatformInfoHob->PlatformGpioSetting_SW);
 
-    //
-    // Note1: This BXT BIOS WA needs to be applied after PAD programming to 
overwrite the GPIO setting to take effect.
-    // Note2: Enable TDO in BIOS SETUP as default for BXT Power-On only, need 
to set to AUTO prior to deliver to customer.
-    // For BXT A0 Stepping only, to disable TDO GPIO to save power.
-    //
-    if (PlatformInfoHob->FABID == FAB2) {
-      DEBUG ((DEBUG_INFO, "FAB ID: FAB2\n"));
-      
GpioPadConfigTable(sizeof(mMinnow3_GpioInitData_FAB2)/sizeof(mMinnow3_GpioInitData_FAB2[0]),
 mMinnow3_GpioInitData_FAB2);
-    }
-
     if (SystemConfiguration.TDO == 2) {  //Auto
       if (BxtA0 == BxtStepping()) {
         DEBUG ((DEBUG_INFO, " BxtA0 TDO disable\n" ));
diff --git 
a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardGpios.h 
b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardGpios.h
index 77d409026..78fc533e7 100644
--- 
a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardGpios.h
+++ 
b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardGpios.h
@@ -340,16 +340,6 @@ BXT_GPIO_PAD_INIT  mMinnow3_GpioInitData_Audio_SSP6 []=
   BXT_GPIO_PAD_CONF(L"GPIO_192 DBI_SCL",         M0  ,     HI_Z  ,GPIO_D,   HI 
   ,   NA      ,  Wake_Disabled,  P_2K_H,   NA    ,    NA,NA        ,  NA  ,  
GPIO_PADBAR+0x0028,  NORTHWEST),//Feature: Codec Power Down PD Net in Sch: 
SOC_CODEC_PD_N
 };
 
-BXT_GPIO_PAD_INIT  mMinnow3_GpioInitData_FAB2[] =
-{
-  //
-  //                  Group Pin#:  pad_name,    
PMode,GPIO_Config,HostSw,GPO_STATE,INT_Trigger,  Wake_Enabled 
,Term_H_L,Inverted, GPI_ROUT, IOSstae, IOSTerm,     MMIO_Offset  ,Community
-  //
-  BXT_GPIO_PAD_CONF(L"GPIO_76 AVS_I2S1_WS_SYNC", M0   ,    GPI   ,GPIO_D,   NA 
   ,   Level   ,  Wake_Disabled, P_20K_L,   NA    ,IOAPIC,    TxDRxE,    NA,  
GPIO_PADBAR+0x0120,  NORTHWEST),//Feature:SSIC_WWAN_Wake
-  BXT_GPIO_PAD_CONF(L"GPIO_6",                   M0   ,    GPI   ,GPIO_D,   NA 
   ,   Level    , Wake_Disabled, P_20K_L,   NA    ,IOAPIC,    TxDRxE,    NA,  
GPIO_PADBAR+0x0030,  NORTH),    //Feature:DGPU Power OK
-  BXT_GPIO_PAD_CONF(L"GPIO_217 CNV_BRI_RSP",     M0   ,    GPO   ,GPIO_D,   LO 
   ,   NA       , Wake_Disabled, P_20K_L,   NA    ,    NA,        NA,    NA,  
GPIO_PADBAR+0x0240,  NORTH),    //Feature:DGPU_SEL
-};
-
 //
 // GPIO 191 is only used if EPI reworks are applied on the board. This GPIO 
switches between SD Card data (if set to 1) and EPI data (if set to 0).
 //
diff --git 
a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInit.c 
b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInit.c
index c1ee6b9c9..666a0bfdf 100644
--- 
a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInit.c
+++ 
b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInit.c
@@ -147,6 +147,15 @@ MinnowBoard3PostMemInitCallback (
     PcdSet8 (PcdeMMCHostMaxSpeed, (UINT8) MaxSpeed);
   }
 
+  //
+  // I2S NHLT Virtual Bus ID
+  //
+  PcdSet8(HdaEndpointBtRenderVirtualBusId, 2);     // I2S3
+  PcdSet8(HdaEndpointBtCaptureVirtualBusId, 2);    // I2S3
+  PcdSet8(HdaEndpointI2sRenderSKPVirtualBusId, 0); // I2S1
+  PcdSet8(HdaEndpointI2sRenderHPVirtualBusId, 0);  // I2S1
+  PcdSet8(HdaEndpointI2sCaptureVirtualBusId, 0);   // I2S1
+
   //
   // Add init steps here
   //
diff --git 
a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInitPostMem.inf
 
b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInitPostMem.inf
index 801c47f14..9cf90c637 100644
--- 
a/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInitPostMem.inf
+++ 
b/Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/BoardInitPostMem.inf
@@ -63,6 +63,11 @@
   gPlatformModuleTokenSpaceGuid.PcdLogoDisplay
   gPlatformModuleTokenSpaceGuid.PcdBtDevice
   gPlatformModuleTokenSpaceGuid.PcdeMMCHostMaxSpeed
+  gEfiBxtTokenSpaceGuid.HdaEndpointBtRenderVirtualBusId
+  gEfiBxtTokenSpaceGuid.HdaEndpointBtCaptureVirtualBusId
+  gEfiBxtTokenSpaceGuid.HdaEndpointI2sRenderSKPVirtualBusId
+  gEfiBxtTokenSpaceGuid.HdaEndpointI2sRenderHPVirtualBusId
+  gEfiBxtTokenSpaceGuid.HdaEndpointI2sCaptureVirtualBusId
 
 [Guids]
   gEfiPlatformInfoGuid
diff --git 
a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/SouthClusterConfig.vfi
 
b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/SouthClusterConfig.vfi
index 3dbc2f313..f45d47a82 100644
--- 
a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/SouthClusterConfig.vfi
+++ 
b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/SouthClusterConfig.vfi
@@ -2765,8 +2765,8 @@ form formid     = HDAUDIO_OPTIONS_FORM_ID,
     oneof varid     = Setup.ScHdAudioNhltEndpointDmic,
            prompt      = STRING_TOKEN(STR_HDA_NHLT_ENDPOINT_DMIC),
            help        = STRING_TOKEN(STR_HDA_NHLT_ENDPOINT_DMIC_HELP),
-           option text = STRING_TOKEN(STR_DISABLE),  value = 0, flags = 
RESET_REQUIRED;
-           option text = STRING_TOKEN(STR_HDA_DMIC_2CH), value = 1, flags = 
DEFAULT |RESET_REQUIRED;
+           option text = STRING_TOKEN(STR_DISABLE),  value = 0, flags = 
DEFAULT | RESET_REQUIRED;
+           option text = STRING_TOKEN(STR_HDA_DMIC_2CH), value = 1, flags = 
RESET_REQUIRED;
            option text = STRING_TOKEN(STR_HDA_DMIC_4CH), value = 2, flags = 
RESET_REQUIRED;
     endoneof;
 
diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/BroxtonSiPkg.dec 
b/Silicon/BroxtonSoC/BroxtonSiPkg/BroxtonSiPkg.dec
index c06b4e131..a28765f23 100644
--- a/Silicon/BroxtonSoC/BroxtonSiPkg/BroxtonSiPkg.dec
+++ b/Silicon/BroxtonSoC/BroxtonSiPkg/BroxtonSiPkg.dec
@@ -332,6 +332,18 @@
   gEfiBxtTokenSpaceGuid.PcdSetCoreCount|0|UINT32|0x10000223
   gEfiBxtTokenSpaceGuid.PcdVtdGfxBaseAddress|0xFED64000|UINT32|0x10000224
   gSiPkgTokenSpaceGuid.PcdForceVolatileVariable|FALSE|BOOLEAN|0x30000012
+  
+  ## I2S Audio Configuration
+  ## Blue Tooth Render
+  gEfiBxtTokenSpaceGuid.HdaEndpointBtRenderVirtualBusId|0x0F|UINT8|0x80000001
+  ## Blue Tooth Capture
+  gEfiBxtTokenSpaceGuid.HdaEndpointBtCaptureVirtualBusId|0x0F|UINT8|0x80000002
+  ## Speaker Render
+  
gEfiBxtTokenSpaceGuid.HdaEndpointI2sRenderSKPVirtualBusId|0x0F|UINT8|0x80000003
+  ## Headphone Render
+  
gEfiBxtTokenSpaceGuid.HdaEndpointI2sRenderHPVirtualBusId|0x0F|UINT8|0x80000004
+  ## Headphone Capture
+  gEfiBxtTokenSpaceGuid.HdaEndpointI2sCaptureVirtualBusId|0x0F|UINT8|0x80000005
 
 [PcdsFeatureFlag]
   gBxtRefCodePkgTokenSpaceGuid.PcdCeAtaSupport|FALSE|BOOLEAN|0x12
diff --git 
a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/Private/DxeScHdaLib/DxeScHdaLib.inf
 
b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/Private/DxeScHdaLib/DxeScHdaLib.inf
index 2013054fd..03be30648 100644
--- 
a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/Private/DxeScHdaLib/DxeScHdaLib.inf
+++ 
b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/Private/DxeScHdaLib/DxeScHdaLib.inf
@@ -40,6 +40,11 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision      ## CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId        ## CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision  ## CONSUMES
+  gEfiBxtTokenSpaceGuid.HdaEndpointBtRenderVirtualBusId
+  gEfiBxtTokenSpaceGuid.HdaEndpointBtCaptureVirtualBusId
+  gEfiBxtTokenSpaceGuid.HdaEndpointI2sRenderSKPVirtualBusId
+  gEfiBxtTokenSpaceGuid.HdaEndpointI2sRenderHPVirtualBusId
+  gEfiBxtTokenSpaceGuid.HdaEndpointI2sCaptureVirtualBusId
 
 [Sources]
   ScHdaLib.c
diff --git 
a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/Private/DxeScHdaLib/ScHdaLib.c
 
b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/Private/DxeScHdaLib/ScHdaLib.c
index e27b38dda..028f6ee62 100644
--- 
a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/Private/DxeScHdaLib/ScHdaLib.c
+++ 
b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/Private/DxeScHdaLib/ScHdaLib.c
@@ -568,7 +568,7 @@ NhltEndpointConstructor (
     case HdaBtRender:
       DEBUG ((DEBUG_INFO, "Endpoint: HdaBtRender\n"));
       if (GetBxtSeries() == BxtP) {
-        HdaEndpointBtRender.VirtualBusId = 2;
+        HdaEndpointBtRender.VirtualBusId = 
PcdGet8(HdaEndpointBtRenderVirtualBusId);
         DEBUG ((DEBUG_INFO, "For BXT-P, HdaEndpointBtRender.VirtualBusId 
Change to 0x%02x.\n", HdaEndpointBtRender.VirtualBusId));
       }
       CopyMem (Endpoint, &HdaEndpointBtRender, sizeof (ENDPOINT_DESCRIPTOR));
@@ -579,7 +579,7 @@ NhltEndpointConstructor (
     case HdaBtCapture:
       DEBUG ((DEBUG_INFO, "Endpoint: HdaBtCapture\n"));
       if (GetBxtSeries() == BxtP) {
-        HdaEndpointBtCapture.VirtualBusId = 2;
+        HdaEndpointBtCapture.VirtualBusId = 
PcdGet8(HdaEndpointBtCaptureVirtualBusId);
         DEBUG ((DEBUG_INFO, "For BXT-P, HdaEndpointBtCapture.VirtualBusId 
Change to 0x%02x.\n", HdaEndpointBtCapture.VirtualBusId));
       }
       CopyMem (Endpoint, &HdaEndpointBtCapture, sizeof (ENDPOINT_DESCRIPTOR));
@@ -589,12 +589,9 @@ NhltEndpointConstructor (
       break;
     case HdaI2sRenderSKP:
       DEBUG ((DEBUG_INFO, "Endpoint: HdaI2sRenderSKP\n"));
-      //
-      // For BXT-P, Virtual Bus ID is 5, while it is 0 for BXTM
-      //
       if (GetBxtSeries() == BxtP) {
-        HdaEndpointI2sRenderSKP.VirtualBusId = 5;
-        DEBUG ((DEBUG_INFO, "For BXT-P, Endpoint: HdaI2sRenderSKP virtual bus 
ID is 5.\n"));
+        HdaEndpointI2sRenderSKP.VirtualBusId = 
PcdGet8(HdaEndpointI2sRenderSKPVirtualBusId);
+        DEBUG ((DEBUG_INFO, "For BXT-P, Endpoint: HdaI2sRenderSKP virtual bus 
ID is 0x%02x.\n", HdaEndpointI2sRenderSKP.VirtualBusId));
       }
       CopyMem (Endpoint, &HdaEndpointI2sRenderSKP, sizeof 
(ENDPOINT_DESCRIPTOR));
       EndpointConfigBuffer = I2sConfigSKP;
@@ -610,12 +607,9 @@ NhltEndpointConstructor (
       break;
     case HdaI2sRenderHP:
       DEBUG ((DEBUG_INFO, "Endpoint: HdaI2sRenderHP\n"));
-      //
-      // For BXT-P, Virtual Bus ID is 5, while it is 0 for BXTM
-      //
       if (GetBxtSeries() == BxtP) {
-        HdaEndpointI2sRenderHP.VirtualBusId = 5;
-        DEBUG ((DEBUG_INFO, "For BXT-P, Endpoint: HdaI2sRenderHP virtual bus 
ID is 5.\n"));
+        HdaEndpointI2sRenderHP.VirtualBusId = 
PcdGet8(HdaEndpointI2sRenderHPVirtualBusId);
+        DEBUG ((DEBUG_INFO, "For BXT-P, Endpoint: HdaI2sRenderHP virtual bus 
ID is 0x%02x.\n", HdaEndpointI2sRenderHP.VirtualBusId ));
       }
       CopyMem (Endpoint, &HdaEndpointI2sRenderHP, sizeof 
(ENDPOINT_DESCRIPTOR));
       EndpointConfigBuffer = I2sConfig;
@@ -624,12 +618,9 @@ NhltEndpointConstructor (
       break;
     case HdaI2sCaptureHP:
       DEBUG ((DEBUG_INFO, "Endpoint: HdaI2sCaptureHP\n"));
-      //
-      // For BXT-P, Virtual Bus ID is 5, while it is 0 for BXTM
-      //
       if (GetBxtSeries() == BxtP) {
-        HdaEndpointI2sCapture.VirtualBusId = 5;
-        DEBUG ((DEBUG_INFO, "For BXT-P, Endpoint: HdaI2sCaptureHP virtual bus 
ID is 5.\n"));
+        HdaEndpointI2sCapture.VirtualBusId = 
PcdGet8(HdaEndpointI2sCaptureVirtualBusId);
+        DEBUG ((DEBUG_INFO, "For BXT-P, Endpoint: HdaI2sCaptureHP virtual bus 
ID is 0x%02x.\n", HdaEndpointI2sCapture.VirtualBusId));
       }
       CopyMem (Endpoint, &HdaEndpointI2sCapture, sizeof (ENDPOINT_DESCRIPTOR));
       EndpointConfigBuffer = I2sConfig;
diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/ScInit/Dxe/ScHda.c 
b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/ScInit/Dxe/ScHda.c
index 16efcbe85..4600b5326 100644
--- a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/ScInit/Dxe/ScHda.c
+++ b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/ScInit/Dxe/ScHda.c
@@ -266,6 +266,39 @@ ConfigureHdaAtBoot (
   Status = GetConfigBlock ((VOID *) ScPolicy, &gHdAudioConfigGuid, (VOID *) 
&HdaConfig);
   ASSERT_EFI_ERROR (Status);
 
+  if ((HdaConfig->IoBufferOwnership == ScHdaIoBufOwnerHdaLinkI2sPort) || \
+      (HdaConfig->IoBufferOwnership == ScHdaIoBufOwnerI2sPort)) {    
+    HdaConfig->DspEndpointBluetooth = TRUE;
+    HdaConfig->DspEndpointI2sSkp = TRUE;
+    HdaConfig->DspEndpointI2sHp = TRUE;
+  }
+  
+  DEBUG ((DEBUG_INFO, "------------------ HD-Audio Config 
------------------\n"));
+  DEBUG ((DEBUG_INFO, " HDA Enable                   = %x\n", 
HdaConfig->Enable));
+  DEBUG ((DEBUG_INFO, " DSP Enable                   = %x\n", 
HdaConfig->DspEnable));
+  DEBUG ((DEBUG_INFO, " Pme                          = %x\n", HdaConfig->Pme));
+  DEBUG ((DEBUG_INFO, " I/O Buffer Ownership         = %x\n", 
HdaConfig->IoBufferOwnership));
+  DEBUG ((DEBUG_INFO, " I/O Buffer Voltage           = %x\n", 
HdaConfig->IoBufferVoltage));
+  DEBUG ((DEBUG_INFO, " VC Type                      = %x\n", 
HdaConfig->VcType));
+  DEBUG ((DEBUG_INFO, " DSP Feature Mask             = %x\n", 
HdaConfig->DspFeatureMask));
+  DEBUG ((DEBUG_INFO, " DSP PP Module Mask           = %x\n", 
HdaConfig->DspPpModuleMask));
+  DEBUG ((DEBUG_INFO, " ResetWaitTimer               = %x\n", 
HdaConfig->ResetWaitTimer));
+  DEBUG ((DEBUG_INFO, " VcType                       = %x\n", 
HdaConfig->VcType));
+  DEBUG ((DEBUG_INFO, " HD-A Link Frequency          = %x\n", 
HdaConfig->HdAudioLinkFrequency));
+  DEBUG ((DEBUG_INFO, " iDisp Link Frequency         = %x\n", 
HdaConfig->IDispLinkFrequency));
+  DEBUG ((DEBUG_INFO, " iDisp Link T-Mode            = %x\n", 
HdaConfig->IDispLinkTmode));
+  DEBUG ((DEBUG_INFO, " DSP Endpoint DMIC            = %x\n", 
HdaConfig->DspEndpointDmic));
+  DEBUG ((DEBUG_INFO, " DSP Endpoint I2S SKP         = %x\n", 
HdaConfig->DspEndpointI2sSkp));
+  DEBUG ((DEBUG_INFO, " DSP Endpoint I2S HP          = %x\n", 
HdaConfig->DspEndpointI2sHp));
+  DEBUG ((DEBUG_INFO, " DSP Endpoint BT              = %x\n", 
HdaConfig->DspEndpointBluetooth));
+  DEBUG ((DEBUG_INFO, " DSP Feature Mask             = %x\n", 
HdaConfig->DspFeatureMask));
+  DEBUG ((DEBUG_INFO, " DSP PP Module Mask           = %x\n", 
HdaConfig->DspPpModuleMask));
+  DEBUG ((DEBUG_INFO, " CSME Memory Transfers        = %x\n", HdaConfig->Mmt));
+  DEBUG ((DEBUG_INFO, " Host Memory Transfers        = %x\n", HdaConfig->Hmt));
+  DEBUG ((DEBUG_INFO, " BIOS Configuration Lock Down = %x\n", 
HdaConfig->BiosCfgLockDown));
+  DEBUG ((DEBUG_INFO, " Power Gating                 = %x\n", 
HdaConfig->PwrGate));
+  DEBUG ((DEBUG_INFO, " Clock Gating                 = %x\n", 
HdaConfig->ClkGate));
+
   HdaPciBase = MmPciBase (
                  DEFAULT_PCI_BUS_NUMBER_SC,
                  PCI_DEVICE_NUMBER_HDA,
-- 
2.14.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to