From 91b682c33c7d974f73038171d534f22f258a06af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Thu, 24 Aug 2017 22:48:44 +0300 Subject: soc/amd/stoneyridge: Move oem_fan_control() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While at it, replace LibAmdMemFill() with memset(). Change-Id: I770cab446add8f305f02e365e7c9763df88cd958 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/21192 Reviewed-by: Marshall Dawson Tested-by: build bot (Jenkins) --- src/mainboard/amd/gardenia/BiosCallOuts.c | 23 +++++++++++++++++++++++ src/soc/amd/stoneyridge/imc.c | 23 ----------------------- src/soc/amd/stoneyridge/include/soc/imc.h | 5 ----- 3 files changed, 23 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/mainboard/amd/gardenia/BiosCallOuts.c b/src/mainboard/amd/gardenia/BiosCallOuts.c index 31681cbe27..1d06411790 100644 --- a/src/mainboard/amd/gardenia/BiosCallOuts.c +++ b/src/mainboard/amd/gardenia/BiosCallOuts.c @@ -19,6 +19,29 @@ #include #include #include +#include + +/* Hardware Monitor Fan Control + * Hardware limitation: + * HWM will fail to read the input temperature via I2C if other + * software switches the I2C address. AMD recommends using IMC + * to control fans, instead of HWM. + */ +static void oem_fan_control(FCH_DATA_BLOCK *FchParams) +{ + /* Enable IMC fan control. the recommand way */ + imc_reg_init(); + + FchParams->Imc.ImcEnable = TRUE; + + /* 1 IMC, 0 HWM */ + FchParams->Hwm.HwmControl = 1; + + /* 2 disable IMC, 1 enable IMC, 0 following hw strap setting */ + FchParams->Imc.ImcEnableOverWrite = 1; + + memset(&FchParams->Imc.EcStruct, 0, sizeof(FCH_EC)); +} static AGESA_STATUS fch_initenv(UINT32 Func, UINTN FchData, VOID *ConfigPtr) { diff --git a/src/soc/amd/stoneyridge/imc.c b/src/soc/amd/stoneyridge/imc.c index 7e40a99086..e7c6fac43c 100644 --- a/src/soc/amd/stoneyridge/imc.c +++ b/src/soc/amd/stoneyridge/imc.c @@ -79,26 +79,3 @@ void enable_imc_thermal_zone(void) WriteECmsg(MSG_SYS_TO_IMC, AccessWidth8, &FunNum, &StdHeader); WaitForEcLDN9MailboxCmdAck(&StdHeader); } - -/* Hardware Monitor Fan Control - * Hardware limitation: - * HWM will fail to read the input temperature via I2C if other - * software switches the I2C address. AMD recommends using IMC - * to control fans, instead of HWM. - */ -void oem_fan_control(FCH_DATA_BLOCK *FchParams) -{ - /* Enable IMC fan control. the recommand way */ - imc_reg_init(); - - FchParams->Imc.ImcEnable = TRUE; - - /* 1 IMC, 0 HWM */ - FchParams->Hwm.HwmControl = 1; - - /* 2 disable IMC, 1 enable IMC, 0 following hw strap setting */ - FchParams->Imc.ImcEnableOverWrite = 1; - - LibAmdMemFill(&(FchParams->Imc.EcStruct), 0, sizeof(FCH_EC), - FchParams->StdHeader); -} diff --git a/src/soc/amd/stoneyridge/include/soc/imc.h b/src/soc/amd/stoneyridge/include/soc/imc.h index 3d0e7406c2..a077506ff3 100644 --- a/src/soc/amd/stoneyridge/include/soc/imc.h +++ b/src/soc/amd/stoneyridge/include/soc/imc.h @@ -16,12 +16,7 @@ #ifndef STONEYRIDGE_IMC_H #define STONEYRIDGE_IMC_H -#include -#include -#include - void imc_reg_init(void); void enable_imc_thermal_zone(void); -void oem_fan_control(FCH_DATA_BLOCK *FchParams); #endif -- cgit v1.2.3