.. | .. |
---|
8 | 8 | #ifndef __INTEL_TH_H__ |
---|
9 | 9 | #define __INTEL_TH_H__ |
---|
10 | 10 | |
---|
| 11 | +#include <linux/irqreturn.h> |
---|
| 12 | + |
---|
11 | 13 | /* intel_th_device device types */ |
---|
12 | 14 | enum { |
---|
13 | 15 | /* Devices that generate trace data */ |
---|
.. | .. |
---|
18 | 20 | INTEL_TH_SWITCH, |
---|
19 | 21 | }; |
---|
20 | 22 | |
---|
| 23 | +struct intel_th_device; |
---|
| 24 | + |
---|
21 | 25 | /** |
---|
22 | 26 | * struct intel_th_output - descriptor INTEL_TH_OUTPUT type devices |
---|
23 | 27 | * @port: output port number, assigned by the switch |
---|
.. | .. |
---|
25 | 29 | * @scratchpad: scratchpad bits to flag when this output is enabled |
---|
26 | 30 | * @multiblock: true for multiblock output configuration |
---|
27 | 31 | * @active: true when this output is enabled |
---|
| 32 | + * @wait_empty: wait for device pipeline to be empty |
---|
28 | 33 | * |
---|
29 | 34 | * Output port descriptor, used by switch driver to tell which output |
---|
30 | 35 | * port this output device corresponds to. Filled in at output device's |
---|
.. | .. |
---|
42 | 47 | /** |
---|
43 | 48 | * struct intel_th_drvdata - describes hardware capabilities and quirks |
---|
44 | 49 | * @tscu_enable: device needs SW to enable time stamping unit |
---|
| 50 | + * @multi_is_broken: device has multiblock mode is broken |
---|
| 51 | + * @has_mintctl: device has interrupt control (MINTCTL) register |
---|
45 | 52 | * @host_mode_only: device can only operate in 'host debugger' mode |
---|
46 | 53 | */ |
---|
47 | 54 | struct intel_th_drvdata { |
---|
48 | 55 | unsigned int tscu_enable : 1, |
---|
| 56 | + multi_is_broken : 1, |
---|
| 57 | + has_mintctl : 1, |
---|
49 | 58 | host_mode_only : 1; |
---|
50 | 59 | }; |
---|
51 | 60 | |
---|
.. | .. |
---|
160 | 169 | struct intel_th_output *output); |
---|
161 | 170 | void (*enable)(struct intel_th_device *thdev, |
---|
162 | 171 | struct intel_th_output *output); |
---|
| 172 | + void (*trig_switch)(struct intel_th_device *thdev, |
---|
| 173 | + struct intel_th_output *output); |
---|
163 | 174 | void (*disable)(struct intel_th_device *thdev, |
---|
164 | 175 | struct intel_th_output *output); |
---|
165 | 176 | /* output ops */ |
---|
166 | | - void (*irq)(struct intel_th_device *thdev); |
---|
| 177 | + irqreturn_t (*irq)(struct intel_th_device *thdev); |
---|
| 178 | + void (*wait_empty)(struct intel_th_device *thdev); |
---|
167 | 179 | int (*activate)(struct intel_th_device *thdev); |
---|
168 | 180 | void (*deactivate)(struct intel_th_device *thdev); |
---|
169 | 181 | /* file_operations for those who want a device node */ |
---|
.. | .. |
---|
216 | 228 | |
---|
217 | 229 | struct intel_th * |
---|
218 | 230 | intel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata, |
---|
219 | | - struct resource *devres, unsigned int ndevres, int irq); |
---|
| 231 | + struct resource *devres, unsigned int ndevres); |
---|
220 | 232 | void intel_th_free(struct intel_th *th); |
---|
221 | 233 | |
---|
222 | 234 | int intel_th_driver_register(struct intel_th_driver *thdrv); |
---|
223 | 235 | void intel_th_driver_unregister(struct intel_th_driver *thdrv); |
---|
224 | 236 | |
---|
225 | 237 | int intel_th_trace_enable(struct intel_th_device *thdev); |
---|
| 238 | +int intel_th_trace_switch(struct intel_th_device *thdev); |
---|
226 | 239 | int intel_th_trace_disable(struct intel_th_device *thdev); |
---|
227 | 240 | int intel_th_set_output(struct intel_th_device *thdev, |
---|
228 | 241 | unsigned int master); |
---|
229 | 242 | int intel_th_output_enable(struct intel_th *th, unsigned int otype); |
---|
230 | 243 | |
---|
231 | | -enum { |
---|
| 244 | +enum th_mmio_idx { |
---|
232 | 245 | TH_MMIO_CONFIG = 0, |
---|
233 | | - TH_MMIO_SW = 2, |
---|
| 246 | + TH_MMIO_SW = 1, |
---|
| 247 | + TH_MMIO_RTIT = 2, |
---|
234 | 248 | TH_MMIO_END, |
---|
235 | 249 | }; |
---|
236 | 250 | |
---|
.. | .. |
---|
240 | 254 | #define TH_CONFIGURABLE_MASTERS 256 |
---|
241 | 255 | #define TH_MSC_MAX 2 |
---|
242 | 256 | |
---|
| 257 | +/* Maximum IRQ vectors */ |
---|
| 258 | +#define TH_NVEC_MAX 8 |
---|
| 259 | + |
---|
243 | 260 | /** |
---|
244 | 261 | * struct intel_th - Intel TH controller |
---|
245 | 262 | * @dev: driver core's device |
---|
.. | .. |
---|
247 | 264 | * @hub: "switch" subdevice (GTH) |
---|
248 | 265 | * @resource: resources of the entire controller |
---|
249 | 266 | * @num_thdevs: number of devices in the @thdev array |
---|
250 | | - * @num_resources: number or resources in the @resource array |
---|
| 267 | + * @num_resources: number of resources in the @resource array |
---|
251 | 268 | * @irq: irq number |
---|
| 269 | + * @num_irqs: number of IRQs is use |
---|
252 | 270 | * @id: this Intel TH controller's device ID in the system |
---|
253 | 271 | * @major: device node major for output devices |
---|
254 | 272 | */ |
---|
.. | .. |
---|
259 | 277 | struct intel_th_device *hub; |
---|
260 | 278 | struct intel_th_drvdata *drvdata; |
---|
261 | 279 | |
---|
262 | | - struct resource *resource; |
---|
| 280 | + struct resource resource[TH_MMIO_END]; |
---|
263 | 281 | int (*activate)(struct intel_th *); |
---|
264 | 282 | void (*deactivate)(struct intel_th *); |
---|
265 | 283 | unsigned int num_thdevs; |
---|
266 | 284 | unsigned int num_resources; |
---|
267 | 285 | int irq; |
---|
| 286 | + int num_irqs; |
---|
268 | 287 | |
---|
269 | 288 | int id; |
---|
270 | 289 | int major; |
---|
.. | .. |
---|
299 | 318 | REG_TSCU_OFFSET = 0x2000, |
---|
300 | 319 | REG_TSCU_LENGTH = 0x1000, |
---|
301 | 320 | |
---|
| 321 | + REG_CTS_OFFSET = 0x3000, |
---|
| 322 | + REG_CTS_LENGTH = 0x1000, |
---|
| 323 | + |
---|
302 | 324 | /* Software Trace Hub (STH) [0x4000..0x4fff] */ |
---|
303 | 325 | REG_STH_OFFSET = 0x4000, |
---|
304 | 326 | REG_STH_LENGTH = 0x2000, |
---|