soc/intel/common/cse: Add consistent HECI command id/group id naming

Below changes are done:
1. Consistent HECI command/group ID naming.
2. Rename macros to match with Intel ME BIOS Spec.
3. Move command ids, group ids and related macros into cse.h
4. Add description for structure members.

TEST=Build and Boot hatch board.

Change-Id: Ia902095483d5badf778d0c1faa6bf8cc431f0e50
Signed-off-by: Sridhar Siricilla <sridhar.siricilla@intel.com>
Signed-off-by: Rizwan Qureshi <rizwan.qureshi@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/38247
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
diff --git a/src/soc/intel/common/block/cse/cse.c b/src/soc/intel/common/block/cse/cse.c
index 74a0020..0f50cc1 100644
--- a/src/soc/intel/common/block/cse/cse.c
+++ b/src/soc/intel/common/block/cse/cse.c
@@ -67,25 +67,6 @@
 #define MEI_HDR_CSE_ADDR_START	0
 #define MEI_HDR_CSE_ADDR	(((1 << 8) - 1) << MEI_HDR_CSE_ADDR_START)
 
-#define HECI_OP_MODE_SEC_OVERRIDE 5
-
-/* Global Reset Command ID */
-#define MKHI_GLOBAL_RESET_REQ	0xb
-#define MKHI_GROUP_ID_CBM	0
-
-/* RST Origin */
-#define GR_ORIGIN_BIOS_POST	2
-
-#define MKHI_HMRFPO_GROUP_ID	5
-
-/* HMRFPO Command Ids */
-#define MKHI_HMRFPO_ENABLE	1
-#define MKHI_HMRFPO_GET_STATUS	3
-
-#define ME_HFS_CWS_NORMAL	5
-#define ME_HFS_MODE_NORMAL	0
-#define ME_HFS_TEMP_DISABLE	3
-
 static struct cse_device {
 	uintptr_t sec_bar;
 } cse;
@@ -258,14 +239,14 @@
 }
 
 /*
- * Checks if CSE is in SEC_OVERRIDE operation mode. This is the mode where
+ * Checks if CSE is in ME_HFS1_COM_SECOVER_MEI_MSG operation mode. This is the mode where
  * CSE will allow reflashing of CSE region.
  */
 static uint8_t check_cse_sec_override_mode(void)
 {
 	union me_hfsts1 hfs1;
 	hfs1.data = me_read_config32(PCI_ME_HFSTS1);
-	if (hfs1.fields.operation_mode == HECI_OP_MODE_SEC_OVERRIDE)
+	if (hfs1.fields.operation_mode == ME_HFS1_COM_SECOVER_MEI_MSG)
 		return 1;
 	return 0;
 }
@@ -591,7 +572,7 @@
 	struct reset_message msg = {
 		.hdr = {
 			.group_id = MKHI_GROUP_ID_CBM,
-			.command = MKHI_GLOBAL_RESET_REQ,
+			.command = MKHI_CBM_GLOBAL_RESET_REQ,
 		},
 		.req_origin = GR_ORIGIN_BIOS_POST,
 		.reset_type = rst_type
@@ -632,7 +613,7 @@
 	/* HMRFPO Enable message */
 	struct hmrfpo_enable_msg msg = {
 		.hdr = {
-			.group_id = MKHI_HMRFPO_GROUP_ID,
+			.group_id = MKHI_GROUP_ID_HMRFPO,
 			.command = MKHI_HMRFPO_ENABLE,
 		},
 		.nonce = {0},
@@ -641,7 +622,9 @@
 	/* HMRFPO Enable response */
 	struct hmrfpo_enable_resp {
 		struct mkhi_hdr hdr;
+		/* Base addr for factory data area, not relevant for client SKUs */
 		uint32_t fct_base;
+		/* Length of factory data area, not relevant for client SKUs */
 		uint32_t fct_limit;
 		uint8_t status;
 		uint8_t padding[3];
@@ -658,9 +641,9 @@
 	 * - Working state is normal and
 	 * - Operation mode is normal or temporary disable mode.
 	 */
-	if (hfs1.fields.working_state != ME_HFS_CWS_NORMAL ||
-		(hfs1.fields.operation_mode != ME_HFS_MODE_NORMAL &&
-		hfs1.fields.operation_mode != ME_HFS_TEMP_DISABLE)) {
+	if (hfs1.fields.working_state != ME_HFS1_CWS_NORMAL ||
+		(hfs1.fields.operation_mode != ME_HFS1_COM_NORMAL &&
+		hfs1.fields.operation_mode != ME_HFS1_COM_SOFT_TEMP_DISABLE)) {
 		printk(BIOS_ERR, "HECI: ME not in required Mode\n");
 		goto failed;
 	}
@@ -697,7 +680,7 @@
 
 	struct hmrfpo_get_status_msg msg = {
 		.hdr = {
-			.group_id = MKHI_HMRFPO_GROUP_ID,
+			.group_id = MKHI_GROUP_ID_HMRFPO,
 			.command = MKHI_HMRFPO_GET_STATUS,
 		},
 	};