From e07532fb160e54b9ded934c3964a2cf80f5ae780 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Sat, 10 Apr 2021 14:26:15 -0700 Subject: drivers/intel/fsp2_0: Add support to identify GPIO config changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Traditionally, for each Intel platform using FSP, FSP-S has at some point configured GPIOs differently than the mainboard configuration in coreboot. This has resulted in various side-effects in coreboot, payload and OS because of misconfigured GPIOs. On more recent Intel platforms, a UPD `GpioOverride` is added that coreboot can use to ensure that FSP does not touch any GPIO configuration. This change adds a debug option `CHECK_GPIO_CONFIG_CHANGES` to fsp2_0 driver in coreboot that makes a platform callback `gpio_snapshot` to snapshot GPIO configuration before making a call to FSP SiliconInit and Notify phases. This snapshot is then compared against the GPIO configuration using platform callback `gpio_verify_snapshot` after returning from FSP. The callbacks are not added to romstage (FSP-M) because mainboard configures all pads in ramstage. This debug hook allows developers to dump information about any pads that have a different configuration after call to FSP in ramstage. It is useful to identify missed UPD configurations or bugs in FSP that might not honor the UPDs set by coreboot. This debug hook expects the platform to implement the callbacks `gpio_snapshot` and `gpio_verify_snapshot`. These can be implemented as part of the common GPIO driver for platforms using FSP2.0+. Platforms that implement this support must select the config `HAVE_GPIO_SNAPSHOT_VERIFY_SUPPORT` to make the debug config `CHECK_GPIO_CONFIG_CHANGES` visible to user. Proposal for the GPIO snapshot/verify support was discussed in the RFC CB:50829. Signed-off-by: Furquan Shaikh Change-Id: I5326fc98b6eba0f8ba946842253b288c0d42c523 Reviewed-on: https://review.coreboot.org/c/coreboot/+/50989 Reviewed-by: Michael Niewöhner Tested-by: build bot (Jenkins) --- src/drivers/intel/fsp2_0/Kconfig.debug_blob | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/drivers/intel/fsp2_0/Kconfig.debug_blob') diff --git a/src/drivers/intel/fsp2_0/Kconfig.debug_blob b/src/drivers/intel/fsp2_0/Kconfig.debug_blob index 14f502c4d6..e9e6053c64 100644 --- a/src/drivers/intel/fsp2_0/Kconfig.debug_blob +++ b/src/drivers/intel/fsp2_0/Kconfig.debug_blob @@ -45,4 +45,21 @@ config DISPLAY_FSP_VERSION_INFO_2 Select this option to display Firmware version information using new header 'FirmwareVersionInfo.h'. +config HAVE_GPIO_SNAPSHOT_VERIFY_SUPPORT + bool + default n + help + Select this option if platform provides support for GPIO + config snapshot and verify callbacks: `gpio_snapshot()` + and `gpio_verify_snapshot()` + +config CHECK_GPIO_CONFIG_CHANGES + bool "Check GPIO config changes across calls to FSP-S" + depends on HAVE_GPIO_SNAPSHOT_VERIFY_SUPPORT + help + Select this option to identify if any GPIOs are re-configured + by FSP-S differently than the mainboard configuration. This + requires platform support to snapshot and verify that config + matches snapshot. + endif # PLATFORM_USES_FSP2_0 -- cgit v1.2.3