Subrata Banik has uploaded this change for review.

View Change

soc/intel/common/block/cse: Add helper function cse_send_global_reset

Sends GLOBAL_RESET_REQ cmd to CSE.
1. Check if CSE is enable from devicetree.cb
2. Ensure CSE in Normal Mode prior sending global reset command
3. If not in normal mode then send error status
4. If in normal mode then only call cse_request_global_reset() to
send global reset command

Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Change-Id: I3668b473bec8d51f847908d11e2e25c485ec7a97
---
M src/soc/intel/common/block/cse/cse.c
M src/soc/intel/common/block/include/intelblocks/cse.h
2 files changed, 28 insertions(+), 1 deletion(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/41/45341/1
diff --git a/src/soc/intel/common/block/cse/cse.c b/src/soc/intel/common/block/cse/cse.c
index 4b598e2..90afdcf 100644
--- a/src/soc/intel/common/block/cse/cse.c
+++ b/src/soc/intel/common/block/cse/cse.c
@@ -663,6 +663,25 @@
return status;
}

+int cse_send_global_reset(void)
+{
+ int status = -1;
+ union me_hfsts1 hfs1;
+
+ if (!is_cse_enabled())
+ goto ret;
+
+ /* Check ME operating mode */
+ hfs1.data = me_read_config32(PCI_ME_HFSTS1);
+ if (hfs1.fields.operation_mode)
+ goto ret;
+
+ /* ME should be in Normal Mode for this command */
+ status = cse_request_global_reset(GLOBAL_RESET);
+ret:
+ return status;
+}
+
static bool cse_is_hmrfpo_enable_allowed(void)
{
/*
diff --git a/src/soc/intel/common/block/include/intelblocks/cse.h b/src/soc/intel/common/block/include/intelblocks/cse.h
index a67010c..9804b0d 100644
--- a/src/soc/intel/common/block/include/intelblocks/cse.h
+++ b/src/soc/intel/common/block/include/intelblocks/cse.h
@@ -126,7 +126,15 @@
* Returns 0 on failure and 1 on success.
*/
int cse_request_global_reset(enum rst_req_type rst_type);
-
+/*
+ * Sends GLOBAL_RESET_REQ cmd to CSE.
+ * 1. Check if CSE is enable from devicetree.cb
+ * 2. Ensure CSE in Normal Mode prior sending global reset command
+ * 3. If not in normal mode then send error status
+ * 4. If in normal mode then only call cse_request_global_reset() to send global reset command
+ * Returns 0 on failure and 1 on success.
+ */
+int cse_send_global_reset(void);
/*
* Sends HMRFPO_ENABLE command.
* HMRFPO - Host ME Region Flash Protection Override.

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

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I3668b473bec8d51f847908d11e2e25c485ec7a97
Gerrit-Change-Number: 45341
Gerrit-PatchSet: 1
Gerrit-Owner: Subrata Banik <subrata.banik@intel.com>
Gerrit-Reviewer: Patrick Rudolph <siro@das-labor.org>
Gerrit-MessageType: newchange