blob: 6452f7e483c665f7f7e2b6643a3e0fcf7b253e59 [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
Arunachalam Ganapathycac7d162021-07-08 09:35:57 +010017#if __aarch64__
18void amu_enable(bool el2_unused, cpu_context_t *ctx);
19#else
Antonio Nino Diaz033b4bb2018-10-25 16:52:26 +010020void amu_enable(bool el2_unused);
Arunachalam Ganapathycac7d162021-07-08 09:35:57 +010021#endif
Dimitris Papastamose08005a2017-10-12 13:02:29 +010022
Chris Kayf11909f2021-08-19 11:21:52 +010023#if ENABLE_AMU_AUXILIARY_COUNTERS
24/*
25 * AMU data for a single core.
26 */
27struct amu_core {
28 uint16_t enable; /* Mask of auxiliary counters to enable */
29};
30
31/*
32 * Topological platform data specific to the AMU.
33 */
34struct 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 */
43const struct amu_topology *plat_amu_topology(void);
44#endif /* ENABLE_AMU_FCONF */
45#endif /* ENABLE_AMU_AUXILIARY_COUNTERS */
46
Antonio Nino Diaz033b4bb2018-10-25 16:52:26 +010047#endif /* AMU_H */