From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web09.5258.1612428687365865577 for ; Thu, 04 Feb 2021 00:51:27 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: heng.luo@intel.com) IronPort-SDR: H5hxg/Q2Yi0Pa2vJqPsvEan8XrAIjUXKRkDKC2YhUBiwcj6ULK2qRLW8WLiW34dXd7OolQhjH2 mvjfqj2G3skQ== X-IronPort-AV: E=McAfee;i="6000,8403,9884"; a="160364669" X-IronPort-AV: E=Sophos;i="5.79,400,1602572400"; d="scan'208";a="160364669" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2021 00:51:24 -0800 IronPort-SDR: cK6H0ZjwTfchuajxnymsTffcxY+4Rl5Tt9WamaLoVVBWxf1e0t+ZYKb7vKCzxJBmmCqtnGE74/ cLvuiWM2Yxgg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,400,1602572400"; d="scan'208";a="393062253" Received: from hengluo-dev.ccr.corp.intel.com ([10.239.153.154]) by orsmga008.jf.intel.com with ESMTP; 04 Feb 2021 00:51:21 -0800 From: "Heng Luo" To: devel@edk2.groups.io Cc: Sai Chaganty , Nate DeSimone Subject: [Patch V2 19/40] TigerlakeSiliconPkg/IpBlock: Add Hda component Date: Thu, 4 Feb 2021 16:48:58 +0800 Message-Id: <20210204084919.3603-19-heng.luo@intel.com> X-Mailer: git-send-email 2.24.0.windows.2 In-Reply-To: <20210204084919.3603-1-heng.luo@intel.com> References: <20210204084919.3603-1-heng.luo@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3171 Adds the following files: * IpBlock/Hda/IncludePrivate * IpBlock/Hda/Library * IpBlock/Hda/LibraryPrivate Cc: Sai Chaganty Cc: Nate DeSimone Signed-off-by: Heng Luo --- Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/IncludePrivate/Library/DxeHd= aPolicyLib.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++= +++++++++ Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/IncludePrivate/Register/HdaR= egs.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/Library/DxeHdaNhltLib/DxeHda= NhltLib.c | 383 ++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++ Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/Library/DxeHdaNhltLib/DxeHda= NhltLib.inf | 31 +++++++++++++++++++++++++++++++ Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/LibraryPrivate/DxeHdaPolicyL= ib/DxeHdaPolicyLib.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++= ++++++++++++++++++++++++++++++++++++++++++++++ Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/LibraryPrivate/DxeHdaPolicyL= ib/DxeHdaPolicyLib.inf | 31 +++++++++++++++++++++++++++++++ 6 files changed, 638 insertions(+) diff --git a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/IncludePrivate/L= ibrary/DxeHdaPolicyLib.h b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/In= cludePrivate/Library/DxeHdaPolicyLib.h new file mode 100644 index 0000000000..9c42bf5611 --- /dev/null +++ b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/IncludePrivate/Library/= DxeHdaPolicyLib.h @@ -0,0 +1,55 @@ +/** @file=0D + DXE Hda policy library.=0D +=0D + Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +#ifndef _DXE_HDA_POLICY_LIB_H_=0D +#define _DXE_HDA_POLICY_LIB_H_=0D +=0D +#include =0D +=0D +/**=0D + Print HDAUDIO_DXE_CONFIG and serial out.=0D +=0D + @param[in] PchPolicy Pointer to a PCH_POLICY_PROTOCOL=0D +**/=0D +VOID=0D +HdaDxePrintConfig (=0D + IN PCH_POLICY_PROTOCOL *PchPolicy=0D + );=0D +=0D +/**=0D + Load Config block default=0D +=0D + @param[in] ConfigBlockPointer Pointer to config block=0D +**/=0D +VOID=0D +HdaDxeLoadConfigDefault (=0D + IN VOID *ConfigBlockPointer=0D + );=0D +=0D +/**=0D + Get Hda config block table size.=0D +=0D + @retval Size of config block=0D +**/=0D +UINT16=0D +HdaDxeGetConfigBlockTotalSize (=0D + VOID=0D + );=0D +=0D +/**=0D + Add Hda ConfigBlock.=0D +=0D + @param[in] ConfigBlockTableAddress The pointer to config block table= =0D +=0D + @retval EFI_SUCCESS The policy default is initialized.= =0D + @retval EFI_OUT_OF_RESOURCES Insufficient resources to create b= uffer=0D +**/=0D +EFI_STATUS=0D +HdaDxeAddConfigBlock (=0D + IN VOID *ConfigBlockTableAddress=0D + );=0D +=0D +#endif // _DXE_HDA_POLICY_LIB_H_=0D diff --git a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/IncludePrivate/R= egister/HdaRegs.h b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/IncludePr= ivate/Register/HdaRegs.h new file mode 100644 index 0000000000..b165e7bb22 --- /dev/null +++ b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/IncludePrivate/Register= /HdaRegs.h @@ -0,0 +1,46 @@ +/** @file=0D + Register names for High Definition Audio device.=0D +=0D + Conventions:=0D +=0D + - Register definition format:=0D + Prefix_[GenerationName]_[ComponentName]_SubsystemName_RegisterSpace_Re= gisterName=0D + - Prefix:=0D + Definitions beginning with "R_" are registers=0D + Definitions beginning with "B_" are bits within registers=0D + Definitions beginning with "V_" are meaningful values within the bits= =0D + Definitions beginning with "S_" are register size=0D + Definitions beginning with "N_" are the bit position=0D + - [GenerationName]:=0D + Three letter acronym of the generation is used (e.g. SKL,KBL,CNL etc.)= .=0D + Register name without GenerationName applies to all generations.=0D + - [ComponentName]:=0D + This field indicates the component name that the register belongs to (= e.g. PCH, SA etc.)=0D + Register name without ComponentName applies to all components.=0D + Register that is specific to -LP denoted by "_PCH_LP_" in component na= me.=0D + - SubsystemName:=0D + This field indicates the subsystem name of the component that the regi= ster belongs to=0D + (e.g. PCIE, USB, SATA, GPIO, PMC etc.).=0D + - RegisterSpace:=0D + MEM - MMIO space register of subsystem.=0D + IO - IO space register of subsystem.=0D + PCR - Private configuration register of subsystem.=0D + CFG - PCI configuration space register of subsystem.=0D + - RegisterName:=0D + Full register name.=0D +=0D + Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +#ifndef _HDA_REGS_H_=0D +#define _HDA_REGS_H_=0D +=0D +//=0D +// HD-A Controller Registers=0D +//=0D +// PCI Configuration Space Registers=0D +//=0D +#define R_HDA_CFG_PCS 0x54=0D +#define B_HDA_CFG_PCS_PMEE BIT8=0D +=0D +#endif=0D diff --git a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/Library/DxeHdaNh= ltLib/DxeHdaNhltLib.c b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/Libra= ry/DxeHdaNhltLib/DxeHdaNhltLib.c new file mode 100644 index 0000000000..71388934e6 --- /dev/null +++ b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/Library/DxeHdaNhltLib/D= xeHdaNhltLib.c @@ -0,0 +1,383 @@ +/** @file=0D + HD Audio NHLT Library implementation.=0D +=0D + Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +/**=0D + Returns pointer to Endpoint ENDPOINT_DESCRIPTOR structure.=0D +=0D + @param[in] *NhltTable Endpoint for which Format address is retrieved= =0D + @param[in] FormatIndex Index of Format to be retrieved=0D +=0D + @retval Pointer to ENDPOINT_DESCRIPTOR structure with g= iven index=0D +**/=0D +ENDPOINT_DESCRIPTOR *=0D +GetNhltEndpoint (=0D + IN CONST NHLT_ACPI_TABLE *NhltTable,=0D + IN CONST UINT8 EndpointIndex=0D + )=0D +{=0D + UINT8 Index;=0D + ENDPOINT_DESCRIPTOR *Endpoint;=0D + Endpoint =3D (ENDPOINT_DESCRIPTOR*) (NhltTable->EndpointDescriptors);=0D +=0D + if (EndpointIndex > NhltTable->EndpointCount) {=0D + return NULL;=0D + }=0D +=0D + for (Index =3D 0; Index < EndpointIndex; Index++) {=0D + Endpoint =3D (ENDPOINT_DESCRIPTOR*) ((UINT8*) (Endpoint) + Endpoint->E= ndpointDescriptorLength);=0D + }=0D +=0D + return Endpoint;=0D +}=0D +=0D +/**=0D + Returns pointer to Endpoint Specific Configuration SPECIFIC_CONFIG struc= ture.=0D +=0D + @param[in] *Endpoint Endpoint for which config address is retrieved= =0D +=0D + @retval Pointer to SPECIFIC_CONFIG structure with endpo= int's capabilities=0D +**/=0D +SPECIFIC_CONFIG *=0D +GetNhltEndpointDeviceCapabilities (=0D + IN CONST ENDPOINT_DESCRIPTOR *Endpoint=0D + )=0D +{=0D + return (SPECIFIC_CONFIG*) (&Endpoint->EndpointConfig);=0D +}=0D +=0D +/**=0D + Returns pointer to all Formats Configuration FORMATS_CONFIG structure.=0D +=0D + @param[in] *Endpoint Endpoint for which Formats address is retrieved= =0D +=0D + @retval Pointer to FORMATS_CONFIG structure=0D +**/=0D +FORMATS_CONFIG *=0D +GetNhltEndpointFormatsConfig (=0D + IN CONST ENDPOINT_DESCRIPTOR *Endpoint=0D + )=0D +{=0D + FORMATS_CONFIG *FormatsConfig;=0D + FormatsConfig =3D (FORMATS_CONFIG*) ((UINT8*) (&Endpoint->EndpointConfig= )=0D + + sizeof (Endpoint->EndpointConfig.Ca= pabilitiesSize)=0D + + Endpoint->EndpointConfig.Capabiliti= esSize);=0D +=0D + return FormatsConfig;=0D +}=0D +=0D +/**=0D + Returns pointer to Format Configuration FORMAT_CONFIG structure.=0D +=0D + @param[in] *Endpoint Endpoint for which Format address is retrieved= =0D + @param[in] FormatIndex Index of Format to be retrieved=0D +=0D + @retval Pointer to FORMAT_CONFIG structure with given i= ndex=0D +**/=0D +FORMAT_CONFIG *=0D +GetNhltEndpointFormat (=0D + IN CONST ENDPOINT_DESCRIPTOR *Endpoint,=0D + IN CONST UINT8 FormatIndex=0D + )=0D +{=0D + UINT8 Index;=0D + UINT32 Length;=0D + FORMATS_CONFIG *FormatsConfig;=0D + FORMAT_CONFIG *Format;=0D +=0D + Length =3D 0;=0D + FormatsConfig =3D GetNhltEndpointFormatsConfig (Endpoint);=0D + Format =3D FormatsConfig->FormatsConfiguration;=0D +=0D + if (FormatIndex > FormatsConfig->FormatsCount) {=0D + return NULL;=0D + }=0D +=0D + for (Index =3D 0; Index < FormatIndex; Index++) {=0D + Length =3D sizeof (Format->Format) + Format->FormatConfiguration.Capab= ilitiesSize=0D + + sizeof (Format->FormatConfiguration.CapabilitiesSize);=0D + Format =3D (FORMAT_CONFIG*) ((UINT8*) (Format) + Length);=0D + }=0D +=0D + return Format;=0D +}=0D +=0D +/**=0D + Returns pointer to all Device Information DEVICES_INFO structure.=0D +=0D + @param[in] *Endpoint Endpoint for which DevicesInfo address is retri= eved=0D +=0D + @retval Pointer to DEVICES_INFO structure=0D +**/=0D +DEVICES_INFO *=0D +GetNhltEndpointDevicesInfo (=0D + IN CONST ENDPOINT_DESCRIPTOR *Endpoint=0D + )=0D +{=0D + DEVICES_INFO *DevicesInfo;=0D + FORMATS_CONFIG *FormatsConfig;=0D + FORMAT_CONFIG *Format;=0D +=0D + FormatsConfig =3D GetNhltEndpointFormatsConfig (Endpoint);=0D + Format =3D GetNhltEndpointFormat (Endpoint, FormatsConfig->FormatsCount)= ;=0D + DevicesInfo =3D (DEVICES_INFO*) ((UINT8*) Format);=0D +=0D + return DevicesInfo;=0D +}=0D +=0D +/**=0D + Returns pointer to Device Information DEVICES_INFO structure.=0D +=0D + @param[in] *Endpoint Endpoint for which Device Info address is ret= rieved=0D + @param[in] DeviceInfoIndex Index of Device Info to be retrieved=0D +=0D + @retval Pointer to DEVICE_INFO structure with given i= ndex=0D +**/=0D +DEVICE_INFO *=0D +GetNhltEndpointDeviceInfo (=0D + IN CONST ENDPOINT_DESCRIPTOR *Endpoint,=0D + IN CONST UINT8 DeviceInfoIndex=0D + )=0D +{=0D + DEVICES_INFO *DevicesInfo;=0D + DEVICE_INFO *DeviceInfo;=0D +=0D + DevicesInfo =3D GetNhltEndpointDevicesInfo (Endpoint);=0D + DeviceInfo =3D DevicesInfo->DeviceInformation;=0D +=0D + if (DevicesInfo =3D=3D NULL || DeviceInfoIndex >=3D DevicesInfo->DeviceI= nfoCount) {=0D + return NULL;=0D + }=0D +=0D + DeviceInfo =3D (DEVICE_INFO*) ((UINT8*) (DeviceInfo) + sizeof (*DeviceIn= fo) * DeviceInfoIndex);=0D +=0D + return DeviceInfo;=0D +}=0D +=0D +/**=0D + Returns pointer to OED Configuration SPECIFIC_CONFIG structure.=0D +=0D + @param[in] *NhltTable NHLT table for which OED address is retrieved=0D +=0D + @retval Pointer to SPECIFIC_CONFIG structure with NHLT = capabilities=0D +**/=0D +SPECIFIC_CONFIG *=0D +GetNhltOedConfig (=0D + IN CONST NHLT_ACPI_TABLE *NhltTable=0D + )=0D +{=0D + ENDPOINT_DESCRIPTOR *Endpoint;=0D + SPECIFIC_CONFIG *OedConfig;=0D +=0D + Endpoint =3D GetNhltEndpoint (NhltTable, (NhltTable->EndpointCount));=0D + OedConfig =3D (SPECIFIC_CONFIG*) ((UINT8*) (Endpoint));=0D +=0D + return OedConfig;=0D +}=0D +=0D +/**=0D + Prints Format configuration.=0D +=0D + @param[in] *Format Format to be printed=0D +=0D + @retval None=0D +**/=0D +VOID=0D +NhltFormatDump (=0D + IN CONST FORMAT_CONFIG *Format=0D + )=0D +{=0D + UINT32 Index;=0D +=0D + DEBUG ((DEBUG_INFO, "------------------------------- FORMAT ------------= -------------------\n"));=0D + DEBUG ((DEBUG_INFO, " Format->Format.Format.wFormatTag =3D 0x%x\n",= Format->Format.Format.wFormatTag));=0D + DEBUG ((DEBUG_INFO, " Format->Format.Format.nChannels =3D %d\n", F= ormat->Format.Format.nChannels));=0D + DEBUG ((DEBUG_INFO, " Format->Format.Format.nSamplesPerSec =3D %d\n", F= ormat->Format.Format.nSamplesPerSec));=0D + DEBUG ((DEBUG_INFO, " Format->Format.Format.nAvgBytesPerSec =3D %d\n", F= ormat->Format.Format.nAvgBytesPerSec));=0D + DEBUG ((DEBUG_INFO, " Format->Format.Format.nBlockAlign =3D %d\n", F= ormat->Format.Format.nBlockAlign));=0D + DEBUG ((DEBUG_INFO, " Format->Format.Format.wBitsPerSample =3D %d\n", F= ormat->Format.Format.wBitsPerSample));=0D + DEBUG ((DEBUG_INFO, " Format->Format.Format.cbSize =3D %d\n", F= ormat->Format.Format.cbSize));=0D + DEBUG ((DEBUG_INFO, " Format->Format.Samples =3D %d\n", F= ormat->Format.Samples));=0D + DEBUG ((DEBUG_INFO, " Format->Format.dwChannelMask =3D 0x%x\n",= Format->Format.dwChannelMask));=0D + DEBUG ((DEBUG_INFO, " Format->Format.SubFormat =3D %g\n", F= ormat->Format.SubFormat));=0D +=0D +=0D + DEBUG ((DEBUG_INFO, " Format->FormatConfiguration.CapabilitiesSize =3D %= d B\n", Format->FormatConfiguration.CapabilitiesSize));=0D + DEBUG ((DEBUG_VERBOSE, " Format->FormatConfiguration.Capabilities:"));=0D + for (Index =3D 0; Index < ( Format->FormatConfiguration.CapabilitiesSiz= e ) ; Index++) {=0D + if (Index % 16 =3D=3D 0) {=0D + DEBUG ((DEBUG_VERBOSE, "\n"));=0D + }=0D + DEBUG ((DEBUG_VERBOSE, "0x%02x, ", Format->FormatConfiguration.Capabil= ities[Index]));=0D + }=0D + DEBUG ((DEBUG_VERBOSE, "\n"));=0D +}=0D +=0D +/**=0D + Prints Device Information.=0D +=0D + @param[in] *DeviceInfo DeviceInfo to be printed=0D +=0D + @retval None=0D +**/=0D +VOID=0D +NhltDeviceInfoDump (=0D + IN CONST DEVICE_INFO *DeviceInfo=0D + )=0D +{=0D + DEBUG ((DEBUG_INFO, "----------------------------- DEVICE INFO ---------= -------------------\n"));=0D + DEBUG ((DEBUG_INFO, " DeviceInfo->DeviceId =3D %a\n", DeviceIn= fo->DeviceId));=0D + DEBUG ((DEBUG_INFO, " DeviceInfo->DeviceInstanceId =3D 0x%x\n", DeviceIn= fo->DeviceInstanceId));=0D + DEBUG ((DEBUG_INFO, " DeviceInfo->DevicePortId =3D 0x%x\n", DeviceIn= fo->DevicePortId));=0D +}=0D +=0D +/**=0D + Prints Endpoint configuration.=0D +=0D + @param[in] *Endpoint Endpoint to be printed=0D +=0D + @retval None=0D +**/=0D +VOID=0D +NhltEndpointDump (=0D + IN CONST ENDPOINT_DESCRIPTOR *Endpoint=0D + )=0D +{=0D + UINT8 Index;=0D + FORMATS_CONFIG *FormatsConfigs;=0D + FORMAT_CONFIG *Format;=0D + DEVICES_INFO *DevicesInfo;=0D + DEVICE_INFO *DeviceInfo;=0D +=0D + DEBUG ((DEBUG_INFO, "------------------------------ ENDPOINT -----------= -------------------\n"));=0D + DEBUG ((DEBUG_INFO, " Endpoint->DeviceDescriptorLength =3D %d B\n", Endp= oint->EndpointDescriptorLength));=0D + DEBUG ((DEBUG_INFO, " Endpoint->LinkType =3D 0x%x\n", Endp= oint->LinkType));=0D + DEBUG ((DEBUG_INFO, " Endpoint->InstanceId =3D 0x%x\n", Endp= oint->InstanceId));=0D + DEBUG ((DEBUG_INFO, " Endpoint->HwVendorId =3D 0x%x\n", Endp= oint->HwVendorId));=0D + DEBUG ((DEBUG_INFO, " Endpoint->HwDeviceId =3D 0x%x\n", Endp= oint->HwDeviceId));=0D + DEBUG ((DEBUG_INFO, " Endpoint->HwRevisionId =3D 0x%x\n", Endp= oint->HwRevisionId));=0D + DEBUG ((DEBUG_INFO, " Endpoint->HwSubsystemId =3D 0x%x\n", Endp= oint->HwSubsystemId));=0D + DEBUG ((DEBUG_INFO, " Endpoint->DeviceType =3D 0x%x\n", Endp= oint->DeviceType));=0D + DEBUG ((DEBUG_INFO, " Endpoint->Direction =3D 0x%x\n", Endp= oint->Direction));=0D + DEBUG ((DEBUG_INFO, " Endpoint->VirtualBusId =3D 0x%x\n", Endp= oint->VirtualBusId));=0D +=0D + DEBUG ((DEBUG_INFO, " Endpoint->EndpointConfig.CapabilitiesSize =3D %d B= \n", Endpoint->EndpointConfig.CapabilitiesSize));=0D + DEBUG ((DEBUG_VERBOSE, " Endpoint->EndpointConfig.Capabilities:"));=0D + for (Index =3D 0; Index < (Endpoint->EndpointConfig.CapabilitiesSize ) ;= Index++) {=0D + if (Index % 16 =3D=3D 0) DEBUG ((DEBUG_VERBOSE, "\n"));=0D + DEBUG ((DEBUG_VERBOSE, "0x%02x, ", Endpoint->EndpointConfig.Capabiliti= es[Index]));=0D + }=0D +=0D + FormatsConfigs =3D GetNhltEndpointFormatsConfig (Endpoint);=0D +=0D + DEBUG ((DEBUG_INFO, "\n"));=0D + DEBUG ((DEBUG_INFO, " Endpoint->FormatsConfig.FormatsCount =3D %d\n", Fo= rmatsConfigs->FormatsCount));=0D + for (Index =3D 0; Index < FormatsConfigs->FormatsCount; Index++) {=0D + Format =3D GetNhltEndpointFormat (Endpoint, Index);=0D + if (Format !=3D NULL) {=0D + NhltFormatDump (Format);=0D + }=0D + }=0D +=0D + DevicesInfo =3D GetNhltEndpointDevicesInfo (Endpoint);=0D + if (DevicesInfo !=3D NULL) {=0D + DEBUG ((DEBUG_INFO, "\n"));=0D + DEBUG ((DEBUG_INFO, " Endpoint->DevicesInfo.DeviceInfoCount =3D %d\n",= DevicesInfo->DeviceInfoCount));=0D + for (Index =3D 0; Index < DevicesInfo->DeviceInfoCount; Index++) {=0D + DeviceInfo =3D GetNhltEndpointDeviceInfo (Endpoint, Index);=0D + if (DeviceInfo !=3D NULL) {=0D + NhltDeviceInfoDump (DeviceInfo);=0D + }=0D + }=0D + }=0D + DEBUG ((DEBUG_VERBOSE, "\n"));=0D +}=0D +=0D +/**=0D + Prints OED (Offload Engine Driver) configuration.=0D +=0D + @param[in] *OedConfig OED to be printed=0D +=0D + @retval None=0D +**/=0D +VOID=0D +NhltOedConfigDump (=0D + IN CONST SPECIFIC_CONFIG *OedConfig=0D + )=0D +{=0D + UINT8 Index;=0D +=0D + DEBUG ((DEBUG_INFO, "-------------------------- OED CONFIGURATION ------= -------------------\n"));=0D + DEBUG ((DEBUG_INFO, " OedConfig->CapabilitiesSize =3D %d B\n", OedConfig= ->CapabilitiesSize));=0D + DEBUG ((DEBUG_VERBOSE, " OedConfig->Capabilities:"));=0D + for (Index =3D 0; Index < (OedConfig->CapabilitiesSize) ; Index++) {=0D + if (Index % 16 =3D=3D 0) DEBUG ((DEBUG_VERBOSE, "\n"));=0D + DEBUG ((DEBUG_VERBOSE, "0x%02x, ", OedConfig->Capabilities[Index]));=0D + }=0D +=0D + DEBUG ((DEBUG_VERBOSE, "\n"));=0D +}=0D +=0D +/**=0D + Prints NHLT (Non HDA-Link Table) to be exposed via ACPI (aka. OED (Offlo= ad Engine Driver) Configuration Table).=0D +=0D + @param[in] *NhltTable The NHLT table to print=0D +=0D + @retval None=0D +**/=0D +VOID=0D +NhltAcpiTableDump (=0D + IN NHLT_ACPI_TABLE *NhltTable=0D + )=0D +{=0D + DEBUG_CODE_BEGIN ();=0D + UINT8 Index;=0D +=0D + DEBUG ((DEBUG_INFO, "\n"));=0D + DEBUG ((DEBUG_INFO, "--- NHLT ACPI Table Dump [OED (Offload Engine Drive= r) Configuration] ---\n"));=0D +=0D + DEBUG ((DEBUG_INFO, "sizeof NHLT_ACPI_TABLE =3D %d B\n", sizeof (NHLT_AC= PI_TABLE)));=0D + DEBUG ((DEBUG_INFO, "sizeof EFI_ACPI_DESCRIPTION_HEADER =3D %d B\n", siz= eof (EFI_ACPI_DESCRIPTION_HEADER)));=0D + DEBUG ((DEBUG_INFO, "sizeof ENDPOINT_DESCRIPTOR =3D %d B\n", sizeof (END= POINT_DESCRIPTOR)));=0D + DEBUG ((DEBUG_INFO, "sizeof SPECIFIC_CONFIG =3D %d B\n", sizeof (SPECIFI= C_CONFIG)));=0D + DEBUG ((DEBUG_INFO, "sizeof FORMATS_CONFIG =3D %d B\n", sizeof (FORMATS_= CONFIG)));=0D + DEBUG ((DEBUG_INFO, "sizeof FORMAT_CONFIG =3D %d B\n", sizeof (FORMAT_CO= NFIG)));=0D + DEBUG ((DEBUG_INFO, "sizeof WAVEFORMATEXTENSIBLE =3D %d B\n", sizeof (WA= VEFORMATEXTENSIBLE)));=0D + DEBUG ((DEBUG_INFO, "sizeof DEVICES_INFO =3D %d B\n", sizeof (DEVICES_IN= FO)));=0D + DEBUG ((DEBUG_INFO, "sizeof DEVICE_INFO =3D %d B\n", sizeof (DEVICE_INFO= )));=0D +=0D + DEBUG ((DEBUG_INFO, " NHLT_ACPI_TABLE Header.Signature =3D 0x%08x\= n", NhltTable->Header.Signature));=0D + DEBUG ((DEBUG_INFO, " NHLT_ACPI_TABLE Header.Length =3D 0x%08x\= n", NhltTable->Header.Length));=0D + DEBUG ((DEBUG_INFO, " NHLT_ACPI_TABLE Header.Revision =3D 0x%02x\= n", NhltTable->Header.Revision));=0D + DEBUG ((DEBUG_INFO, " NHLT_ACPI_TABLE Header.Checksum =3D 0x%02x\= n", NhltTable->Header.Checksum));=0D + DEBUG ((DEBUG_INFO, " NHLT_ACPI_TABLE Header.OemId =3D %a\n", = NhltTable->Header.OemId));=0D + DEBUG ((DEBUG_INFO, " NHLT_ACPI_TABLE Header.OemTableId =3D 0x%lx\n= ", NhltTable->Header.OemTableId));=0D + DEBUG ((DEBUG_INFO, " NHLT_ACPI_TABLE Header.OemRevision =3D 0x%08x\= n", NhltTable->Header.OemRevision));=0D + DEBUG ((DEBUG_INFO, " NHLT_ACPI_TABLE Header.CreatorId =3D 0x%08x\= n", NhltTable->Header.CreatorId));=0D + DEBUG ((DEBUG_INFO, " NHLT_ACPI_TABLE Header.CreatorRevision =3D 0x%08x\= n", NhltTable->Header.CreatorRevision));=0D + DEBUG ((DEBUG_INFO, "\n"));=0D +=0D + DEBUG ((DEBUG_INFO, " NHLT_ACPI_TABLE EndpointCount =3D %d\n", NhltTable= ->EndpointCount));=0D + for (Index =3D 0; Index < NhltTable->EndpointCount; Index++) {=0D + NhltEndpointDump (GetNhltEndpoint (NhltTable, Index));=0D + }=0D +=0D + NhltOedConfigDump (GetNhltOedConfig (NhltTable));=0D + DEBUG ((DEBUG_INFO, "---------------------------------------------------= -------------------\n"));=0D +=0D + DEBUG_CODE_END ();=0D +}=0D +=0D diff --git a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/Library/DxeHdaNh= ltLib/DxeHdaNhltLib.inf b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/Lib= rary/DxeHdaNhltLib/DxeHdaNhltLib.inf new file mode 100644 index 0000000000..a1574c3ab1 --- /dev/null +++ b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/Library/DxeHdaNhltLib/D= xeHdaNhltLib.inf @@ -0,0 +1,31 @@ +## @file=0D +# Component information file for HD Audio NHLT Library=0D +#=0D +# Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D +INF_VERSION =3D 0x00010017=0D +BASE_NAME =3D DxeHdaNhltLib=0D +FILE_GUID =3D DA915B7F-EE08-4C1D-B3D0-DE7C52AB155A=0D +VERSION_STRING =3D 1.0=0D +MODULE_TYPE =3D BASE=0D +LIBRARY_CLASS =3D DxeHdaNhltLib=0D +=0D +[LibraryClasses]=0D +BaseLib=0D +DebugLib=0D +MemoryAllocationLib=0D +BaseMemoryLib=0D +PchInfoLib=0D +ConfigBlockLib=0D +=0D +[Packages]=0D +MdePkg/MdePkg.dec=0D +TigerlakeSiliconPkg/SiPkg.dec=0D +=0D +[Sources]=0D +DxeHdaNhltLib.c=0D +=0D diff --git a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/LibraryPrivate/D= xeHdaPolicyLib/DxeHdaPolicyLib.c b/Silicon/Intel/TigerlakeSiliconPkg/IpBloc= k/Hda/LibraryPrivate/DxeHdaPolicyLib/DxeHdaPolicyLib.c new file mode 100644 index 0000000000..30843fab39 --- /dev/null +++ b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/LibraryPrivate/DxeHdaPo= licyLib/DxeHdaPolicyLib.c @@ -0,0 +1,92 @@ +/** @file=0D + This file provides services for Hda policy function=0D +=0D + Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +/**=0D + Print HDAUDIO_DXE_CONFIG and serial out.=0D +=0D + @param[in] PchPolicy Pointer to a PCH_POLICY_PROTOCOL=0D +**/=0D +VOID=0D +HdaDxePrintConfig (=0D + IN PCH_POLICY_PROTOCOL *PchPolicy=0D + )=0D +{=0D + EFI_STATUS Status;=0D + HDAUDIO_DXE_CONFIG *HdaDxeConfig;=0D + UINT32 Index;=0D +=0D + Status =3D GetConfigBlock ((VOID *) PchPolicy, &gHdAudioDxeConfigGuid, (= VOID *) &HdaDxeConfig);=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + DEBUG ((DEBUG_INFO, "------------------ HD-Audio DXE Config ------------= ------\n"));=0D +=0D + for (Index =3D 0; Index < PCH_MAX_HDA_SNDW_LINK_NUM; Index++) {=0D + DEBUG ((DEBUG_INFO, " SNDW%d AutonomousClockStop : %d\n", Index, HdaD= xeConfig->SndwConfig[Index].AutonomousClockStop));=0D + DEBUG ((DEBUG_INFO, " SNDW%d DODS : %d\n", Index, HdaD= xeConfig->SndwConfig[Index].DataOnDelaySelect));=0D + DEBUG ((DEBUG_INFO, " SNDW%d DOAS : %d\n", Index, HdaD= xeConfig->SndwConfig[Index].DataOnActiveIntervalSelect));=0D + }=0D + DEBUG ((DEBUG_INFO, " DSP Feature Mask : 0x%x\n", HdaDxeCon= fig->DspFeatureMask));=0D +}=0D +=0D +/**=0D + Load Config block default=0D +=0D + @param[in] ConfigBlockPointer Pointer to config block=0D +**/=0D +VOID=0D +HdaDxeLoadConfigDefault (=0D + IN VOID *ConfigBlockPointer=0D + )=0D +{=0D + HDAUDIO_DXE_CONFIG *HdAudioDxeConfig;=0D + HdAudioDxeConfig =3D ConfigBlockPointer;=0D +=0D + DEBUG ((DEBUG_INFO, "HdaDxeConfig->Header.GuidHob.Name =3D %g\n", &HdAud= ioDxeConfig->Header.GuidHob.Name));=0D + DEBUG ((DEBUG_INFO, "HdaDxeConfig->Header.GuidHob.Header.HobLength =3D 0= x%x\n", HdAudioDxeConfig->Header.GuidHob.Header.HobLength));=0D +}=0D +=0D +STATIC COMPONENT_BLOCK_ENTRY mHdaBlocks =3D {=0D + &gHdAudioDxeConfigGuid,=0D + sizeof (HDAUDIO_DXE_CONFIG),=0D + HDAUDIO_DXE_CONFIG_REVISION,=0D + HdaDxeLoadConfigDefault=0D +};=0D +=0D +/**=0D + Get Hda config block table size.=0D +=0D + @retval Size of config block=0D +**/=0D +UINT16=0D +HdaDxeGetConfigBlockTotalSize (=0D + VOID=0D + )=0D +{=0D + return mHdaBlocks.Size;=0D +}=0D +=0D +/**=0D + Add Hda ConfigBlock.=0D +=0D + @param[in] ConfigBlockTableAddress The pointer to config block table= =0D +=0D + @retval EFI_SUCCESS The policy default is initialized.= =0D + @retval EFI_OUT_OF_RESOURCES Insufficient resources to create b= uffer=0D +**/=0D +EFI_STATUS=0D +HdaDxeAddConfigBlock (=0D + IN VOID *ConfigBlockTableAddress=0D + )=0D +{=0D + return AddComponentConfigBlocks (ConfigBlockTableAddress, &mHdaBlocks, 1= );=0D +}=0D diff --git a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/LibraryPrivate/D= xeHdaPolicyLib/DxeHdaPolicyLib.inf b/Silicon/Intel/TigerlakeSiliconPkg/IpBl= ock/Hda/LibraryPrivate/DxeHdaPolicyLib/DxeHdaPolicyLib.inf new file mode 100644 index 0000000000..758499b95e --- /dev/null +++ b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/Hda/LibraryPrivate/DxeHdaPo= licyLib/DxeHdaPolicyLib.inf @@ -0,0 +1,31 @@ +## @file=0D +# Component description file for the Hda policy library=0D +#=0D +# Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +=0D +[Defines]=0D +INF_VERSION =3D 0x00010017=0D +BASE_NAME =3D DxeHdaPolicyLib=0D +FILE_GUID =3D B053EFE4-0868-4510-A71D-96A85CD16C77=0D +VERSION_STRING =3D 1.0=0D +MODULE_TYPE =3D BASE=0D +LIBRARY_CLASS =3D DxeHdaPolicyLib=0D +=0D +[LibraryClasses]=0D +DebugLib=0D +ConfigBlockLib=0D +SiConfigBlockLib=0D +=0D +[Packages]=0D +MdePkg/MdePkg.dec=0D +TigerlakeSiliconPkg/SiPkg.dec=0D +=0D +[Sources]=0D +DxeHdaPolicyLib.c=0D +=0D +[Guids]=0D +gHdAudioDxeConfigGuid ## CONSUMES=0D --=20 2.24.0.windows.2