soc/amd/stoneyridge: Move oem_fan_control()

While at it, replace LibAmdMemFill() with memset().

Change-Id: I770cab446add8f305f02e365e7c9763df88cd958
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/21192
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Kyösti Mälkki 2017-08-24 22:48:44 +03:00
parent 0ff2e01e80
commit 91b682c33c
3 changed files with 23 additions and 28 deletions

View File

@ -19,6 +19,29 @@
#include <soc/imc.h>
#include <soc/southbridge.h>
#include <stdlib.h>
#include <string.h>
/* 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)
{

View File

@ -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);
}

View File

@ -16,12 +16,7 @@
#ifndef STONEYRIDGE_IMC_H
#define STONEYRIDGE_IMC_H
#include <Porting.h>
#include <AGESA.h>
#include <FchCommonCfg.h>
void imc_reg_init(void);
void enable_imc_thermal_zone(void);
void oem_fan_control(FCH_DATA_BLOCK *FchParams);
#endif