Loading drivers/firmware/qcom/tz_log.c +97 −20 Original line number Diff line number Diff line Loading @@ -53,6 +53,10 @@ * Length of descriptive name associated with Interrupt */ #define TZBSP_MAX_INT_DESC 16 /* * TZ 3.X version info */ #define QSEE_VERSION_TZ_3_X 0x800000 /* * VMID Table */ Loading @@ -71,6 +75,19 @@ struct tzdbg_boot_info_t { uint32_t warm_jmp_addr; /* Last Warmboot Jump Address */ uint32_t spare; /* Reserved for future use. */ }; /* * Boot Info Table for 64-bit */ struct tzdbg_boot_info64_t { uint32_t wb_entry_cnt; /* Warmboot entry CPU Counter */ uint32_t wb_exit_cnt; /* Warmboot exit CPU Counter */ uint32_t pc_entry_cnt; /* Power Collapse entry CPU Counter */ uint32_t pc_exit_cnt; /* Power Collapse exit CPU counter */ uint32_t psci_entry_cnt;/* PSCI syscall entry CPU Counter */ uint32_t psci_exit_cnt; /* PSCI syscall exit CPU Counter */ uint64_t warm_jmp_addr; /* Last Warmboot Jump Address */ uint32_t warm_jmp_instr; /* Last Warmboot Jump Address Instruction */ }; /* * Reset Info Table */ Loading Loading @@ -318,12 +335,69 @@ static int _disp_tz_boot_stats(void) { int i; int len = 0; struct tzdbg_boot_info_t *ptr; struct tzdbg_boot_info_t *ptr = NULL; struct tzdbg_boot_info64_t *ptr_64 = NULL; int ret = 0; uint32_t smc_id = 0; uint32_t feature = 10; struct qseecom_command_scm_resp resp = {}; struct scm_desc desc = {0}; ptr = (struct tzdbg_boot_info_t *)((unsigned char *)tzdbg.diag_buf + tzdbg.diag_buf->boot_info_off); if (!is_scm_armv8()) { ret = scm_call(SCM_SVC_INFO, SCM_SVC_UTIL, &feature, sizeof(feature), &resp, sizeof(resp)); } else { smc_id = TZ_INFO_GET_FEATURE_VERSION_ID; desc.arginfo = TZ_INFO_GET_FEATURE_VERSION_ID_PARAM_ID; desc.args[0] = feature; ret = scm_call2(smc_id, &desc); resp.result = desc.ret[0]; } if (ret) { pr_err("%s: scm_call to register log buffer failed\n", __func__); return 0; } pr_info("qsee_version = 0x%x\n", resp.result); if (resp.result >= QSEE_VERSION_TZ_3_X) { ptr_64 = (struct tzdbg_boot_info64_t *)((unsigned char *) tzdbg.diag_buf + tzdbg.diag_buf->boot_info_off); } else { ptr = (struct tzdbg_boot_info_t *)((unsigned char *) tzdbg.diag_buf + tzdbg.diag_buf->boot_info_off); } for (i = 0; i < tzdbg.diag_buf->cpu_count; i++) { if (resp.result >= QSEE_VERSION_TZ_3_X) { len += snprintf(tzdbg.disp_buf + len, (debug_rw_buf_size - 1) - len, " CPU #: %d\n" " Warmboot jump address : 0x%llx\n" " Warmboot entry CPU counter : 0x%x\n" " Warmboot exit CPU counter : 0x%x\n" " Power Collapse entry CPU counter : 0x%x\n" " Power Collapse exit CPU counter : 0x%x\n" " Psci entry CPU counter : 0x%x\n" " Psci exit CPU counter : 0x%x\n" " Warmboot Jump Address Instruction : 0x%x\n", i, (uint64_t)ptr_64->warm_jmp_addr, ptr_64->wb_entry_cnt, ptr_64->wb_exit_cnt, ptr_64->pc_entry_cnt, ptr_64->pc_exit_cnt, ptr_64->psci_entry_cnt, ptr_64->psci_exit_cnt, ptr_64->warm_jmp_instr); if (len > (debug_rw_buf_size - 1)) { pr_warn("%s: Cannot fit all info into the buffer\n", __func__); break; } ptr_64++; } else { len += snprintf(tzdbg.disp_buf + len, (debug_rw_buf_size - 1) - len, " CPU #: %d\n" Loading @@ -332,8 +406,10 @@ static int _disp_tz_boot_stats(void) " Warmboot exit CPU counter : 0x%x\n" " Power Collapse entry CPU counter: 0x%x\n" " Power Collapse exit CPU counter : 0x%x\n", i, ptr->warm_jmp_addr, ptr->wb_entry_cnt, ptr->wb_exit_cnt, ptr->pc_entry_cnt, i, ptr->warm_jmp_addr, ptr->wb_entry_cnt, ptr->wb_exit_cnt, ptr->pc_entry_cnt, ptr->pc_exit_cnt); if (len > (debug_rw_buf_size - 1)) { Loading @@ -343,6 +419,7 @@ static int _disp_tz_boot_stats(void) } ptr++; } } tzdbg.stat[TZDBG_BOOT].data = tzdbg.disp_buf; return len; } Loading Loading
drivers/firmware/qcom/tz_log.c +97 −20 Original line number Diff line number Diff line Loading @@ -53,6 +53,10 @@ * Length of descriptive name associated with Interrupt */ #define TZBSP_MAX_INT_DESC 16 /* * TZ 3.X version info */ #define QSEE_VERSION_TZ_3_X 0x800000 /* * VMID Table */ Loading @@ -71,6 +75,19 @@ struct tzdbg_boot_info_t { uint32_t warm_jmp_addr; /* Last Warmboot Jump Address */ uint32_t spare; /* Reserved for future use. */ }; /* * Boot Info Table for 64-bit */ struct tzdbg_boot_info64_t { uint32_t wb_entry_cnt; /* Warmboot entry CPU Counter */ uint32_t wb_exit_cnt; /* Warmboot exit CPU Counter */ uint32_t pc_entry_cnt; /* Power Collapse entry CPU Counter */ uint32_t pc_exit_cnt; /* Power Collapse exit CPU counter */ uint32_t psci_entry_cnt;/* PSCI syscall entry CPU Counter */ uint32_t psci_exit_cnt; /* PSCI syscall exit CPU Counter */ uint64_t warm_jmp_addr; /* Last Warmboot Jump Address */ uint32_t warm_jmp_instr; /* Last Warmboot Jump Address Instruction */ }; /* * Reset Info Table */ Loading Loading @@ -318,12 +335,69 @@ static int _disp_tz_boot_stats(void) { int i; int len = 0; struct tzdbg_boot_info_t *ptr; struct tzdbg_boot_info_t *ptr = NULL; struct tzdbg_boot_info64_t *ptr_64 = NULL; int ret = 0; uint32_t smc_id = 0; uint32_t feature = 10; struct qseecom_command_scm_resp resp = {}; struct scm_desc desc = {0}; ptr = (struct tzdbg_boot_info_t *)((unsigned char *)tzdbg.diag_buf + tzdbg.diag_buf->boot_info_off); if (!is_scm_armv8()) { ret = scm_call(SCM_SVC_INFO, SCM_SVC_UTIL, &feature, sizeof(feature), &resp, sizeof(resp)); } else { smc_id = TZ_INFO_GET_FEATURE_VERSION_ID; desc.arginfo = TZ_INFO_GET_FEATURE_VERSION_ID_PARAM_ID; desc.args[0] = feature; ret = scm_call2(smc_id, &desc); resp.result = desc.ret[0]; } if (ret) { pr_err("%s: scm_call to register log buffer failed\n", __func__); return 0; } pr_info("qsee_version = 0x%x\n", resp.result); if (resp.result >= QSEE_VERSION_TZ_3_X) { ptr_64 = (struct tzdbg_boot_info64_t *)((unsigned char *) tzdbg.diag_buf + tzdbg.diag_buf->boot_info_off); } else { ptr = (struct tzdbg_boot_info_t *)((unsigned char *) tzdbg.diag_buf + tzdbg.diag_buf->boot_info_off); } for (i = 0; i < tzdbg.diag_buf->cpu_count; i++) { if (resp.result >= QSEE_VERSION_TZ_3_X) { len += snprintf(tzdbg.disp_buf + len, (debug_rw_buf_size - 1) - len, " CPU #: %d\n" " Warmboot jump address : 0x%llx\n" " Warmboot entry CPU counter : 0x%x\n" " Warmboot exit CPU counter : 0x%x\n" " Power Collapse entry CPU counter : 0x%x\n" " Power Collapse exit CPU counter : 0x%x\n" " Psci entry CPU counter : 0x%x\n" " Psci exit CPU counter : 0x%x\n" " Warmboot Jump Address Instruction : 0x%x\n", i, (uint64_t)ptr_64->warm_jmp_addr, ptr_64->wb_entry_cnt, ptr_64->wb_exit_cnt, ptr_64->pc_entry_cnt, ptr_64->pc_exit_cnt, ptr_64->psci_entry_cnt, ptr_64->psci_exit_cnt, ptr_64->warm_jmp_instr); if (len > (debug_rw_buf_size - 1)) { pr_warn("%s: Cannot fit all info into the buffer\n", __func__); break; } ptr_64++; } else { len += snprintf(tzdbg.disp_buf + len, (debug_rw_buf_size - 1) - len, " CPU #: %d\n" Loading @@ -332,8 +406,10 @@ static int _disp_tz_boot_stats(void) " Warmboot exit CPU counter : 0x%x\n" " Power Collapse entry CPU counter: 0x%x\n" " Power Collapse exit CPU counter : 0x%x\n", i, ptr->warm_jmp_addr, ptr->wb_entry_cnt, ptr->wb_exit_cnt, ptr->pc_entry_cnt, i, ptr->warm_jmp_addr, ptr->wb_entry_cnt, ptr->wb_exit_cnt, ptr->pc_entry_cnt, ptr->pc_exit_cnt); if (len > (debug_rw_buf_size - 1)) { Loading @@ -343,6 +419,7 @@ static int _disp_tz_boot_stats(void) } ptr++; } } tzdbg.stat[TZDBG_BOOT].data = tzdbg.disp_buf; return len; } Loading