lib: sbi_pmu: Introduce fw_counter_write_value API

Add fw_counter_write_value API for platform specific firmware events
which separates setting the counter's initial value from starting the
counter. This is required so that the fw_event_data array can be reused
to save the event data received.

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Mayuresh Chitale
2023-03-09 18:43:57 +05:30
committed by Anup Patel
parent 641d2e9f38
commit 57d3aa3b0d
2 changed files with 21 additions and 15 deletions

View File

@@ -51,14 +51,19 @@ struct sbi_pmu_device {
*/
uint64_t (*fw_counter_read_value)(uint32_t counter_index);
/**
* Write value to custom firmware counter
* Note: 0 <= counter_index < SBI_PMU_FW_CTR_MAX
*/
void (*fw_counter_write_value)(uint32_t counter_index,
uint64_t value);
/**
* Start custom firmware counter
* Note: SBI_PMU_FW_MAX <= event_idx_code
* Note: 0 <= counter_index < SBI_PMU_FW_CTR_MAX
*/
int (*fw_counter_start)(uint32_t counter_index,
uint64_t event_data,
uint64_t init_val, bool init_val_update);
uint64_t event_data);
/**
* Stop custom firmware counter