From: zwei4 <david.wei@intel.com>
To: edk2-devel@lists.01.org
Subject: [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Enable HD audio.
Date: Wed, 13 Dec 2017 17:06:52 +0800 [thread overview]
Message-ID: <20171213090652.11708-1-david.wei@intel.com> (raw)
Enable HD audio on Intel reference board.
(1) Enable HdAudioDspUaaCompliance.
(2) Move audio verb table to board specifc folder.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: zwei4 <david.wei@intel.com>
---
.../Board/LeafHill/BoardInitPostMem/BoardInit.c | 7 ++++
.../LeafHill/BoardInitPostMem/BoardInitPostMem.inf | 5 ++-
.../LeafHill/BoardInitPostMem}/HdaVerbTables.c | 38 ++---------------
.../LeafHill/BoardInitPostMem/HdaVerbTables.h | 38 +++++++++++++++++
.../PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf | 2 +
.../PeiFspPolicyInitLib/PeiFspScPolicyInitLib.c | 11 ++---
.../Library/PeiPolicyUpdateLib/HdaVerbTables.h | 30 --------------
.../PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf | 1 -
.../Library/PeiPolicyUpdateLib/PeiScPolicyUpdate.c | 48 ----------------------
Platform/BroxtonPlatformPkg/PlatformPkg.dec | 5 +++
10 files changed, 64 insertions(+), 121 deletions(-)
rename Platform/BroxtonPlatformPkg/{Common/Library/PeiPolicyUpdateLib => Board/LeafHill/BoardInitPostMem}/HdaVerbTables.c (66%)
create mode 100644 Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/HdaVerbTables.h
delete mode 100644 Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/HdaVerbTables.h
diff --git a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInit.c b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInit.c
index 4bd93d167..ca49dfe0f 100644
--- a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInit.c
+++ b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInit.c
@@ -22,6 +22,7 @@
#include <Ppi/BoardInitSignalling.h>
#include "BoardInit.h"
#include "BoardInitMiscs.h"
+#include "HdaVerbTables.h"
EFI_STATUS
EFIAPI
@@ -135,6 +136,12 @@ LeafHillPostMemInitCallback (
//
PcdSet8 (PcdeMMCHostMaxSpeed, (UINT8) (SystemConfiguration.ScceMMCHostMaxSpeed));
+ //
+ // HDA audio verb table
+ //
+ PcdSet64 (PcdHdaVerbTablePtr, (UINT64) (UINTN) &HdaVerbTableAlc662);
+ PcdSet8(HdaVerbTableEntryNum, 1);
+
//
// Add init steps here
//
diff --git a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf
index 0f11b1c11..5154235f8 100644
--- a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf
+++ b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/BoardInitPostMem.inf
@@ -31,6 +31,7 @@
PlatformInfoHob.c
BoardGpios.c
BoardGpios.h
+ HdaVerbTables.c
[LibraryClasses]
PeiServicesLib
@@ -64,7 +65,9 @@
gPlatformModuleTokenSpaceGuid.PcdSueCreek
gPlatformModuleTokenSpaceGuid.PcdMaxPkgCState
gPlatformModuleTokenSpaceGuid.PcdeMMCHostMaxSpeed
-
+ gPlatformModuleTokenSpaceGuid.PcdHdaVerbTablePtr
+ gPlatformModuleTokenSpaceGuid.HdaVerbTableEntryNum
+
[Guids]
gEfiPlatformInfoGuid
gEfiAuthenticatedVariableGuid
diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/HdaVerbTables.c b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/HdaVerbTables.c
similarity index 66%
rename from Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/HdaVerbTables.c
rename to Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/HdaVerbTables.c
index 6cd068e41..9a911fe2c 100644
--- a/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/HdaVerbTables.c
+++ b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/HdaVerbTables.c
@@ -1,5 +1,7 @@
/** @file
- Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
+ HD Audio Verb Table.
+
+ Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -14,13 +16,6 @@
#include "HdaVerbTables.h"
HDAUDIO_VERB_TABLE HdaVerbTableAlc662 = {
- //
- // VerbTable: (Realtek ALC662)
- // Revision ID = 0xff
- // Codec Verb Table for IOTG CRB boards
- // Codec Address: CAd value (0/1/2)
- // Codec Vendor: 0x10EC0662
- //
{
0x10EC0662, // Vendor ID / Device ID
0xFF, // Revision ID
@@ -28,31 +23,7 @@ HDAUDIO_VERB_TABLE HdaVerbTableAlc662 = {
15 * 4 // Number of data DWORDs following the header.
},
{
- //
- // Realtek Semiconductor Corp.
- //
- // Realtek High Definition Audio Configuration - Version : 5.0.2.6
- // Realtek HD Audio Codec : ALC662-VD
- // PCI PnP ID : PCI\VEN_8086&DEV_2668&SUBSYS_72708086
- // HDA Codec PnP ID : HDAUDIO\FUNC_01&VEN_10EC&DEV_0662&SUBSYS_80860000
- // The number of verb command block : 15
- //
- // NID 0x12 : 0x40130000
- // NID 0x14 : 0x01014010
- // NID 0x15 : 0x01011012
- // NID 0x16 : 0x01016011
- // NID 0x18 : 0x01A19030
- // NID 0x19 : 0x02A19040
- // NID 0x1A : 0x0181303F
- // NID 0x1B : 0x0221401F
- // NID 0x1C : 0x411111F0
- // NID 0x1D : 0x4045E601
- // NID 0x1E : 0x01441120
- //
- //
- // HDA Codec Subsystem ID Verb-table
- // HDA Codec Subsystem ID : 0x80860000
- //
+
0x00172000,
0x00172100,
0x00172286,
@@ -172,4 +143,3 @@ HDAUDIO_VERB_TABLE HdaVerbTableAlc662 = {
0x0204A9B8
}
};
-
diff --git a/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/HdaVerbTables.h b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/HdaVerbTables.h
new file mode 100644
index 000000000..74a20e37e
--- /dev/null
+++ b/Platform/BroxtonPlatformPkg/Board/LeafHill/BoardInitPostMem/HdaVerbTables.h
@@ -0,0 +1,38 @@
+/** @file
+ HD Audio Verb Table header file.
+ This file includes package header files, library classes.
+
+ Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _HDA_VERBTABLES_H_
+#define _HDA_VERBTABLES_H_
+
+#pragma pack (push,1)
+
+
+typedef struct {
+ UINT32 VendorDeviceId; ///< Codec Vendor/Device ID
+ UINT8 RevisionId; ///< Revision ID of the codec. 0xFF matches any revision.
+ UINT8 SdiNo; ///< SDI number, 0xFF matches any SDI.
+ UINT16 DataDwords; ///< Number of data DWORDs following the header.
+} HDA_VERB_TABLE_HEADER;
+
+typedef struct {
+ HDA_VERB_TABLE_HEADER VerbTableHeader;
+ UINT32 VerbTableData[];
+} HDAUDIO_VERB_TABLE;
+#pragma pack (pop)
+
+extern HDAUDIO_VERB_TABLE HdaVerbTableAlc662;
+
+#endif // _HDA_VERBTABLES_H_
diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf b/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf
index 8c1648d76..593984c40 100644
--- a/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf
+++ b/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf
@@ -87,6 +87,8 @@
gPlatformModuleTokenSpaceGuid.PcdBoardVbtFileGuid
gPlatformModuleTokenSpaceGuid.PcdMaxPkgCState
gPlatformModuleTokenSpaceGuid.PcdeMMCHostMaxSpeed
+ gPlatformModuleTokenSpaceGuid.PcdHdaVerbTablePtr
+ gPlatformModuleTokenSpaceGuid.HdaVerbTableEntryNum
[Ppis]
gSiPolicyPpiGuid ## CONSUMES
diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspScPolicyInitLib.c b/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspScPolicyInitLib.c
index 1a6666ebc..f9055db20 100644
--- a/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspScPolicyInitLib.c
+++ b/Platform/BroxtonPlatformPkg/Common/Library/PeiFspPolicyInitLib/PeiFspScPolicyInitLib.c
@@ -152,7 +152,6 @@ PeiFspScPolicyInit (
BOOLEAN FlashProtectionEnabled;
SC_POLICY_PPI *ScPolicy;
SC_FLASH_PROTECTION_CONFIG *FlashProtectionConfig;
- SC_HDAUDIO_CONFIG *HdaConfig;
UINTN HeciBaseAddress;
UINT32 SecMode;
@@ -363,13 +362,11 @@ PeiFspScPolicyInit (
FspsUpd->FspsConfig.Mmt = SystemConfiguration->ScHdAudioMmt;
FspsUpd->FspsConfig.Hmt = SystemConfiguration->ScHdAudioHmt;
FspsUpd->FspsConfig.HdAudioIoBufferOwnership = SystemConfiguration->ScHdAudioIoBufferOwnership;
+ FspsUpd->FspsConfig.HdaVerbTableEntryNum = PcdGet8(HdaVerbTableEntryNum);
+ FspsUpd->FspsConfig.HdaVerbTablePtr = (UINT32)PcdGet64(PcdHdaVerbTablePtr);
+
+ FspsUpd->FspsConfig.HdAudioDspUaaCompliance = 1;
- Status = GetConfigBlock ((VOID *) ScPolicy, &gHdAudioConfigGuid, (VOID *) &HdaConfig);
- ASSERT_EFI_ERROR (Status);
- if (!EFI_ERROR (Status)) {
- FspsUpd->FspsConfig.HdaVerbTableEntryNum = HdaConfig->VerbTableEntryNum;
- FspsUpd->FspsConfig.HdaVerbTablePtr = HdaConfig->VerbTablePtr;
- }
FspsUpd->FspsConfig.BiosCfgLockDown = SystemConfiguration->ScHdAudioBiosCfgLockDown;
FspsUpd->FspsConfig.HDAudioPwrGate = SystemConfiguration->ScHdAudioPwrGate;
FspsUpd->FspsConfig.HDAudioClkGate = SystemConfiguration->ScHdAudioClkGate;
diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/HdaVerbTables.h b/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/HdaVerbTables.h
deleted file mode 100644
index 64a42bc2c..000000000
--- a/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/HdaVerbTables.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- Header file for HDA Verb Tables.
-
- Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _HDA_VERBTABLES_H_
-#define _HDA_VERBTABLES_H_
-
-#include <Ppi/ScPolicy.h>
-
-enum HDAUDIO_CODEC_SELECT {
- HdaCodecPlatformOnboard = 0,
- HdaCodecExternalKit = 1
-};
-
-extern HDAUDIO_VERB_TABLE HdaVerbTableAlc298;
-extern HDAUDIO_VERB_TABLE HdaVerbTableAlc662;
-
-#endif // _HDA_VERBTABLES_H_
-
diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf b/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf
index d5f0a1b8d..acb5a84bb 100644
--- a/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf
+++ b/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiPolicyUpdateLib.inf
@@ -25,7 +25,6 @@
PeiScPolicyUpdate.c
PeiCpuPolicyUpdatePreMem.c
PeiCpuPolicyUpdate.c
- HdaVerbTables.c
[Packages]
MdePkg/MdePkg.dec
diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiScPolicyUpdate.c b/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiScPolicyUpdate.c
index d9a991ca6..b260c3518 100644
--- a/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiScPolicyUpdate.c
+++ b/Platform/BroxtonPlatformPkg/Common/Library/PeiPolicyUpdateLib/PeiScPolicyUpdate.c
@@ -18,7 +18,6 @@
#include <Library/MemoryAllocationLib.h>
#include <Library/HobLib.h>
#include <Library/PcdLib.h>
-#include "HdaVerbTables.h"
#include <Guid/PlatformInfo.h>
#include <Library/PeiScPolicyLib.h>
#include <Library/HeciMsgLib.h>
@@ -71,43 +70,6 @@ InternalAddVerbTable (
}
-STATIC
-VOID
-InstallPlatformVerbTables (
- IN SC_HDAUDIO_CONFIG *HdaConfig,
- IN UINT16 BoardId,
- IN UINTN CodecType
- )
-{
- UINT8 VerbTableEntryNum;
- UINT32 VerbTableArray[32];
- UINT32 *VerbTablePtr;
-
- VerbTableEntryNum = 0;
-
- //
- // left switch cases defined which can be PlatformInfo or stepping
- //
- if (CodecType == HdaCodecPlatformOnboard) {
- //
- // Add onboard verb table. If we use a board that uses a different one, we need to split this code to board specific
- // location.
- //
- InternalAddVerbTable (&VerbTableEntryNum, VerbTableArray, &HdaVerbTableAlc662);
- } else {
- DEBUG ((DEBUG_INFO, "HD-Audio Warning: External codec kit selected or platform verb table not found, installing all!\n"));
- }
-
- HdaConfig->VerbTableEntryNum = VerbTableEntryNum;
-
- VerbTablePtr = (UINT32 *) AllocateZeroPool (sizeof (UINT32) *VerbTableEntryNum);
- CopyMem (VerbTablePtr, VerbTableArray, sizeof (UINT32) *VerbTableEntryNum);
- HdaConfig->VerbTablePtr = (UINT32) VerbTablePtr;
-
- return;
-}
-
-
/**
Check it's eMMC boot path or not.
@@ -548,16 +510,6 @@ UpdatePeiScPolicy (
}
HdaConfig->ResetWaitTimer = 300;
- //
- // Install Verb Table
- //
- if (SystemConfiguration.ScHdAudio) {
- //
- // set default to on board
- //
- InstallPlatformVerbTables (HdaConfig, BoardId, HdaCodecPlatformOnboard);
- }
-
//
// Update GMM config
//
diff --git a/Platform/BroxtonPlatformPkg/PlatformPkg.dec b/Platform/BroxtonPlatformPkg/PlatformPkg.dec
index f61331f16..f2bb7243e 100644
--- a/Platform/BroxtonPlatformPkg/PlatformPkg.dec
+++ b/Platform/BroxtonPlatformPkg/PlatformPkg.dec
@@ -199,6 +199,11 @@
#gPlatformModuleTokenSpaceGuid.PcdSerialIoUartNumber|2|UINT8|0x8000001B
## This PCD used to select eMMCHostMaxSpeed
gPlatformModuleTokenSpaceGuid.PcdeMMCHostMaxSpeed|0x00|UINT8|0x8000001C
+ ## This PCD points to verb table of HD audio.
+ gPlatformModuleTokenSpaceGuid.PcdHdaVerbTablePtr|0|UINT64|0x8000001D
+ ## This PCD report the number of VBT table entries in VBT table array.
+ gPlatformModuleTokenSpaceGuid.HdaVerbTableEntryNum|0|UINT8|0x8000001E
+
## MemoryCheck value for checking memory before boot OS.
## To save the boot performance, the default MemoryCheck is set to 0.
gClientCommonModuleTokenSpaceGuid.PcdPlatformMemoryCheck|0|UINT8|0x40000005
--
2.14.1.windows.1
reply other threads:[~2017-12-13 9:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171213090652.11708-1-david.wei@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox