drivers: qcom: Add SCM API support for armv7
SCM APIs support is added for tz_log,msm-poweroff, watchdog for mdm9607 target. Change-Id: I7574e12b831dac471d449722138daf77b07075ed Signed-off-by: Hari babu <haribabu@codeaurora.org> Signed-off-by: Sivasri Kumar Vanka <sivasri@codeaurora.org>
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
parent
266dd2ee04
commit
a06a6f514b
@@ -864,6 +864,11 @@ const struct file_operations tzdbg_fops = {
|
||||
*/
|
||||
static void tzdbg_register_qsee_log_buf(struct platform_device *pdev)
|
||||
{
|
||||
/* register log buffer scm request */
|
||||
struct qseecom_reg_log_buf_ireq req = {};
|
||||
|
||||
/* scm response */
|
||||
struct qseecom_command_scm_resp resp = {};
|
||||
size_t len;
|
||||
int ret = 0;
|
||||
struct scm_desc desc = {0};
|
||||
@@ -878,21 +883,30 @@ static void tzdbg_register_qsee_log_buf(struct platform_device *pdev)
|
||||
|
||||
g_qsee_log = (struct tzdbg_log_t *)buf;
|
||||
|
||||
desc.args[0] = coh_pmem;
|
||||
desc.args[1] = len;
|
||||
desc.arginfo = 0x22;
|
||||
ret = scm_call2(SCM_QSEEOS_FNID(1, 6), &desc);
|
||||
|
||||
if (!is_scm_armv8()) {
|
||||
req.qsee_cmd_id = QSEOS_REGISTER_LOG_BUF_COMMAND;
|
||||
req.phy_addr = (uint32_t)coh_pmem;
|
||||
req.len = len;
|
||||
/* SCM_CALL to register the log buffer */
|
||||
ret = scm_call(SCM_SVC_TZSCHEDULER, 1, &req, sizeof(req),
|
||||
&resp, sizeof(resp));
|
||||
} else {
|
||||
desc.args[0] = coh_pmem;
|
||||
desc.args[1] = len;
|
||||
desc.arginfo = 0x22;
|
||||
ret = scm_call2(SCM_QSEEOS_FNID(1, 6), &desc);
|
||||
resp.result = desc.ret[0];
|
||||
}
|
||||
if (ret) {
|
||||
pr_err("%s: scm_call to register log buffer failed\n",
|
||||
__func__);
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (desc.ret[0] != QSEOS_RESULT_SUCCESS) {
|
||||
if (resp.result != QSEOS_RESULT_SUCCESS) {
|
||||
pr_err(
|
||||
"%s: scm_call to register log buf failed, resp result =%llu\n",
|
||||
__func__, desc.ret[0]);
|
||||
__func__, resp.result);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -999,19 +1013,26 @@ static void tzdbg_get_tz_version(void)
|
||||
{
|
||||
uint32_t smc_id = 0;
|
||||
uint32_t feature = 10;
|
||||
struct qseecom_command_scm_resp resp = {0};
|
||||
struct scm_desc desc = {0};
|
||||
int ret = 0;
|
||||
|
||||
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);
|
||||
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 get tz version failed\n",
|
||||
__func__);
|
||||
else
|
||||
tzdbg.tz_version = desc.ret[0];
|
||||
tzdbg.tz_version = resp.result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -128,6 +128,9 @@ int scm_set_dload_mode(int arg1, int arg2)
|
||||
|
||||
return 0;
|
||||
}
|
||||
if (!is_scm_armv8())
|
||||
return scm_call_atomic2(SCM_SVC_BOOT, SCM_DLOAD_CMD, arg1,
|
||||
arg2);
|
||||
|
||||
return scm_call2_atomic(SCM_SIP_FNID(SCM_SVC_BOOT, SCM_DLOAD_CMD),
|
||||
&desc);
|
||||
@@ -240,7 +243,11 @@ static void scm_disable_sdi(void)
|
||||
};
|
||||
|
||||
/* Needed to bypass debug image on some chips */
|
||||
ret = scm_call2_atomic(SCM_SIP_FNID(SCM_SVC_BOOT,
|
||||
if (!is_scm_armv8())
|
||||
ret = scm_call_atomic2(SCM_SVC_BOOT,
|
||||
SCM_WDOG_DEBUG_BOOT_PART, 1, 0);
|
||||
else
|
||||
ret = scm_call2_atomic(SCM_SIP_FNID(SCM_SVC_BOOT,
|
||||
SCM_WDOG_DEBUG_BOOT_PART), &desc);
|
||||
if (ret)
|
||||
pr_err("Failed to disable secure wdog debug: %d\n", ret);
|
||||
@@ -267,7 +274,11 @@ static void halt_spmi_pmic_arbiter(void)
|
||||
|
||||
if (scm_pmic_arbiter_disable_supported) {
|
||||
pr_crit("Calling SCM to disable SPMI PMIC arbiter\n");
|
||||
scm_call2_atomic(SCM_SIP_FNID(SCM_SVC_PWR,
|
||||
if (!is_scm_armv8())
|
||||
scm_call_atomic1(SCM_SVC_PWR,
|
||||
SCM_IO_DISABLE_PMIC_ARBITER, 0);
|
||||
else
|
||||
scm_call2_atomic(SCM_SIP_FNID(SCM_SVC_PWR,
|
||||
SCM_IO_DISABLE_PMIC_ARBITER), &desc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2010-2018, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2010-2019, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
@@ -1282,12 +1282,17 @@ int scm_enable_mem_protection(void)
|
||||
struct scm_desc desc = {0};
|
||||
int ret = 0, resp;
|
||||
|
||||
desc.args[0] = 0;
|
||||
desc.arginfo = 0;
|
||||
ret = scm_call2(SCM_SIP_FNID(SCM_SVC_RTIC,
|
||||
if (!is_scm_armv8()) {
|
||||
ret = scm_call(SCM_SVC_RTIC, TZ_RTIC_ENABLE_MEM_PROTECTION,
|
||||
NULL, 0, &resp, sizeof(resp));
|
||||
} else {
|
||||
desc.args[0] = 0;
|
||||
desc.arginfo = 0;
|
||||
ret = scm_call2(SCM_SIP_FNID(SCM_SVC_RTIC,
|
||||
TZ_RTIC_ENABLE_MEM_PROTECTION),
|
||||
&desc);
|
||||
resp = desc.ret[0];
|
||||
resp = desc.ret[0];
|
||||
}
|
||||
|
||||
if (ret == -1) {
|
||||
pr_err("%s: SCM call not supported\n", __func__);
|
||||
|
||||
@@ -254,7 +254,6 @@ static ssize_t wdog_disable_set(struct device *dev,
|
||||
int ret;
|
||||
u8 disable;
|
||||
struct msm_watchdog_data *wdog_dd = dev_get_drvdata(dev);
|
||||
struct scm_desc desc = {0};
|
||||
|
||||
ret = kstrtou8(buf, 10, &disable);
|
||||
if (ret) {
|
||||
@@ -269,11 +268,17 @@ static ssize_t wdog_disable_set(struct device *dev,
|
||||
return count;
|
||||
}
|
||||
disable = 1;
|
||||
if (!is_scm_armv8()) {
|
||||
ret = scm_call(SCM_SVC_BOOT, SCM_SVC_SEC_WDOG_DIS,
|
||||
&disable, sizeof(disable), NULL, 0);
|
||||
} else {
|
||||
struct scm_desc desc = {0};
|
||||
|
||||
desc.args[0] = 1;
|
||||
desc.arginfo = SCM_ARGS(1);
|
||||
ret = scm_call2(SCM_SIP_FNID(SCM_SVC_BOOT,
|
||||
SCM_SVC_SEC_WDOG_DIS), &desc);
|
||||
desc.args[0] = 1;
|
||||
desc.arginfo = SCM_ARGS(1);
|
||||
ret = scm_call2(SCM_SIP_FNID(SCM_SVC_BOOT,
|
||||
SCM_SVC_SEC_WDOG_DIS), &desc);
|
||||
}
|
||||
if (ret) {
|
||||
dev_err(wdog_dd->dev,
|
||||
"Failed to deactivate secure wdog\n");
|
||||
|
||||
Reference in New Issue
Block a user