coresight: etm4x: Cleanup TRCIDR3 register accesses

This is a no-op change for style and consistency and has no effect on
the binary output by the compiler. In sysreg.h fields are defined as
the register name followed by the field name and then _MASK. This
allows for grepping for fields by name rather than using magic numbers.

Signed-off-by: James Clark <james.clark@arm.com>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
Link: https://lore.kernel.org/r/20220304171913.2292458-4-james.clark@arm.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
This commit is contained in:
James Clark 2022-03-04 17:19:00 +00:00 committed by Mathieu Poirier
parent cf0c7f18d3
commit f4d1f2142a
2 changed files with 20 additions and 30 deletions

View File

@ -1124,53 +1124,33 @@ static void etm4_init_arch_data(void *info)
etmidr3 = etm4x_relaxed_read32(csa, TRCIDR3); etmidr3 = etm4x_relaxed_read32(csa, TRCIDR3);
/* CCITMIN, bits[11:0] minimum threshold value that can be programmed */ /* CCITMIN, bits[11:0] minimum threshold value that can be programmed */
drvdata->ccitmin = BMVAL(etmidr3, 0, 11); drvdata->ccitmin = FIELD_GET(TRCIDR3_CCITMIN_MASK, etmidr3);
/* EXLEVEL_S, bits[19:16] Secure state instruction tracing */ /* EXLEVEL_S, bits[19:16] Secure state instruction tracing */
drvdata->s_ex_level = BMVAL(etmidr3, 16, 19); drvdata->s_ex_level = FIELD_GET(TRCIDR3_EXLEVEL_S_MASK, etmidr3);
drvdata->config.s_ex_level = drvdata->s_ex_level; drvdata->config.s_ex_level = drvdata->s_ex_level;
/* EXLEVEL_NS, bits[23:20] Non-secure state instruction tracing */ /* EXLEVEL_NS, bits[23:20] Non-secure state instruction tracing */
drvdata->ns_ex_level = BMVAL(etmidr3, 20, 23); drvdata->ns_ex_level = FIELD_GET(TRCIDR3_EXLEVEL_NS_MASK, etmidr3);
/* /*
* TRCERR, bit[24] whether a trace unit can trace a * TRCERR, bit[24] whether a trace unit can trace a
* system error exception. * system error exception.
*/ */
if (BMVAL(etmidr3, 24, 24)) drvdata->trc_error = !!(etmidr3 & TRCIDR3_TRCERR);
drvdata->trc_error = true;
else
drvdata->trc_error = false;
/* SYNCPR, bit[25] implementation has a fixed synchronization period? */ /* SYNCPR, bit[25] implementation has a fixed synchronization period? */
if (BMVAL(etmidr3, 25, 25)) drvdata->syncpr = !!(etmidr3 & TRCIDR3_SYNCPR);
drvdata->syncpr = true;
else
drvdata->syncpr = false;
/* STALLCTL, bit[26] is stall control implemented? */ /* STALLCTL, bit[26] is stall control implemented? */
if (BMVAL(etmidr3, 26, 26)) drvdata->stallctl = !!(etmidr3 & TRCIDR3_STALLCTL);
drvdata->stallctl = true;
else
drvdata->stallctl = false;
/* SYSSTALL, bit[27] implementation can support stall control? */ /* SYSSTALL, bit[27] implementation can support stall control? */
if (BMVAL(etmidr3, 27, 27)) drvdata->sysstall = !!(etmidr3 & TRCIDR3_SYSSTALL);
drvdata->sysstall = true;
else
drvdata->sysstall = false;
/* /*
* NUMPROC - the number of PEs available for tracing, 5bits * NUMPROC - the number of PEs available for tracing, 5bits
* = TRCIDR3.bits[13:12]bits[30:28] * = TRCIDR3.bits[13:12]bits[30:28]
* bits[4:3] = TRCIDR3.bits[13:12] (since etm-v4.2, otherwise RES0) * bits[4:3] = TRCIDR3.bits[13:12] (since etm-v4.2, otherwise RES0)
* bits[3:0] = TRCIDR3.bits[30:28] * bits[3:0] = TRCIDR3.bits[30:28]
*/ */
drvdata->nr_pe = (BMVAL(etmidr3, 12, 13) << 3) | BMVAL(etmidr3, 28, 30); drvdata->nr_pe = (FIELD_GET(TRCIDR3_NUMPROC_HI_MASK, etmidr3) << 3) |
FIELD_GET(TRCIDR3_NUMPROC_LO_MASK, etmidr3);
/* NOOVERFLOW, bit[31] is trace overflow prevention supported */ /* NOOVERFLOW, bit[31] is trace overflow prevention supported */
if (BMVAL(etmidr3, 31, 31)) drvdata->nooverflow = !!(etmidr3 & TRCIDR3_NOOVERFLOW);
drvdata->nooverflow = true;
else
drvdata->nooverflow = false;
/* number of resources trace unit supports */ /* number of resources trace unit supports */
etmidr4 = etm4x_relaxed_read32(csa, TRCIDR4); etmidr4 = etm4x_relaxed_read32(csa, TRCIDR4);

View File

@ -147,6 +147,16 @@
#define TRCIDR2_VMIDSIZE_MASK GENMASK(14, 10) #define TRCIDR2_VMIDSIZE_MASK GENMASK(14, 10)
#define TRCIDR2_CCSIZE_MASK GENMASK(28, 25) #define TRCIDR2_CCSIZE_MASK GENMASK(28, 25)
#define TRCIDR3_CCITMIN_MASK GENMASK(11, 0)
#define TRCIDR3_EXLEVEL_S_MASK GENMASK(19, 16)
#define TRCIDR3_EXLEVEL_NS_MASK GENMASK(23, 20)
#define TRCIDR3_TRCERR BIT(24)
#define TRCIDR3_SYNCPR BIT(25)
#define TRCIDR3_STALLCTL BIT(26)
#define TRCIDR3_SYSSTALL BIT(27)
#define TRCIDR3_NUMPROC_LO_MASK GENMASK(30, 28)
#define TRCIDR3_NUMPROC_HI_MASK GENMASK(13, 12)
#define TRCIDR3_NOOVERFLOW BIT(31)
/* /*
* System instructions to access ETM registers. * System instructions to access ETM registers.
* See ETMv4.4 spec ARM IHI0064F section 4.3.6 System instructions * See ETMv4.4 spec ARM IHI0064F section 4.3.6 System instructions