[coreboot-gerrit] New patch to review for coreboot: e1d65c1 superio: ite8772f: Exit extemp busy state

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Fri Mar 20 13:13:51 CET 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8820

-gerrit

commit e1d65c12e5b6f5f52166896f2164b1893787527a
Author: Ryan Lin <ryan.lin at intel.com>
Date:   Mon Sep 22 23:29:16 2014 -0700

    superio: ite8772f: Exit extemp busy state
    
    It causes fan top speed due to this bug + our board-specific workaround,
    and causes invalid temperature sensor readings.
    
    Therefore, re-configure the register "External Temperature Sensor Host
    Control Register" to terminate processes when this issue happens.
    
    BUG=chromium:402204
    TEST=ran suspend_stress_test 500 times
    
    Change-Id: I439d5de798fbe999e4eec5497e6969b7b453121b
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
    Original-Commit-Id: b82f2922c7fce3ca6b2797a8d9775e9db2817fe9
    Original-Change-Id: I6e71b6a46a31b00e541c304f1ed58c1678c1d42e
    Original-Signed-off-by: Ryan Lin <ryan.lin at intel.com>
    Original-Reviewed-on: https://chromium-review.googlesource.com/219445
    Original-Reviewed-by: Shawn Nematbakhsh <shawnn at chromium.org>
---
 src/superio/ite/it8772f/it8772f.h |  1 +
 src/superio/ite/it8772f/superio.c | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/src/superio/ite/it8772f/it8772f.h b/src/superio/ite/it8772f/it8772f.h
index 43e7d4c..d1d898a 100644
--- a/src/superio/ite/it8772f/it8772f.h
+++ b/src/superio/ite/it8772f/it8772f.h
@@ -70,6 +70,7 @@
 #define  IT8772F_FAN_CTL_AUTO_SMOOTHING_DIS	(0 << 7)
 #define  IT8772F_FAN_CTL_AUTO_SMOOTHING_EN	(1 << 7)
 #define IT8772F_EXTEMP_STATUS			0x88
+#define  IT8772F_EXTEMP_STATUS_HOST_BUSY	(1 << 0)
 #define IT8772F_EXTEMP_ADDRESS			0x89
 #define IT8772F_EXTEMP_WRITE_LENGTH		0x8a
 #define IT8772F_EXTEMP_READ_LENGTH		0x8b
diff --git a/src/superio/ite/it8772f/superio.c b/src/superio/ite/it8772f/superio.c
index ca10351..4d83280 100644
--- a/src/superio/ite/it8772f/superio.c
+++ b/src/superio/ite/it8772f/superio.c
@@ -22,6 +22,7 @@
 #include <device/pnp.h>
 #include <pc80/keyboard.h>
 #include <arch/io.h>
+#include <delay.h>
 #include <stdlib.h>
 #include <superio/conf_mode.h>
 
@@ -40,6 +41,34 @@ static inline void it8772f_envc_write(struct resource *res, u8 addr, u8 value)
 	outb(value, res->base + 6);
 }
 
+static void it8772f_extemp_force_idle_status(struct resource *res)
+{
+	u8 reg;
+	int retries = 10;
+
+	/* Wait up to 10ms for non-busy state. */
+	while (retries > 0) {
+		reg = it8772f_envc_read(res, IT8772F_EXTEMP_STATUS);
+
+		if ((reg & IT8772F_EXTEMP_STATUS_HOST_BUSY) == 0x0)
+			break;
+
+		retries--;
+
+		mdelay(1);
+	}
+
+	if (retries == 0 && (reg & IT8772F_EXTEMP_STATUS_HOST_BUSY) == 0x1) {
+		/*
+		 * SIO is busy due to unfinished peci transaction.
+		 * Re-configure Register 0x8E to terminate processes.
+		 */
+		it8772f_envc_write(res, IT8772F_EXTEMP_CONTROL,
+			IT8772F_EXTEMP_CONTROL_AUTO_4HZ |
+			IT8772F_EXTEMP_CONTROL_AUTO_START);
+	}
+}
+
 /*
  * Setup External Temperature to read via PECI into TMPINx register
  */
@@ -142,6 +171,13 @@ static void it8772f_init(struct device *dev)
 			it8772f_enable_fan(res, 2);
 		if (conf->fan3_enable)
 			it8772f_enable_fan(res, 3);
+
+		/*
+		 * System may get wrong temperature data when SIO is in
+		 * busy state. Therefore, check the status and terminate
+		 * processes if needed.
+		 */
+		it8772f_extemp_force_idle_status(res);
 		break;
 	case IT8772F_GPIO:
 		/* Set GPIO output levels */



More information about the coreboot-gerrit mailing list