Subrata Banik submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Paul Menzel: Looks good to me, but someone else must approve EricR Lai: Looks good to me, approved Tim Wawrzynczak: Looks good to me, approved
soc/intel/common/cse: Add helper API for CSE SPI Protection Mode

This patch checks if CSE's spi protection mode is protected or
unprotected. Returns true if CSE's spi protection mode is protected,
otherwise false.

BUG=b:211954778
TEST=Able to build and boot brya with this change. Calling
`cse_is_hfs1_spi_protected()` in coreboot is able to provide
the SPI protection status.

Signed-off-by: Subrata Banik <subratabanik@google.com>
Change-Id: I23f1a1c4b55d8da6e6fd0cf84bef86f49ce80cca
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60403
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: EricR Lai <ericr_lai@compal.corp-partner.google.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
---
M src/soc/intel/common/block/cse/cse.c
M src/soc/intel/common/block/include/intelblocks/cse.h
2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/src/soc/intel/common/block/cse/cse.c b/src/soc/intel/common/block/cse/cse.c
index 05b67ee..7d6faba 100644
--- a/src/soc/intel/common/block/cse/cse.c
+++ b/src/soc/intel/common/block/cse/cse.c
@@ -257,6 +257,22 @@
return cse_check_hfs1_com(ME_HFS1_COM_SOFT_TEMP_DISABLE);
}

+/*
+ * TGL HFSTS1.spi_protection_mode bit replaces the previous
+ * `manufacturing mode (mfg_mode)` without changing the offset and purpose
+ * of this bit.
+ *
+ * Using HFSTS1.mfg_mode to get the SPI protection status for all PCH.
+ * mfg_mode = 0 means SPI protection in on.
+ * mfg_mode = 1 means SPI is unprotected.
+ */
+bool cse_is_hfs1_spi_protected(void)
+{
+ union me_hfsts1 hfs1;
+ hfs1.data = me_read_config32(PCI_ME_HFSTS1);
+ return !hfs1.fields.mfg_mode;
+}
+
bool cse_is_hfs3_fw_sku_lite(void)
{
union me_hfsts3 hfs3;
diff --git a/src/soc/intel/common/block/include/intelblocks/cse.h b/src/soc/intel/common/block/include/intelblocks/cse.h
index 68f1d3c..540dabc 100644
--- a/src/soc/intel/common/block/include/intelblocks/cse.h
+++ b/src/soc/intel/common/block/include/intelblocks/cse.h
@@ -301,6 +301,12 @@
bool cse_is_hfs1_com_soft_temp_disable(void);

/*
+ * Checks CSE's spi protection mode is protected or unprotected.
+ * Returns true if CSE's spi protection mode is protected, otherwise false.
+ */
+bool cse_is_hfs1_spi_protected(void);
+
+/*
* Checks CSE's Firmware SKU is Lite or not.
* Returns true if CSE's Firmware SKU is Lite, otherwise false
*/

9 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one.

To view, visit change 60403. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I23f1a1c4b55d8da6e6fd0cf84bef86f49ce80cca
Gerrit-Change-Number: 60403
Gerrit-PatchSet: 11
Gerrit-Owner: Subrata Banik <subratabanik@google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: EricR Lai <ericr_lai@compal.corp-partner.google.com>
Gerrit-Reviewer: Felix Singer <felixsinger@posteo.net>
Gerrit-Reviewer: Maulik V Vaghela <maulik.v.vaghela@intel.com>
Gerrit-Reviewer: Nick Vaccaro <nvaccaro@google.com>
Gerrit-Reviewer: Patrick Rudolph <siro@das-labor.org>
Gerrit-Reviewer: Paul Menzel <paulepanter@mailbox.org>
Gerrit-Reviewer: Subrata Banik <subratabanik@google.com>
Gerrit-Reviewer: Tim Wawrzynczak <twawrzynczak@chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged