binarypi mainboards: Clean up IS_ENABLED fan control
Remove all checks for #if IS_ENABLED(CONFIG_HUDSON_IMC_FWM) around the imc.h includes. Convert from #if to if() for all fan control setup code. Where necessary, make functions non-static to match the prototypes in imc.h. Change-Id: If88af42d00227285931829441909a982fc292b2b Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com> Reviewed-on: https://review.coreboot.org/21058 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
This commit is contained in:
parent
6dd620bf10
commit
23e5ba9a73
|
@ -23,9 +23,7 @@
|
||||||
#include "heapManager.h"
|
#include "heapManager.h"
|
||||||
#include "FchPlatform.h"
|
#include "FchPlatform.h"
|
||||||
#include "cbfs.h"
|
#include "cbfs.h"
|
||||||
#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
|
|
||||||
#include "imc.h"
|
#include "imc.h"
|
||||||
#endif
|
|
||||||
#include "hudson.h"
|
#include "hudson.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "northbridge/amd/pi/dimmSpd.h"
|
#include "northbridge/amd/pi/dimmSpd.h"
|
||||||
|
@ -74,9 +72,8 @@ AGESA_STATUS Fch_Oem_config(UINT32 Func, UINTN FchData, VOID *ConfigPtr)
|
||||||
} else if (StdHeader->Func == AMD_INIT_ENV) {
|
} else if (StdHeader->Func == AMD_INIT_ENV) {
|
||||||
FCH_DATA_BLOCK *FchParams_env = (FCH_DATA_BLOCK *)FchData;
|
FCH_DATA_BLOCK *FchParams_env = (FCH_DATA_BLOCK *)FchData;
|
||||||
printk(BIOS_DEBUG, "Fch OEM config in INIT ENV ");
|
printk(BIOS_DEBUG, "Fch OEM config in INIT ENV ");
|
||||||
#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
|
if (IS_ENABLED(CONFIG_HUDSON_IMC_FWM))
|
||||||
oem_fan_control(FchParams_env);
|
oem_fan_control(FchParams_env);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* XHCI configuration */
|
/* XHCI configuration */
|
||||||
if (IS_ENABLED(CONFIG_HUDSON_XHCI_ENABLE))
|
if (IS_ENABLED(CONFIG_HUDSON_XHCI_ENABLE))
|
||||||
|
|
|
@ -22,9 +22,7 @@
|
||||||
#include "heapManager.h"
|
#include "heapManager.h"
|
||||||
#include "FchPlatform.h"
|
#include "FchPlatform.h"
|
||||||
#include "cbfs.h"
|
#include "cbfs.h"
|
||||||
#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
|
|
||||||
#include "imc.h"
|
#include "imc.h"
|
||||||
#endif
|
|
||||||
#include "hudson.h"
|
#include "hudson.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -125,7 +123,7 @@ static const CODEC_TBL_LIST CodecTableList[] =
|
||||||
* software switches the I2C address. AMD recommends using IMC
|
* software switches the I2C address. AMD recommends using IMC
|
||||||
* to control fans, instead of HWM.
|
* to control fans, instead of HWM.
|
||||||
*/
|
*/
|
||||||
static void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
||||||
{
|
{
|
||||||
FCH_HWM_FAN_CTR oem_factl[5] = {
|
FCH_HWM_FAN_CTR oem_factl[5] = {
|
||||||
/*temperature input, fan mode, frequency, low_duty, med_duty, multiplier, lowtemp, medtemp, hightemp, LinearRange, LinearHoldCount */
|
/*temperature input, fan mode, frequency, low_duty, med_duty, multiplier, lowtemp, medtemp, hightemp, LinearRange, LinearHoldCount */
|
||||||
|
@ -140,8 +138,7 @@ static void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
||||||
LibAmdMemCopy ((VOID *)(FchParams->Hwm.HwmFanControl), &oem_factl, (sizeof (FCH_HWM_FAN_CTR) * 5), FchParams->StdHeader);
|
LibAmdMemCopy ((VOID *)(FchParams->Hwm.HwmFanControl), &oem_factl, (sizeof (FCH_HWM_FAN_CTR) * 5), FchParams->StdHeader);
|
||||||
|
|
||||||
/* Enable IMC fan control. the recommended way */
|
/* Enable IMC fan control. the recommended way */
|
||||||
#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
|
if (IS_ENABLED(CONFIG_HUDSON_IMC_FWM)) {
|
||||||
|
|
||||||
/* HwMonitorEnable = TRUE && HwmFchtsiAutoOpll ==FALSE to call FchECfancontrolservice */
|
/* HwMonitorEnable = TRUE && HwmFchtsiAutoOpll ==FALSE to call FchECfancontrolservice */
|
||||||
FchParams->Hwm.HwMonitorEnable = TRUE;
|
FchParams->Hwm.HwMonitorEnable = TRUE;
|
||||||
FchParams->Hwm.HwmFchtsiAutoPoll = FALSE; /* 0 disable, 1 enable TSI Auto Polling */
|
FchParams->Hwm.HwmFchtsiAutoPoll = FALSE; /* 0 disable, 1 enable TSI Auto Polling */
|
||||||
|
@ -255,13 +252,12 @@ static void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
||||||
* AGESA put EcDefaultMessage as global data in ROM, so we can't override it.
|
* AGESA put EcDefaultMessage as global data in ROM, so we can't override it.
|
||||||
* so we remove it from AGESA code. Please See FchInitLateHwm.
|
* so we remove it from AGESA code. Please See FchInitLateHwm.
|
||||||
*/
|
*/
|
||||||
|
} else {
|
||||||
#else /* HWM fan control, using the alternative method */
|
/* HWM fan control, using the alternative method */
|
||||||
FchParams->Imc.ImcEnable = FALSE;
|
FchParams->Imc.ImcEnable = FALSE;
|
||||||
FchParams->Hwm.HwMonitorEnable = TRUE;
|
FchParams->Hwm.HwMonitorEnable = TRUE;
|
||||||
FchParams->Hwm.HwmFchtsiAutoPoll = TRUE; /* 1 enable, 0 disable TSI Auto Polling */
|
FchParams->Hwm.HwmFchtsiAutoPoll = TRUE; /* 1 enable, 0 disable TSI Auto Polling */
|
||||||
|
}
|
||||||
#endif /* CONFIG_HUDSON_IMC_FWM */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,9 +20,7 @@
|
||||||
#include "heapManager.h"
|
#include "heapManager.h"
|
||||||
#include "FchPlatform.h"
|
#include "FchPlatform.h"
|
||||||
#include "cbfs.h"
|
#include "cbfs.h"
|
||||||
#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
|
|
||||||
#include "imc.h"
|
#include "imc.h"
|
||||||
#endif
|
|
||||||
#include "hudson.h"
|
#include "hudson.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <device/azalia.h>
|
#include <device/azalia.h>
|
||||||
|
@ -140,7 +138,7 @@ static const CODEC_TBL_LIST CodecTableList[] =
|
||||||
* software switches the I2C address. AMD recommends using IMC
|
* software switches the I2C address. AMD recommends using IMC
|
||||||
* to control fans, instead of HWM.
|
* to control fans, instead of HWM.
|
||||||
*/
|
*/
|
||||||
static void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
||||||
{
|
{
|
||||||
FCH_HWM_FAN_CTR oem_factl[5] = {
|
FCH_HWM_FAN_CTR oem_factl[5] = {
|
||||||
/*temperature input, fan mode, frequency, low_duty, med_duty, multiplier, lowtemp, medtemp, hightemp, LinearRange, LinearHoldCount */
|
/*temperature input, fan mode, frequency, low_duty, med_duty, multiplier, lowtemp, medtemp, hightemp, LinearRange, LinearHoldCount */
|
||||||
|
@ -155,8 +153,7 @@ static void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
||||||
LibAmdMemCopy ((VOID *)(FchParams->Hwm.HwmFanControl), &oem_factl, (sizeof(FCH_HWM_FAN_CTR) * 5), FchParams->StdHeader);
|
LibAmdMemCopy ((VOID *)(FchParams->Hwm.HwmFanControl), &oem_factl, (sizeof(FCH_HWM_FAN_CTR) * 5), FchParams->StdHeader);
|
||||||
|
|
||||||
/* Enable IMC fan control. the recommended way */
|
/* Enable IMC fan control. the recommended way */
|
||||||
#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
|
if (IS_ENABLED(CONFIG_HUDSON_IMC_FWM)) {
|
||||||
|
|
||||||
imc_reg_init();
|
imc_reg_init();
|
||||||
|
|
||||||
/* HwMonitorEnable = TRUE && HwmFchtsiAutoOpll ==FALSE to call FchECfancontrolservice */
|
/* HwMonitorEnable = TRUE && HwmFchtsiAutoOpll ==FALSE to call FchECfancontrolservice */
|
||||||
|
@ -272,13 +269,12 @@ static void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
||||||
* AGESA put EcDefaultMessage as global data in ROM, so we can't override it.
|
* AGESA put EcDefaultMessage as global data in ROM, so we can't override it.
|
||||||
* so we remove it from AGESA code. Please See FchInitLateHwm.
|
* so we remove it from AGESA code. Please See FchInitLateHwm.
|
||||||
*/
|
*/
|
||||||
|
} else {
|
||||||
#else /* HWM fan control, using the alternative method */
|
/* HWM fan control, using the alternative method */
|
||||||
FchParams->Imc.ImcEnable = FALSE;
|
FchParams->Imc.ImcEnable = FALSE;
|
||||||
FchParams->Hwm.HwMonitorEnable = TRUE;
|
FchParams->Hwm.HwMonitorEnable = TRUE;
|
||||||
FchParams->Hwm.HwmFchtsiAutoPoll = TRUE;/* 1 enable, 0 disable TSI Auto Polling */
|
FchParams->Hwm.HwmFchtsiAutoPoll = TRUE;/* 1 enable, 0 disable TSI Auto Polling */
|
||||||
|
}
|
||||||
#endif /* CONFIG_HUDSON_IMC_FWM */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,9 +20,7 @@
|
||||||
#include "heapManager.h"
|
#include "heapManager.h"
|
||||||
#include "FchPlatform.h"
|
#include "FchPlatform.h"
|
||||||
#include "cbfs.h"
|
#include "cbfs.h"
|
||||||
#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
|
|
||||||
#include "imc.h"
|
#include "imc.h"
|
||||||
#endif
|
|
||||||
#include "hudson.h"
|
#include "hudson.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -108,7 +106,7 @@ static const CODEC_TBL_LIST CodecTableList[] =
|
||||||
* software switches the I2C address. AMD recommends using IMC
|
* software switches the I2C address. AMD recommends using IMC
|
||||||
* to control fans, instead of HWM.
|
* to control fans, instead of HWM.
|
||||||
*/
|
*/
|
||||||
static void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
||||||
{
|
{
|
||||||
FCH_HWM_FAN_CTR oem_factl[5] = {
|
FCH_HWM_FAN_CTR oem_factl[5] = {
|
||||||
/*temperature input, fan mode, frequency, low_duty, med_duty, multiplier, lowtemp, medtemp, hightemp, LinearRange, LinearHoldCount */
|
/*temperature input, fan mode, frequency, low_duty, med_duty, multiplier, lowtemp, medtemp, hightemp, LinearRange, LinearHoldCount */
|
||||||
|
@ -123,8 +121,7 @@ static void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
||||||
LibAmdMemCopy ((VOID *)(FchParams->Hwm.HwmFanControl), &oem_factl, (sizeof(FCH_HWM_FAN_CTR) * 5), FchParams->StdHeader);
|
LibAmdMemCopy ((VOID *)(FchParams->Hwm.HwmFanControl), &oem_factl, (sizeof(FCH_HWM_FAN_CTR) * 5), FchParams->StdHeader);
|
||||||
|
|
||||||
/* Enable IMC fan control. the recommended way */
|
/* Enable IMC fan control. the recommended way */
|
||||||
#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
|
if (IS_ENABLED(CONFIG_HUDSON_IMC_FWM)) {
|
||||||
|
|
||||||
/* HwMonitorEnable = TRUE && HwmFchtsiAutoOpll ==FALSE to call FchECfancontrolservice */
|
/* HwMonitorEnable = TRUE && HwmFchtsiAutoOpll ==FALSE to call FchECfancontrolservice */
|
||||||
FchParams->Hwm.HwMonitorEnable = TRUE;
|
FchParams->Hwm.HwMonitorEnable = TRUE;
|
||||||
FchParams->Hwm.HwmFchtsiAutoPoll = FALSE; /* 0 disable, 1 enable TSI Auto Polling */
|
FchParams->Hwm.HwmFchtsiAutoPoll = FALSE; /* 0 disable, 1 enable TSI Auto Polling */
|
||||||
|
@ -238,13 +235,12 @@ static void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
||||||
* AGESA put EcDefaultMessage as global data in ROM, so we can't override it.
|
* AGESA put EcDefaultMessage as global data in ROM, so we can't override it.
|
||||||
* so we remove it from AGESA code. Please See FchInitLateHwm.
|
* so we remove it from AGESA code. Please See FchInitLateHwm.
|
||||||
*/
|
*/
|
||||||
|
} else {
|
||||||
#else /* HWM fan control, using the alternative method */
|
/* HWM fan control, using the alternative method */
|
||||||
FchParams->Imc.ImcEnable = FALSE;
|
FchParams->Imc.ImcEnable = FALSE;
|
||||||
FchParams->Hwm.HwMonitorEnable = TRUE;
|
FchParams->Hwm.HwMonitorEnable = TRUE;
|
||||||
FchParams->Hwm.HwmFchtsiAutoPoll = TRUE; /* 1 enable, 0 disable TSI Auto Polling */
|
FchParams->Hwm.HwmFchtsiAutoPoll = TRUE; /* 1 enable, 0 disable TSI Auto Polling */
|
||||||
|
}
|
||||||
#endif /* CONFIG_HUDSON_IMC_FWM */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,9 +20,7 @@
|
||||||
#include "heapManager.h"
|
#include "heapManager.h"
|
||||||
#include "FchPlatform.h"
|
#include "FchPlatform.h"
|
||||||
#include "cbfs.h"
|
#include "cbfs.h"
|
||||||
#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
|
|
||||||
#include "imc.h"
|
#include "imc.h"
|
||||||
#endif
|
|
||||||
#include "hudson.h"
|
#include "hudson.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <spd_bin.h>
|
#include <spd_bin.h>
|
||||||
|
@ -110,7 +108,7 @@ static const CODEC_TBL_LIST CodecTableList[] =
|
||||||
* software switches the I2C address. AMD recommends using IMC
|
* software switches the I2C address. AMD recommends using IMC
|
||||||
* to control fans, instead of HWM.
|
* to control fans, instead of HWM.
|
||||||
*/
|
*/
|
||||||
static void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
||||||
{
|
{
|
||||||
FCH_HWM_FAN_CTR oem_factl[5] = {
|
FCH_HWM_FAN_CTR oem_factl[5] = {
|
||||||
/*temperature input, fan mode, frequency, low_duty, med_duty, multiplier, lowtemp, medtemp, hightemp, LinearRange, LinearHoldCount */
|
/*temperature input, fan mode, frequency, low_duty, med_duty, multiplier, lowtemp, medtemp, hightemp, LinearRange, LinearHoldCount */
|
||||||
|
@ -125,8 +123,7 @@ static void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
||||||
LibAmdMemCopy ((VOID *)(FchParams->Hwm.HwmFanControl), &oem_factl, (sizeof(FCH_HWM_FAN_CTR) * 5), FchParams->StdHeader);
|
LibAmdMemCopy ((VOID *)(FchParams->Hwm.HwmFanControl), &oem_factl, (sizeof(FCH_HWM_FAN_CTR) * 5), FchParams->StdHeader);
|
||||||
|
|
||||||
/* Enable IMC fan control. the recommended way */
|
/* Enable IMC fan control. the recommended way */
|
||||||
#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
|
if (IS_ENABLED(CONFIG_HUDSON_IMC_FWM)) {
|
||||||
|
|
||||||
/* HwMonitorEnable = TRUE && HwmFchtsiAutoOpll ==FALSE to call FchECfancontrolservice */
|
/* HwMonitorEnable = TRUE && HwmFchtsiAutoOpll ==FALSE to call FchECfancontrolservice */
|
||||||
FchParams->Hwm.HwMonitorEnable = TRUE;
|
FchParams->Hwm.HwMonitorEnable = TRUE;
|
||||||
FchParams->Hwm.HwmFchtsiAutoPoll = FALSE; /* 0 disable, 1 enable TSI Auto Polling */
|
FchParams->Hwm.HwmFchtsiAutoPoll = FALSE; /* 0 disable, 1 enable TSI Auto Polling */
|
||||||
|
@ -240,13 +237,12 @@ static void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
||||||
* AGESA put EcDefaultMessage as global data in ROM, so we can't override it.
|
* AGESA put EcDefaultMessage as global data in ROM, so we can't override it.
|
||||||
* so we remove it from AGESA code. Please See FchInitLateHwm.
|
* so we remove it from AGESA code. Please See FchInitLateHwm.
|
||||||
*/
|
*/
|
||||||
|
} else {
|
||||||
#else /* HWM fan control, using the alternative method */
|
/* HWM fan control, using the alternative method */
|
||||||
FchParams->Imc.ImcEnable = FALSE;
|
FchParams->Imc.ImcEnable = FALSE;
|
||||||
FchParams->Hwm.HwMonitorEnable = TRUE;
|
FchParams->Hwm.HwMonitorEnable = TRUE;
|
||||||
FchParams->Hwm.HwmFchtsiAutoPoll = TRUE; /* 1 enable, 0 disable TSI Auto Polling */
|
FchParams->Hwm.HwmFchtsiAutoPoll = TRUE; /* 1 enable, 0 disable TSI Auto Polling */
|
||||||
|
}
|
||||||
#endif /* CONFIG_HUDSON_IMC_FWM */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,9 +23,7 @@
|
||||||
#include "FchPlatform.h"
|
#include "FchPlatform.h"
|
||||||
#include "cbfs.h"
|
#include "cbfs.h"
|
||||||
#include "gpio_ftns.h"
|
#include "gpio_ftns.h"
|
||||||
#if IS_ENABLED(CONFIG_HUDSON_IMC_FWM)
|
|
||||||
#include "imc.h"
|
#include "imc.h"
|
||||||
#endif
|
|
||||||
#include "hudson.h"
|
#include "hudson.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -55,7 +53,7 @@ const int BiosCalloutsLen = ARRAY_SIZE(BiosCallouts);
|
||||||
* software switches the I2C address. AMD recommends using IMC
|
* software switches the I2C address. AMD recommends using IMC
|
||||||
* to control fans, instead of HWM.
|
* to control fans, instead of HWM.
|
||||||
*/
|
*/
|
||||||
static void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
void oem_fan_control(FCH_DATA_BLOCK *FchParams)
|
||||||
{
|
{
|
||||||
FchParams->Imc.ImcEnable = FALSE;
|
FchParams->Imc.ImcEnable = FALSE;
|
||||||
FchParams->Hwm.HwMonitorEnable = FALSE;
|
FchParams->Hwm.HwMonitorEnable = FALSE;
|
||||||
|
|
Loading…
Reference in New Issue