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 <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 #ifdef PLAT_AMU_GROUP1_COUNTERS_MASK 20 #define AMU_GROUP1_COUNTERS_MASK PLAT_AMU_GROUP1_COUNTERS_MASK 21 #else 22 #define AMU_GROUP1_COUNTERS_MASK U(0) 23 #endif 24 25 #ifdef PLAT_AMU_GROUP1_NR_COUNTERS 26 #define AMU_GROUP1_NR_COUNTERS PLAT_AMU_GROUP1_NR_COUNTERS 27 #else 28 #define AMU_GROUP1_NR_COUNTERS U(0) 29 #endif 30 31 CASSERT(AMU_GROUP1_COUNTERS_MASK <= 0xffff, invalid_amu_group1_counters_mask); 32 CASSERT(AMU_GROUP1_NR_COUNTERS <= 16, invalid_amu_group1_nr_counters); 33 34 bool amu_supported(void); 35 void amu_enable(bool el2_unused); 36 37 /* Group 0 configuration helpers */ 38 uint64_t amu_group0_cnt_read(int idx); 39 void amu_group0_cnt_write(int idx, uint64_t val); 40 41 /* Group 1 configuration helpers */ 42 uint64_t amu_group1_cnt_read(int idx); 43 void amu_group1_cnt_write(int idx, uint64_t val); 44 void amu_group1_set_evtype(int idx, unsigned int val); 45 46 #endif /* AMU_H */ 47