summaryrefslogtreecommitdiff
path: root/security/pfe/pfk_ice.c
diff options
context:
space:
mode:
authorNeeraj Soni <neersoni@codeaurora.org>2017-03-20 17:01:21 +0530
committerNeeraj Soni <neersoni@codeaurora.org>2017-03-20 17:01:21 +0530
commit77eeced18f44fc3f24e9fe9d0fd1e9c5313bc06b (patch)
tree68a1ceb8118866bb022b804e392f6c8da12b0a9b /security/pfe/pfk_ice.c
parent541fe938d28fd1d61c22f25c031ebf600af2c61d (diff)
security: pfe: Adapt ICE engine setup call for eMMC
Ice setup operation will work indpendent of storage type. Command line parameters will be read to find out storage type before doing ICE HW Configuration. Change-Id: I90a520f6d80e92505464fcde04980d858b34b455 Signed-off-by: Neeraj Soni <neersoni@codeaurora.org>
Diffstat (limited to 'security/pfe/pfk_ice.c')
-rw-r--r--security/pfe/pfk_ice.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/security/pfe/pfk_ice.c b/security/pfe/pfk_ice.c
index 2f09d8801a96..facecedc3827 100644
--- a/security/pfe/pfk_ice.c
+++ b/security/pfe/pfk_ice.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017, 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
@@ -64,7 +64,8 @@
uint8_t ice_key[ICE_KEY_SIZE];
uint8_t ice_salt[ICE_KEY_SIZE];
-int qti_pfk_ice_set_key(uint32_t index, uint8_t *key, uint8_t *salt)
+int qti_pfk_ice_set_key(uint32_t index, uint8_t *key, uint8_t *salt,
+ char *storage_type)
{
struct scm_desc desc = {0};
int ret;
@@ -84,6 +85,9 @@ int qti_pfk_ice_set_key(uint32_t index, uint8_t *key, uint8_t *salt)
if (!tzbuf_key || !tzbuf_salt)
return -ENOMEM;
+ if (storage_type == NULL)
+ return -EINVAL;
+
memset(tzbuf_key, 0, tzbuflen_key);
memset(tzbuf_salt, 0, tzbuflen_salt);
@@ -103,7 +107,8 @@ int qti_pfk_ice_set_key(uint32_t index, uint8_t *key, uint8_t *salt)
desc.args[3] = virt_to_phys(tzbuf_salt);
desc.args[4] = tzbuflen_salt;
- ret = qcom_ice_setup_ice_hw("ufs", true);
+ ret = qcom_ice_setup_ice_hw((const char *)storage_type, true);
+
if (ret) {
pr_err("%s: could not enable clocks: 0x%x\n", __func__, ret);
return ret;
@@ -111,7 +116,7 @@ int qti_pfk_ice_set_key(uint32_t index, uint8_t *key, uint8_t *salt)
ret = scm_call2(smc_id, &desc);
- qcom_ice_setup_ice_hw("ufs", false);
+ ret = qcom_ice_setup_ice_hw((const char *)storage_type, false);
pr_debug(" %s , ret = %d\n", __func__, ret);
if (ret) {
@@ -127,7 +132,7 @@ int qti_pfk_ice_set_key(uint32_t index, uint8_t *key, uint8_t *salt)
}
-int qti_pfk_ice_invalidate_key(uint32_t index)
+int qti_pfk_ice_invalidate_key(uint32_t index, char *storage_type)
{
struct scm_desc desc = {0};
int ret;
@@ -137,13 +142,17 @@ int qti_pfk_ice_invalidate_key(uint32_t index)
if (index < MIN_ICE_KEY_INDEX || index > MAX_ICE_KEY_INDEX)
return -EINVAL;
+ if (storage_type == NULL)
+ return -EINVAL;
+
smc_id = TZ_ES_INVALIDATE_ICE_KEY_ID;
pr_debug(" %s , smc_id = 0x%x\n", __func__, smc_id);
desc.arginfo = TZ_ES_INVALIDATE_ICE_KEY_PARAM_ID;
desc.args[0] = index;
- ret = qcom_ice_setup_ice_hw("ufs", true);
+ ret = qcom_ice_setup_ice_hw((const char *)storage_type, true);
+
if (ret) {
pr_err("%s: could not enable clocks: 0x%x\n", __func__, ret);
return ret;
@@ -151,7 +160,7 @@ int qti_pfk_ice_invalidate_key(uint32_t index)
ret = scm_call2(smc_id, &desc);
- qcom_ice_setup_ice_hw("ufs", false);
+ ret = qcom_ice_setup_ice_hw((const char *)storage_type, false);
pr_debug(" %s , ret = %d\n", __func__, ret);
if (ret)