2017-10-12 13:02:29 +01:00
|
|
|
/*
|
2018-08-16 16:52:57 +01:00
|
|
|
* Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
|
2017-10-12 13:02:29 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
*/
|
|
|
|
|
2018-10-25 16:52:26 +01:00
|
|
|
#ifndef AMU_H
|
|
|
|
#define AMU_H
|
2017-10-12 13:02:29 +01:00
|
|
|
|
2018-10-25 16:52:26 +01:00
|
|
|
#include <stdbool.h>
|
2017-11-13 09:49:45 +00:00
|
|
|
#include <stdint.h>
|
2018-12-14 00:18:21 +00:00
|
|
|
|
|
|
|
#include <platform_def.h>
|
|
|
|
|
|
|
|
#include <lib/cassert.h>
|
|
|
|
#include <lib/utils_def.h>
|
2017-12-13 10:54:37 +00:00
|
|
|
|
|
|
|
/* All group 0 counters */
|
2018-10-25 16:52:26 +01:00
|
|
|
#define AMU_GROUP0_COUNTERS_MASK U(0xf)
|
2017-10-12 13:02:29 +01:00
|
|
|
|
2017-12-13 10:54:37 +00:00
|
|
|
#ifdef PLAT_AMU_GROUP1_COUNTERS_MASK
|
|
|
|
#define AMU_GROUP1_COUNTERS_MASK PLAT_AMU_GROUP1_COUNTERS_MASK
|
|
|
|
#else
|
2018-10-25 16:52:26 +01:00
|
|
|
#define AMU_GROUP1_COUNTERS_MASK U(0)
|
2017-12-13 10:54:37 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef PLAT_AMU_GROUP1_NR_COUNTERS
|
|
|
|
#define AMU_GROUP1_NR_COUNTERS PLAT_AMU_GROUP1_NR_COUNTERS
|
|
|
|
#else
|
2018-10-25 16:52:26 +01:00
|
|
|
#define AMU_GROUP1_NR_COUNTERS U(0)
|
2017-12-13 10:54:37 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
CASSERT(AMU_GROUP1_COUNTERS_MASK <= 0xffff, invalid_amu_group1_counters_mask);
|
|
|
|
CASSERT(AMU_GROUP1_NR_COUNTERS <= 16, invalid_amu_group1_nr_counters);
|
|
|
|
|
2018-10-25 16:52:26 +01:00
|
|
|
bool amu_supported(void);
|
|
|
|
void amu_enable(bool el2_unused);
|
2017-10-12 13:02:29 +01:00
|
|
|
|
2017-11-13 09:49:45 +00:00
|
|
|
/* Group 0 configuration helpers */
|
|
|
|
uint64_t amu_group0_cnt_read(int idx);
|
|
|
|
void amu_group0_cnt_write(int idx, uint64_t val);
|
|
|
|
|
|
|
|
/* Group 1 configuration helpers */
|
|
|
|
uint64_t amu_group1_cnt_read(int idx);
|
|
|
|
void amu_group1_cnt_write(int idx, uint64_t val);
|
|
|
|
void amu_group1_set_evtype(int idx, unsigned int val);
|
|
|
|
|
2018-10-25 16:52:26 +01:00
|
|
|
#endif /* AMU_H */
|