Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea642513 authored by Prasad Sodagudi's avatar Prasad Sodagudi
Browse files

soc: qcom: Use scm_is_secure_device() API to find secure boot or not



Currently gladiator error reporting driver is independently
checking whether device in secure boot or not. So use
generic API scm_is_secure_device() and take appropriate
decision to enable certain features.

Change-Id: I89a7bdd21373ffcfec6d90ffbdd29ce8ed3dde88
Signed-off-by: default avatarPrasad Sodagudi <psodagud@codeaurora.org>
parent 3bd0a995
Loading
Loading
Loading
Loading
+3 −35
Original line number Original line Diff line number Diff line
/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * 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
 * it under the terms of the GNU General Public License version 2 and
@@ -22,15 +22,6 @@


#define MODULE_NAME "gladiator_error_reporting"
#define MODULE_NAME "gladiator_error_reporting"


/* SCM call service and command ID */
#define SCM_TZ_SVC_INFO			0x6
#define TZ_INFO_GET_SECURE_STATE	0x4

/* Secure State Check */
#define SEC_STATE_VALID(a)       (a & BIT(0))
#define SCM_SECURE_BOOT_ENABLED  1
#define SCM_SECURE_BOOT_DISABLED 0

/* Register Offsets */
/* Register Offsets */
#define GLADIATOR_ID_COREID	0x0
#define GLADIATOR_ID_COREID	0x0
#define GLADIATOR_ID_REVISIONID	0x4
#define GLADIATOR_ID_REVISIONID	0x4
@@ -602,29 +593,6 @@ bail:
	return ret;
	return ret;
}
}


static int scm_is_gladiator_erp_available(void)
{
	int ret;
	struct scm_desc desc = {0};

	desc.args[0] = 0;
	desc.arginfo = 0;
	ret = scm_call2(SCM_SIP_FNID(SCM_TZ_SVC_INFO,
				TZ_INFO_GET_SECURE_STATE),
				&desc);
	if (ret) {
		pr_err("gladiator_error_reporting: SCM call failed\n");
		return -ENODEV;
	}

	if (SEC_STATE_VALID(desc.ret[0]))
		ret = SCM_SECURE_BOOT_DISABLED;
	else
		ret = SCM_SECURE_BOOT_ENABLED;

	return ret;
}

static struct platform_driver gladiator_erp_driver = {
static struct platform_driver gladiator_erp_driver = {
	.probe = gladiator_erp_probe,
	.probe = gladiator_erp_probe,
	.driver = {
	.driver = {
@@ -638,8 +606,8 @@ static int init_gladiator_erp(void)
{
{
	int ret;
	int ret;


	ret = scm_is_gladiator_erp_available();
	ret = scm_is_secure_device();
	if (ret) {
	if (!ret) {
		pr_info("Gladiator Error Reporting not available %d\n", ret);
		pr_info("Gladiator Error Reporting not available %d\n", ret);
		return -ENODEV;
		return -ENODEV;
	}
	}