aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/coresight.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/coresight.h')
-rw-r--r--include/linux/coresight.h68
1 files changed, 37 insertions, 31 deletions
diff --git a/include/linux/coresight.h b/include/linux/coresight.h
index c265e0468414..d828a6efe0b1 100644
--- a/include/linux/coresight.h
+++ b/include/linux/coresight.h
@@ -40,6 +40,7 @@ enum coresight_dev_type {
40 CORESIGHT_DEV_TYPE_LINK, 40 CORESIGHT_DEV_TYPE_LINK,
41 CORESIGHT_DEV_TYPE_LINKSINK, 41 CORESIGHT_DEV_TYPE_LINKSINK,
42 CORESIGHT_DEV_TYPE_SOURCE, 42 CORESIGHT_DEV_TYPE_SOURCE,
43 CORESIGHT_DEV_TYPE_HELPER,
43}; 44};
44 45
45enum coresight_dev_subtype_sink { 46enum coresight_dev_subtype_sink {
@@ -62,19 +63,30 @@ enum coresight_dev_subtype_source {
62 CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE, 63 CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE,
63}; 64};
64 65
66enum coresight_dev_subtype_helper {
67 CORESIGHT_DEV_SUBTYPE_HELPER_NONE,
68 CORESIGHT_DEV_SUBTYPE_HELPER_CATU,
69};
70
65/** 71/**
66 * struct coresight_dev_subtype - further characterisation of a type 72 * union coresight_dev_subtype - further characterisation of a type
67 * @sink_subtype: type of sink this component is, as defined 73 * @sink_subtype: type of sink this component is, as defined
68 by @coresight_dev_subtype_sink. 74 * by @coresight_dev_subtype_sink.
69 * @link_subtype: type of link this component is, as defined 75 * @link_subtype: type of link this component is, as defined
70 by @coresight_dev_subtype_link. 76 * by @coresight_dev_subtype_link.
71 * @source_subtype: type of source this component is, as defined 77 * @source_subtype: type of source this component is, as defined
72 by @coresight_dev_subtype_source. 78 * by @coresight_dev_subtype_source.
79 * @helper_subtype: type of helper this component is, as defined
80 * by @coresight_dev_subtype_helper.
73 */ 81 */
74struct coresight_dev_subtype { 82union coresight_dev_subtype {
75 enum coresight_dev_subtype_sink sink_subtype; 83 /* We have some devices which acts as LINK and SINK */
76 enum coresight_dev_subtype_link link_subtype; 84 struct {
85 enum coresight_dev_subtype_sink sink_subtype;
86 enum coresight_dev_subtype_link link_subtype;
87 };
77 enum coresight_dev_subtype_source source_subtype; 88 enum coresight_dev_subtype_source source_subtype;
89 enum coresight_dev_subtype_helper helper_subtype;
78}; 90};
79 91
80/** 92/**
@@ -87,7 +99,6 @@ struct coresight_dev_subtype {
87 * @child_ports:child component port number the current component is 99 * @child_ports:child component port number the current component is
88 connected to. 100 connected to.
89 * @nr_outport: number of output ports for this component. 101 * @nr_outport: number of output ports for this component.
90 * @clk: The clock this component is associated to.
91 */ 102 */
92struct coresight_platform_data { 103struct coresight_platform_data {
93 int cpu; 104 int cpu;
@@ -97,7 +108,6 @@ struct coresight_platform_data {
97 const char **child_names; 108 const char **child_names;
98 int *child_ports; 109 int *child_ports;
99 int nr_outport; 110 int nr_outport;
100 struct clk *clk;
101}; 111};
102 112
103/** 113/**
@@ -113,7 +123,7 @@ struct coresight_platform_data {
113 */ 123 */
114struct coresight_desc { 124struct coresight_desc {
115 enum coresight_dev_type type; 125 enum coresight_dev_type type;
116 struct coresight_dev_subtype subtype; 126 union coresight_dev_subtype subtype;
117 const struct coresight_ops *ops; 127 const struct coresight_ops *ops;
118 struct coresight_platform_data *pdata; 128 struct coresight_platform_data *pdata;
119 struct device *dev; 129 struct device *dev;
@@ -157,7 +167,7 @@ struct coresight_device {
157 int nr_inport; 167 int nr_inport;
158 int nr_outport; 168 int nr_outport;
159 enum coresight_dev_type type; 169 enum coresight_dev_type type;
160 struct coresight_dev_subtype subtype; 170 union coresight_dev_subtype subtype;
161 const struct coresight_ops *ops; 171 const struct coresight_ops *ops;
162 struct device dev; 172 struct device dev;
163 atomic_t *refcnt; 173 atomic_t *refcnt;
@@ -171,6 +181,7 @@ struct coresight_device {
171#define source_ops(csdev) csdev->ops->source_ops 181#define source_ops(csdev) csdev->ops->source_ops
172#define sink_ops(csdev) csdev->ops->sink_ops 182#define sink_ops(csdev) csdev->ops->sink_ops
173#define link_ops(csdev) csdev->ops->link_ops 183#define link_ops(csdev) csdev->ops->link_ops
184#define helper_ops(csdev) csdev->ops->helper_ops
174 185
175/** 186/**
176 * struct coresight_ops_sink - basic operations for a sink 187 * struct coresight_ops_sink - basic operations for a sink
@@ -230,10 +241,25 @@ struct coresight_ops_source {
230 struct perf_event *event); 241 struct perf_event *event);
231}; 242};
232 243
244/**
245 * struct coresight_ops_helper - Operations for a helper device.
246 *
247 * All operations could pass in a device specific data, which could
248 * help the helper device to determine what to do.
249 *
250 * @enable : Enable the device
251 * @disable : Disable the device
252 */
253struct coresight_ops_helper {
254 int (*enable)(struct coresight_device *csdev, void *data);
255 int (*disable)(struct coresight_device *csdev, void *data);
256};
257
233struct coresight_ops { 258struct coresight_ops {
234 const struct coresight_ops_sink *sink_ops; 259 const struct coresight_ops_sink *sink_ops;
235 const struct coresight_ops_link *link_ops; 260 const struct coresight_ops_link *link_ops;
236 const struct coresight_ops_source *source_ops; 261 const struct coresight_ops_source *source_ops;
262 const struct coresight_ops_helper *helper_ops;
237}; 263};
238 264
239#ifdef CONFIG_CORESIGHT 265#ifdef CONFIG_CORESIGHT
@@ -267,24 +293,4 @@ static inline struct coresight_platform_data *of_get_coresight_platform_data(
267 struct device *dev, const struct device_node *node) { return NULL; } 293 struct device *dev, const struct device_node *node) { return NULL; }
268#endif 294#endif
269 295
270#ifdef CONFIG_PID_NS
271static inline unsigned long
272coresight_vpid_to_pid(unsigned long vpid)
273{
274 struct task_struct *task = NULL;
275 unsigned long pid = 0;
276
277 rcu_read_lock();
278 task = find_task_by_vpid(vpid);
279 if (task)
280 pid = task_pid_nr(task);
281 rcu_read_unlock();
282
283 return pid;
284}
285#else
286static inline unsigned long
287coresight_vpid_to_pid(unsigned long vpid) { return vpid; }
288#endif
289
290#endif 296#endif