firmware: qcom_scm: Move qseecom specific workarounds

Move qseecom specific workarounds to the main file. This allows
access to the scm device struct.

Change-Id: I08bb227e88a7ba21bce0d3e7911819b07815c83f
Signed-off-by: Siddharth Gupta <sidgup@codeaurora.org>
This commit is contained in:
Siddharth Gupta 2019-12-04 18:51:43 -08:00
parent 365ba81c39
commit b4f766a33e
6 changed files with 23 additions and 25 deletions

View File

@ -18,7 +18,7 @@ obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o
obj-$(CONFIG_RASPBERRYPI_FIRMWARE) += raspberrypi.o
obj-$(CONFIG_FW_CFG_SYSFS) += qemu_fw_cfg.o
obj-$(CONFIG_QCOM_SCM) += _qcom_scm.o
_qcom_scm-y += qcom_scm.o qcom_scm-smc.o qcom_smc.o
_qcom_scm-y += qcom_scm.o qcom_scm-smc.o
_qcom_scm-$(CONFIG_QTEE_SHM_BRIDGE) += qtee_shmbridge.o
obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o
obj-$(CONFIG_TRUSTED_FOUNDATIONS) += trusted_foundations.o

View File

@ -1915,7 +1915,8 @@ int __qcom_scm_invoke_callback_response(struct device *dev, phys_addr_t out_buf,
return ret;
}
int __qcom_scm_qseecom_do(u32 cmd_id, struct scm_desc *desc, bool retry)
int __qcom_scm_qseecom_do(struct device *dev, u32 cmd_id, struct scm_desc *desc,
bool retry)
{
int _ret;
struct qcom_scm_desc _desc;
@ -1927,9 +1928,9 @@ int __qcom_scm_qseecom_do(u32 cmd_id, struct scm_desc *desc, bool retry)
_desc.arginfo = desc->arginfo;
if (retry)
_ret = qcom_scm_call(NULL, &_desc);
_ret = qcom_scm_call(dev, &_desc);
else
_ret = qcom_scm_call_noretry(NULL, &_desc);
_ret = qcom_scm_call_noretry(dev, &_desc);
memcpy(desc->ret, &_desc.res, sizeof(_desc.res));

View File

@ -16,6 +16,7 @@
#include <linux/of_platform.h>
#include <linux/clk.h>
#include <linux/reset-controller.h>
#include <soc/qcom/qseecom_scm.h>
#include "qcom_scm.h"
#include "qtee_shmbridge_internal.h"
@ -895,6 +896,20 @@ int qcom_scm_invoke_callback_response(phys_addr_t out_buf,
out_buf_size, result, response_type, data);
}
int qcom_scm_qseecom_call(u32 cmd_id, struct scm_desc *desc)
{
return __qcom_scm_qseecom_do(__scm ? __scm->dev : NULL, cmd_id, desc,
true);
}
EXPORT_SYMBOL(qcom_scm_qseecom_call);
int qcom_scm_qseecom_call_noretry(u32 cmd_id, struct scm_desc *desc)
{
return __qcom_scm_qseecom_do(__scm ? __scm->dev : NULL, cmd_id, desc,
false);
}
EXPORT_SYMBOL(qcom_scm_qseecom_call_noretry);
/**
* qcom_scm_is_available() - Checks if SCM is available
*/

View File

@ -218,6 +218,9 @@ extern int __qcom_scm_camera_protect_all(struct device *dev, uint32_t protect,
extern int __qcom_scm_camera_protect_phy_lanes(struct device *dev,
bool protect, u64 regmask);
extern int __qcom_scm_qseecom_do(struct device *dev, u32 cmd_id,
struct scm_desc *desc, bool retry);
// TOS Services and Function IDs
#define QCOM_SCM_SVC_QSEELOG 0x01
#define QCOM_SCM_QSEELOG_REGISTER 0x06

View File

@ -1,19 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2019 The Linux Foundation. All rights reserved.
*/
#include <linux/device.h>
#include <linux/arm-smccc.h>
#include <soc/qcom/qseecom_scm.h>
int qcom_scm_qseecom_call(u32 cmd_id, struct scm_desc *desc)
{
return __qcom_scm_qseecom_do(cmd_id, desc, true);
}
EXPORT_SYMBOL(qcom_scm_qseecom_call);
int qcom_scm_qseecom_call_noretry(u32 cmd_id, struct scm_desc *desc)
{
return __qcom_scm_qseecom_do(cmd_id, desc, false);
}
EXPORT_SYMBOL(qcom_scm_qseecom_call_noretry);

View File

@ -75,8 +75,6 @@ struct scm_desc {
u64 ret[MAX_SCM_RETS];
};
extern int __qcom_scm_qseecom_do(u32 cmd_id, struct scm_desc *desc, bool retry);
#if IS_ENABLED(CONFIG_QCOM_SCM)
int qcom_scm_qseecom_call(u32 cmd_id, struct scm_desc *desc);