Merge tag 'rproc-v4.15' of git://github.com/andersson/remoteproc
[muen/linux.git] / drivers / firmware / qcom_scm-64.c
index 3fea6f563ca91f17b380f2a5a138900ddfc0c141..688525dd4aee599548c52502168b3f04f62388fb 100644 (file)
@@ -382,6 +382,33 @@ int __qcom_scm_set_remote_state(struct device *dev, u32 state, u32 id)
        return ret ? : res.a1;
 }
 
+int __qcom_scm_assign_mem(struct device *dev, phys_addr_t mem_region,
+                         size_t mem_sz, phys_addr_t src, size_t src_sz,
+                         phys_addr_t dest, size_t dest_sz)
+{
+       int ret;
+       struct qcom_scm_desc desc = {0};
+       struct arm_smccc_res res;
+
+       desc.args[0] = mem_region;
+       desc.args[1] = mem_sz;
+       desc.args[2] = src;
+       desc.args[3] = src_sz;
+       desc.args[4] = dest;
+       desc.args[5] = dest_sz;
+       desc.args[6] = 0;
+
+       desc.arginfo = QCOM_SCM_ARGS(7, QCOM_SCM_RO, QCOM_SCM_VAL,
+                                    QCOM_SCM_RO, QCOM_SCM_VAL, QCOM_SCM_RO,
+                                    QCOM_SCM_VAL, QCOM_SCM_VAL);
+
+       ret = qcom_scm_call(dev, QCOM_SCM_SVC_MP,
+                           QCOM_MEM_PROT_ASSIGN_ID,
+                           &desc, &res);
+
+       return ret ? : res.a1;
+}
+
 int __qcom_scm_restore_sec_cfg(struct device *dev, u32 device_id, u32 spare)
 {
        struct qcom_scm_desc desc = {0};