hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/hwtracing/stm/stm.h
....@@ -10,23 +10,20 @@
1010 #ifndef _STM_STM_H_
1111 #define _STM_STM_H_
1212
13
+#include <linux/configfs.h>
14
+
1315 struct stp_policy;
1416 struct stp_policy_node;
17
+struct stm_protocol_driver;
1518
16
-struct stp_policy_node *
17
-stp_policy_node_lookup(struct stm_device *stm, char *s);
18
-void stp_policy_node_put(struct stp_policy_node *policy_node);
19
-void stp_policy_unbind(struct stp_policy *policy);
20
-
21
-void stp_policy_node_get_ranges(struct stp_policy_node *policy_node,
22
- unsigned int *mstart, unsigned int *mend,
23
- unsigned int *cstart, unsigned int *cend);
2419 int stp_configfs_init(void);
2520 void stp_configfs_exit(void);
2621
22
+void *stp_policy_node_priv(struct stp_policy_node *pn);
23
+
2724 struct stp_master {
2825 unsigned int nr_free;
29
- unsigned long chan_map[0];
26
+ unsigned long chan_map[];
3027 };
3128
3229 struct stm_device {
....@@ -40,24 +37,39 @@
4037 struct mutex link_mutex;
4138 spinlock_t link_lock;
4239 struct list_head link_list;
40
+ /* framing protocol in use */
41
+ const struct stm_protocol_driver *pdrv;
42
+ const struct config_item_type *pdrv_node_type;
4343 /* master allocation */
4444 spinlock_t mc_lock;
45
- struct stp_master *masters[0];
45
+ struct stp_master *masters[];
4646 };
4747
4848 #define to_stm_device(_d) \
4949 container_of((_d), struct stm_device, dev)
50
+
51
+struct stp_policy_node *
52
+stp_policy_node_lookup(struct stm_device *stm, char *s);
53
+void stp_policy_node_put(struct stp_policy_node *policy_node);
54
+void stp_policy_unbind(struct stp_policy *policy);
55
+
56
+void stp_policy_node_get_ranges(struct stp_policy_node *policy_node,
57
+ unsigned int *mstart, unsigned int *mend,
58
+ unsigned int *cstart, unsigned int *cend);
59
+
60
+const struct config_item_type *
61
+get_policy_node_type(struct configfs_attribute **attrs);
5062
5163 struct stm_output {
5264 spinlock_t lock;
5365 unsigned int master;
5466 unsigned int channel;
5567 unsigned int nr_chans;
68
+ void *pdrv_private;
5669 };
5770
5871 struct stm_file {
5972 struct stm_device *stm;
60
- struct stp_policy_node *policy_node;
6173 struct stm_output output;
6274 };
6375
....@@ -71,11 +83,35 @@
7183 struct stm_device __rcu *link;
7284 struct list_head link_entry;
7385 /* one output per stm_source device */
74
- struct stp_policy_node *policy_node;
7586 struct stm_output output;
7687 };
7788
7889 #define to_stm_source_device(_d) \
7990 container_of((_d), struct stm_source_device, dev)
8091
92
+void *to_pdrv_policy_node(struct config_item *item);
93
+
94
+struct stm_protocol_driver {
95
+ struct module *owner;
96
+ const char *name;
97
+ ssize_t (*write)(struct stm_data *data,
98
+ struct stm_output *output, unsigned int chan,
99
+ const char *buf, size_t count);
100
+ void (*policy_node_init)(void *arg);
101
+ int (*output_open)(void *priv, struct stm_output *output);
102
+ void (*output_close)(struct stm_output *output);
103
+ ssize_t priv_sz;
104
+ struct configfs_attribute **policy_attr;
105
+};
106
+
107
+int stm_register_protocol(const struct stm_protocol_driver *pdrv);
108
+void stm_unregister_protocol(const struct stm_protocol_driver *pdrv);
109
+int stm_lookup_protocol(const char *name,
110
+ const struct stm_protocol_driver **pdrv,
111
+ const struct config_item_type **type);
112
+void stm_put_protocol(const struct stm_protocol_driver *pdrv);
113
+ssize_t stm_data_write(struct stm_data *data, unsigned int m,
114
+ unsigned int c, bool ts_first, const void *buf,
115
+ size_t count);
116
+
81117 #endif /* _STM_STM_H_ */