Dimitris Papastamos | e08005a | 2017-10-12 13:02:29 +0100 | [diff] [blame] | 1 | /* |
johpow01 | fa59c6f | 2020-10-02 13:41:11 -0500 | [diff] [blame] | 2 | * Copyright (c) 2017-2021, 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 | |
Antonio Nino Diaz | 033b4bb | 2018-10-25 16:52:26 +0100 | [diff] [blame] | 7 | #ifndef AMU_H |
| 8 | #define AMU_H |
Dimitris Papastamos | e08005a | 2017-10-12 13:02:29 +0100 | [diff] [blame] | 9 | |
Antonio Nino Diaz | 033b4bb | 2018-10-25 16:52:26 +0100 | [diff] [blame] | 10 | #include <stdbool.h> |
Chris Kay | f11909f | 2021-08-19 11:21:52 +0100 | [diff] [blame] | 11 | #include <stdint.h> |
| 12 | |
Arunachalam Ganapathy | cac7d16 | 2021-07-08 09:35:57 +0100 | [diff] [blame] | 13 | #include <context.h> |
Alexei Fedorov | 7e6306b | 2020-07-14 08:17:56 +0100 | [diff] [blame] | 14 | |
Chris Kay | f11909f | 2021-08-19 11:21:52 +0100 | [diff] [blame] | 15 | #include <platform_def.h> |
| 16 | |
Arunachalam Ganapathy | cac7d16 | 2021-07-08 09:35:57 +0100 | [diff] [blame] | 17 | #if __aarch64__ |
| 18 | void amu_enable(bool el2_unused, cpu_context_t *ctx); |
| 19 | #else |
Antonio Nino Diaz | 033b4bb | 2018-10-25 16:52:26 +0100 | [diff] [blame] | 20 | void amu_enable(bool el2_unused); |
Arunachalam Ganapathy | cac7d16 | 2021-07-08 09:35:57 +0100 | [diff] [blame] | 21 | #endif |
Dimitris Papastamos | e08005a | 2017-10-12 13:02:29 +0100 | [diff] [blame] | 22 | |
Chris Kay | f11909f | 2021-08-19 11:21:52 +0100 | [diff] [blame] | 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 | |
Antonio Nino Diaz | 033b4bb | 2018-10-25 16:52:26 +0100 | [diff] [blame] | 47 | #endif /* AMU_H */ |