Sridhar Siricilla has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36786 )
Change subject: src/soc/intel/common/cse: Add helper functions to support CSE FW update ......................................................................
src/soc/intel/common/cse: Add helper functions to support CSE FW update
Below helper functions are added: * cse_wait_opmode_soft_temp_disable() - It polls for CSE's operation mode 'Soft Temporary Disable". The CSE enters this mode when it boots from RO_BP1 region.
* cse_check_opmode_soft_temp_disable() - It reads CSE's FWSTS1 register and checks for CSE's operation mode 'Soft Temporary Disable'.
Change-Id: Ibdcf01f31b0310932b8e834ae83144f8a67f1fef Signed-off-by: Sridhar Siricilla sridhar.siricilla@intel.com --- M src/soc/intel/common/block/cse/cse.c 1 file changed, 29 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/86/36786/1
diff --git a/src/soc/intel/common/block/cse/cse.c b/src/soc/intel/common/block/cse/cse.c index 247e60a..d7fd21b 100644 --- a/src/soc/intel/common/block/cse/cse.c +++ b/src/soc/intel/common/block/cse/cse.c @@ -294,6 +294,35 @@ return 1; }
+static int cse_check_opmode_soft_temp_disable(void) +{ + union me_hfsts1 hfs1; + + hfs1.data = me_read_config32(PCI_ME_HFSTS1); + + if (hfs1.fields.operation_mode == ME_HFS_TEMP_DISABLE) + return 1; + else + return 0; +} + +/* + * Polls for CSE's operation mode 'Soft Temporary Disable'. + * The CSE enters the operation mode when it boots from RO_BP1 region. + */ +uint8_t cse_wait_opmode_soft_temp_disable(void) +{ + struct stopwatch sw; + stopwatch_init_msecs_expire(&sw, HECI_DELAY_READY); + while (!check_cse_opmode_soft_disable_state()) { + udelay(HECI_DELAY); + if (stopwatch_expired(&sw)) + return 0; + } + + return 1; +} + static int wait_heci_ready(void) { struct stopwatch sw;