Hello Rizwan Qureshi,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/35228
to review the following change.
Change subject: src/soc/intel/(cnl,skl,icl): Remove, and call send_heci_reset_message() defined in common code ......................................................................
src/soc/intel/(cnl,skl,icl): Remove, and call send_heci_reset_message() defined in common code
Removed send_heci_reset_message() from socs(cnl/skl/icl), and made changes to call function send_heci_reset_req_message() defined in the common code.
Change-Id: I691fc0610356ef1f64ffa7cc4fe7a39b1344cc16 Signed-off-by: Rizwan Qureshi rizwan.qureshi@intel.com Signed-off-by: sridhar sridhar.siricilla@intel.com --- M src/soc/intel/cannonlake/reset.c M src/soc/intel/icelake/reset.c M src/soc/intel/skylake/include/soc/me.h M src/soc/intel/skylake/me.c 4 files changed, 3 insertions(+), 166 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/35228/1
diff --git a/src/soc/intel/cannonlake/reset.c b/src/soc/intel/cannonlake/reset.c index e92396f3..e01c22c 100644 --- a/src/soc/intel/cannonlake/reset.c +++ b/src/soc/intel/cannonlake/reset.c @@ -22,65 +22,10 @@ #include <string.h> #include <soc/pci_devs.h>
-/* Reset Request */ -#define MKHI_GLOBAL_RESET 0x0b -#define MKHI_STATUS_SUCCESS 0 - -#define GR_ORIGIN_BIOS_MEM_INIT 0x01 -#define GR_ORIGIN_BIOS_POST 0x02 -#define GR_ORIGIN_MEBX 0x03 - -#define GLOBAL_RST_TYPE 0x01 - -#define BIOS_HOST_ADD 0x00 -#define HECI_MKHI_ADD 0x07 - -static int send_heci_reset_message(void) -{ - int status; - struct reset_reply { - u8 group_id; - u8 command; - u8 reserved; - u8 result; - } __packed reply; - struct reset_message { - u8 group_id; - u8 cmd; - u8 reserved; - u8 result; - u8 req_origin; - u8 reset_type; - } __packed; - struct reset_message msg = { - .cmd = MKHI_GLOBAL_RESET, - .req_origin = GR_ORIGIN_BIOS_POST, - .reset_type = GLOBAL_RST_TYPE - }; - size_t reply_size; - - heci_reset(); - - status = heci_send(&msg, sizeof(msg), BIOS_HOST_ADD, HECI_MKHI_ADD); - if (status != 1) - return -1; - - reply_size = sizeof(reply); - memset(&reply, 0, reply_size); - if (!heci_receive(&reply, &reply_size)) - return -1; - if (reply.result != MKHI_STATUS_SUCCESS) { - printk(BIOS_DEBUG, "Returned Mkhi Status is not success!\n"); - return -1; - } - printk(BIOS_DEBUG, "Heci receive success!\n"); - return 0; -} - void do_global_reset(void) { /* Ask CSE to do the global reset */ - if (!send_heci_reset_message()) + if (!send_heci_reset_req_message(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 470b5f4..d83b3ee 100644 --- a/src/soc/intel/icelake/reset.c +++ b/src/soc/intel/icelake/reset.c @@ -22,65 +22,10 @@ #include <string.h> #include <soc/pci_devs.h>
-/* Reset Request */ -#define MKHI_GLOBAL_RESET 0x0b -#define MKHI_STATUS_SUCCESS 0 - -#define GR_ORIGIN_BIOS_MEM_INIT 0x01 -#define GR_ORIGIN_BIOS_POST 0x02 -#define GR_ORIGIN_MEBX 0x03 - -#define GLOBAL_RST_TYPE 0x01 - -#define BIOS_HOST_ADD 0x00 -#define HECI_MKHI_ADD 0x07 - -static int send_heci_reset_message(void) -{ - int status; - struct reset_reply { - u8 group_id; - u8 command; - u8 reserved; - u8 result; - } __packed reply; - struct reset_message { - u8 group_id; - u8 cmd; - u8 reserved; - u8 result; - u8 req_origin; - u8 reset_type; - } __packed; - struct reset_message msg = { - .cmd = MKHI_GLOBAL_RESET, - .req_origin = GR_ORIGIN_BIOS_POST, - .reset_type = GLOBAL_RST_TYPE - }; - size_t reply_size; - - heci_reset(); - - status = heci_send(&msg, sizeof(msg), BIOS_HOST_ADD, HECI_MKHI_ADD); - if (status != 1) - return -1; - - reply_size = sizeof(reply); - memset(&reply, 0, reply_size); - if (!heci_receive(&reply, &reply_size)) - return -1; - if (reply.result != MKHI_STATUS_SUCCESS) { - printk(BIOS_DEBUG, "Returned Mkhi Status is not success!\n"); - return -1; - } - printk(BIOS_DEBUG, "Heci receive success!\n"); - return 0; -} - void do_global_reset(void) { /* Ask CSE to do the global reset */ - if (!send_heci_reset_message()) + if (!send_heci_reset_req_message(GLOBAL_RESET)) return;
/* global reset if CSE fail to reset */ diff --git a/src/soc/intel/skylake/include/soc/me.h b/src/soc/intel/skylake/include/soc/me.h index fbe5033..bec54d8 100644 --- a/src/soc/intel/skylake/include/soc/me.h +++ b/src/soc/intel/skylake/include/soc/me.h @@ -197,17 +197,8 @@
#define MKHI_GEN_GROUP_ID 0xff
-/* Reset Request */ -#define MKHI_GLOBAL_RESET 0x0b - #define MKHI_GET_FW_VERSION 0x02
-#define GR_ORIGIN_BIOS_MEM_INIT 0x01 -#define GR_ORIGIN_BIOS_POST 0x02 -#define GR_ORIGIN_MEBX 0x03 - -#define GLOBAL_RST_TYPE 0x01 - #define BIOS_HOST_ADD 0x00 #define HECI_MKHI_ADD 0x07
diff --git a/src/soc/intel/skylake/me.c b/src/soc/intel/skylake/me.c index e8d75e3..fde4b13 100644 --- a/src/soc/intel/skylake/me.c +++ b/src/soc/intel/skylake/me.c @@ -431,50 +431,6 @@ } }
-static int send_heci_reset_message(void) -{ - int status; - struct reset_reply { - u8 group_id; - u8 command; - u8 reserved; - u8 result; - } __packed reply; - struct reset_message { - u8 group_id; - u8 cmd; - u8 reserved; - u8 result; - u8 req_origin; - u8 reset_type; - } __packed; - struct reset_message msg = { - .cmd = MKHI_GLOBAL_RESET, - .req_origin = GR_ORIGIN_BIOS_POST, - .reset_type = GLOBAL_RST_TYPE - }; - size_t reply_size; - - heci_reset(); - - status = heci_send(&msg, sizeof(msg), BIOS_HOST_ADD, HECI_MKHI_ADD); - if (!status) - return -1; - - reply_size = sizeof(reply); - memset(&reply, 0, reply_size); - status = heci_receive(&reply, &reply_size); - if (!status) - return -1; - /* get reply result from HECI MSG */ - if (reply.result) { - printk(BIOS_DEBUG, "%s: Exit with Failure\n", __func__); - return -1; - } - printk(BIOS_DEBUG, "%s: Exit with Success\n", __func__); - return 0; -} - int send_global_reset(void) { int status = -1; @@ -486,7 +442,7 @@ goto ret;
/* ME should be in Normal Mode for this command */ - status = send_heci_reset_message(); + status = send_heci_reset_req_message(GLOBAL_RESET); ret: return status; }