soc/amd/stoneyridge: Disable SATA based on devicetree setting
Grunt boards don't use SATA, so it should be disabled to save power. Check if SATA is enabled in devicetree, and enable/disable the device based on that setting. BUG=b:112139043 TEST=Buil and boot grunt, checked the absence of SATA PCI. Change-Id: I4a3b5f65e612e8da5bedff0c557a0850f350dfa8 Signed-off-by: Richard Spiegel <richard.spiegel@silverbackltd.com> Reviewed-on: https://review.coreboot.org/27845 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
parent
cea8493285
commit
bb18b43065
|
@ -53,6 +53,7 @@ AGESA_STATUS agesa_fch_initreset(UINT32 Func, UINTN FchData, VOID *ConfigPtr)
|
||||||
AGESA_STATUS agesa_fch_initenv(UINT32 Func, UINTN FchData, VOID *ConfigPtr)
|
AGESA_STATUS agesa_fch_initenv(UINT32 Func, UINTN FchData, VOID *ConfigPtr)
|
||||||
{
|
{
|
||||||
AMD_CONFIG_PARAMS *StdHeader = ConfigPtr;
|
AMD_CONFIG_PARAMS *StdHeader = ConfigPtr;
|
||||||
|
const struct device *dev = dev_find_slot(0, SATA_DEVFN);
|
||||||
|
|
||||||
if (StdHeader->Func == AMD_INIT_ENV) {
|
if (StdHeader->Func == AMD_INIT_ENV) {
|
||||||
FCH_DATA_BLOCK *FchParams_env = (FCH_DATA_BLOCK *)FchData;
|
FCH_DATA_BLOCK *FchParams_env = (FCH_DATA_BLOCK *)FchData;
|
||||||
|
@ -67,19 +68,22 @@ AGESA_STATUS agesa_fch_initenv(UINT32 Func, UINTN FchData, VOID *ConfigPtr)
|
||||||
|
|
||||||
/* SATA configuration */
|
/* SATA configuration */
|
||||||
FchParams_env->Sata.SataClass = CONFIG_STONEYRIDGE_SATA_MODE;
|
FchParams_env->Sata.SataClass = CONFIG_STONEYRIDGE_SATA_MODE;
|
||||||
switch ((SATA_CLASS)CONFIG_STONEYRIDGE_SATA_MODE) {
|
if (dev && dev->enabled) {
|
||||||
case SataRaid:
|
switch ((SATA_CLASS)CONFIG_STONEYRIDGE_SATA_MODE) {
|
||||||
case SataAhci:
|
case SataRaid:
|
||||||
case SataAhci7804:
|
case SataAhci:
|
||||||
case SataLegacyIde:
|
case SataAhci7804:
|
||||||
|
case SataLegacyIde:
|
||||||
|
FchParams_env->Sata.SataIdeMode = FALSE;
|
||||||
|
break;
|
||||||
|
case SataIde2Ahci:
|
||||||
|
case SataIde2Ahci7804:
|
||||||
|
default: /* SataNativeIde */
|
||||||
|
FchParams_env->Sata.SataIdeMode = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else
|
||||||
FchParams_env->Sata.SataIdeMode = FALSE;
|
FchParams_env->Sata.SataIdeMode = FALSE;
|
||||||
break;
|
|
||||||
case SataIde2Ahci:
|
|
||||||
case SataIde2Ahci7804:
|
|
||||||
default: /* SataNativeIde */
|
|
||||||
FchParams_env->Sata.SataIdeMode = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Platform updates */
|
/* Platform updates */
|
||||||
platform_FchParams_env(FchParams_env);
|
platform_FchParams_env(FchParams_env);
|
||||||
|
|
|
@ -72,18 +72,32 @@ static inline int sb_ide_enable(void)
|
||||||
|
|
||||||
void SetFchResetParams(FCH_RESET_INTERFACE *params)
|
void SetFchResetParams(FCH_RESET_INTERFACE *params)
|
||||||
{
|
{
|
||||||
|
const struct device *dev = dev_find_slot(0, SATA_DEVFN);
|
||||||
params->Xhci0Enable = IS_ENABLED(CONFIG_STONEYRIDGE_XHCI_ENABLE);
|
params->Xhci0Enable = IS_ENABLED(CONFIG_STONEYRIDGE_XHCI_ENABLE);
|
||||||
params->SataEnable = sb_sata_enable();
|
if (dev && dev->enabled) {
|
||||||
params->IdeEnable = sb_ide_enable();
|
params->SataEnable = sb_sata_enable();
|
||||||
|
params->IdeEnable = sb_ide_enable();
|
||||||
|
} else {
|
||||||
|
params->SataEnable = FALSE;
|
||||||
|
params->IdeEnable = FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFchEnvParams(FCH_INTERFACE *params)
|
void SetFchEnvParams(FCH_INTERFACE *params)
|
||||||
{
|
{
|
||||||
|
const struct device *dev = dev_find_slot(0, SATA_DEVFN);
|
||||||
params->AzaliaController = AzEnable;
|
params->AzaliaController = AzEnable;
|
||||||
params->SataClass = CONFIG_STONEYRIDGE_SATA_MODE;
|
params->SataClass = CONFIG_STONEYRIDGE_SATA_MODE;
|
||||||
params->SataEnable = is_sata_config();
|
if (dev && dev->enabled) {
|
||||||
params->IdeEnable = !params->SataEnable;
|
params->SataEnable = is_sata_config();
|
||||||
params->SataIdeMode = (CONFIG_STONEYRIDGE_SATA_MODE == SataLegacyIde);
|
params->IdeEnable = !params->SataEnable;
|
||||||
|
params->SataIdeMode = (CONFIG_STONEYRIDGE_SATA_MODE ==
|
||||||
|
SataLegacyIde);
|
||||||
|
} else {
|
||||||
|
params->SataEnable = FALSE;
|
||||||
|
params->IdeEnable = FALSE;
|
||||||
|
params->SataIdeMode = FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFchMidParams(FCH_INTERFACE *params)
|
void SetFchMidParams(FCH_INTERFACE *params)
|
||||||
|
|
Loading…
Reference in New Issue