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 ENABLE_FEAT_AMU 18 #if __aarch64__ 19 void amu_enable(bool el2_unused, cpu_context_t *ctx); 20 #else 21 void amu_enable(bool el2_unused); 22 #endif 23 #else 24 #if __aarch64__ 25 static inline void amu_enable(bool el2_unused, cpu_context_t *ctx) 26 { 27 } 28 #else 29 static inline void amu_enable(bool el2_unused) 30 { 31 } 32 #endif 33 #endif 34 35 #if ENABLE_AMU_AUXILIARY_COUNTERS 36 /* 37 * AMU data for a single core. 38 */ 39 struct amu_core { 40 uint16_t enable; /* Mask of auxiliary counters to enable */ 41 }; 42 43 /* 44 * Topological platform data specific to the AMU. 45 */ 46 struct amu_topology { 47 struct amu_core cores[PLATFORM_CORE_COUNT]; /* Per-core data */ 48 }; 49 50 #if !ENABLE_AMU_FCONF 51 /* 52 * Retrieve the platform's AMU topology. A `NULL` return value is treated as a 53 * non-fatal error, in which case no auxiliary counters will be enabled. 54 */ 55 const struct amu_topology *plat_amu_topology(void); 56 #endif /* ENABLE_AMU_FCONF */ 57 #endif /* ENABLE_AMU_AUXILIARY_COUNTERS */ 58 59 #endif /* AMU_H */ 60