1 /* 2 * Copyright (c) 2017-2018, 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 10 #include <cassert.h> 11 #include <platform_def.h> 12 #include <stdint.h> 13 14 /* All group 0 counters */ 15 #define AMU_GROUP0_COUNTERS_MASK 0xf 16 17 #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 29 CASSERT(AMU_GROUP1_COUNTERS_MASK <= 0xffff, invalid_amu_group1_counters_mask); 30 CASSERT(AMU_GROUP1_NR_COUNTERS <= 16, invalid_amu_group1_nr_counters); 31 32 int amu_supported(void); 33 void amu_enable(int el2_unused); 34 35 /* Group 0 configuration helpers */ 36 uint64_t amu_group0_cnt_read(int idx); 37 void amu_group0_cnt_write(int idx, uint64_t val); 38 39 /* Group 1 configuration helpers */ 40 uint64_t amu_group1_cnt_read(int idx); 41 void amu_group1_cnt_write(int idx, uint64_t val); 42 void amu_group1_set_evtype(int idx, unsigned int val); 43 44 #endif /* __AMU_H__ */ 45