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

Commit 3db9866f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: reset: Download mode is not supported in secure boot"

parents 2513b11d 6b8a0f7a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -571,6 +571,7 @@ skip_sysfs_create:
	if (scm_is_call_available(SCM_SVC_PWR, SCM_IO_DEASSERT_PS_HOLD) > 0)
		scm_deassert_ps_hold_supported = true;

	download_mode = scm_is_secure_device();
	set_dload_mode(download_mode);
	if (!download_mode)
		scm_disable_sdi();
+3 −35
Original line number 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
 * it under the terms of the GNU General Public License version 2 and
@@ -22,15 +22,6 @@

#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 */
#define GLADIATOR_ID_COREID	0x0
#define GLADIATOR_ID_REVISIONID	0x4
@@ -602,29 +593,6 @@ bail:
	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 = {
	.probe = gladiator_erp_probe,
	.driver = {
@@ -638,8 +606,8 @@ static int init_gladiator_erp(void)
{
	int ret;

	ret = scm_is_gladiator_erp_available();
	if (ret) {
	ret = scm_is_secure_device();
	if (!ret) {
		pr_info("Gladiator Error Reporting not available %d\n", ret);
		return -ENODEV;
	}
+36 −0
Original line number Diff line number Diff line
@@ -1200,3 +1200,39 @@ int scm_restore_sec_cfg(u32 device_id, u32 spare, int *scm_ret)
	return 0;
}
EXPORT_SYMBOL(scm_restore_sec_cfg);

/*
 * SCM call command ID to check secure mode
 * Return zero for secure device.
 * Return one for non secure device or secure
 * device with debug enabled device.
 */
#define TZ_INFO_GET_SECURE_STATE	0x4
bool scm_is_secure_device(void)
{
	struct scm_desc desc = {0};
	int ret = 0, resp;

	desc.args[0] = 0;
	desc.arginfo = 0;
	if (!is_scm_armv8()) {
		ret = scm_call(SCM_SVC_INFO, TZ_INFO_GET_SECURE_STATE, NULL,
			0, &resp, sizeof(resp));
	} else {
		ret = scm_call2(SCM_SIP_FNID(SCM_SVC_INFO,
				TZ_INFO_GET_SECURE_STATE),
				&desc);
		resp = desc.ret[0];
	}

	if (ret) {
		pr_err("%s: SCM call failed\n", __func__);
		return false;
	}

	if ((resp & BIT(0)) || (resp & BIT(2)))
		return true;
	else
		return false;
}
EXPORT_SYMBOL(scm_is_secure_device);
+6 −0
Original line number Diff line number Diff line
@@ -125,6 +125,7 @@ extern bool is_scm_armv8(void);
extern int scm_restore_sec_cfg(u32 device_id, u32 spare, int *scm_ret);
extern u32 scm_io_read(phys_addr_t address);
extern int scm_io_write(phys_addr_t address, u32 val);
extern bool scm_is_secure_device(void);

#define SCM_HDCP_MAX_REG 5

@@ -227,5 +228,10 @@ static inline int scm_io_write(phys_addr_t address, u32 val)
{
	return 0;
}

inline bool scm_is_secure_device(void)
{
	return false;
}
#endif
#endif