blob: 46d5e15936584ef88d45ce5ebc72f71ffe41e7e5 [file] [log] [blame]
Dimitris Papastamose08005a2017-10-12 13:02:29 +01001/*
Antonio Nino Diaz4b32e622018-08-16 16:52:57 +01002 * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
Dimitris Papastamose08005a2017-10-12 13:02:29 +01003 *
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 <cassert.h>
11#include <platform_def.h>
Dimitris Papastamos525c37a2017-11-13 09:49:45 +000012#include <stdint.h>
Dimitris Papastamos60346db2017-12-13 10:54:37 +000013
14/* All group 0 counters */
Dimitris Papastamose08005a2017-10-12 13:02:29 +010015#define AMU_GROUP0_COUNTERS_MASK 0xf
16
Dimitris Papastamos60346db2017-12-13 10:54:37 +000017#ifdef PLAT_AMU_GROUP1_COUNTERS_MASK
18#define AMU_GROUP1_COUNTERS_MASK PLAT_AMU_GROUP1_COUNTERS_MASK
19#else
20#define AMU_GROUP1_COUNTERS_MASK 0
21#endif
22
23#ifdef PLAT_AMU_GROUP1_NR_COUNTERS
24#define AMU_GROUP1_NR_COUNTERS PLAT_AMU_GROUP1_NR_COUNTERS
25#else
26#define AMU_GROUP1_NR_COUNTERS 0
27#endif
28
29CASSERT(AMU_GROUP1_COUNTERS_MASK <= 0xffff, invalid_amu_group1_counters_mask);
30CASSERT(AMU_GROUP1_NR_COUNTERS <= 16, invalid_amu_group1_nr_counters);
31
Dimitris Papastamos525c37a2017-11-13 09:49:45 +000032int amu_supported(void);
Dimitris Papastamose08005a2017-10-12 13:02:29 +010033void amu_enable(int el2_unused);
34
Dimitris Papastamos525c37a2017-11-13 09:49:45 +000035/* Group 0 configuration helpers */
36uint64_t amu_group0_cnt_read(int idx);
37void amu_group0_cnt_write(int idx, uint64_t val);
38
39/* Group 1 configuration helpers */
40uint64_t amu_group1_cnt_read(int idx);
41void amu_group1_cnt_write(int idx, uint64_t val);
42void amu_group1_set_evtype(int idx, unsigned int val);
43
Dimitris Papastamose08005a2017-10-12 13:02:29 +010044#endif /* __AMU_H__ */