1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright(C) 2015 Linaro Limited. All rights reserved.
4  * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
5  */
6 
7 #ifndef _CORESIGHT_ETM_PERF_H
8 #define _CORESIGHT_ETM_PERF_H
9 
10 #include "coresight-priv.h"
11 
12 struct coresight_device;
13 
14 /*
15  * In both ETMv3 and v4 the maximum number of address comparator implentable
16  * is 8.  The actual number is implementation specific and will be checked
17  * when filters are applied.
18  */
19 #define ETM_ADDR_CMP_MAX	8
20 
21 /**
22  * struct etm_filter - single instruction range or start/stop configuration.
23  * @start_addr:	The address to start tracing on.
24  * @stop_addr:	The address to stop tracing on.
25  * @type:	Is this a range or start/stop filter.
26  */
27 struct etm_filter {
28 	unsigned long start_addr;
29 	unsigned long stop_addr;
30 	enum etm_addr_type type;
31 };
32 
33 /**
34  * struct etm_filters - set of filters for a session
35  * @etm_filter:	All the filters for this session.
36  * @nr_filters:	Number of filters
37  * @ssstatus:	Status of the start/stop logic.
38  */
39 struct etm_filters {
40 	struct etm_filter	etm_filter[ETM_ADDR_CMP_MAX];
41 	unsigned int		nr_filters;
42 	bool			ssstatus;
43 };
44 
45 
46 #ifdef CONFIG_CORESIGHT
47 int etm_perf_symlink(struct coresight_device *csdev, bool link);
48 
49 #else
50 static inline int etm_perf_symlink(struct coresight_device *csdev, bool link)
51 { return -EINVAL; }
52 
53 #endif /* CONFIG_CORESIGHT */
54 
55 #endif
56