blob: faa0ee125f77a55331661a0f9da328b09961d907 [file] [log] [blame]
Dimitris Papastamose08005a2017-10-12 13:02:29 +01001/*
2 * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef __AMU_H__
8#define __AMU_H__
9
Dimitris Papastamos60346db2017-12-13 10:54:37 +000010#include <sys/cdefs.h> /* for CASSERT() */
11#include <cassert.h>
12#include <platform_def.h>
Dimitris Papastamos525c37a2017-11-13 09:49:45 +000013#include <stdint.h>
Dimitris Papastamos60346db2017-12-13 10:54:37 +000014
15/* All group 0 counters */
Dimitris Papastamose08005a2017-10-12 13:02:29 +010016#define AMU_GROUP0_COUNTERS_MASK 0xf
17
Dimitris Papastamos60346db2017-12-13 10:54:37 +000018#ifdef PLAT_AMU_GROUP1_COUNTERS_MASK
19#define AMU_GROUP1_COUNTERS_MASK PLAT_AMU_GROUP1_COUNTERS_MASK
20#else
21#define AMU_GROUP1_COUNTERS_MASK 0
22#endif
23
24#ifdef PLAT_AMU_GROUP1_NR_COUNTERS
25#define AMU_GROUP1_NR_COUNTERS PLAT_AMU_GROUP1_NR_COUNTERS
26#else
27#define AMU_GROUP1_NR_COUNTERS 0
28#endif
29
30CASSERT(AMU_GROUP1_COUNTERS_MASK <= 0xffff, invalid_amu_group1_counters_mask);
31CASSERT(AMU_GROUP1_NR_COUNTERS <= 16, invalid_amu_group1_nr_counters);
32
Dimitris Papastamos525c37a2017-11-13 09:49:45 +000033int amu_supported(void);
Dimitris Papastamose08005a2017-10-12 13:02:29 +010034void amu_enable(int el2_unused);
35
Dimitris Papastamos525c37a2017-11-13 09:49:45 +000036/* Group 0 configuration helpers */
37uint64_t amu_group0_cnt_read(int idx);
38void amu_group0_cnt_write(int idx, uint64_t val);
39
40/* Group 1 configuration helpers */
41uint64_t amu_group1_cnt_read(int idx);
42void amu_group1_cnt_write(int idx, uint64_t val);
43void amu_group1_set_evtype(int idx, unsigned int val);
44
Dimitris Papastamose08005a2017-10-12 13:02:29 +010045#endif /* __AMU_H__ */