Dimitris Papastamos | e08005a | 2017-10-12 13:02:29 +0100 | [diff] [blame] | 1 | /* |
Antonio Nino Diaz | 4b32e62 | 2018-08-16 16:52:57 +0100 | [diff] [blame] | 2 | * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. |
Dimitris Papastamos | e08005a | 2017-10-12 13:02:29 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef __AMU_H__ |
| 8 | #define __AMU_H__ |
| 9 | |
Dimitris Papastamos | 60346db | 2017-12-13 10:54:37 +0000 | [diff] [blame] | 10 | #include <cassert.h> |
| 11 | #include <platform_def.h> |
Dimitris Papastamos | 525c37a | 2017-11-13 09:49:45 +0000 | [diff] [blame] | 12 | #include <stdint.h> |
Dimitris Papastamos | 60346db | 2017-12-13 10:54:37 +0000 | [diff] [blame] | 13 | |
| 14 | /* All group 0 counters */ |
Dimitris Papastamos | e08005a | 2017-10-12 13:02:29 +0100 | [diff] [blame] | 15 | #define AMU_GROUP0_COUNTERS_MASK 0xf |
| 16 | |
Dimitris Papastamos | 60346db | 2017-12-13 10:54:37 +0000 | [diff] [blame] | 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 | |
Dimitris Papastamos | 525c37a | 2017-11-13 09:49:45 +0000 | [diff] [blame] | 32 | int amu_supported(void); |
Dimitris Papastamos | e08005a | 2017-10-12 13:02:29 +0100 | [diff] [blame] | 33 | void amu_enable(int el2_unused); |
| 34 | |
Dimitris Papastamos | 525c37a | 2017-11-13 09:49:45 +0000 | [diff] [blame] | 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 | |
Dimitris Papastamos | e08005a | 2017-10-12 13:02:29 +0100 | [diff] [blame] | 44 | #endif /* __AMU_H__ */ |