[coreboot-gerrit] New patch to review for coreboot: 14fbc60 AMD hudson: add imc fan control
WANG Siyuan (wangsiyuanbuaa@gmail.com)
gerrit at coreboot.org
Mon Oct 28 04:39:41 CET 2013
WANG Siyuan (wangsiyuanbuaa at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4003
-gerrit
commit 14fbc60efc4040232bf214c62beaf1f68063ab0a
Author: WANG Siyuan <wangsiyuanbuaa at gmail.com>
Date: Mon Oct 28 10:49:28 2013 +0800
AMD hudson: add imc fan control
Use 3 imc functions to control fan:
function 0x81: set imc thermal zone information
function 0x83: set imc fan policy temperature thresholds
function 0x85: set imc fan policy PWM settings
Change-Id: I613fd195afffc5e26d59c61b33cdf834b8dbbfbb
Signed-off-by: WANG Siyuan <SiYuan.Wang at amd.com>
Signed-off-by: WANG Siyuan <wangsiyuanbuaa at gmail.com>
---
src/southbridge/amd/agesa/hudson/Makefile.inc | 1 +
src/southbridge/amd/agesa/hudson/imc_fan_control.c | 85 ++++++++++++++++++++++
src/southbridge/amd/agesa/hudson/imc_fan_control.h | 14 ++++
3 files changed, 100 insertions(+)
diff --git a/src/southbridge/amd/agesa/hudson/Makefile.inc b/src/southbridge/amd/agesa/hudson/Makefile.inc
index d50d09e..02bff34 100644
--- a/src/southbridge/amd/agesa/hudson/Makefile.inc
+++ b/src/southbridge/amd/agesa/hudson/Makefile.inc
@@ -9,6 +9,7 @@ ramstage-y += hda.c
ramstage-y += pci.c
ramstage-y += pcie.c
ramstage-y += sd.c
+ramstage-y += imc_fan_control.c
ramstage-$(CONFIG_GENERATE_ACPI_TABLES) += fadt.c
ramstage-y += reset.c
diff --git a/src/southbridge/amd/agesa/hudson/imc_fan_control.c b/src/southbridge/amd/agesa/hudson/imc_fan_control.c
new file mode 100644
index 0000000..61f5d26
--- /dev/null
+++ b/src/southbridge/amd/agesa/hudson/imc_fan_control.c
@@ -0,0 +1,85 @@
+#include "imc_fan_control.h"
+#include <delay.h>
+
+void imc_fan_control(void)
+{
+ u8 val;
+ val = read8(ACPI_MMIO_BASE + PMIO2_BASE + 0x01);
+ val |= BIT2;
+ write8(ACPI_MMIO_BASE + PMIO2_BASE + 0x01, val);
+ write8(ACPI_MMIO_BASE + PMIO2_BASE + 0x02, 0xf7);
+ write8(ACPI_MMIO_BASE + PMIO2_BASE + 0x03, 0xff);
+ write8(ACPI_MMIO_BASE + PMIO2_BASE + 0x04, 0xff);
+
+ val = read8(ACPI_MMIO_BASE + PMIO2_BASE + 0x11);
+ val |= BIT2;
+ write8(ACPI_MMIO_BASE + PMIO2_BASE + 0x11, val);
+ write8(ACPI_MMIO_BASE + PMIO2_BASE + 0x12, 0xf7);
+ write8(ACPI_MMIO_BASE + PMIO2_BASE + 0x13, 0xff);
+ write8(ACPI_MMIO_BASE + PMIO2_BASE + 0x14, 0xff);
+
+ imc_func_0x83();
+ imc_func_0x85();
+ imc_func_0x81();
+}
+
+void write_imc_msg(u8 idx, u8 val)
+{
+ outb(idx, 0x3e);
+ outb(val, 0x3f);
+}
+
+void imc_func_0x81(void)
+{
+ write_imc_msg(MSG_REG0, 0);
+ write_imc_msg(MSG_REG1, 0);
+ write_imc_msg(MSG_REG2, 0x3d);
+ write_imc_msg(MSG_REG3, 0xe);
+ write_imc_msg(MSG_REG4, 0);
+ write_imc_msg(MSG_REG5, 0x54);
+ write_imc_msg(MSG_REG6, 0x98);
+ write_imc_msg(MSG_REG7, 0x2);
+ write_imc_msg(MSG_REG8, 0x1);
+ write_imc_msg(MSG_REG9, 0);
+ write_imc_msg(MSG_SYS_TO_IMC, Fun_81);
+ mdelay(50);
+}
+
+void imc_func_0x83(void)
+{
+ write_imc_msg(MSG_REG0, 0);
+ write_imc_msg(MSG_REG1, 0);
+ write_imc_msg(MSG_REG2, 0x69);
+ write_imc_msg(MSG_REG3, 0x3c);
+ write_imc_msg(MSG_REG4, 0xff);
+ write_imc_msg(MSG_REG5, 0xff);
+ write_imc_msg(MSG_REG6, 0xff);
+ write_imc_msg(MSG_REG7, 0xff);
+ write_imc_msg(MSG_REG8, 0xff);
+ write_imc_msg(MSG_REG9, 0xff);
+ write_imc_msg(MSG_REGA, 0x69);
+ write_imc_msg(MSG_REGB, 0);
+ write_imc_msg(MSG_SYS_TO_IMC, Fun_83);
+ mdelay(50);
+}
+
+void imc_func_0x85(void)
+{
+ write_imc_msg(MSG_REG0, 0);
+ write_imc_msg(MSG_REG1, 0);
+ write_imc_msg(MSG_REG2, 0x64);
+ write_imc_msg(MSG_REG3, 0xff);
+ write_imc_msg(MSG_REG4, 0xff);
+ write_imc_msg(MSG_REG5, 0xff);
+ write_imc_msg(MSG_REG6, 0xff);
+ write_imc_msg(MSG_REG7, 0xff);
+ write_imc_msg(MSG_REG8, 0xff);
+ write_imc_msg(MSG_REG9, 0xff);
+ write_imc_msg(MSG_SYS_TO_IMC, Fun_85);
+ mdelay(50);
+}
+
+void imc_func_0x89(void)
+{
+ /* not use */
+}
diff --git a/src/southbridge/amd/agesa/hudson/imc_fan_control.h b/src/southbridge/amd/agesa/hudson/imc_fan_control.h
new file mode 100644
index 0000000..c7a134b
--- /dev/null
+++ b/src/southbridge/amd/agesa/hudson/imc_fan_control.h
@@ -0,0 +1,14 @@
+#ifndef _IMC_FAN_CONTROL_H_
+#define _IMC_FAN_CONTROL_H_
+
+#include <arch/io.h>
+#include "FchPlatform.h"
+
+void imc_fan_control(void);
+void write_imc_msg(u8 idx, u8 val);
+void imc_func_0x81(void);
+void imc_func_0x83(void);
+void imc_func_0x85(void);
+void imc_func_0x89(void);
+
+#endif
More information about the coreboot-gerrit
mailing list