1 /*
2  * Copyright (c) 2017-2021, 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 <stdbool.h>
11 #include <stdint.h>
12 
13 #include <context.h>
14 
15 #include <platform_def.h>
16 
17 #if __aarch64__
18 void amu_enable(bool el2_unused, cpu_context_t *ctx);
19 #else
20 void amu_enable(bool el2_unused);
21 #endif
22 
23 #if ENABLE_AMU_AUXILIARY_COUNTERS
24 /*
25  * AMU data for a single core.
26  */
27 struct amu_core {
28 	uint16_t enable; /* Mask of auxiliary counters to enable */
29 };
30 
31 /*
32  * Topological platform data specific to the AMU.
33  */
34 struct amu_topology {
35 	struct amu_core cores[PLATFORM_CORE_COUNT]; /* Per-core data */
36 };
37 
38 #if !ENABLE_AMU_FCONF
39 /*
40  * Retrieve the platform's AMU topology. A `NULL` return value is treated as a
41  * non-fatal error, in which case no auxiliary counters will be enabled.
42  */
43 const struct amu_topology *plat_amu_topology(void);
44 #endif /* ENABLE_AMU_FCONF */
45 #endif /* ENABLE_AMU_AUXILIARY_COUNTERS */
46 
47 #endif /* AMU_H */
48