1 /*
2  * Copyright(C) 2015 Linaro Limited. All rights reserved.
3  * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 as published by
7  * the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef _CORESIGHT_ETM_PERF_H
19 #define _CORESIGHT_ETM_PERF_H
20 
21 #include "coresight-priv.h"
22 
23 struct coresight_device;
24 
25 /*
26  * In both ETMv3 and v4 the maximum number of address comparator implentable
27  * is 8.  The actual number is implementation specific and will be checked
28  * when filters are applied.
29  */
30 #define ETM_ADDR_CMP_MAX	8
31 
32 /**
33  * struct etm_filter - single instruction range or start/stop configuration.
34  * @start_addr:	The address to start tracing on.
35  * @stop_addr:	The address to stop tracing on.
36  * @type:	Is this a range or start/stop filter.
37  */
38 struct etm_filter {
39 	unsigned long start_addr;
40 	unsigned long stop_addr;
41 	enum etm_addr_type type;
42 };
43 
44 /**
45  * struct etm_filters - set of filters for a session
46  * @etm_filter:	All the filters for this session.
47  * @nr_filters:	Number of filters
48  * @ssstatus:	Status of the start/stop logic.
49  */
50 struct etm_filters {
51 	struct etm_filter	etm_filter[ETM_ADDR_CMP_MAX];
52 	unsigned int		nr_filters;
53 	bool			ssstatus;
54 };
55 
56 
57 #ifdef CONFIG_CORESIGHT
58 int etm_perf_symlink(struct coresight_device *csdev, bool link);
59 
60 #else
61 static inline int etm_perf_symlink(struct coresight_device *csdev, bool link)
62 { return -EINVAL; }
63 
64 #endif /* CONFIG_CORESIGHT */
65 
66 #endif
67