Add 'struct coresight_path' to store the data that is needed by
coresight_enable_path/coresight_disable_path. The structure
will be transmitted to the helper and sink device to enable
related funcationalities.
Signed-off-by: Jie Gan <quic_jiegan@xxxxxxxxxxx>
---
drivers/hwtracing/coresight/coresight-core.c | 87 ++++++++++++++-----
drivers/hwtracing/coresight/coresight-etb10.c | 3 +-
.../hwtracing/coresight/coresight-etm-perf.c | 52 ++++++-----
.../hwtracing/coresight/coresight-etm-perf.h | 2 +-
drivers/hwtracing/coresight/coresight-priv.h | 21 +++--
drivers/hwtracing/coresight/coresight-sysfs.c | 32 +++----
.../hwtracing/coresight/coresight-tmc-etf.c | 3 +-
.../hwtracing/coresight/coresight-tmc-etr.c | 6 +-
drivers/hwtracing/coresight/coresight-trbe.c | 4 +-
drivers/hwtracing/coresight/ultrasoc-smb.c | 3 +-
10 files changed, 137 insertions(+), 76 deletions(-)
INIT_LIST_HEAD(path);
+ cs_path->path = path;
+ /*
+ * Since not all source devices have a defined trace_id function,
+ * make sure to check for it before use.
+ *
+ * Assert the mode is CS_MODE_SYSFS, the trace_id will be assigned
+ * again later if the mode is CS_MODE_PERF.
+ */
+ if (source_ops(source)->trace_id != NULL) {
+ rc = source_ops(source)->trace_id(source, CS_MODE_SYSFS, NULL);
+ if(IS_VALID_CS_TRACE_ID(rc))
+ cs_path->trace_id = rc;
+ else
+ cs_path->trace_id = 0;
+ }
+ else
+ cs_path->trace_id = 0;
+/**
+ * struct coresight_path - data needed by enable/disable path
+ * @handle: perf aux handle for ETM.
+ * @path: path from source to sink.
+ * @trace_id: trace_id of the whole path.
+ */
+struct coresight_path {
+ struct perf_output_handle *handle;
+ struct list_head *path;
+ u8 trace_id;
+};
+
static inline void coresight_insert_barrier_packet(void *buf)
{
if (buf)
@@ -132,16 +144,15 @@ static inline void CS_UNLOCK(void __iomem *addr)
} while (0);
}
-void coresight_disable_path(struct list_head *path);
-int coresight_enable_path(struct list_head *path, enum cs_mode mode,
- void *sink_data);
+void coresight_disable_path(struct coresight_path *cs_path);
+int coresight_enable_path(struct coresight_path *cs_path, enum cs_mode mode);
struct coresight_device *coresight_get_sink(struct list_head *path);