blob: 99647a70248081ae0968c64cd9c6bfa719612cd0 [file] [log] [blame]
Shalabh Jainb0037c02013-01-18 12:47:40 -08001/* Copyright (c) 2008-2013, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef DIAGCHAR_H
14#define DIAGCHAR_H
15
16#include <linux/init.h>
17#include <linux/module.h>
18#include <linux/mempool.h>
19#include <linux/mutex.h>
Dixon Peterson5db2e3c2012-09-06 19:13:14 -070020#include <linux/spinlock.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070021#include <linux/workqueue.h>
Shalabh Jain5e9a92b2012-06-07 21:53:49 -070022#include <linux/sched.h>
Dixon Petersonf2d449c2013-02-01 18:02:20 -080023#include <linux/wakelock.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070024#include <mach/msm_smd.h>
25#include <asm/atomic.h>
26#include <asm/mach-types.h>
Dixon Peterson66fb11b2012-12-04 20:30:54 -080027
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028/* Size of the USB buffers used for read and write*/
29#define USB_MAX_OUT_BUF 4096
Ravi Aravamudhancc9946862013-07-15 13:31:11 -070030#define APPS_BUF_SIZE 4096
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070031#define IN_BUF_SIZE 16384
32#define MAX_IN_BUF_SIZE 32768
33#define MAX_SYNC_OBJ_NAME_SIZE 32
34/* Size of the buffer used for deframing a packet
35 reveived from the PC tool*/
36#define HDLC_MAX 4096
37#define HDLC_OUT_BUF_SIZE 8192
38#define POOL_TYPE_COPY 1
39#define POOL_TYPE_HDLC 2
Dixon Peterson6dba7572013-04-12 18:45:16 -070040#define POOL_TYPE_USER 3
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070041#define POOL_TYPE_WRITE_STRUCT 4
Shalabh Jainb0037c02013-01-18 12:47:40 -080042#define POOL_TYPE_HSIC 5
43#define POOL_TYPE_HSIC_2 6
44#define POOL_TYPE_HSIC_WRITE 11
45#define POOL_TYPE_HSIC_2_WRITE 12
46#define POOL_TYPE_ALL 10
Ravi Aravamudhan46df7d22013-06-12 11:57:07 -070047
48#define POOL_COPY_IDX 0
49#define POOL_HDLC_IDX 1
50#define POOL_USER_IDX 2
51#define POOL_WRITE_STRUCT_IDX 3
52#define POOL_HSIC_IDX 4
53#define POOL_HSIC_2_IDX 5
54#define POOL_HSIC_3_IDX 6
55#define POOL_HSIC_4_IDX 7
56#define POOL_HSIC_WRITE_IDX 8
57#define POOL_HSIC_2_WRITE_IDX 9
58#define POOL_HSIC_3_WRITE_IDX 10
59#define POOL_HSIC_4_WRITE_IDX 11
60
61#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
62#define NUM_MEMORY_POOLS 12
63#else
64#define NUM_MEMORY_POOLS 4
65#endif
66
Ravi Aravamudhane131ce12013-08-21 20:44:50 -070067#define MAX_SSID_PER_RANGE 200
68
Dixon Petersoneecbadb2012-12-10 21:59:28 -080069#define MODEM_DATA 0
70#define LPASS_DATA 1
71#define WCNSS_DATA 2
Ashay Jaiswal8be3ce82012-09-13 16:01:54 -070072#define APPS_DATA 3
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070073#define SDIO_DATA 4
Dixon Petersoneecbadb2012-12-10 21:59:28 -080074#define HSIC_DATA 5
Shalabh Jainb0037c02013-01-18 12:47:40 -080075#define HSIC_2_DATA 6
76#define SMUX_DATA 10
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070077#define APPS_PROC 1
Ravi Aravamudhane131ce12013-08-21 20:44:50 -070078/*
79 * Each row contains First (uint32_t), Last (uint32_t), Actual
80 * last (uint32_t) values along with the range of SSIDs
81 * (MAX_SSID_PER_RANGE*uint32_t).
82 * And there are MSG_MASK_TBL_CNT rows.
83 */
84#define MSG_MASK_SIZE ((MAX_SSID_PER_RANGE+3) * 4 * MSG_MASK_TBL_CNT)
Ravi Aravamudhanbbcb99f2013-11-06 19:43:03 -080085#define MAX_EQUIP_ID 16
86#define MAX_ITEMS_PER_EQUIP_ID 512
87#define LOG_MASK_ITEM_SIZE (5 + MAX_ITEMS_PER_EQUIP_ID)
88#define LOG_MASK_SIZE (MAX_EQUIP_ID * LOG_MASK_ITEM_SIZE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070089#define EVENT_MASK_SIZE 1000
Dixon Peterson6dba7572013-04-12 18:45:16 -070090#define USER_SPACE_DATA 8192
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070091#define PKT_SIZE 4096
Ravi Aravamudhanbbcb99f2013-11-06 19:43:03 -080092
Shalabh Jain321c8b52012-02-22 12:37:06 -080093#define DIAG_CTRL_MSG_LOG_MASK 9
94#define DIAG_CTRL_MSG_EVENT_MASK 10
95#define DIAG_CTRL_MSG_F3_MASK 11
Shalabh Jain1c99e4c2012-03-26 18:47:59 -070096#define CONTROL_CHAR 0x7E
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070097
Shalabh Jain7b20eab2012-06-19 17:50:58 -070098#define DIAG_CON_APSS (0x0001) /* Bit mask for APSS */
99#define DIAG_CON_MPSS (0x0002) /* Bit mask for MPSS */
100#define DIAG_CON_LPASS (0x0004) /* Bit mask for LPASS */
101#define DIAG_CON_WCNSS (0x0008) /* Bit mask for WCNSS */
102
Dixon Peterson15a6ecb2013-06-25 12:36:33 -0700103#define NUM_STM_PROCESSORS 4
104
105#define DIAG_STM_MODEM 0x01
106#define DIAG_STM_LPASS 0x02
107#define DIAG_STM_WCNSS 0x04
108#define DIAG_STM_APPS 0x08
109
Dixon Petersondd73a912014-02-13 18:45:11 -0800110#define DIAG_DIAG_STM 0x214
111
112#define BAD_PARAM_RESPONSE_MESSAGE 20
113
Dixon Peterson5a26a302012-11-15 17:26:17 -0800114/*
115 * The status bit masks when received in a signal handler are to be
116 * used in conjunction with the peripheral list bit mask to determine the
117 * status for a peripheral. For instance, 0x00010002 would denote an open
118 * status on the MPSS
119 */
120#define DIAG_STATUS_OPEN (0x00010000) /* DCI channel open status mask */
121#define DIAG_STATUS_CLOSED (0x00020000) /* DCI channel closed status mask */
122
Dixon Petersonf2d449c2013-02-01 18:02:20 -0800123#define MODE_REALTIME 1
124#define MODE_NONREALTIME 0
125
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800126#define NUM_SMD_DATA_CHANNELS 3
Dixon Peterson3ff84ea2012-12-21 20:16:18 -0800127#define NUM_SMD_CONTROL_CHANNELS NUM_SMD_DATA_CHANNELS
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800128#define NUM_SMD_DCI_CHANNELS 1
Dixon Peterson3ff84ea2012-12-21 20:16:18 -0800129#define NUM_SMD_CMD_CHANNELS 1
130#define NUM_SMD_DCI_CMD_CHANNELS 1
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800131
132#define SMD_DATA_TYPE 0
133#define SMD_CNTL_TYPE 1
134#define SMD_DCI_TYPE 2
Dixon Peterson3ff84ea2012-12-21 20:16:18 -0800135#define SMD_CMD_TYPE 3
136#define SMD_DCI_CMD_TYPE 4
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800137
Ravi Aravamudhan6a2da562013-06-17 16:01:34 -0700138#define DIAG_PROC_DCI 1
139#define DIAG_PROC_MEMORY_DEVICE 2
140
141/* Flags to vote the DCI or Memory device process up or down
142 when it becomes active or inactive */
143#define VOTE_DOWN 0
144#define VOTE_UP 1
145
Ravi Aravamudhan3dc66352013-06-14 10:46:19 -0700146#define DIAG_TS_SIZE 50
147
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700148/* Maximum number of pkt reg supported at initialization*/
Mohit Aggarwal3aa45862013-03-05 18:37:58 +0530149extern int diag_max_reg;
150extern int diag_threshold_reg;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700151
152#define APPEND_DEBUG(ch) \
153do { \
154 diag_debug_buf[diag_debug_buf_idx] = ch; \
155 (diag_debug_buf_idx < 1023) ? \
156 (diag_debug_buf_idx++) : (diag_debug_buf_idx = 0); \
157} while (0)
158
Ashay Jaiswala372f8c2012-12-12 14:02:38 +0530159/* List of remote processor supported */
160enum remote_procs {
161 MDM = 1,
Dixon Petersonf90f3582013-01-26 18:14:17 -0800162 MDM2 = 2,
163 MDM3 = 3,
164 MDM4 = 4,
165 QSC = 5,
Ashay Jaiswala372f8c2012-12-12 14:02:38 +0530166};
167
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700168struct diag_master_table {
169 uint16_t cmd_code;
170 uint16_t subsys_id;
171 uint32_t client_id;
172 uint16_t cmd_code_lo;
173 uint16_t cmd_code_hi;
174 int process_id;
175};
176
177struct bindpkt_params_per_process {
178 /* Name of the synchronization object associated with this proc */
179 char sync_obj_name[MAX_SYNC_OBJ_NAME_SIZE];
180 uint32_t count; /* Number of entries in this bind */
181 struct bindpkt_params *params; /* first bind params */
182};
183
184struct bindpkt_params {
185 uint16_t cmd_code;
186 uint16_t subsys_id;
187 uint16_t cmd_code_lo;
188 uint16_t cmd_code_hi;
189 /* For Central Routing, used to store Processor number */
190 uint16_t proc_id;
191 uint32_t event_id;
192 uint32_t log_code;
193 /* For Central Routing, used to store SMD channel pointer */
194 uint32_t client_id;
195};
196
197struct diag_write_device {
198 void *buf;
199 int length;
200};
201
202struct diag_client_map {
203 char name[20];
204 int pid;
205};
206
Dixon Petersonf2d449c2013-02-01 18:02:20 -0800207struct diag_nrt_wake_lock {
208 int enabled;
209 int ref_count;
210 int copy_count;
211 struct wake_lock read_lock;
212 spinlock_t read_spinlock;
213};
214
Ravi Aravamudhan6a2da562013-06-17 16:01:34 -0700215struct real_time_vote_t {
216 uint16_t proc;
217 uint8_t real_time_vote;
218};
219
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700220/* This structure is defined in USB header file */
221#ifndef CONFIG_DIAG_OVER_USB
222struct diag_request {
223 char *buf;
224 int length;
225 int actual;
226 int status;
227 void *context;
228};
229#endif
230
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800231struct diag_smd_info {
232 int peripheral; /* The peripheral this smd channel communicates with */
233 int type; /* The type of smd channel (data, control, dci) */
234 uint16_t peripheral_mask;
Dixon Peterson9ce39c62013-02-21 13:00:52 -0800235 int encode_hdlc; /* Whether data is raw and needs to be hdlc encoded */
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800236
237 smd_channel_t *ch;
238 smd_channel_t *ch_save;
239
Dixon Peterson25f042b2013-02-27 13:00:08 -0800240 struct mutex smd_ch_mutex;
241
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800242 int in_busy_1;
243 int in_busy_2;
244
245 unsigned char *buf_in_1;
246 unsigned char *buf_in_2;
247
Dixon Peterson9ce39c62013-02-21 13:00:52 -0800248 unsigned char *buf_in_1_raw;
249 unsigned char *buf_in_2_raw;
250
Dixon Petersond2309b42013-08-28 21:00:05 -0700251 unsigned int buf_in_1_size;
252 unsigned int buf_in_2_size;
253
254 unsigned int buf_in_1_raw_size;
255 unsigned int buf_in_2_raw_size;
256
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800257 struct diag_request *write_ptr_1;
258 struct diag_request *write_ptr_2;
259
Dixon Petersonf2d449c2013-02-01 18:02:20 -0800260 struct diag_nrt_wake_lock nrt_lock;
261
Dixon Petersonbba99ca2013-07-10 17:25:20 -0700262 struct workqueue_struct *wq;
263
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800264 struct work_struct diag_read_smd_work;
265 struct work_struct diag_notify_update_smd_work;
266 int notify_context;
Dixon Peterson15a6ecb2013-06-25 12:36:33 -0700267 struct work_struct diag_general_smd_work;
268 int general_context;
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800269
270 /*
271 * Function ptr for function to call to process the data that
272 * was just read from the smd channel
273 */
274 int (*process_smd_read_data)(struct diag_smd_info *smd_info,
275 void *buf, int num_bytes);
276};
277
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700278struct diagchar_dev {
279
280 /* State for the char driver */
281 unsigned int major;
282 unsigned int minor_start;
283 int num;
284 struct cdev *cdev;
285 char *name;
286 int dropped_count;
287 struct class *diagchar_class;
288 int ref_count;
289 struct mutex diagchar_mutex;
290 wait_queue_head_t wait_q;
Shalabh Jainc70b3b62012-08-31 19:11:20 -0700291 wait_queue_head_t smd_wait_q;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700292 struct diag_client_map *client_map;
293 int *data_ready;
294 int num_clients;
Shalabh Jain3d29fc32012-02-09 17:15:59 -0800295 int polling_reg_flag;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700296 struct diag_write_device *buf_tbl;
Dixon Petersona6d98092013-05-16 12:26:26 -0700297 unsigned int buf_tbl_size;
Dixon Petersonb4618a42012-02-29 18:56:31 -0800298 int use_device_tree;
Dixon Peterson3ff84ea2012-12-21 20:16:18 -0800299 int supports_separate_cmdrsp;
Dixon Peterson9ce39c62013-02-21 13:00:52 -0800300 int supports_apps_hdlc_encoding;
Dixon Peterson15a6ecb2013-06-25 12:36:33 -0700301 /* The state requested in the STM command */
302 int stm_state_requested[NUM_STM_PROCESSORS];
303 /* The current STM state */
304 int stm_state[NUM_STM_PROCESSORS];
305 /* Whether or not the peripheral supports STM */
306 int peripheral_supports_stm[NUM_SMD_CONTROL_CHANNELS];
Shalabh Jain1c99e4c2012-03-26 18:47:59 -0700307 /* DCI related variables */
Ravi Aravamudhanc94a4732013-12-10 10:26:10 -0800308 struct list_head dci_req_list;
Shalabh Jain16794902012-09-14 10:56:49 -0700309 struct diag_dci_client_tbl *dci_client_tbl;
Shalabh Jain1c99e4c2012-03-26 18:47:59 -0700310 int dci_tag;
311 int dci_client_id;
312 struct mutex dci_mutex;
313 int num_dci_client;
314 unsigned char *apps_dci_buf;
315 int dci_state;
Shalabh Jain16794902012-09-14 10:56:49 -0700316 struct workqueue_struct *diag_dci_wq;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700317 /* Memory pool parameters */
318 unsigned int itemsize;
319 unsigned int poolsize;
320 unsigned int itemsize_hdlc;
321 unsigned int poolsize_hdlc;
Dixon Peterson6dba7572013-04-12 18:45:16 -0700322 unsigned int itemsize_user;
323 unsigned int poolsize_user;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700324 unsigned int itemsize_write_struct;
325 unsigned int poolsize_write_struct;
326 unsigned int debug_flag;
327 /* State for the mempool for the char driver */
328 mempool_t *diagpool;
329 mempool_t *diag_hdlc_pool;
Dixon Peterson6dba7572013-04-12 18:45:16 -0700330 mempool_t *diag_user_pool;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700331 mempool_t *diag_write_struct_pool;
Ravi Aravamudhan850b4c92013-07-03 17:57:52 -0700332 spinlock_t diag_mem_lock;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700333 int count;
334 int count_hdlc_pool;
Dixon Peterson6dba7572013-04-12 18:45:16 -0700335 int count_user_pool;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700336 int count_write_struct_pool;
337 int used;
Shalabh Jain321c8b52012-02-22 12:37:06 -0800338 /* Buffers for masks */
Shalabh Jaina06c6d72012-04-30 13:40:35 -0700339 struct mutex diag_cntl_mutex;
Shalabh Jain321c8b52012-02-22 12:37:06 -0800340 struct diag_ctrl_event_mask *event_mask;
341 struct diag_ctrl_log_mask *log_mask;
342 struct diag_ctrl_msg_mask *msg_mask;
Ravi Aravamudhand09f8772012-12-20 14:48:30 -0800343 struct diag_ctrl_feature_mask *feature_mask;
Ravi Aravamudhanbbcb99f2013-11-06 19:43:03 -0800344 struct mutex log_mask_mutex;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345 /* State for diag forwarding */
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800346 struct diag_smd_info smd_data[NUM_SMD_DATA_CHANNELS];
347 struct diag_smd_info smd_cntl[NUM_SMD_CONTROL_CHANNELS];
348 struct diag_smd_info smd_dci[NUM_SMD_DCI_CHANNELS];
Dixon Peterson3ff84ea2012-12-21 20:16:18 -0800349 struct diag_smd_info smd_cmd[NUM_SMD_CMD_CHANNELS];
350 struct diag_smd_info smd_dci_cmd[NUM_SMD_DCI_CMD_CHANNELS];
Ravi Aravamudhan91391ce2013-10-01 17:09:50 -0700351 int rcvd_feature_mask[NUM_SMD_CONTROL_CHANNELS];
Dixon Peterson3ff84ea2012-12-21 20:16:18 -0800352 int separate_cmdrsp[NUM_SMD_CONTROL_CHANNELS];
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700353 unsigned char *usb_buf_out;
354 unsigned char *apps_rsp_buf;
Mohit Aggarwala0118b12013-12-05 17:14:35 +0530355 unsigned char *user_space_data_buf;
Shalabh Jain321c8b52012-02-22 12:37:06 -0800356 /* buffer for updating mask to peripherals */
357 unsigned char *buf_msg_mask_update;
358 unsigned char *buf_log_mask_update;
359 unsigned char *buf_event_mask_update;
Ravi Aravamudhand09f8772012-12-20 14:48:30 -0800360 unsigned char *buf_feature_mask_update;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700361 int read_len_legacy;
Dixon Peterson25f042b2013-02-27 13:00:08 -0800362 struct mutex diag_hdlc_mutex;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700363 unsigned char *hdlc_buf;
364 unsigned hdlc_count;
365 unsigned hdlc_escape;
Ravi Aravamudhan72c55282013-03-20 19:29:01 -0700366 int in_busy_pktdata;
Ravi Aravamudhan37903fe2013-06-03 12:35:05 -0700367 struct device *dci_device;
368 struct device *dci_cmd_device;
Ravi Aravamudhan6a2da562013-06-17 16:01:34 -0700369 /* Variables for non real time mode */
370 int real_time_mode;
371 int real_time_update_busy;
372 uint16_t proc_active_mask;
373 uint16_t proc_rt_vote_mask;
374 struct mutex real_time_mutex;
375 struct work_struct diag_real_time_work;
376 struct workqueue_struct *diag_real_time_wq;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700377#ifdef CONFIG_DIAG_OVER_USB
378 int usb_connected;
379 struct usb_diag_ch *legacy_ch;
380 struct work_struct diag_proc_hdlc_work;
381 struct work_struct diag_read_work;
Mohit Aggarwalb4465772013-04-18 13:08:07 +0530382 struct work_struct diag_usb_connect_work;
383 struct work_struct diag_usb_disconnect_work;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700384#endif
385 struct workqueue_struct *diag_wq;
386 struct work_struct diag_drain_work;
Shalabh Jain321c8b52012-02-22 12:37:06 -0800387 struct workqueue_struct *diag_cntl_wq;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700388 uint8_t *msg_masks;
Ravi Aravamudhan987be232013-08-08 15:46:50 -0700389 uint8_t msg_status;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700390 uint8_t *log_masks;
Ravi Aravamudhan987be232013-08-08 15:46:50 -0700391 uint8_t log_status;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700392 uint8_t *event_masks;
Ravi Aravamudhan987be232013-08-08 15:46:50 -0700393 uint8_t event_status;
Ravi Aravamudhand09f8772012-12-20 14:48:30 -0800394 uint8_t log_on_demand_support;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700395 struct diag_master_table *table;
396 uint8_t *pkt_buf;
397 int pkt_length;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700398 struct diag_request *usb_read_ptr;
399 struct diag_request *write_ptr_svc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700400 int logging_mode;
Shalabh Jainc236f982011-12-15 22:55:20 -0800401 int mask_check;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700402 int logging_process_id;
Dixon Peterson625ee652012-06-21 22:03:49 -0700403 struct task_struct *socket_process;
Shalabh Jain84e30342012-10-16 16:16:08 -0700404 struct task_struct *callback_process;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700405#ifdef CONFIG_DIAG_SDIO_PIPE
406 unsigned char *buf_in_sdio;
407 unsigned char *usb_buf_mdm_out;
408 struct sdio_channel *sdio_ch;
409 int read_len_mdm;
410 int in_busy_sdio;
411 struct usb_diag_ch *mdm_ch;
412 struct work_struct diag_read_mdm_work;
413 struct workqueue_struct *diag_sdio_wq;
414 struct work_struct diag_read_sdio_work;
Shalabh Jain5d9ba342011-08-10 13:51:54 -0700415 struct work_struct diag_close_sdio_work;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700416 struct diag_request *usb_read_mdm_ptr;
417 struct diag_request *write_ptr_mdm;
418#endif
Shalabh Jain737fca72012-11-14 21:53:43 -0800419#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
420 /* common for all bridges */
Mohit Aggarwalb4465772013-04-18 13:08:07 +0530421 struct work_struct diag_connect_work;
Shalabh Jain737fca72012-11-14 21:53:43 -0800422 struct work_struct diag_disconnect_work;
Shalabh Jainf7228dc2012-05-23 17:32:05 -0700423 /* SGLTE variables */
424 int lcid;
425 unsigned char *buf_in_smux;
426 int in_busy_smux;
427 int diag_smux_enabled;
Ashay Jaiswal2d8daae2012-07-17 17:29:33 +0530428 int smux_connected;
Dixon Peterson938f8602012-08-17 20:02:57 -0700429 struct diag_request *write_ptr_mdm;
Dixon Peterson32e70bb2011-12-16 13:26:45 -0800430#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700431};
432
Shalabh Jain737fca72012-11-14 21:53:43 -0800433extern struct diag_bridge_dev *diag_bridge;
Shalabh Jainb0037c02013-01-18 12:47:40 -0800434extern struct diag_hsic_dev *diag_hsic;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700435extern struct diagchar_dev *driver;
Ravi Aravamudhanf55dc1d2012-12-27 11:51:42 -0800436
437extern int wrap_enabled;
438extern uint16_t wrap_count;
439
Ravi Aravamudhan3dc66352013-06-14 10:46:19 -0700440void diag_get_timestamp(char *time_str);
Ravi Aravamudhan8081a132013-08-02 12:19:28 -0700441int diag_find_polling_reg(int i);
Ravi Aravamudhan3dc66352013-06-14 10:46:19 -0700442
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700443#endif