[PATCH 23/41] imx: ahab: Get and decode AHAB events
Peng Fan (OSS)
peng.fan at oss.nxp.com
Mon Jan 23 10:16:42 CET 2023
From: Peng Fan <peng.fan at nxp.com>
For ahab_status command, support to get and decode AHAB events
Also update code to use new macros
Signed-off-by: Ye Li <ye.li at nxp.com>
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
arch/arm/include/asm/mach-imx/ele_api.h | 114 +++++++--
arch/arm/mach-imx/ele_ahab.c | 295 +++++++++++++++++++++---
arch/arm/mach-imx/imx8ulp/rdc.c | 2 +-
arch/arm/mach-imx/imx9/trdc.c | 2 +-
drivers/misc/sentinel/ele_api.c | 28 +--
5 files changed, 384 insertions(+), 57 deletions(-)
diff --git a/arch/arm/include/asm/mach-imx/ele_api.h b/arch/arm/include/asm/mach-imx/ele_api.h
index 5dc4a20c5fd..cfcbc38a1c0 100644
--- a/arch/arm/include/asm/mach-imx/ele_api.h
+++ b/arch/arm/include/asm/mach-imx/ele_api.h
@@ -10,20 +10,106 @@
#define ELE_CMD_TAG 0x17
#define ELE_RESP_TAG 0xe1
-#define ELE_LOG_CID 0x21
-#define ELE_AUTH_OEM_CTNR_CID 0x87
-#define ELE_VERIFY_IMG_CID 0x88
-#define ELE_RELEASE_CTNR_CID 0x89
-#define ELE_WRITE_SECURE_FUSE_REQ_CID 0x91
-#define ELE_FWD_LIFECYCLE_UP_REQ_CID 0x95
-#define ELE_READ_FUSE_REQ_CID 0x97
-#define ELE_GET_FW_VERSION_CID 0x9D
-#define ELE_GET_EVENTS_REQ_CID 0xA2
-#define ELE_RELEASE_RDC_REQ_CID 0xC4
-#define ELE_GET_FW_STATUS_CID 0xC5
-#define ELE_WRITE_FUSE_REQ_CID 0xD6
-#define ELE_CAAM_RELEASE_CID 0xD7
-#define ELE_GET_INFO_CID 0xDA
+/* ELE commands */
+#define ELE_PING_REQ 0x01
+#define ELE_FW_AUTH_REQ 0x02
+#define ELE_RESTART_RST_TIMER_REQ 0x04
+#define ELE_DUMP_DEBUG_BUFFER_REQ 0x21
+#define ELE_OEM_CNTN_AUTH_REQ 0x87
+#define ELE_VERIFY_IMAGE_REQ 0x88
+#define ELE_RELEASE_CONTAINER_REQ 0x89
+#define ELE_WRITE_SECURE_FUSE_REQ 0x91
+#define ELE_FWD_LIFECYCLE_UP_REQ 0x95
+#define ELE_READ_FUSE_REQ 0x97
+#define ELE_GET_FW_VERSION_REQ 0x9D
+#define ELE_RET_LIFECYCLE_UP_REQ 0xA0
+#define ELE_GET_EVENTS_REQ 0xA2
+#define ELE_START_RNG 0xA3
+#define ELE_GENERATE_DEK_BLOB 0xAF
+#define ELE_ENABLE_PATCH_REQ 0xC3
+#define ELE_RELEASE_RDC_REQ 0xC4
+#define ELE_GET_FW_STATUS_REQ 0xC5
+#define ELE_ENABLE_OTFAD_REQ 0xC6
+#define ELE_RESET_REQ 0xC7
+#define ELE_UPDATE_OTP_CLKDIV_REQ 0xD0
+#define ELE_POWER_DOWN_REQ 0xD1
+#define ELE_ENABLE_APC_REQ 0xD2
+#define ELE_ENABLE_RTC_REQ 0xD3
+#define ELE_DEEP_POWER_DOWN_REQ 0xD4
+#define ELE_STOP_RST_TIMER_REQ 0xD5
+#define ELE_WRITE_FUSE_REQ 0xD6
+#define ELE_RELEASE_CAAM_REQ 0xD7
+#define ELE_RESET_A35_CTX_REQ 0xD8
+#define ELE_MOVE_TO_UNSECURED_REQ 0xD9
+#define ELE_GET_INFO_REQ 0xDA
+#define ELE_ATTEST_REQ 0xDB
+#define ELE_RELEASE_PATCH_REQ 0xDC
+#define ELE_OTP_SEQ_SWITH_REQ 0xDD
+
+/* ELE failure indications */
+#define ELE_ROM_PING_FAILURE_IND 0x0A
+#define ELE_FW_PING_FAILURE_IND 0x1A
+#define ELE_BAD_SIGNATURE_FAILURE_IND 0xF0
+#define ELE_BAD_HASH_FAILURE_IND 0xF1
+#define ELE_INVALID_LIFECYCLE_IND 0xF2
+#define ELE_PERMISSION_DENIED_FAILURE_IND 0xF3
+#define ELE_INVALID_MESSAGE_FAILURE_IND 0xF4
+#define ELE_BAD_VALUE_FAILURE_IND 0xF5
+#define ELE_BAD_FUSE_ID_FAILURE_IND 0xF6
+#define ELE_BAD_CONTAINER_FAILURE_IND 0xF7
+#define ELE_BAD_VERSION_FAILURE_IND 0xF8
+#define ELE_INVALID_KEY_FAILURE_IND 0xF9
+#define ELE_BAD_KEY_HASH_FAILURE_IND 0xFA
+#define ELE_NO_VALID_CONTAINER_FAILURE_IND 0xFB
+#define ELE_BAD_CERTIFICATE_FAILURE_IND 0xFC
+#define ELE_BAD_UID_FAILURE_IND 0xFD
+#define ELE_BAD_MONOTONIC_COUNTER_FAILURE_IND 0xFE
+#define ELE_MUST_SIGNED_FAILURE_IND 0xE0
+#define ELE_NO_AUTHENTICATION_FAILURE_IND 0xEE
+#define ELE_BAD_SRK_SET_FAILURE_IND 0xEF
+#define ELE_UNALIGNED_PAYLOAD_FAILURE_IND 0xA6
+#define ELE_WRONG_SIZE_FAILURE_IND 0xA7
+#define ELE_ENCRYPTION_FAILURE_IND 0xA8
+#define ELE_DECRYPTION_FAILURE_IND 0xA9
+#define ELE_OTP_PROGFAIL_FAILURE_IND 0xAA
+#define ELE_OTP_LOCKED_FAILURE_IND 0xAB
+#define ELE_OTP_INVALID_IDX_FAILURE_IND 0xAD
+#define ELE_TIME_OUT_FAILURE_IND 0xB0
+#define ELE_BAD_PAYLOAD_FAILURE_IND 0xB1
+#define ELE_WRONG_ADDRESS_FAILURE_IND 0xB4
+#define ELE_DMA_FAILURE_IND 0xB5
+#define ELE_DISABLED_FEATURE_FAILURE_IND 0xB6
+#define ELE_MUST_ATTEST_FAILURE_IND 0xB7
+#define ELE_RNG_NOT_STARTED_FAILURE_IND 0xB8
+#define ELE_CRC_ERROR_IND 0xB9
+#define ELE_AUTH_SKIPPED_OR_FAILED_FAILURE_IND 0xBB
+#define ELE_INCONSISTENT_PAR_FAILURE_IND 0xBC
+#define ELE_RNG_INST_FAILURE_FAILURE_IND 0xBD
+#define ELE_LOCKED_REG_FAILURE_IND 0xBE
+#define ELE_BAD_ID_FAILURE_IND 0xBF
+#define ELE_INVALID_OPERATION_FAILURE_IND 0xC0
+#define ELE_NON_SECURE_STATE_FAILURE_IND 0xC1
+#define ELE_MSG_TRUNCATED_IND 0xC2
+#define ELE_BAD_IMAGE_NUM_FAILURE_IND 0xC3
+#define ELE_BAD_IMAGE_ADDR_FAILURE_IND 0xC4
+#define ELE_BAD_IMAGE_PARAM_FAILURE_IND 0xC5
+#define ELE_BAD_IMAGE_TYPE_FAILURE_IND 0xC6
+#define ELE_CORRUPTED_SRK_FAILURE_IND 0xD0
+#define ELE_OUT_OF_MEMORY_IND 0xD1
+#define ELE_CSTM_FAILURE_IND 0xCF
+#define ELE_OLD_VERSION_FAILURE_IND 0xCE
+#define ELE_WRONG_BOOT_MODE_FAILURE_IND 0xCD
+#define ELE_APC_ALREADY_ENABLED_FAILURE_IND 0xCB
+#define ELE_RTC_ALREADY_ENABLED_FAILURE_IND 0xCC
+#define ELE_ABORT_IND 0xFF
+
+/* ELE IPC identifier */
+#define ELE_IPC_MU_RTD 0x1
+#define ELE_IPC_MU_APD 0x2
+
+/* ELE Status*/
+#define ELE_SUCCESS_IND 0xD6
+#define ELE_FAILURE_IND 0x29
#define S400_MAX_MSG 255U
diff --git a/arch/arm/mach-imx/ele_ahab.c b/arch/arm/mach-imx/ele_ahab.c
index 1874e326da7..79852b0b4c7 100644
--- a/arch/arm/mach-imx/ele_ahab.c
+++ b/arch/arm/mach-imx/ele_ahab.c
@@ -21,36 +21,239 @@ DECLARE_GLOBAL_DATA_PTR;
#define IMG_CONTAINER_END_BASE (IMG_CONTAINER_BASE + 0xFFFFUL)
-#define AHAB_NO_AUTHENTICATION_IND 0xee
-#define AHAB_BAD_KEY_HASH_IND 0xfa
-#define AHAB_INVALID_KEY_IND 0xf9
-#define AHAB_BAD_SIGNATURE_IND 0xf0
-#define AHAB_BAD_HASH_IND 0xf1
+#define AHAB_MAX_EVENTS 8
+
+static char *ele_ipc_str[] = {
+ "IPC = MU RTD (0x1)\n",
+ "IPC = MU APD (0x2)\n",
+ "IPC = INVALID\n",
+ NULL
+};
+
+static char *ele_status_str[] = {
+ "STA = ELE_SUCCESS_IND (0xD6)\n",
+ "STA = ELE_FAILURE_IND (0x29)\n",
+ "STA = INVALID\n",
+ NULL
+};
+
+static char *ele_cmd_str[] = {
+ "CMD = ELE_PING_REQ (0x01)\n",
+ "CMD = ELE_FW_AUTH_REQ (0x02)\n",
+ "CMD = ELE_RESTART_RST_TIMER_REQ (0x04)\n",
+ "CMD = ELE_DUMP_DEBUG_BUFFER_REQ (0x21)\n",
+ "CMD = ELE_OEM_CNTN_AUTH_REQ (0x87)\n",
+ "CMD = ELE_VERIFY_IMAGE_REQ (0x88)\n",
+ "CMD = ELE_RELEASE_CONTAINER_REQ (0x89)\n",
+ "CMD = ELE_WRITE_SECURE_FUSE_REQ (0x91)\n",
+ "CMD = ELE_FWD_LIFECYCLE_UP_REQ (0x95)\n",
+ "CMD = ELE_READ_FUSE_REQ (0x97)\n",
+ "CMD = ELE_GET_FW_VERSION_REQ (0x9D)\n",
+ "CMD = ELE_RET_LIFECYCLE_UP_REQ (0xA0)\n",
+ "CMD = ELE_GET_EVENTS_REQ (0xA2)\n",
+ "CMD = ELE_ENABLE_PATCH_REQ (0xC3)\n",
+ "CMD = ELE_RELEASE_RDC_REQ (0xC4)\n",
+ "CMD = ELE_GET_FW_STATUS_REQ (0xC5)\n",
+ "CMD = ELE_ENABLE_OTFAD_REQ (0xC6)\n",
+ "CMD = ELE_RESET_REQ (0xC7)\n",
+ "CMD = ELE_UPDATE_OTP_CLKDIV_REQ (0xD0)\n",
+ "CMD = ELE_POWER_DOWN_REQ (0xD1)\n",
+ "CMD = ELE_ENABLE_APC_REQ (0xD2)\n",
+ "CMD = ELE_ENABLE_RTC_REQ (0xD3)\n",
+ "CMD = ELE_DEEP_POWER_DOWN_REQ (0xD4)\n",
+ "CMD = ELE_STOP_RST_TIMER_REQ (0xD5)\n",
+ "CMD = ELE_WRITE_FUSE_REQ (0xD6)\n",
+ "CMD = ELE_RELEASE_CAAM_REQ (0xD7)\n",
+ "CMD = ELE_RESET_A35_CTX_REQ (0xD8)\n",
+ "CMD = ELE_MOVE_TO_UNSECURED_REQ (0xD9)\n",
+ "CMD = ELE_GET_INFO_REQ (0xDA)\n",
+ "CMD = ELE_ATTEST_REQ (0xDB)\n",
+ "CMD = ELE_RELEASE_PATCH_REQ (0xDC)\n",
+ "CMD = ELE_OTP_SEQ_SWITH_REQ (0xDD)\n",
+ "CMD = INVALID\n",
+ NULL
+};
+
+static char *ele_ind_str[] = {
+ "IND = ELE_ROM_PING_FAILURE_IND (0x0A)\n",
+ "IND = ELE_FW_PING_FAILURE_IND (0x1A)\n",
+ "IND = ELE_BAD_SIGNATURE_FAILURE_IND (0xF0)\n",
+ "IND = ELE_BAD_HASH_FAILURE_IND (0xF1)\n",
+ "IND = ELE_INVALID_LIFECYCLE_IND (0xF2)\n",
+ "IND = ELE_PERMISSION_DENIED_FAILURE_IND (0xF3)\n",
+ "IND = ELE_INVALID_MESSAGE_FAILURE_IND (0xF4)\n",
+ "IND = ELE_BAD_VALUE_FAILURE_IND (0xF5)\n",
+ "IND = ELE_BAD_FUSE_ID_FAILURE_IND (0xF6)\n",
+ "IND = ELE_BAD_CONTAINER_FAILURE_IND (0xF7)\n",
+ "IND = ELE_BAD_VERSION_FAILURE_IND (0xF8)\n",
+ "IND = ELE_INVALID_KEY_FAILURE_IND (0xF9)\n",
+ "IND = ELE_BAD_KEY_HASH_FAILURE_IND (0xFA)\n",
+ "IND = ELE_NO_VALID_CONTAINER_FAILURE_IND (0xFB)\n",
+ "IND = ELE_BAD_CERTIFICATE_FAILURE_IND (0xFC)\n",
+ "IND = ELE_BAD_UID_FAILURE_IND (0xFD)\n",
+ "IND = ELE_BAD_MONOTONIC_COUNTER_FAILURE_IND (0xFE)\n",
+ "IND = ELE_MUST_SIGNED_FAILURE_IND (0xE0)\n",
+ "IND = ELE_NO_AUTHENTICATION_FAILURE_IND (0xEE)\n",
+ "IND = ELE_BAD_SRK_SET_FAILURE_IND (0xEF)\n",
+ "IND = ELE_UNALIGNED_PAYLOAD_FAILURE_IND (0xA6)\n",
+ "IND = ELE_WRONG_SIZE_FAILURE_IND (0xA7)\n",
+ "IND = ELE_ENCRYPTION_FAILURE_IND (0xA8)\n",
+ "IND = ELE_DECRYPTION_FAILURE_IND (0xA9)\n",
+ "IND = ELE_OTP_PROGFAIL_FAILURE_IND (0xAA)\n",
+ "IND = ELE_OTP_LOCKED_FAILURE_IND (0xAB)\n",
+ "IND = ELE_OTP_INVALID_IDX_FAILURE_IND (0xAD)\n",
+ "IND = ELE_TIME_OUT_FAILURE_IND (0xB0)\n",
+ "IND = ELE_BAD_PAYLOAD_FAILURE_IND (0xB1)\n",
+ "IND = ELE_WRONG_ADDRESS_FAILURE_IND (0xB4)\n",
+ "IND = ELE_DMA_FAILURE_IND (0xB5)\n",
+ "IND = ELE_DISABLED_FEATURE_FAILURE_IND (0xB6)\n",
+ "IND = ELE_MUST_ATTEST_FAILURE_IND (0xB7)\n",
+ "IND = ELE_RNG_NOT_STARTED_FAILURE_IND (0xB8)\n",
+ "IND = ELE_CRC_ERROR_IND (0xB9)\n",
+ "IND = ELE_AUTH_SKIPPED_OR_FAILED_FAILURE_IND (0xBB)\n",
+ "IND = ELE_INCONSISTENT_PAR_FAILURE_IND (0xBC)\n",
+ "IND = ELE_RNG_INST_FAILURE_FAILURE_IND (0xBD)\n",
+ "IND = ELE_LOCKED_REG_FAILURE_IND (0xBE)\n",
+ "IND = ELE_BAD_ID_FAILURE_IND (0xBF)\n",
+ "IND = ELE_INVALID_OPERATION_FAILURE_IND (0xC0)\n",
+ "IND = ELE_NON_SECURE_STATE_FAILURE_IND (0xC1)\n",
+ "IND = ELE_MSG_TRUNCATED_IND (0xC2)\n",
+ "IND = ELE_BAD_IMAGE_NUM_FAILURE_IND (0xC3)\n",
+ "IND = ELE_BAD_IMAGE_ADDR_FAILURE_IND (0xC4)\n",
+ "IND = ELE_BAD_IMAGE_PARAM_FAILURE_IND (0xC5)\n",
+ "IND = ELE_BAD_IMAGE_TYPE_FAILURE_IND (0xC6)\n",
+ "IND = ELE_CORRUPTED_SRK_FAILURE_IND (0xD0)\n",
+ "IND = ELE_OUT_OF_MEMORY_IND (0xD1)\n",
+ "IND = ELE_CSTM_FAILURE_IND (0xCF)\n",
+ "IND = ELE_OLD_VERSION_FAILURE_IND (0xCE)\n",
+ "IND = ELE_WRONG_BOOT_MODE_FAILURE_IND (0xCD)\n",
+ "IND = ELE_APC_ALREADY_ENABLED_FAILURE_IND (0xCB)\n",
+ "IND = ELE_RTC_ALREADY_ENABLED_FAILURE_IND (0xCC)\n",
+ "IND = ELE_ABORT_IND (0xFF)\n",
+ "IND = INVALID\n",
+ NULL
+};
+
+static u8 ele_cmd[] = {
+ ELE_PING_REQ,
+ ELE_FW_AUTH_REQ,
+ ELE_RESTART_RST_TIMER_REQ,
+ ELE_DUMP_DEBUG_BUFFER_REQ,
+ ELE_OEM_CNTN_AUTH_REQ,
+ ELE_VERIFY_IMAGE_REQ,
+ ELE_RELEASE_CONTAINER_REQ,
+ ELE_WRITE_SECURE_FUSE_REQ,
+ ELE_FWD_LIFECYCLE_UP_REQ,
+ ELE_READ_FUSE_REQ,
+ ELE_GET_FW_VERSION_REQ,
+ ELE_RET_LIFECYCLE_UP_REQ,
+ ELE_GET_EVENTS_REQ,
+ ELE_ENABLE_PATCH_REQ,
+ ELE_RELEASE_RDC_REQ,
+ ELE_GET_FW_STATUS_REQ,
+ ELE_ENABLE_OTFAD_REQ,
+ ELE_RESET_REQ,
+ ELE_UPDATE_OTP_CLKDIV_REQ,
+ ELE_POWER_DOWN_REQ,
+ ELE_ENABLE_APC_REQ,
+ ELE_ENABLE_RTC_REQ,
+ ELE_DEEP_POWER_DOWN_REQ,
+ ELE_STOP_RST_TIMER_REQ,
+ ELE_WRITE_FUSE_REQ,
+ ELE_RELEASE_CAAM_REQ,
+ ELE_RESET_A35_CTX_REQ,
+ ELE_MOVE_TO_UNSECURED_REQ,
+ ELE_GET_INFO_REQ,
+ ELE_ATTEST_REQ,
+ ELE_RELEASE_PATCH_REQ,
+ ELE_OTP_SEQ_SWITH_REQ
+};
+
+static u8 ele_ind[] = {
+ ELE_ROM_PING_FAILURE_IND,
+ ELE_FW_PING_FAILURE_IND,
+ ELE_BAD_SIGNATURE_FAILURE_IND,
+ ELE_BAD_HASH_FAILURE_IND,
+ ELE_INVALID_LIFECYCLE_IND,
+ ELE_PERMISSION_DENIED_FAILURE_IND,
+ ELE_INVALID_MESSAGE_FAILURE_IND,
+ ELE_BAD_VALUE_FAILURE_IND,
+ ELE_BAD_FUSE_ID_FAILURE_IND,
+ ELE_BAD_CONTAINER_FAILURE_IND,
+ ELE_BAD_VERSION_FAILURE_IND,
+ ELE_INVALID_KEY_FAILURE_IND,
+ ELE_BAD_KEY_HASH_FAILURE_IND,
+ ELE_NO_VALID_CONTAINER_FAILURE_IND,
+ ELE_BAD_CERTIFICATE_FAILURE_IND,
+ ELE_BAD_UID_FAILURE_IND,
+ ELE_BAD_MONOTONIC_COUNTER_FAILURE_IND,
+ ELE_MUST_SIGNED_FAILURE_IND,
+ ELE_NO_AUTHENTICATION_FAILURE_IND,
+ ELE_BAD_SRK_SET_FAILURE_IND,
+ ELE_UNALIGNED_PAYLOAD_FAILURE_IND,
+ ELE_WRONG_SIZE_FAILURE_IND,
+ ELE_ENCRYPTION_FAILURE_IND,
+ ELE_DECRYPTION_FAILURE_IND,
+ ELE_OTP_PROGFAIL_FAILURE_IND,
+ ELE_OTP_LOCKED_FAILURE_IND,
+ ELE_OTP_INVALID_IDX_FAILURE_IND,
+ ELE_TIME_OUT_FAILURE_IND,
+ ELE_BAD_PAYLOAD_FAILURE_IND,
+ ELE_WRONG_ADDRESS_FAILURE_IND,
+ ELE_DMA_FAILURE_IND,
+ ELE_DISABLED_FEATURE_FAILURE_IND,
+ ELE_MUST_ATTEST_FAILURE_IND,
+ ELE_RNG_NOT_STARTED_FAILURE_IND,
+ ELE_CRC_ERROR_IND,
+ ELE_AUTH_SKIPPED_OR_FAILED_FAILURE_IND,
+ ELE_INCONSISTENT_PAR_FAILURE_IND,
+ ELE_RNG_INST_FAILURE_FAILURE_IND,
+ ELE_LOCKED_REG_FAILURE_IND,
+ ELE_BAD_ID_FAILURE_IND,
+ ELE_INVALID_OPERATION_FAILURE_IND,
+ ELE_NON_SECURE_STATE_FAILURE_IND,
+ ELE_MSG_TRUNCATED_IND,
+ ELE_BAD_IMAGE_NUM_FAILURE_IND,
+ ELE_BAD_IMAGE_ADDR_FAILURE_IND,
+ ELE_BAD_IMAGE_PARAM_FAILURE_IND,
+ ELE_BAD_IMAGE_TYPE_FAILURE_IND,
+ ELE_CORRUPTED_SRK_FAILURE_IND,
+ ELE_OUT_OF_MEMORY_IND,
+ ELE_CSTM_FAILURE_IND,
+ ELE_OLD_VERSION_FAILURE_IND,
+ ELE_WRONG_BOOT_MODE_FAILURE_IND,
+ ELE_APC_ALREADY_ENABLED_FAILURE_IND,
+ ELE_RTC_ALREADY_ENABLED_FAILURE_IND,
+ ELE_ABORT_IND
+};
+
+static u8 ele_ipc[] = {
+ ELE_IPC_MU_RTD,
+ ELE_IPC_MU_APD
+};
+
+static u8 ele_status[] = {
+ ELE_SUCCESS_IND,
+ ELE_FAILURE_IND
+};
+
+static inline u32 get_idx(u8 *list, u8 tgt, u32 size)
+{
+ u32 i;
+
+ for (i = 0; i < size; i++) {
+ if (list[i] == tgt)
+ return i;
+ }
+
+ return i; /* last str is invalid */
+}
static void display_ahab_auth_ind(u32 event)
{
u8 resp_ind = (event >> 8) & 0xff;
- switch (resp_ind) {
- case AHAB_NO_AUTHENTICATION_IND:
- printf("AHAB_NO_AUTHENTICATION_IND (0x%02X)\n\n", resp_ind);
- break;
- case AHAB_BAD_KEY_HASH_IND:
- printf("AHAB_BAD_KEY_HASH_IND (0x%02X)\n\n", resp_ind);
- break;
- case AHAB_INVALID_KEY_IND:
- printf("AHAB_INVALID_KEY_IND (0x%02X)\n\n", resp_ind);
- break;
- case AHAB_BAD_SIGNATURE_IND:
- printf("AHAB_BAD_SIGNATURE_IND (0x%02X)\n\n", resp_ind);
- break;
- case AHAB_BAD_HASH_IND:
- printf("AHAB_BAD_HASH_IND (0x%02X)\n\n", resp_ind);
- break;
- default:
- printf("Unknown Indicator (0x%02X)\n\n", resp_ind);
- break;
- }
+ printf("%s\n", ele_ind_str[get_idx(ele_ind, resp_ind, ARRAY_SIZE(ele_ind))]);
}
int ahab_auth_cntr_hdr(struct container_hdr *container, u16 length)
@@ -271,10 +474,20 @@ static int do_ahab_close(struct cmd_tbl *cmdtp, int flag, int argc,
{
int err;
u32 resp;
+ u32 lc;
if (!confirm_close())
return -EACCES;
+ lc = readl(FSB_BASE_ADDR + 0x41c);
+ lc &= 0x3ff;
+
+ if (lc != 0x8) {
+ puts("Current lifecycle is NOT OEM open, can't move to OEM closed\n");
+ display_life_cycle(lc);
+ return -EPERM;
+ }
+
err = ele_forward_lifecycle(8, &resp);
if (err != 0) {
printf("Error in forward lifecycle to OEM closed\n");
@@ -312,14 +525,42 @@ static int do_ahab_dump(struct cmd_tbl *cmdtp, int flag, int argc, char *const a
return ahab_dump();
}
-static int do_ahab_status(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+static void display_event(u32 event)
{
- u32 lc;
+ printf("\n\t0x%08x\n", event);
+ printf("\t%s", ele_ipc_str[get_idx(ele_ipc, (event >> 24) & 0xff, ARRAY_SIZE(ele_ipc))]);
+ printf("\t%s", ele_cmd_str[get_idx(ele_cmd, (event >> 16) & 0xff, ARRAY_SIZE(ele_cmd))]);
+ printf("\t%s", ele_ind_str[get_idx(ele_ind, (event >> 8) & 0xff, ARRAY_SIZE(ele_ind))]);
+ printf("\t%s", ele_status_str[get_idx(ele_status, event & 0xff, ARRAY_SIZE(ele_status))]);
+}
+
+static int do_ahab_status(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ u32 lc, i;
+ u32 events[AHAB_MAX_EVENTS];
+ u32 cnt = AHAB_MAX_EVENTS;
+ int ret;
lc = readl(FSB_BASE_ADDR + 0x41c);
lc &= 0x3ff;
display_life_cycle(lc);
+
+ ret = ele_get_events(events, &cnt, NULL);
+ if (ret) {
+ printf("Get ELE EVENTS error %d\n", ret);
+ return CMD_RET_FAILURE;
+ }
+
+ if (!cnt) {
+ puts("\n\tNo Events Found!\n");
+ return 0;
+ }
+
+ for (i = 0; i < cnt; i++)
+ display_event(events[i]);
+
return 0;
}
diff --git a/arch/arm/mach-imx/imx8ulp/rdc.c b/arch/arm/mach-imx/imx8ulp/rdc.c
index 954a2d08ec6..fa6e33d5fcb 100644
--- a/arch/arm/mach-imx/imx8ulp/rdc.c
+++ b/arch/arm/mach-imx/imx8ulp/rdc.c
@@ -191,7 +191,7 @@ int release_rdc(enum rdc_type type)
msg.version = ELE_VERSION;
msg.tag = ELE_CMD_TAG;
msg.size = 2;
- msg.command = ELE_RELEASE_RDC_REQ_CID;
+ msg.command = ELE_RELEASE_RDC_REQ;
msg.data[0] = (rdc_id << 8) | 0x2; /* A35 XRDC */
mu_hal_init(s_mu_base);
diff --git a/arch/arm/mach-imx/imx9/trdc.c b/arch/arm/mach-imx/imx9/trdc.c
index 938fe78eec6..3d59af96126 100644
--- a/arch/arm/mach-imx/imx9/trdc.c
+++ b/arch/arm/mach-imx/imx9/trdc.c
@@ -339,7 +339,7 @@ int release_rdc(u8 xrdc)
msg.version = ELE_VERSION;
msg.tag = ELE_CMD_TAG;
msg.size = 2;
- msg.command = ELE_RELEASE_RDC_REQ_CID;
+ msg.command = ELE_RELEASE_RDC_REQ;
msg.data[0] = (rdc_id << 8) | 0x2; /* A55 */
mu_hal_init(s_mu_base);
diff --git a/drivers/misc/sentinel/ele_api.c b/drivers/misc/sentinel/ele_api.c
index 1e0640d192b..7a4e1b7823b 100644
--- a/drivers/misc/sentinel/ele_api.c
+++ b/drivers/misc/sentinel/ele_api.c
@@ -29,7 +29,7 @@ int ele_release_rdc(u8 core_id, u8 xrdc, u32 *response)
msg.version = ELE_VERSION;
msg.tag = ELE_CMD_TAG;
msg.size = 2;
- msg.command = ELE_RELEASE_RDC_REQ_CID;
+ msg.command = ELE_RELEASE_RDC_REQ;
switch (xrdc) {
case 0:
msg.data[0] = (0x74 << 8) | core_id;
@@ -74,7 +74,7 @@ int ele_auth_oem_ctnr(ulong ctnr_addr, u32 *response)
msg.version = ELE_VERSION;
msg.tag = ELE_CMD_TAG;
msg.size = 3;
- msg.command = ELE_AUTH_OEM_CTNR_CID;
+ msg.command = ELE_OEM_CNTN_AUTH_REQ;
msg.data[0] = upper_32_bits(ctnr_addr);
msg.data[1] = lower_32_bits(ctnr_addr);
@@ -104,7 +104,7 @@ int ele_release_container(u32 *response)
msg.version = ELE_VERSION;
msg.tag = ELE_CMD_TAG;
msg.size = 1;
- msg.command = ELE_RELEASE_CTNR_CID;
+ msg.command = ELE_RELEASE_CONTAINER_REQ;
ret = misc_call(dev, false, &msg, size, &msg, size);
if (ret)
@@ -132,7 +132,7 @@ int ele_verify_image(u32 img_id, u32 *response)
msg.version = ELE_VERSION;
msg.tag = ELE_CMD_TAG;
msg.size = 2;
- msg.command = ELE_VERIFY_IMG_CID;
+ msg.command = ELE_VERIFY_IMAGE_REQ;
msg.data[0] = 1 << img_id;
ret = misc_call(dev, false, &msg, size, &msg, size);
@@ -161,7 +161,7 @@ int ele_forward_lifecycle(u16 life_cycle, u32 *response)
msg.version = ELE_VERSION;
msg.tag = ELE_CMD_TAG;
msg.size = 2;
- msg.command = ELE_FWD_LIFECYCLE_UP_REQ_CID;
+ msg.command = ELE_FWD_LIFECYCLE_UP_REQ;
msg.data[0] = life_cycle;
ret = misc_call(dev, false, &msg, size, &msg, size);
@@ -201,7 +201,7 @@ int ele_read_common_fuse(u16 fuse_id, u32 *fuse_words, u32 fuse_num, u32 *respon
msg.version = ELE_VERSION;
msg.tag = ELE_CMD_TAG;
msg.size = 2;
- msg.command = ELE_READ_FUSE_REQ_CID;
+ msg.command = ELE_READ_FUSE_REQ;
msg.data[0] = fuse_id;
ret = misc_call(dev, false, &msg, size, &msg, size);
@@ -238,7 +238,7 @@ int ele_write_fuse(u16 fuse_id, u32 fuse_val, bool lock, u32 *response)
msg.version = ELE_VERSION;
msg.tag = ELE_CMD_TAG;
msg.size = 3;
- msg.command = ELE_WRITE_FUSE_REQ_CID;
+ msg.command = ELE_WRITE_FUSE_REQ;
msg.data[0] = (32 << 16) | (fuse_id << 5);
if (lock)
msg.data[0] |= (1 << 31);
@@ -271,7 +271,7 @@ int ele_release_caam(u32 core_did, u32 *response)
msg.version = ELE_VERSION;
msg.tag = ELE_CMD_TAG;
msg.size = 2;
- msg.command = ELE_CAAM_RELEASE_CID;
+ msg.command = ELE_RELEASE_CAAM_REQ;
msg.data[0] = core_did;
ret = misc_call(dev, false, &msg, size, &msg, size);
@@ -310,7 +310,7 @@ int ele_get_fw_version(u32 *fw_version, u32 *sha1, u32 *response)
msg.version = ELE_VERSION;
msg.tag = ELE_CMD_TAG;
msg.size = 1;
- msg.command = ELE_GET_FW_VERSION_CID;
+ msg.command = ELE_GET_FW_VERSION_REQ;
ret = misc_call(dev, false, &msg, size, &msg, size);
if (ret)
@@ -341,7 +341,7 @@ int ele_dump_buffer(u32 *buffer, u32 buffer_length)
msg.version = ELE_VERSION;
msg.tag = ELE_CMD_TAG;
msg.size = 1;
- msg.command = ELE_LOG_CID;
+ msg.command = ELE_DUMP_DEBUG_BUFFER_REQ;
ret = misc_call(dev, false, &msg, size, &msg, size);
if (ret) {
@@ -375,7 +375,7 @@ int ele_get_info(struct ele_get_info_data *info, u32 *response)
msg.version = ELE_VERSION;
msg.tag = ELE_CMD_TAG;
msg.size = 4;
- msg.command = ELE_GET_INFO_CID;
+ msg.command = ELE_GET_INFO_REQ;
msg.data[0] = upper_32_bits((ulong)info);
msg.data[1] = lower_32_bits((ulong)info);
msg.data[2] = sizeof(struct ele_get_info_data);
@@ -406,7 +406,7 @@ int ele_get_fw_status(u32 *status, u32 *response)
msg.version = ELE_VERSION;
msg.tag = ELE_CMD_TAG;
msg.size = 1;
- msg.command = ELE_GET_FW_STATUS_CID;
+ msg.command = ELE_GET_FW_STATUS_REQ;
ret = misc_call(dev, false, &msg, size, &msg, size);
if (ret)
@@ -436,7 +436,7 @@ int ele_release_m33_trout(void)
msg.version = ELE_VERSION;
msg.tag = ELE_CMD_TAG;
msg.size = 1;
- msg.command = 0xd3;
+ msg.command = ELE_ENABLE_RTC_REQ;
ret = misc_call(dev, false, &msg, size, &msg, size);
if (ret)
@@ -467,7 +467,7 @@ int ele_get_events(u32 *events, u32 *events_cnt, u32 *response)
msg.version = ELE_VERSION;
msg.tag = ELE_CMD_TAG;
msg.size = 1;
- msg.command = ELE_GET_EVENTS_REQ_CID;
+ msg.command = ELE_GET_EVENTS_REQ;
ret = misc_call(dev, false, &msg, size, &msg, size);
if (ret)
--
2.36.0
More information about the U-Boot
mailing list