From b5d998b9e0988bcd22512b026972373511097974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Sun, 20 Aug 2017 21:36:08 +0300 Subject: sb/intel/common: Add HAVE_DEBUG_SMBUS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ifb1a1eff71968f31af9004ff00717f202d3ec29e Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/21117 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- src/southbridge/intel/common/Kconfig | 4 ++++ src/southbridge/intel/common/smbus.c | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'src/southbridge') diff --git a/src/southbridge/intel/common/Kconfig b/src/southbridge/intel/common/Kconfig index 669569e18c..304ecbfba3 100644 --- a/src/southbridge/intel/common/Kconfig +++ b/src/southbridge/intel/common/Kconfig @@ -1,9 +1,13 @@ config SOUTHBRIDGE_INTEL_COMMON def_bool n + config SOUTHBRIDGE_INTEL_COMMON_GPIO def_bool n + config SOUTHBRIDGE_INTEL_COMMON_SMBUS def_bool n + select HAVE_DEBUG_SMBUS + config HAVE_INTEL_CHIPSET_LOCKDOWN def_bool n diff --git a/src/southbridge/intel/common/smbus.c b/src/southbridge/intel/common/smbus.c index 90ef03ee12..2067baa8b2 100644 --- a/src/southbridge/intel/common/smbus.c +++ b/src/southbridge/intel/common/smbus.c @@ -16,11 +16,18 @@ */ #include +#include #include #include #include "smbus.h" +#if IS_ENABLED(CONFIG_DEBUG_SMBUS) +#define dprintk(args...) printk(BIOS_DEBUG, ##args) +#else +#define dprintk(args...) do {} while (0) +#endif + /* I801 command constants */ #define I801_QUICK (0 << 2) #define I801_BYTE (1 << 2) @@ -256,6 +263,9 @@ int do_smbus_block_read(unsigned int smbus_base, u8 device, u8 cmd, } } while ((status & SMBHSTSTS_HOST_BUSY) && loops); + dprintk("%s: status = %02x, len = %d / %d, loops = %d\n", + __func__, status, bytes_read, slave_bytes, loops); + /* Post-check we received complete message. */ slave_bytes = inb(smbus_base + SMBHSTDAT0); if (bytes_read < slave_bytes) @@ -329,6 +339,9 @@ int do_smbus_block_write(unsigned int smbus_base, u8 device, u8 cmd, } } while ((status & SMBHSTSTS_HOST_BUSY) && loops); + dprintk("%s: status = %02x, len = %d / %d, loops = %d\n", + __func__, status, bytes_sent, bytes, loops); + if (bytes_sent < bytes) return SMBUS_ERROR; @@ -396,6 +409,9 @@ int do_i2c_block_read(unsigned int smbus_base, u8 device, } } while ((status & SMBHSTSTS_HOST_BUSY) && loops); + dprintk("%s: status = %02x, len = %d / %d, loops = %d\n", + __func__, status, bytes_read, bytes, loops); + if (bytes_read < bytes) return SMBUS_ERROR; -- cgit v1.2.3