lib: sbi_pmu: add callback for counter width

This patch adds a callback to fetch the number of bits implemented for a
custom firmware counter. If the callback fails or is not implemented then
width defaults to 63.

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Mayuresh Chitale
2023-03-09 18:43:51 +05:30
committed by Anup Patel
parent 506144f398
commit 1fe8dc9955
2 changed files with 11 additions and 0 deletions

View File

@@ -41,6 +41,11 @@ struct sbi_pmu_device {
bool (*fw_counter_match_code)(uint32_t counter_index,
uint32_t event_idx_code);
/**
* Fetch the max width of this counter in number of bits.
*/
int (*fw_counter_width)(void);
/**
* Read value of custom firmware counter
* Note: 0 <= counter_index < SBI_PMU_FW_CTR_MAX