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

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

Merge "jtagv8-etm: Add the authentication logic"

parents cd5605e7 fa29447c
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -1480,6 +1480,27 @@ static void etm_os_lock_init(struct etm_ctx *etmdata)
		etmdata->os_lock_present = false;
}

static bool coresight_authstatus_enabled(void __iomem *addr)
{
	int ret;
	unsigned int auth_val;

	if (!addr)
		return false;

	auth_val = readl_relaxed(addr + TRCAUTHSTATUS);

	if ((BMVAL(auth_val, 0, 1) == 0x2) ||
	    (BMVAL(auth_val, 2, 3) == 0x2) ||
	    (BMVAL(auth_val, 4, 5) == 0x2) ||
	    (BMVAL(auth_val, 6, 7) == 0x2))
		ret = false;
	else
		ret = true;

	return ret;
}

static void etm_init_arch_data(void *info)
{
	uint32_t val;
@@ -1487,6 +1508,9 @@ static void etm_init_arch_data(void *info)

	ETM_UNLOCK(etmdata);

	if (!coresight_authstatus_enabled(etmdata->base))
		goto out;

	etm_os_lock_init(etmdata);

	val = etm_readl(etmdata, TRCIDR1);
@@ -1505,6 +1529,7 @@ static void etm_init_arch_data(void *info)
	etmdata->nr_seq_state = BMVAL(val, 25, 27);
	etmdata->nr_cntr = BMVAL(val, 28, 30);

out:
	ETM_LOCK(etmdata);
}