mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 18:14:24 +00:00

Adds driver support to preserve DSU PMU register values over a DSU power cycle. This driver needs to be enabled by the platforms that support DSU and also need it's PMU registers to be preserved Change-Id: I7fc68a3d7d99ee369379aa5cd114fffc763fc0d2 Signed-off-by: Arvind Ram Prakash <arvind.ramprakash@arm.com>
42 lines
991 B
C
42 lines
991 B
C
/*
|
|
* Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#ifndef DSU_H
|
|
#define DSU_H
|
|
|
|
#define PMCR_N_MAX 0x1f
|
|
|
|
#define save_pmu_reg(state, reg) state->reg = read_##reg()
|
|
|
|
#define restore_pmu_reg(context, reg) write_##reg(context->reg)
|
|
|
|
typedef struct cluster_pmu_state{
|
|
uint64_t clusterpmcr;
|
|
uint64_t clusterpmcntenset;
|
|
uint64_t clusterpmccntr;
|
|
uint64_t clusterpmovsset;
|
|
uint64_t clusterpmselr;
|
|
uint64_t clusterpmsevtyper;
|
|
uint64_t counter_val[PMCR_N_MAX];
|
|
uint64_t counter_type[PMCR_N_MAX];
|
|
} cluster_pmu_state_t;
|
|
|
|
static inline unsigned int read_cluster_eventctr_num(void)
|
|
{
|
|
return ((read_clusterpmcr() >> CLUSTERPMCR_N_SHIFT) &
|
|
CLUSTERPMCR_N_MASK);
|
|
}
|
|
|
|
|
|
void save_dsu_pmu_state(cluster_pmu_state_t *cluster_pmu_context);
|
|
|
|
void restore_dsu_pmu_state(cluster_pmu_state_t *cluster_pmu_context);
|
|
|
|
void cluster_on_dsu_pmu_context_restore(void);
|
|
|
|
void cluster_off_dsu_pmu_context_save(void);
|
|
|
|
#endif /* DSU_H */
|