Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
[deliverable/linux.git] / drivers / hwtracing / stm / stm.h
CommitLineData
7bd1d409
AS
1/*
2 * System Trace Module (STM) infrastructure
3 * Copyright (c) 2014, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope 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 * STM class implements generic infrastructure for System Trace Module devices
15 * as defined in MIPI STPv2 specification.
16 */
17
18#ifndef _STM_STM_H_
19#define _STM_STM_H_
20
21struct stp_policy;
22struct stp_policy_node;
23
24struct stp_policy_node *
25stp_policy_node_lookup(struct stm_device *stm, char *s);
26void stp_policy_node_put(struct stp_policy_node *policy_node);
27void stp_policy_unbind(struct stp_policy *policy);
28
29void stp_policy_node_get_ranges(struct stp_policy_node *policy_node,
30 unsigned int *mstart, unsigned int *mend,
31 unsigned int *cstart, unsigned int *cend);
32int stp_configfs_init(void);
33void stp_configfs_exit(void);
34
35struct stp_master {
36 unsigned int nr_free;
37 unsigned long chan_map[0];
38};
39
40struct stm_device {
41 struct device dev;
42 struct module *owner;
43 struct stp_policy *policy;
44 struct mutex policy_mutex;
45 int major;
46 unsigned int sw_nmasters;
47 struct stm_data *data;
48 spinlock_t link_lock;
49 struct list_head link_list;
50 /* master allocation */
51 spinlock_t mc_lock;
52 struct stp_master *masters[0];
53};
54
55#define to_stm_device(_d) \
56 container_of((_d), struct stm_device, dev)
57
58struct stm_output {
59 unsigned int master;
60 unsigned int channel;
61 unsigned int nr_chans;
62};
63
64struct stm_file {
65 struct stm_device *stm;
66 struct stp_policy_node *policy_node;
67 struct stm_output output;
68};
69
70struct stm_device *stm_find_device(const char *name);
71void stm_put_device(struct stm_device *stm);
72
73struct stm_source_device {
74 struct device dev;
75 struct stm_source_data *data;
76 spinlock_t link_lock;
0df771de 77 struct stm_device __rcu *link;
7bd1d409
AS
78 struct list_head link_entry;
79 /* one output per stm_source device */
80 struct stp_policy_node *policy_node;
81 struct stm_output output;
82};
83
84#define to_stm_source_device(_d) \
85 container_of((_d), struct stm_source_device, dev)
86
87#endif /* _STM_STM_H_ */
This page took 0.049559 seconds and 5 git commands to generate.