amu.h 1.15 KB
Newer Older
1
/*
2
 * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
3
4
5
6
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

7
8
#ifndef AMU_H
#define AMU_H
9

10
11
#include <cassert.h>
#include <platform_def.h>
12
#include <stdbool.h>
13
#include <stdint.h>
14
#include <utils_def.h>
15
16

/* All group 0 counters */
17
#define AMU_GROUP0_COUNTERS_MASK	U(0xf)
18

19
20
21
#ifdef PLAT_AMU_GROUP1_COUNTERS_MASK
#define AMU_GROUP1_COUNTERS_MASK	PLAT_AMU_GROUP1_COUNTERS_MASK
#else
22
#define AMU_GROUP1_COUNTERS_MASK	U(0)
23
24
25
26
27
#endif

#ifdef PLAT_AMU_GROUP1_NR_COUNTERS
#define AMU_GROUP1_NR_COUNTERS		PLAT_AMU_GROUP1_NR_COUNTERS
#else
28
#define AMU_GROUP1_NR_COUNTERS		U(0)
29
30
31
32
33
#endif

CASSERT(AMU_GROUP1_COUNTERS_MASK <= 0xffff, invalid_amu_group1_counters_mask);
CASSERT(AMU_GROUP1_NR_COUNTERS <= 16, invalid_amu_group1_nr_counters);

34
35
bool amu_supported(void);
void amu_enable(bool el2_unused);
36

37
38
39
40
41
42
43
44
45
/* Group 0 configuration helpers */
uint64_t amu_group0_cnt_read(int idx);
void amu_group0_cnt_write(int idx, uint64_t val);

/* Group 1 configuration helpers */
uint64_t amu_group1_cnt_read(int idx);
void amu_group1_cnt_write(int idx, uint64_t val);
void amu_group1_set_evtype(int idx, unsigned int val);

46
#endif /* AMU_H */