diff --git a/src/soc/intel/alderlake/romstage/romstage.c b/src/soc/intel/alderlake/romstage/romstage.c index e78f106f80..2ccadbca4a 100644 --- a/src/soc/intel/alderlake/romstage/romstage.c +++ b/src/soc/intel/alderlake/romstage/romstage.c @@ -2,11 +2,13 @@ #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -21,6 +23,23 @@ #include #include #include +#include + +#define PSF_UFS0_BASE_ADDRESS 0x280 +#define PSF_UFS1_BASE_ADDRESS 0x300 +#define PCR_PSFX_T0_SHDW_PCIEN 0x1C +#define PCR_PSFX_T0_SHDW_PCIEN_FUNDIS (1 << 8) + +static void disable_ufs(void) +{ + /* disable USF0 */ + pcr_or32(PID_PSF2, PSF_UFS0_BASE_ADDRESS + PCR_PSFX_T0_SHDW_PCIEN, + PCR_PSFX_T0_SHDW_PCIEN_FUNDIS); + + /* disable USF1 */ + pcr_or32(PID_PSF2, PSF_UFS1_BASE_ADDRESS + PCR_PSFX_T0_SHDW_PCIEN, + PCR_PSFX_T0_SHDW_PCIEN_FUNDIS); +} #include "ux.h" @@ -164,6 +183,17 @@ void mainboard_romstage_entry(void) timestamp_add_now(TS_CSE_FW_SYNC_END); } + /* Program to Disable UFS Controllers */ + if (!is_devfn_enabled(PCH_DEVFN_UFS) && + (CONFIG(USE_UNIFIED_AP_FIRMWARE_FOR_UFS_AND_NON_UFS))) { + printk(BIOS_INFO, "Disabling UFS controllers\n"); + disable_ufs(); + if (ps->prev_sleep_state == ACPI_S5) { + printk(BIOS_INFO, "Warm Reset after disabling UFS controllers\n"); + system_reset(); + } + } + /* Program MCHBAR, DMIBAR, GDXBAR and EDRAMBAR */ systemagent_early_init(); /* Program SMBus base address and enable it */