aboutsummaryrefslogtreecommitdiff
path: root/include/lib/mpmm/mpmm.h
blob: 955c530e83fedfca00c159368ff45f099f68e36d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * Copyright (c) 2021, Arm Limited. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef MPMM_H
#define MPMM_H

#include <stdbool.h>

#include <platform_def.h>

/*
 * Enable the Maximum Power Mitigation Mechanism.
 *
 * This function will enable MPMM for the current core. The AMU counters
 * representing the MPMM gears must have been configured and enabled prior to
 * calling this function.
 */
void mpmm_enable(void);

/*
 * MPMM core data.
 *
 * This structure represents per-core data retrieved from the hardware
 * configuration device tree.
 */
struct mpmm_core {
	/*
	 * Whether MPMM is supported.
	 *
	 * Cores with support for MPMM offer one or more auxiliary AMU counters
	 * representing MPMM gears.
	 */
	bool supported;
};

/*
 * MPMM topology.
 *
 * This topology structure describes the system-wide representation of the
 * information retrieved from the hardware configuration device tree.
 */
struct mpmm_topology {
	struct mpmm_core cores[PLATFORM_CORE_COUNT]; /* Per-core data */
};

#if !ENABLE_MPMM_FCONF
/*
 * Retrieve the platform's MPMM topology. A `NULL` return value is treated as a
 * non-fatal error, in which case MPMM will not be enabled for any core.
 */
const struct mpmm_topology *plat_mpmm_topology(void);
#endif /* ENABLE_MPMM_FCONF */

#endif /* MPMM_H */