mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-25 07:41:42 +01:00
lib: utils: fdt_pmu: Make the fdt_pmu_evt_select table global variable
To allow platform override pmu_init() filling the translation table fdt_pmu_evt_select[] when PMU node doesn't provide such information, we need to share the table and its entry counter with other .c file. We also define the structures of PMU property in fdt_helper.h, so we can initialize the mappings in arrays. Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
009ae4e602
commit
0308f93dc4
@@ -14,21 +14,17 @@
|
||||
#include <sbi/sbi_pmu.h>
|
||||
#include <sbi/sbi_scratch.h>
|
||||
#include <sbi_utils/fdt/fdt_helper.h>
|
||||
#include <sbi_utils/fdt/fdt_pmu.h>
|
||||
|
||||
#define FDT_PMU_HW_EVENT_MAX (SBI_PMU_HW_EVENT_MAX * 2)
|
||||
|
||||
struct fdt_pmu_hw_event_select {
|
||||
uint32_t eidx;
|
||||
uint64_t select;
|
||||
};
|
||||
|
||||
static struct fdt_pmu_hw_event_select fdt_pmu_evt_select[FDT_PMU_HW_EVENT_MAX] = {0};
|
||||
static uint32_t hw_event_count;
|
||||
struct fdt_pmu_hw_event_select_map fdt_pmu_evt_select[FDT_PMU_HW_EVENT_MAX] = {0};
|
||||
uint32_t hw_event_count;
|
||||
|
||||
uint64_t fdt_pmu_get_select_value(uint32_t event_idx)
|
||||
{
|
||||
int i;
|
||||
struct fdt_pmu_hw_event_select *event;
|
||||
struct fdt_pmu_hw_event_select_map *event;
|
||||
|
||||
for (i = 0; i < SBI_PMU_HW_EVENT_MAX; i++) {
|
||||
event = &fdt_pmu_evt_select[i];
|
||||
@@ -65,7 +61,7 @@ int fdt_pmu_setup(void *fdt)
|
||||
int i, pmu_offset, len, result;
|
||||
const u32 *event_val;
|
||||
const u32 *event_ctr_map;
|
||||
struct fdt_pmu_hw_event_select *event;
|
||||
struct fdt_pmu_hw_event_select_map *event;
|
||||
uint64_t raw_selector, select_mask;
|
||||
u32 event_idx_start, event_idx_end, ctr_map;
|
||||
|
||||
|
Reference in New Issue
Block a user