From nobody Mon Feb 9 07:55:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+93539+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93539+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1662685633; cv=none; d=zohomail.com; s=zohoarc; b=cK5DBfHyazS4K9A5mE3T2IPvGqzEzCImr/RLm0HJ0m6bz1HkwPH8COPcCQq27IGYvL7bVlDdYoA85xQ1sQKtxqsuQdpcw/mOw+jlXbNQptChh2Y19eFNIDNnE7jDqYrii52B1h+nGzhmCaRLayer2FCbDw0mNlcZULA3I6IlcNQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662685633; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=u/F/JTSxXqj3ZO3gbNW73DNUHKFGAPDpxLV9A9BF+w0=; b=oJQk+uGXLmSnMuBwUgIzlh8vY35vzKiPSRf+7HaRG4BEALHPF8jZmQmCzMsjPeKlhQ/5uYIMqKH9Z4l8oRmmW+/Hg337GawuWqe7PJZp41U1Z26qUuYYd3WvO3vP5IN6nYTcbz25xqPdt81xS33E+urxFzbooe2hJYeRoys9VfI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93539+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1662685633760527.9120097069111; Thu, 8 Sep 2022 18:07:13 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Ft8CYY1788612xX4S4ML7jba; Thu, 08 Sep 2022 18:07:13 -0700 X-Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web08.1280.1662685631700254532 for ; Thu, 08 Sep 2022 18:07:12 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10464"; a="323568618" X-IronPort-AV: E=Sophos;i="5.93,300,1654585200"; d="scan'208";a="323568618" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2022 18:07:11 -0700 X-IronPort-AV: E=Sophos;i="5.93,300,1654585200"; d="scan'208";a="676950460" X-Received: from nldesimo-desk1.amr.corp.intel.com ([10.24.80.62]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2022 18:07:11 -0700 From: "Nate DeSimone" To: devel@edk2.groups.io Cc: Chasel Chiu , Sai Chaganty , Isaac Oram , Benjamin Doron , Michael Kubacki , Jeremy Soller Subject: [edk2-devel] [edk2-platforms] [PATCH V3 1/6] KabylakeOpenBoardPkg: Add HdmiDebugPchDetectionLib Date: Thu, 8 Sep 2022 18:06:59 -0700 Message-Id: <20220909010704.7186-2-nathaniel.l.desimone@intel.com> In-Reply-To: <20220909010704.7186-1-nathaniel.l.desimone@intel.com> References: <20220909010704.7186-1-nathaniel.l.desimone@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nathaniel.l.desimone@intel.com X-Gm-Message-State: acvlNBWppDe9IytIkIII1oRbx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1662685633; bh=ELTNooemz1i6MX4kq0TxGDnwMTvmS6YUgpL4xHMGWLw=; h=Cc:Date:From:Reply-To:Subject:To; b=UQ0h+n7xJjc2Lvq6d9REFKaEHABx9KAPMDl1zyFyp9UObSR/C5fQs2LOb/JF2hhoWA1 tA906gN0xayulr0JrZ7ZSTEVKUs/a1t7IDp32VhlpFQiQMxjT/OmVvTS2Q9PwCS866J2V jNDYba6t9kGEgLZWCFAyg7gBItBCqFsT88M= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1662685634276100004 Content-Type: text/plain; charset="utf-8" This library detects the type of PCH present on the system to the granualarity level needed to determine which GMBUS pins to use to access the HDMI DDC I2C bus. Cc: Chasel Chiu Cc: Sai Chaganty Cc: Isaac Oram Cc: Benjamin Doron Cc: Michael Kubacki Cc: Jeremy Soller Signed-off-by: Nate DeSimone --- .../AspireVn7Dash572G/OpenBoardPkg.dsc | 1 + .../GalagoPro3/OpenBoardPkg.dsc | 1 + .../Library/HdmiDebugPchDetectionLib.h | 34 ++++++++++ .../KabylakeRvp3/OpenBoardPkg.dsc | 1 + .../HdmiDebugPchDetectionLib.c | 67 +++++++++++++++++++ .../HdmiDebugPchDetectionLib.inf | 38 +++++++++++ 6 files changed, 142 insertions(+) create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/Include/Library/Hdm= iDebugPchDetectionLib.h create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/Library/HdmiDebugPc= hDetectionLib/HdmiDebugPchDetectionLib.c create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/Library/HdmiDebugPc= hDetectionLib/HdmiDebugPchDetectionLib.inf diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoar= dPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardP= kg.dsc index 29aa8d9111..5e9ed615cf 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.dsc @@ -184,6 +184,7 @@ GpioExpanderLib|$(PLATFORM_BOARD_PACKAGE)/Library/BaseGpioExpanderLib/Ba= seGpioExpanderLib.inf I2cAccessLib|$(PLATFORM_BOARD_PACKAGE)/Library/PeiI2cAccessLib/PeiI2cAcc= essLib.inf PlatformSecLib|$(PLATFORM_PACKAGE)/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/SecFspWrapperPlatformSecLib.inf + HdmiDebugPchDetectionLib|$(PLATFORM_BOARD_PACKAGE)/Library/HdmiDebugPchD= etectionLib/HdmiDebugPchDetectionLib.inf =20 # Thunderbolt !if gKabylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable =3D=3D TRUE diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.ds= c b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc index 93cf93942b..59d361b472 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc @@ -128,6 +128,7 @@ GpioExpanderLib|$(PLATFORM_BOARD_PACKAGE)/Library/BaseGpioExpanderLib/Ba= seGpioExpanderLib.inf I2cAccessLib|$(PLATFORM_BOARD_PACKAGE)/Library/PeiI2cAccessLib/PeiI2cAcc= essLib.inf PlatformSecLib|$(PLATFORM_PACKAGE)/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/SecFspWrapperPlatformSecLib.inf + HdmiDebugPchDetectionLib|$(PLATFORM_BOARD_PACKAGE)/Library/HdmiDebugPchD= etectionLib/HdmiDebugPchDetectionLib.inf =20 # Thunderbolt !if gKabylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable =3D=3D TRUE diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Include/Library/HdmiDebugP= chDetectionLib.h b/Platform/Intel/KabylakeOpenBoardPkg/Include/Library/Hdmi= DebugPchDetectionLib.h new file mode 100644 index 0000000000..af5e6059f5 --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/Include/Library/HdmiDebugPchDetec= tionLib.h @@ -0,0 +1,34 @@ +/** @file + PCH Detection for the HDMI I2C Debug Port + +Copyright (c) 2022, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef HDMI_DEBUG_PCH_DETECTION_LIB_H_ +#define HDMI_DEBUG_PCH_DETECTION_LIB_H_ + +#include + +typedef enum { + PchTypeUnknown =3D 0, + PchTypeSptLp, + PchTypeSptH, + PchTypeKbpH, + PchTypeCnlLp, + PchTypeCnlH, + PchTypeMax +} PCH_TYPE; + +/** + Returns the type of PCH on the system + + @retval The PCH type. +**/ +PCH_TYPE +GetPchTypeInternal ( + VOID + ); + +#endif diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.= dsc b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc index a46d36b056..3085a80ca2 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc @@ -171,6 +171,7 @@ GpioExpanderLib|$(PLATFORM_BOARD_PACKAGE)/Library/BaseGpioExpanderLib/Ba= seGpioExpanderLib.inf I2cAccessLib|$(PLATFORM_BOARD_PACKAGE)/Library/PeiI2cAccessLib/PeiI2cAcc= essLib.inf PlatformSecLib|$(PLATFORM_PACKAGE)/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/SecFspWrapperPlatformSecLib.inf + HdmiDebugPchDetectionLib|$(PLATFORM_BOARD_PACKAGE)/Library/HdmiDebugPchD= etectionLib/HdmiDebugPchDetectionLib.inf =20 # Thunderbolt !if gKabylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable =3D=3D TRUE diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Library/HdmiDebugPchDetect= ionLib/HdmiDebugPchDetectionLib.c b/Platform/Intel/KabylakeOpenBoardPkg/Lib= rary/HdmiDebugPchDetectionLib/HdmiDebugPchDetectionLib.c new file mode 100644 index 0000000000..596976dd1b --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/Library/HdmiDebugPchDetectionLib/= HdmiDebugPchDetectionLib.c @@ -0,0 +1,67 @@ +/** @file + PCH Detection for the HDMI I2C Debug Port + +Copyright (c) 2022, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include + + +// +// PCH Detection Registers +// +#define PCH_PCI_BUS 0 +#define PCH_LPC_PCI_DEV 31 +#define PCH_LPC_PCI_FUN 0 +#define R_PCH_LPC_DID 0x02 + +#define V_SPT_LP_PCH_START_DEVICE_ID 0x9D40 +#define V_SPT_LP_PCH_END_DEVICE_ID 0x9D5F +#define V_SPT_H_PCH_START_DEVICE_ID 0xA140 +#define V_SPT_H_PCH_END_DEVICE_ID 0xA15F +#define V_KBP_H_PCH_START_DEVICE_ID 0xA2C0 +#define V_KBP_H_PCH_END_DEVICE_ID 0xA2DF +#define V_CNL_LP_PCH_START_DEVICE_ID 0x9D80 +#define V_CNL_LP_PCH_END_DEVICE_ID 0x9D9F +#define V_CNL_H_PCH_START_DEVICE_ID 0xA300 +#define V_CNL_H_PCH_END_DEVICE_ID 0xA31F + +#define V_KBP_H_PCH_DEVICE_ID_ES 0xA2C0 //= /< This is SKL-PCH-H in KBL-PCH-H package +#define V_KBP_H_PCH_DEVICE_ID_SVR_ES 0xA2D0 //= /< This is SKL-PCH-H in KBL-PCH-H package + +/** + Returns the type of PCH on the system + + @retval The PCH type. +**/ +PCH_TYPE +GetPchTypeInternal ( + VOID + ) +{ + PCH_TYPE PchType; + UINT16 DeviceId; + + PchType =3D PchTypeUnknown; + DeviceId =3D PciRead16 (PCI_LIB_ADDRESS (PCH_PCI_BUS, PCH_LPC_PCI_DEV, = PCH_LPC_PCI_FUN, R_PCH_LPC_DID)); + if ((DeviceId >=3D V_SPT_LP_PCH_START_DEVICE_ID) && (DeviceId <=3D V_SPT= _LP_PCH_END_DEVICE_ID)) { + PchType =3D PchTypeSptLp; + } else if ((DeviceId >=3D V_SPT_H_PCH_START_DEVICE_ID) && (DeviceId <=3D= V_SPT_H_PCH_END_DEVICE_ID )) { + PchType =3D PchTypeSptH; + } else if ((DeviceId >=3D V_KBP_H_PCH_START_DEVICE_ID) && (DeviceId <=3D= V_KBP_H_PCH_END_DEVICE_ID)) { + PchType =3D PchTypeKbpH; + if ((DeviceId =3D=3D V_KBP_H_PCH_DEVICE_ID_ES) || (DeviceId =3D=3D V_K= BP_H_PCH_DEVICE_ID_SVR_ES)) { + PchType =3D PchTypeSptH; + } + } else if ((DeviceId >=3D V_CNL_LP_PCH_START_DEVICE_ID) && (DeviceId <= =3D V_CNL_LP_PCH_END_DEVICE_ID)) { + PchType =3D PchTypeCnlLp; + } else if ((DeviceId >=3D V_CNL_H_PCH_START_DEVICE_ID) && (DeviceId <=3D= V_CNL_H_PCH_END_DEVICE_ID)) { + PchType =3D PchTypeCnlH; + } + + return PchType; +} diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Library/HdmiDebugPchDetect= ionLib/HdmiDebugPchDetectionLib.inf b/Platform/Intel/KabylakeOpenBoardPkg/L= ibrary/HdmiDebugPchDetectionLib/HdmiDebugPchDetectionLib.inf new file mode 100644 index 0000000000..897f60fbb9 --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/Library/HdmiDebugPchDetectionLib/= HdmiDebugPchDetectionLib.inf @@ -0,0 +1,38 @@ +### @file +# Component description file for the HDMI I2C Debug Port PCH Detection lib= rary +# +# Copyright (c) 2022, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D BaseHdmiDebugPchDetectionLib + FILE_GUID =3D EA098B52-45DF-4367-A32D-F36ACF91A0A9 + VERSION_STRING =3D 1.0 + MODULE_TYPE =3D BASE + LIBRARY_CLASS =3D HdmiDebugPchDetectionLib +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 +# + +[LibraryClasses] + BaseLib + PciLib + +[Packages] + MdePkg/MdePkg.dec + KabylakeOpenBoardPkg/OpenBoardPkg.dec + +[Sources] + HdmiDebugPchDetectionLib.c + +[Ppis] + +[Guids] + +[Pcd] --=20 2.27.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#93539): https://edk2.groups.io/g/devel/message/93539 Mute This Topic: https://groups.io/mt/93563550/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-