coresight: etb10: implementing AUX API
[firefly-linux-kernel-4.4.55.git] / include / linux / coresight.h
index a7cabfa23b55823773cb91e9bfd7996ae34f3f97..385d62e64abb00218d5f52f32bd1875dde5b7b43 100644 (file)
@@ -14,6 +14,7 @@
 #define _LINUX_CORESIGHT_H
 
 #include <linux/device.h>
+#include <linux/perf_event.h>
 #include <linux/sched.h>
 
 /* Peripheral id registers (0xFD0-0xFEC) */
@@ -152,7 +153,6 @@ struct coresight_connection {
                by @coresight_ops.
  * @dev:       The device entity associated to this component.
  * @refcnt:    keep track of what is in use.
- * @path_link: link of current component into the path being enabled.
  * @orphan:    true if the component has connections that haven't been linked.
  * @enable:    'true' if component is currently part of an active path.
  * @activated: 'true' only if a _sink_ has been activated.  A sink can be
@@ -168,7 +168,6 @@ struct coresight_device {
        const struct coresight_ops *ops;
        struct device dev;
        atomic_t *refcnt;
-       struct list_head path_link;
        bool orphan;
        bool enable;    /* true only if configured as part of a path */
        bool activated; /* true only if a sink is part of a path */
@@ -183,12 +182,29 @@ struct coresight_device {
 /**
  * struct coresight_ops_sink - basic operations for a sink
  * Operations available for sinks
- * @enable:    enables the sink.
- * @disable:   disables the sink.
+ * @enable:            enables the sink.
+ * @disable:           disables the sink.
+ * @alloc_buffer:      initialises perf's ring buffer for trace collection.
+ * @free_buffer:       release memory allocated in @get_config.
+ * @set_buffer:                initialises buffer mechanic before a trace session.
+ * @reset_buffer:      finalises buffer mechanic after a trace session.
+ * @update_buffer:     update buffer pointers after a trace session.
  */
 struct coresight_ops_sink {
-       int (*enable)(struct coresight_device *csdev);
+       int (*enable)(struct coresight_device *csdev, u32 mode);
        void (*disable)(struct coresight_device *csdev);
+       void *(*alloc_buffer)(struct coresight_device *csdev, int cpu,
+                             void **pages, int nr_pages, bool overwrite);
+       void (*free_buffer)(void *config);
+       int (*set_buffer)(struct coresight_device *csdev,
+                         struct perf_output_handle *handle,
+                         void *sink_config);
+       unsigned long (*reset_buffer)(struct coresight_device *csdev,
+                                     struct perf_output_handle *handle,
+                                     void *sink_config, bool *lost);
+       void (*update_buffer)(struct coresight_device *csdev,
+                             struct perf_output_handle *handle,
+                             void *sink_config);
 };
 
 /**
@@ -205,14 +221,18 @@ struct coresight_ops_link {
 /**
  * struct coresight_ops_source - basic operations for a source
  * Operations available for sources.
+ * @cpu_id:    returns the value of the CPU number this component
+ *             is associated to.
  * @trace_id:  returns the value of the component's trace ID as known
              to the HW.
*             to the HW.
  * @enable:    enables tracing for a source.
  * @disable:   disables tracing for a source.
  */
 struct coresight_ops_source {
+       int (*cpu_id)(struct coresight_device *csdev);
        int (*trace_id)(struct coresight_device *csdev);
-       int (*enable)(struct coresight_device *csdev);
+       int (*enable)(struct coresight_device *csdev,
+                     struct perf_event_attr *attr,  u32 mode);
        void (*disable)(struct coresight_device *csdev);
 };