blob: 463f890fd02b428762190107248179f238cffa73 [file] [log] [blame]
Dimitris Papastamos0b00f8a2018-02-14 10:00:06 +00001/*
2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Antonio Nino Diaz033b4bb2018-10-25 16:52:26 +01007#ifndef CPUAMU_H
8#define CPUAMU_H
Dimitris Papastamos0b00f8a2018-02-14 10:00:06 +00009
10/*******************************************************************************
11 * CPU Activity Monitor Unit register specific definitions.
12 ******************************************************************************/
13#define CPUAMCNTENCLR_EL0 S3_3_C15_C9_7
14#define CPUAMCNTENSET_EL0 S3_3_C15_C9_6
15#define CPUAMCFGR_EL0 S3_3_C15_C10_6
16#define CPUAMUSERENR_EL0 S3_3_C15_C10_7
17
18/* Activity Monitor Event Counter Registers */
19#define CPUAMEVCNTR0_EL0 S3_3_C15_C9_0
20#define CPUAMEVCNTR1_EL0 S3_3_C15_C9_1
21#define CPUAMEVCNTR2_EL0 S3_3_C15_C9_2
22#define CPUAMEVCNTR3_EL0 S3_3_C15_C9_3
23#define CPUAMEVCNTR4_EL0 S3_3_C15_C9_4
24
25/* Activity Monitor Event Type Registers */
26#define CPUAMEVTYPER0_EL0 S3_3_C15_C10_0
27#define CPUAMEVTYPER1_EL0 S3_3_C15_C10_1
28#define CPUAMEVTYPER2_EL0 S3_3_C15_C10_2
29#define CPUAMEVTYPER3_EL0 S3_3_C15_C10_3
30#define CPUAMEVTYPER4_EL0 S3_3_C15_C10_4
31
Julius Werner53456fc2019-07-09 13:49:11 -070032#ifndef __ASSEMBLER__
Dimitris Papastamos0b00f8a2018-02-14 10:00:06 +000033#include <stdint.h>
34
Antonio Nino Diaz033b4bb2018-10-25 16:52:26 +010035uint64_t cpuamu_cnt_read(unsigned int idx);
36void cpuamu_cnt_write(unsigned int idx, uint64_t val);
Dimitris Papastamos0b00f8a2018-02-14 10:00:06 +000037unsigned int cpuamu_read_cpuamcntenset_el0(void);
38unsigned int cpuamu_read_cpuamcntenclr_el0(void);
39void cpuamu_write_cpuamcntenset_el0(unsigned int mask);
40void cpuamu_write_cpuamcntenclr_el0(unsigned int mask);
Dimitris Papastamos1be747f2018-02-14 10:28:36 +000041
42int midr_match(unsigned int cpu_midr);
43void cpuamu_context_save(unsigned int nr_counters);
44void cpuamu_context_restore(unsigned int nr_counters);
45
Julius Werner53456fc2019-07-09 13:49:11 -070046#endif /* __ASSEMBLER__ */
Dimitris Papastamos0b00f8a2018-02-14 10:00:06 +000047
Antonio Nino Diaz033b4bb2018-10-25 16:52:26 +010048#endif /* CPUAMU_H */