]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/blob - drivers/misc/tegra-profiler/comm.h
tegra-profiler: add access to the exception tables
[sojka/nv-tegra/linux-3.10.git] / drivers / misc / tegra-profiler / comm.h
1 /*
2  * drivers/misc/tegra-profiler/comm.h
3  *
4  * Copyright (c) 2014, NVIDIA CORPORATION.  All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  */
16
17 #ifndef __QUADD_COMM_H__
18 #define __QUADD_COMM_H__
19
20 #include <linux/types.h>
21
22 struct quadd_record_data;
23 struct quadd_comm_cap;
24 struct quadd_module_state;
25 struct miscdevice;
26 struct quadd_parameters;
27 struct quadd_extables;
28 struct quadd_unwind_ctx;
29
30 struct quadd_ring_buffer {
31         char *buf;
32         spinlock_t lock;
33
34         size_t size;
35         size_t pos_read;
36         size_t pos_write;
37         size_t fill_count;
38         size_t max_fill_count;
39 };
40
41 struct quadd_iovec {
42         void *base;
43         size_t len;
44 };
45
46 struct quadd_extabs_mmap {
47         struct vm_area_struct *mmap_vma;
48         void *data;
49
50         struct list_head list;
51         struct list_head ex_entries;
52 };
53
54 struct quadd_comm_control_interface {
55         int (*start)(void);
56         void (*stop)(void);
57         int (*set_parameters)(struct quadd_parameters *param,
58                               uid_t *debug_app_uid);
59         void (*get_capabilities)(struct quadd_comm_cap *cap);
60         void (*get_state)(struct quadd_module_state *state);
61         int (*set_extab)(struct quadd_extables *extabs,
62                          struct quadd_extabs_mmap *mmap);
63         void (*delete_mmap)(struct quadd_extabs_mmap *mmap);
64 };
65
66 struct quadd_comm_data_interface {
67         void (*put_sample)(struct quadd_record_data *data,
68                            struct quadd_iovec *vec, int vec_count);
69         void (*reset)(void);
70         int (*is_active)(void);
71 };
72
73 struct quadd_comm_ctx {
74         struct quadd_comm_control_interface *control;
75
76         struct quadd_ring_buffer rb;
77         size_t rb_size;
78
79         atomic_t active;
80
81         struct mutex io_mutex;
82         int nr_users;
83
84         int params_ok;
85         pid_t process_pid;
86         uid_t debug_app_uid;
87
88         wait_queue_head_t read_wait;
89
90         struct miscdevice *misc_dev;
91
92         struct list_head ext_mmaps;
93         spinlock_t mmaps_lock;
94 };
95
96 struct quadd_comm_data_interface *
97 quadd_comm_events_init(struct quadd_comm_control_interface *control);
98 void quadd_comm_events_exit(void);
99
100 #endif  /* __QUADD_COMM_H__ */