Subrata Banik submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Furquan Shaikh: Looks good to me, approved HAOUAS Elyes: Looks good to me, but someone else must approve Angel Pons: Looks good to me, approved Michael Niewöhner: Looks good to me, approved
soc/intel/common/block/cse: Refactor cse_request_global_reset() function

List of changes:
1. Check if CSE is enabled from devicetree.cb
2. Create helper function cse_request_reset()
3. Modify caller function argument cse_request_global_reset()

Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Change-Id: I3668b473bec8d51f847908d11e2e25c485ec7a97
Reviewed-on: https://review.coreboot.org/c/coreboot/+/45341
Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M src/soc/intel/alderlake/reset.c
M src/soc/intel/cannonlake/reset.c
M src/soc/intel/common/block/cse/cse.c
M src/soc/intel/common/block/include/intelblocks/cse.h
M src/soc/intel/elkhartlake/reset.c
M src/soc/intel/icelake/reset.c
M src/soc/intel/jasperlake/reset.c
M src/soc/intel/skylake/me.c
M src/soc/intel/tigerlake/reset.c
9 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/src/soc/intel/alderlake/reset.c b/src/soc/intel/alderlake/reset.c
index d37ff54..1f7ea3c 100644
--- a/src/soc/intel/alderlake/reset.c
+++ b/src/soc/intel/alderlake/reset.c
@@ -11,7 +11,7 @@
void do_global_reset(void)
{
/* Ask CSE to do the global reset */
- if (cse_request_global_reset(GLOBAL_RESET))
+ if (cse_request_global_reset())
return;

/* global reset if CSE fail to reset */
diff --git a/src/soc/intel/cannonlake/reset.c b/src/soc/intel/cannonlake/reset.c
index d37ff54..1f7ea3c 100644
--- a/src/soc/intel/cannonlake/reset.c
+++ b/src/soc/intel/cannonlake/reset.c
@@ -11,7 +11,7 @@
void do_global_reset(void)
{
/* Ask CSE to do the global reset */
- if (cse_request_global_reset(GLOBAL_RESET))
+ if (cse_request_global_reset())
return;

/* global reset if CSE fail to reset */
diff --git a/src/soc/intel/common/block/cse/cse.c b/src/soc/intel/common/block/cse/cse.c
index 4b598e2..ef6db3d 100644
--- a/src/soc/intel/common/block/cse/cse.c
+++ b/src/soc/intel/common/block/cse/cse.c
@@ -616,9 +616,10 @@
}

/*
- * Sends GLOBAL_RESET_REQ cmd to CSE.The reset type can be GLOBAL_RESET/CSE_RESET_ONLY.
+ * Sends GLOBAL_RESET_REQ cmd to CSE with reset type GLOBAL_RESET.
+ * Returns 0 on failure and 1 on success.
*/
-int cse_request_global_reset(enum rst_req_type rst_type)
+static int cse_request_reset(enum rst_req_type rst_type)
{
int status;
struct mkhi_hdr reply;
@@ -644,7 +645,7 @@
return 0;
}

- if (!cse_is_global_reset_allowed()) {
+ if (!cse_is_global_reset_allowed() || !is_cse_enabled()) {
printk(BIOS_ERR, "HECI: CSE does not meet required prerequisites\n");
return 0;
}
@@ -663,6 +664,11 @@
return status;
}

+int cse_request_global_reset(void)
+{
+ return cse_request_reset(GLOBAL_RESET);
+}
+
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..f554933 100644
--- a/src/soc/intel/common/block/include/intelblocks/cse.h
+++ b/src/soc/intel/common/block/include/intelblocks/cse.h
@@ -121,12 +121,10 @@
};

/*
- * Sends GLOBAL_RESET_REQ cmd to CSE.
- * The reset type can be one of the above defined reset type.
+ * Sends GLOBAL_RESET_REQ cmd to CSE with reset type GLOBAL_RESET.
* Returns 0 on failure and 1 on success.
*/
-int cse_request_global_reset(enum rst_req_type rst_type);
-
+int cse_request_global_reset(void);
/*
* Sends HMRFPO_ENABLE command.
* HMRFPO - Host ME Region Flash Protection Override.
diff --git a/src/soc/intel/elkhartlake/reset.c b/src/soc/intel/elkhartlake/reset.c
index 107db5a..fe3d769 100644
--- a/src/soc/intel/elkhartlake/reset.c
+++ b/src/soc/intel/elkhartlake/reset.c
@@ -11,7 +11,7 @@
void do_global_reset(void)
{
/* Ask CSE to do the global reset */
- if (cse_request_global_reset(GLOBAL_RESET))
+ if (cse_request_global_reset())
return;

/* global reset if CSE fail to reset */
diff --git a/src/soc/intel/icelake/reset.c b/src/soc/intel/icelake/reset.c
index d37ff54..1f7ea3c 100644
--- a/src/soc/intel/icelake/reset.c
+++ b/src/soc/intel/icelake/reset.c
@@ -11,7 +11,7 @@
void do_global_reset(void)
{
/* Ask CSE to do the global reset */
- if (cse_request_global_reset(GLOBAL_RESET))
+ if (cse_request_global_reset())
return;

/* global reset if CSE fail to reset */
diff --git a/src/soc/intel/jasperlake/reset.c b/src/soc/intel/jasperlake/reset.c
index d37ff54..1f7ea3c 100644
--- a/src/soc/intel/jasperlake/reset.c
+++ b/src/soc/intel/jasperlake/reset.c
@@ -11,7 +11,7 @@
void do_global_reset(void)
{
/* Ask CSE to do the global reset */
- if (cse_request_global_reset(GLOBAL_RESET))
+ if (cse_request_global_reset())
return;

/* global reset if CSE fail to reset */
diff --git a/src/soc/intel/skylake/me.c b/src/soc/intel/skylake/me.c
index 0d6135f..b967d31 100644
--- a/src/soc/intel/skylake/me.c
+++ b/src/soc/intel/skylake/me.c
@@ -353,7 +353,7 @@
goto ret;

/* ME should be in Normal Mode for this command */
- status = cse_request_global_reset(GLOBAL_RESET);
+ status = cse_request_global_reset();
ret:
return status;
}
diff --git a/src/soc/intel/tigerlake/reset.c b/src/soc/intel/tigerlake/reset.c
index d37ff54..1f7ea3c 100644
--- a/src/soc/intel/tigerlake/reset.c
+++ b/src/soc/intel/tigerlake/reset.c
@@ -11,7 +11,7 @@
void do_global_reset(void)
{
/* Ask CSE to do the global reset */
- if (cse_request_global_reset(GLOBAL_RESET))
+ if (cse_request_global_reset())
return;

/* global reset if CSE fail to reset */

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: 12
Gerrit-Owner: Subrata Banik <subrata.banik@intel.com>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Furquan Shaikh <furquan@google.com>
Gerrit-Reviewer: HAOUAS Elyes <ehaouas@noos.fr>
Gerrit-Reviewer: Michael Niewöhner <foss@mniewoehner.de>
Gerrit-Reviewer: Patrick Rudolph <siro@das-labor.org>
Gerrit-Reviewer: Subrata Banik <subrata.banik@intel.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net>
Gerrit-MessageType: merged