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>
This commit is contained in:
Subrata Banik
2020-09-14 19:04:03 +05:30
parent e9b937352e
commit f463dc0947
9 changed files with 18 additions and 14 deletions

View File

@@ -11,7 +11,7 @@
void do_global_reset(void) void do_global_reset(void)
{ {
/* Ask CSE to do the global reset */ /* Ask CSE to do the global reset */
if (cse_request_global_reset(GLOBAL_RESET)) if (cse_request_global_reset())
return; return;
/* global reset if CSE fail to reset */ /* global reset if CSE fail to reset */

View File

@@ -11,7 +11,7 @@
void do_global_reset(void) void do_global_reset(void)
{ {
/* Ask CSE to do the global reset */ /* Ask CSE to do the global reset */
if (cse_request_global_reset(GLOBAL_RESET)) if (cse_request_global_reset())
return; return;
/* global reset if CSE fail to reset */ /* global reset if CSE fail to reset */

View File

@@ -616,9 +616,10 @@ static bool cse_is_global_reset_allowed(void)
} }
/* /*
* 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; int status;
struct mkhi_hdr reply; struct mkhi_hdr reply;
@@ -644,7 +645,7 @@ int cse_request_global_reset(enum rst_req_type rst_type)
return 0; 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"); printk(BIOS_ERR, "HECI: CSE does not meet required prerequisites\n");
return 0; return 0;
} }
@@ -663,6 +664,11 @@ int cse_request_global_reset(enum rst_req_type rst_type)
return status; return status;
} }
int cse_request_global_reset(void)
{
return cse_request_reset(GLOBAL_RESET);
}
static bool cse_is_hmrfpo_enable_allowed(void) static bool cse_is_hmrfpo_enable_allowed(void)
{ {
/* /*

View File

@@ -121,12 +121,10 @@ enum rst_req_type {
}; };
/* /*
* Sends GLOBAL_RESET_REQ cmd to CSE. * Sends GLOBAL_RESET_REQ cmd to CSE with reset type GLOBAL_RESET.
* The reset type can be one of the above defined reset type.
* Returns 0 on failure and 1 on success. * 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. * Sends HMRFPO_ENABLE command.
* HMRFPO - Host ME Region Flash Protection Override. * HMRFPO - Host ME Region Flash Protection Override.

View File

@@ -11,7 +11,7 @@
void do_global_reset(void) void do_global_reset(void)
{ {
/* Ask CSE to do the global reset */ /* Ask CSE to do the global reset */
if (cse_request_global_reset(GLOBAL_RESET)) if (cse_request_global_reset())
return; return;
/* global reset if CSE fail to reset */ /* global reset if CSE fail to reset */

View File

@@ -11,7 +11,7 @@
void do_global_reset(void) void do_global_reset(void)
{ {
/* Ask CSE to do the global reset */ /* Ask CSE to do the global reset */
if (cse_request_global_reset(GLOBAL_RESET)) if (cse_request_global_reset())
return; return;
/* global reset if CSE fail to reset */ /* global reset if CSE fail to reset */

View File

@@ -11,7 +11,7 @@
void do_global_reset(void) void do_global_reset(void)
{ {
/* Ask CSE to do the global reset */ /* Ask CSE to do the global reset */
if (cse_request_global_reset(GLOBAL_RESET)) if (cse_request_global_reset())
return; return;
/* global reset if CSE fail to reset */ /* global reset if CSE fail to reset */

View File

@@ -353,7 +353,7 @@ int send_global_reset(void)
goto ret; goto ret;
/* ME should be in Normal Mode for this command */ /* ME should be in Normal Mode for this command */
status = cse_request_global_reset(GLOBAL_RESET); status = cse_request_global_reset();
ret: ret:
return status; return status;
} }

View File

@@ -11,7 +11,7 @@
void do_global_reset(void) void do_global_reset(void)
{ {
/* Ask CSE to do the global reset */ /* Ask CSE to do the global reset */
if (cse_request_global_reset(GLOBAL_RESET)) if (cse_request_global_reset())
return; return;
/* global reset if CSE fail to reset */ /* global reset if CSE fail to reset */