soc/intel/icelake: Make use of is_devfn_enabled() function

1. Replace all pcidev_path_on_root() and is_dev_enabled() functions
combination with is_devfn_enabled().
2. Remove unused local variable of device structure type
(struct device *).
3. Replace pcidev_path_on_root() and dev->enabled check with
is_devfn_enabled() call.
4. Leave SATA, eMMC controller FSP UPDs at default state if
controller is not enabled and FSP UPDs are set to disable.

TEST=Able to build and boot without any regression seen on ICLRVP.

Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Change-Id: Id6861af3b5d1ce4f44b6d2109301bd4f5857f324
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55721
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Subrata Banik 2021-06-21 18:07:50 +05:30
parent d41a5ae489
commit 1a5d4120e6
2 changed files with 15 additions and 43 deletions

View File

@ -55,11 +55,7 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
mainboard_silicon_init_params(params); mainboard_silicon_init_params(params);
dev = pcidev_path_on_root(SA_DEVFN_IGD); params->PeiGraphicsPeimInit = CONFIG(RUN_FSP_GOP) && is_devfn_enabled(SA_DEVFN_IGD);
if (CONFIG(RUN_FSP_GOP) && dev && dev->enabled)
params->PeiGraphicsPeimInit = 1;
else
params->PeiGraphicsPeimInit = 0;
params->PavpEnable = CONFIG(PAVP); params->PavpEnable = CONFIG(PAVP);
@ -68,11 +64,8 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
params->CnviBtAudioOffload = config->CnviBtAudioOffload; params->CnviBtAudioOffload = config->CnviBtAudioOffload;
/* SATA */ /* SATA */
dev = pcidev_on_root(PCH_DEV_SLOT_SATA, 0); params->SataEnable = is_devfn_enabled(PCH_DEVFN_SATA);
if (!dev) if (params->SataEnable) {
params->SataEnable = 0;
else {
params->SataEnable = dev->enabled;
params->SataMode = config->SataMode; params->SataMode = config->SataMode;
params->SataSalpSupport = config->SataSalpSupport; params->SataSalpSupport = config->SataSalpSupport;
memcpy(params->SataPortsEnable, config->SataPortsEnable, memcpy(params->SataPortsEnable, config->SataPortsEnable,
@ -82,11 +75,7 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
} }
/* Lan */ /* Lan */
dev = pcidev_on_root(PCH_DEV_SLOT_ESPI, 6); params->PchLanEnable = is_devfn_enabled(PCH_DEVFN_GBE);
if (!dev)
params->PchLanEnable = 0;
else
params->PchLanEnable = dev->enabled;
/* Audio */ /* Audio */
params->PchHdaDspEnable = config->PchHdaDspEnable; params->PchHdaDspEnable = config->PchHdaDspEnable;
@ -166,11 +155,8 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
sizeof(config->PcieClkSrcClkReq)); sizeof(config->PcieClkSrcClkReq));
/* eMMC */ /* eMMC */
dev = pcidev_on_root(PCH_DEV_SLOT_STORAGE, 0); params->ScsEmmcEnabled = is_devfn_enabled(PCH_DEVFN_EMMC);
if (!dev) if (params->ScsEmmcEnabled) {
params->ScsEmmcEnabled = 0;
else {
params->ScsEmmcEnabled = dev->enabled;
params->ScsEmmcHs400Enabled = config->ScsEmmcHs400Enabled; params->ScsEmmcHs400Enabled = config->ScsEmmcHs400Enabled;
params->EmmcUseCustomDlls = config->EmmcUseCustomDlls; params->EmmcUseCustomDlls = config->EmmcUseCustomDlls;
if (config->EmmcUseCustomDlls == 1) { if (config->EmmcUseCustomDlls == 1) {
@ -190,14 +176,8 @@ void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
} }
/* SD */ /* SD */
dev = pcidev_on_root(PCH_DEV_SLOT_XHCI, 5); params->ScsSdCardEnabled = is_devfn_enabled(PCH_DEVFN_SDCARD);
if (!dev) params->SdCardPowerEnableActiveHigh = config->SdCardPowerEnableActiveHigh;
params->ScsSdCardEnabled = 0;
else {
params->ScsSdCardEnabled = dev->enabled;
params->SdCardPowerEnableActiveHigh =
config->SdCardPowerEnableActiveHigh;
}
params->Heci3Enabled = config->Heci3Enabled; params->Heci3Enabled = config->Heci3Enabled;
params->Device4Enable = config->Device4Enable; params->Device4Enable = config->Device4Enable;

View File

@ -13,18 +13,14 @@ static void soc_memory_init_params(FSP_M_CONFIG *m_cfg,
const struct soc_intel_icelake_config *config) const struct soc_intel_icelake_config *config)
{ {
unsigned int i; unsigned int i;
const struct device *dev = pcidev_path_on_root(SA_DEVFN_IGD);
uint32_t mask = 0; uint32_t mask = 0;
if (CONFIG(SOC_INTEL_DISABLE_IGD) || !dev || !dev->enabled) { /*
/* Skip IGD initialization in FSP if device is disabled */ * If IGD is enabled, set IGD stolen size to 60MB.
m_cfg->InternalGfx = 0; * Otherwise, skip IGD init in FSP.
m_cfg->IgdDvmt50PreAlloc = 0; */
} else { m_cfg->InternalGfx = !CONFIG(SOC_INTEL_DISABLE_IGD) && is_devfn_enabled(SA_DEVFN_IGD);
m_cfg->InternalGfx = 1; m_cfg->IgdDvmt50PreAlloc = m_cfg->InternalGfx ? 0xFE : 0;
/* Set IGD stolen size to 60MB. */
m_cfg->IgdDvmt50PreAlloc = 0xFE;
}
m_cfg->TsegSize = CONFIG_SMM_TSEG_SIZE; m_cfg->TsegSize = CONFIG_SMM_TSEG_SIZE;
m_cfg->IedSize = CONFIG_IED_REGION_SIZE; m_cfg->IedSize = CONFIG_IED_REGION_SIZE;
@ -34,11 +30,7 @@ static void soc_memory_init_params(FSP_M_CONFIG *m_cfg,
m_cfg->SkipMbpHob = 1; m_cfg->SkipMbpHob = 1;
/* If Audio Codec is enabled, enable FSP UPD */ /* If Audio Codec is enabled, enable FSP UPD */
dev = pcidev_path_on_root(PCH_DEVFN_HDA); m_cfg->PchHdaEnable = is_devfn_enabled(PCH_DEVFN_HDA);
if (!dev)
m_cfg->PchHdaEnable = 0;
else
m_cfg->PchHdaEnable = dev->enabled;
for (i = 0; i < ARRAY_SIZE(config->PcieRpEnable); i++) { for (i = 0; i < ARRAY_SIZE(config->PcieRpEnable); i++) {
if (config->PcieRpEnable[i]) if (config->PcieRpEnable[i])