Skip to content

Commit

Permalink
issue ARM-software#2: handle PMCR.X not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
algrant-arm committed Jun 30, 2022
1 parent c768207 commit 3c374e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/cs_pmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ int cs_pmu_write_status(cs_device_t, unsigned int flags,
/**
* Control whether the CPU PMU event bus is exported to ETM etc.
* Does not affect interrupt generation.
* Return non-zero if the PMU cannot export its events.
*
* \param enable Indicate whether to enable or disable export.
*/
Expand Down
12 changes: 11 additions & 1 deletion source/cs_pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,22 @@ int cs_pmu_reset(cs_device_t dev, unsigned int flags)
}


/* Update PMCR.X. It may be RAZ/WI, in which case we return an error on enable. */
int cs_pmu_bus_export(cs_device_t dev, int enable)
{
uint32_t pmcr;
struct cs_device *d = DEV(dev);
assert(d->type == DEV_CPU_PMU);
_cs_unlock(d);
return _cs_set_bit(d, CS_PMCR, CS_PMCR_X, enable);
pmcr = _cs_read(d, CS_PMCR);
if (!enable) {
return _cs_write(d, CS_PMCR, pmcr & ~CS_PMCR_X);
} else {
_cs_write_wo(d, CS_PMCR, pmcr | CS_PMCR_X);
pmcr = _cs_read(d, CS_PMCR);
/* Return 0 if PMCR.X now reports as set. */
return (pmcr & CS_PMCR_X) ? 0 : -1;
}
}


Expand Down

0 comments on commit 3c374e3

Please sign in to comment.