summaryrefslogtreecommitdiff
path: root/drivers/firmware
diff options
context:
space:
mode:
authorMallikarjuna Reddy Amireddy <mamire@codeaurora.org>2015-05-06 00:01:57 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2016-08-09 06:44:57 -0700
commit063f6eab6aad5f3263dd52f5e086216bb1007d0c (patch)
tree5d2335272616efe0dcf16c72d1c92c6217281764 /drivers/firmware
parente94b446eac88a43e42ecde105275d48b677ea5b3 (diff)
firmware: qcom: tz_log: fix incorrect datatype for warm_jmp_addr.
warm_jmp_addr variable datatype is uint32 in tz version 2.X (32 -bit) and uint64 in tz version >=3.X (64 bit). But HLOS side always hadling with uint32. So this is causing mismatch data types between Tz and HLOS side, which is providing wrong 'Warmboot jump address'. So updating tzdbg_boot_info according to the TZ versions. Change-Id: I216f9d4407592ae0112902fe423a807ae3c146d0 Signed-off-by: Mallikarjuna Reddy Amireddy <mamire@codeaurora.org>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/qcom/tz_log.c117
1 files changed, 97 insertions, 20 deletions
diff --git a/drivers/firmware/qcom/tz_log.c b/drivers/firmware/qcom/tz_log.c
index 7a45142a66c1..bf3a24b3eb01 100644
--- a/drivers/firmware/qcom/tz_log.c
+++ b/drivers/firmware/qcom/tz_log.c
@@ -54,6 +54,10 @@
*/
#define TZBSP_MAX_INT_DESC 16
/*
+ * TZ 3.X version info
+ */
+#define QSEE_VERSION_TZ_3_X 0x800000
+/*
* VMID Table
*/
struct tzdbg_vmid_t {
@@ -72,6 +76,19 @@ struct tzdbg_boot_info_t {
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
*/
struct tzdbg_reset_info_t {
@@ -318,30 +335,90 @@ 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];
+ }
- for (i = 0; i < tzdbg.diag_buf->cpu_count; i++) {
- len += snprintf(tzdbg.disp_buf + len,
- (debug_rw_buf_size - 1) - len,
- " CPU #: %d\n"
- " Warmboot jump address : 0x%x\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",
- i, ptr->warm_jmp_addr, ptr->wb_entry_cnt,
- ptr->wb_exit_cnt, ptr->pc_entry_cnt,
- ptr->pc_exit_cnt);
+ 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 (len > (debug_rw_buf_size - 1)) {
- pr_warn("%s: Cannot fit all info into the buffer\n",
- __func__);
- break;
+ 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"
+ " Warmboot jump address : 0x%x\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",
+ 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)) {
+ pr_warn("%s: Cannot fit all info into the buffer\n",
+ __func__);
+ break;
+ }
+ ptr++;
}
- ptr++;
}
tzdbg.stat[TZDBG_BOOT].data = tzdbg.disp_buf;
return len;