From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=PLFmaWjZ; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: nathaniel.l.desimone@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662685632; x=1694221632; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C9eGs4lgwx9gVfZ5Bqt3vRF4817n6FOpOD06lKPYhu0=; b=PLFmaWjZmWsWjCT6OZh8rXFKl+vPhkNJdQrVkP8mV4aX64jI/f+LFf9g c6m8HapQOsmiQPNdXh1PyLtH3ijydwraQAPnouTH3go3ubLfTP8IycDKE eAZxmKBE43/Tarc0hurnslx/TUEXFLf4JeEk3xny5MnB0eMYKlPg/ArFS p/RXMeOyI6HfYX01t4yTAvPUFWpZXz1Al63WdYU2LH6990bjiN3RK6Koa qnd05NOwZ9c1mKiAiX7dULKIYm1+j7OyASJjn8zej4V6jNqCY4IiyUPu8 9lDEPJLwY2EJ6JjkWFZ05atJFcAKZtoO37f32cEc18cw7PLl5VHRJI1Th Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10464"; a="323568623" X-IronPort-AV: E=Sophos;i="5.93,300,1654585200"; d="scan'208";a="323568623" 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:12 -0700 X-IronPort-AV: E=Sophos;i="5.93,300,1654585200"; d="scan'208";a="676950469" 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:12 -0700 From: "Nate DeSimone" To: devel@edk2.groups.io Cc: Chasel Chiu , Sai Chaganty , Isaac Oram , Benjamin Doron , Michael Kubacki , Jeremy Soller Subject: [edk2-platforms] [PATCH V3 3/6] KabylakeOpenBoardPkg: Add HdmiDebugGpioInitLib Date: Thu, 8 Sep 2022 18:07:01 -0700 Message-Id: <20220909010704.7186-4-nathaniel.l.desimone@intel.com> X-Mailer: git-send-email 2.27.0.windows.1 In-Reply-To: <20220909010704.7186-1-nathaniel.l.desimone@intel.com> References: <20220909010704.7186-1-nathaniel.l.desimone@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This library initializes any GPIOs necessary for the HDMI DDC bus to operate. This can be called very early (SEC phase) to enable closed chassis debug through 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 | 3 +- .../GalagoPro3/OpenBoardPkg.dsc | 3 +- .../Include/Library/HdmiDebugGpioInitLib.h | 26 +++ .../KabylakeRvp3/OpenBoardPkg.dsc | 3 +- .../HdmiDebugGpioInitLib.c | 163 ++++++++++++++++++ .../HdmiDebugGpioInitLib.inf | 43 +++++ 6 files changed, 238 insertions(+), 3 deletions(-) create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/Include/Library/HdmiDebugGpioInitLib.h create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/Library/HdmiDebugGpioInitLib/HdmiDebugGpioInitLib.c create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/Library/HdmiDebugGpioInitLib/HdmiDebugGpioInitLib.inf diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.dsc index 5e9ed615cf..0edc315b59 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.dsc @@ -1,7 +1,7 @@ ## @file # The main build description file for the Aspire VN7-572G board. # -# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2022, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -184,6 +184,7 @@ GpioExpanderLib|$(PLATFORM_BOARD_PACKAGE)/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.inf I2cAccessLib|$(PLATFORM_BOARD_PACKAGE)/Library/PeiI2cAccessLib/PeiI2cAccessLib.inf PlatformSecLib|$(PLATFORM_PACKAGE)/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecFspWrapperPlatformSecLib.inf + HdmiDebugGpioInitLib|$(PLATFORM_BOARD_PACKAGE)/Library/HdmiDebugGpioInitLib/HdmiDebugGpioInitLib.inf HdmiDebugPchDetectionLib|$(PLATFORM_BOARD_PACKAGE)/Library/HdmiDebugPchDetectionLib/HdmiDebugPchDetectionLib.inf # Thunderbolt diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc index 59d361b472..a34c21496b 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc @@ -1,7 +1,7 @@ ## @file # The main build description file for the GalagoPro3 board. # -# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -128,6 +128,7 @@ GpioExpanderLib|$(PLATFORM_BOARD_PACKAGE)/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.inf I2cAccessLib|$(PLATFORM_BOARD_PACKAGE)/Library/PeiI2cAccessLib/PeiI2cAccessLib.inf PlatformSecLib|$(PLATFORM_PACKAGE)/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecFspWrapperPlatformSecLib.inf + HdmiDebugGpioInitLib|$(PLATFORM_BOARD_PACKAGE)/Library/HdmiDebugGpioInitLib/HdmiDebugGpioInitLib.inf HdmiDebugPchDetectionLib|$(PLATFORM_BOARD_PACKAGE)/Library/HdmiDebugPchDetectionLib/HdmiDebugPchDetectionLib.inf # Thunderbolt diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Include/Library/HdmiDebugGpioInitLib.h b/Platform/Intel/KabylakeOpenBoardPkg/Include/Library/HdmiDebugGpioInitLib.h new file mode 100644 index 0000000000..33bdeb74fc --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/Include/Library/HdmiDebugGpioInitLib.h @@ -0,0 +1,26 @@ +/** @file + GPIO initialization for the HDMI I2C Debug Port + +Copyright (c) 2022, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef HDMI_DEBUG_GPIO_INIT_LIB_H_ +#define HDMI_DEBUG_GPIO_INIT_LIB_H_ + +#include + +/** + Configures GPIOs to enable usage of the HDMI DDC I2C Bus + + @retval EFI_SUCCESS The function completed successfully + @retval EFI_UNSUPPORTED The platform is using a PCH that is not supported yet. + +**/ +EFI_STATUS +HdmiDebugGpioInit ( + VOID + ); + +#endif diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc index 3085a80ca2..faaafde84f 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc @@ -1,7 +1,7 @@ ## @file # The main build description file for the KabylakeRvp3 board. # -# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2022, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -171,6 +171,7 @@ GpioExpanderLib|$(PLATFORM_BOARD_PACKAGE)/Library/BaseGpioExpanderLib/BaseGpioExpanderLib.inf I2cAccessLib|$(PLATFORM_BOARD_PACKAGE)/Library/PeiI2cAccessLib/PeiI2cAccessLib.inf PlatformSecLib|$(PLATFORM_PACKAGE)/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecFspWrapperPlatformSecLib.inf + HdmiDebugGpioInitLib|$(PLATFORM_BOARD_PACKAGE)/Library/HdmiDebugGpioInitLib/HdmiDebugGpioInitLib.inf HdmiDebugPchDetectionLib|$(PLATFORM_BOARD_PACKAGE)/Library/HdmiDebugPchDetectionLib/HdmiDebugPchDetectionLib.inf # Thunderbolt diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Library/HdmiDebugGpioInitLib/HdmiDebugGpioInitLib.c b/Platform/Intel/KabylakeOpenBoardPkg/Library/HdmiDebugGpioInitLib/HdmiDebugGpioInitLib.c new file mode 100644 index 0000000000..b82ac41df7 --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/Library/HdmiDebugGpioInitLib/HdmiDebugGpioInitLib.c @@ -0,0 +1,163 @@ +/** @file + GPIO initialization for the HDMI I2C Debug Port + +Copyright (c) 2022, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include + +#include +#include +#include +#include + +//GPIO Table Terminator +#define END_OF_GPIO_TABLE 0xFFFFFFFF + +typedef enum { + EnumDdcUnknown = 0, + EnumDdcA, + EnumDdcB, + EnumDdcC, + EnumDdcD, + EnumDdcE, + EnumDdcF, + EnumI2cChannelMax +} IGFX_I2C_CHANNEL; + +/*** SKL-LP ***/ + +// HDMI-B DDC GPIO Pins +GPIO_INIT_CONFIG mDebugGpioTableSklLpDdpB[] = +{ + {GPIO_SKL_LP_GPP_E18, {GpioPadModeNative1, GpioHostOwnDefault, GpioDirNone, GpioOutDefault, GpioIntDis, GpioHostDeepReset, GpioTermNone}}, //DDPB_CTRLCLK + {GPIO_SKL_LP_GPP_E19, {GpioPadModeNative1, GpioHostOwnDefault, GpioDirNone, GpioOutDefault, GpioIntDis, GpioHostDeepReset, GpioTermNone}}, //DDPB_CTRLDATA + {END_OF_GPIO_TABLE, {GpioPadModeGpio, GpioHostOwnGpio, GpioDirNone, GpioOutDefault, GpioIntDis, GpioDswReset, GpioTermNone}},//Marking End of Table +}; +UINT16 mDebugGpioTableSklLpDdpBSize = sizeof (mDebugGpioTableSklLpDdpB) / sizeof (GPIO_INIT_CONFIG) - 1; + +// HDMI-C DDC GPIO Pins +GPIO_INIT_CONFIG mDebugGpioTableSklLpDdpC[] = +{ + {GPIO_SKL_LP_GPP_E20, {GpioPadModeNative1, GpioHostOwnDefault, GpioDirNone, GpioOutDefault, GpioIntDis, GpioHostDeepReset, GpioTermNone}}, //DDPC_CTRLCLK + {GPIO_SKL_LP_GPP_E21, {GpioPadModeNative1, GpioHostOwnDefault, GpioDirNone, GpioOutDefault, GpioIntDis, GpioHostDeepReset, GpioTermNone}}, //DDPC_CTRLDATA + {END_OF_GPIO_TABLE, {GpioPadModeGpio, GpioHostOwnGpio, GpioDirNone, GpioOutDefault, GpioIntDis, GpioDswReset, GpioTermNone}},//Marking End of Table +}; +UINT16 mDebugGpioTableSklLpDdpCSize = sizeof (mDebugGpioTableSklLpDdpC) / sizeof (GPIO_INIT_CONFIG) - 1; + +// HDMI-D DDC GPIO Pins +GPIO_INIT_CONFIG mDebugGpioTableSklLpDdpD[] = +{ + {GPIO_SKL_LP_GPP_E22, {GpioPadModeNative1, GpioHostOwnDefault, GpioDirNone, GpioOutDefault, GpioIntDis, GpioHostDeepReset, GpioTermNone}}, //DDPD_CTRLCLK + {GPIO_SKL_LP_GPP_E23, {GpioPadModeNative1, GpioHostOwnDefault, GpioDirNone, GpioOutDefault, GpioIntDis, GpioHostDeepReset, GpioTermNone}}, //DDPD_CTRLDATA + {END_OF_GPIO_TABLE, {GpioPadModeGpio, GpioHostOwnGpio, GpioDirNone, GpioOutDefault, GpioIntDis, GpioDswReset, GpioTermNone}},//Marking End of Table +}; +UINT16 mDebugGpioTableSklLpDdpDSize = sizeof (mDebugGpioTableSklLpDdpD) / sizeof (GPIO_INIT_CONFIG) - 1; + +/*** SKL-H ***/ + +// HDMI-B DDC GPIO Pins +GPIO_INIT_CONFIG mDebugGpioTableSklHDdpB[] = +{ + {GPIO_SKL_H_GPP_I5, {GpioPadModeNative1, GpioHostOwnDefault, GpioDirNone, GpioOutDefault, GpioIntDis, GpioHostDeepReset, GpioTermNone}}, //DDPB_CTRLCLK + {GPIO_SKL_H_GPP_I6, {GpioPadModeNative1, GpioHostOwnDefault, GpioDirNone, GpioOutDefault, GpioIntDis, GpioHostDeepReset, GpioTermNone}}, //DDPB_CTRLDATA + {END_OF_GPIO_TABLE, {GpioPadModeGpio, GpioHostOwnGpio, GpioDirNone, GpioOutDefault, GpioIntDis, GpioDswReset, GpioTermNone}},//Marking End of Table +}; +UINT16 mDebugGpioTableSklHDdpBSize = sizeof (mDebugGpioTableSklHDdpB) / sizeof (GPIO_INIT_CONFIG) - 1; + +// HDMI-C DDC GPIO Pins +GPIO_INIT_CONFIG mDebugGpioTableSklHDdpC[] = +{ + {GPIO_SKL_H_GPP_I7, {GpioPadModeNative1, GpioHostOwnDefault, GpioDirNone, GpioOutDefault, GpioIntDis, GpioHostDeepReset, GpioTermNone}}, //DDPC_CTRLCLK + {GPIO_SKL_H_GPP_I8, {GpioPadModeNative1, GpioHostOwnDefault, GpioDirNone, GpioOutDefault, GpioIntDis, GpioHostDeepReset, GpioTermNone}}, //DDPC_CTRLDATA + {END_OF_GPIO_TABLE, {GpioPadModeGpio, GpioHostOwnGpio, GpioDirNone, GpioOutDefault, GpioIntDis, GpioDswReset, GpioTermNone}},//Marking End of Table +}; +UINT16 mDebugGpioTableSklHDdpCSize = sizeof (mDebugGpioTableSklHDdpC) / sizeof (GPIO_INIT_CONFIG) - 1; + +// HDMI-D DDC GPIO Pins +GPIO_INIT_CONFIG mDebugGpioTableSklHDdpD[] = +{ + {GPIO_SKL_H_GPP_I9, {GpioPadModeNative1, GpioHostOwnDefault, GpioDirNone, GpioOutDefault, GpioIntDis, GpioHostDeepReset, GpioTermNone}}, //DDPD_CTRLCLK + {GPIO_SKL_H_GPP_I10, {GpioPadModeNative1, GpioHostOwnDefault, GpioDirNone, GpioOutDefault, GpioIntDis, GpioHostDeepReset, GpioTermNone}}, //DDPD_CTRLDATA + {END_OF_GPIO_TABLE, {GpioPadModeGpio, GpioHostOwnGpio, GpioDirNone, GpioOutDefault, GpioIntDis, GpioDswReset, GpioTermNone}},//Marking End of Table +}; +UINT16 mDebugGpioTableSklHDdpDSize = sizeof (mDebugGpioTableSklHDdpD) / sizeof (GPIO_INIT_CONFIG) - 1; + +/** + Configures GPIO + + @param[in] GpioTable Point to Platform Gpio table + @param[in] GpioTableCount Number of Gpio table entries + +**/ +VOID +HdmiDebugConfigureGpio ( + IN GPIO_INIT_CONFIG *GpioDefinition, + IN UINT16 GpioTableCount + ) +{ + EFI_STATUS Status; + + Status = GpioConfigurePads (GpioTableCount, GpioDefinition); + +} + +/** + Configures GPIOs to enable usage of the HDMI DDC I2C Bus + + @retval EFI_SUCCESS The function completed successfully + @retval EFI_UNSUPPORTED The platform is using a PCH that is not supported yet. + +**/ +EFI_STATUS +HdmiDebugGpioInit ( + VOID + ) +{ + IGFX_I2C_CHANNEL Channel; + PCH_TYPE PchType; + + PchType = GetPchTypeInternal (); + Channel = (IGFX_I2C_CHANNEL) PcdGet32 (PcdI2cHdmiDebugPortDdcI2cChannel); + switch (PchType) { + case PchTypeSptLp: + switch (Channel) { + case EnumDdcB: + HdmiDebugConfigureGpio (mDebugGpioTableSklLpDdpB, mDebugGpioTableSklLpDdpBSize); + return EFI_SUCCESS; + case EnumDdcC: + HdmiDebugConfigureGpio (mDebugGpioTableSklLpDdpC, mDebugGpioTableSklLpDdpCSize); + return EFI_SUCCESS; + case EnumDdcD: + HdmiDebugConfigureGpio (mDebugGpioTableSklLpDdpD, mDebugGpioTableSklLpDdpDSize); + return EFI_SUCCESS; + + default: + return EFI_UNSUPPORTED; + } + break; + case PchTypeSptH: + case PchTypeKbpH: + switch (Channel) { + case EnumDdcB: + HdmiDebugConfigureGpio (mDebugGpioTableSklHDdpB, mDebugGpioTableSklHDdpBSize); + return EFI_SUCCESS; + case EnumDdcC: + HdmiDebugConfigureGpio (mDebugGpioTableSklHDdpC, mDebugGpioTableSklHDdpCSize); + return EFI_SUCCESS; + case EnumDdcD: + HdmiDebugConfigureGpio (mDebugGpioTableSklHDdpD, mDebugGpioTableSklHDdpDSize); + return EFI_SUCCESS; + + default: + return EFI_UNSUPPORTED; + } + break; + default: + return EFI_UNSUPPORTED; + } +} diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Library/HdmiDebugGpioInitLib/HdmiDebugGpioInitLib.inf b/Platform/Intel/KabylakeOpenBoardPkg/Library/HdmiDebugGpioInitLib/HdmiDebugGpioInitLib.inf new file mode 100644 index 0000000000..de921a5208 --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/Library/HdmiDebugGpioInitLib/HdmiDebugGpioInitLib.inf @@ -0,0 +1,43 @@ +### @file +# Component description file for the HDMI I2C Debug Port GPIO initialization library +# +# Copyright (c) 2022, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = BaseHdmiDebugGpioInitLib + FILE_GUID = 4CC9D17A-B6D4-4FE2-AB82-27D539A8D8A9 + VERSION_STRING = 1.0 + MODULE_TYPE = BASE + LIBRARY_CLASS = HdmiDebugGpioInitLib +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[LibraryClasses] + BaseLib + PcdLib + PciLib + GpioLib + HdmiDebugPchDetectionLib + +[Packages] + MdePkg/MdePkg.dec + KabylakeOpenBoardPkg/OpenBoardPkg.dec + KabylakeSiliconPkg/SiPkg.dec + +[Sources] + HdmiDebugGpioInitLib.c + +[Ppis] + +[Guids] + +[Pcd] + gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortDdcI2cChannel ## CONSUMES -- 2.27.0.windows.1