blob: de476e427b3df48c1d0820ef2a9f59b2bae3f123 [file] [log] [blame]
Dimitris Papastamose08005a2017-10-12 13:02:29 +01001/*
johpow01fa59c6f2020-10-02 13:41:11 -05002 * Copyright (c) 2017-2021, ARM Limited and Contributors. All rights reserved.
Dimitris Papastamose08005a2017-10-12 13:02:29 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Antonio Nino Diaz033b4bb2018-10-25 16:52:26 +01007#ifndef AMU_H
8#define AMU_H
Dimitris Papastamose08005a2017-10-12 13:02:29 +01009
Antonio Nino Diaz033b4bb2018-10-25 16:52:26 +010010#include <stdbool.h>
Chris Kayf11909f2021-08-19 11:21:52 +010011#include <stdint.h>
12
Arunachalam Ganapathycac7d162021-07-08 09:35:57 +010013#include <context.h>
Alexei Fedorov7e6306b2020-07-14 08:17:56 +010014
Chris Kayf11909f2021-08-19 11:21:52 +010015#include <platform_def.h>
16
Andre Przywara906776e2023-03-03 10:30:06 +000017#if ENABLE_FEAT_AMU
Arunachalam Ganapathycac7d162021-07-08 09:35:57 +010018#if __aarch64__
19void amu_enable(bool el2_unused, cpu_context_t *ctx);
20#else
Antonio Nino Diaz033b4bb2018-10-25 16:52:26 +010021void amu_enable(bool el2_unused);
Arunachalam Ganapathycac7d162021-07-08 09:35:57 +010022#endif
Andre Przywara906776e2023-03-03 10:30:06 +000023#else
24#if __aarch64__
25static inline void amu_enable(bool el2_unused, cpu_context_t *ctx)
26{
27}
28#else
29static inline void amu_enable(bool el2_unused)
30{
31}
32#endif
33#endif
Dimitris Papastamose08005a2017-10-12 13:02:29 +010034
Chris Kayf11909f2021-08-19 11:21:52 +010035#if ENABLE_AMU_AUXILIARY_COUNTERS
36/*
37 * AMU data for a single core.
38 */
39struct amu_core {
40 uint16_t enable; /* Mask of auxiliary counters to enable */
41};
42
43/*
44 * Topological platform data specific to the AMU.
45 */
46struct 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 */
55const struct amu_topology *plat_amu_topology(void);
56#endif /* ENABLE_AMU_FCONF */
57#endif /* ENABLE_AMU_AUXILIARY_COUNTERS */
58
Antonio Nino Diaz033b4bb2018-10-25 16:52:26 +010059#endif /* AMU_H */