Dixon Peterson | f2d449c | 2013-02-01 18:02:20 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2 | * |
| 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 DIAGFWD_CNTL_H |
| 14 | #define DIAGFWD_CNTL_H |
| 15 | |
Shalabh Jain | f50076b | 2012-02-15 19:27:01 -0800 | [diff] [blame] | 16 | /* Message registration commands */ |
| 17 | #define DIAG_CTRL_MSG_REG 1 |
| 18 | /* Message passing for DTR events */ |
| 19 | #define DIAG_CTRL_MSG_DTR 2 |
| 20 | /* Control Diag sleep vote, buffering etc */ |
| 21 | #define DIAG_CTRL_MSG_DIAGMODE 3 |
| 22 | /* Diag data based on "light" diag mask */ |
| 23 | #define DIAG_CTRL_MSG_DIAGDATA 4 |
Shalabh Jain | f50076b | 2012-02-15 19:27:01 -0800 | [diff] [blame] | 24 | /* Send diag internal feature mask 'diag_int_feature_mask' */ |
| 25 | #define DIAG_CTRL_MSG_FEATURE 8 |
| 26 | /* Send Diag log mask for a particular equip id */ |
| 27 | #define DIAG_CTRL_MSG_EQUIP_LOG_MASK 9 |
| 28 | /* Send Diag event mask */ |
| 29 | #define DIAG_CTRL_MSG_EVENT_MASK_V2 10 |
| 30 | /* Send Diag F3 mask */ |
| 31 | #define DIAG_CTRL_MSG_F3_MASK_V2 11 |
Dixon Peterson | bae1fe0 | 2013-05-07 19:42:55 -0700 | [diff] [blame] | 32 | #define DIAG_CTRL_MSG_NUM_PRESETS 12 |
| 33 | #define DIAG_CTRL_MSG_SET_PRESET_ID 13 |
| 34 | #define DIAG_CTRL_MSG_LOG_MASK_WITH_PRESET_ID 14 |
| 35 | #define DIAG_CTRL_MSG_EVENT_MASK_WITH_PRESET_ID 15 |
| 36 | #define DIAG_CTRL_MSG_F3_MASK_WITH_PRESET_ID 16 |
| 37 | #define DIAG_CTRL_MSG_LAST DIAG_CTRL_MSG_F3_MASK_WITH_PRESET_ID |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 38 | |
Dixon Peterson | 2a49ad2 | 2013-04-24 17:10:39 -0700 | [diff] [blame] | 39 | /* Denotes that we support sending/receiving the feature mask */ |
Dixon Peterson | 3ff84ea | 2012-12-21 20:16:18 -0800 | [diff] [blame] | 40 | #define F_DIAG_INT_FEATURE_MASK 0x01 |
| 41 | /* Denotes that we support responding to "Log on Demand" */ |
| 42 | #define F_DIAG_LOG_ON_DEMAND_RSP_ON_MASTER 0x04 |
| 43 | /* |
| 44 | * Supports dedicated main request/response on |
| 45 | * new Data Rx and DCI Rx channels |
| 46 | */ |
| 47 | #define F_DIAG_REQ_RSP_CHANNEL 0x10 |
| 48 | |
| 49 | #define ENABLE_SEPARATE_CMDRSP 1 |
| 50 | #define DISABLE_SEPARATE_CMDRSP 0 |
Dixon Peterson | 2a49ad2 | 2013-04-24 17:10:39 -0700 | [diff] [blame] | 51 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 52 | struct cmd_code_range { |
| 53 | uint16_t cmd_code_lo; |
| 54 | uint16_t cmd_code_hi; |
| 55 | uint32_t data; |
| 56 | }; |
| 57 | |
| 58 | struct diag_ctrl_msg { |
| 59 | uint32_t version; |
| 60 | uint16_t cmd_code; |
| 61 | uint16_t subsysid; |
| 62 | uint16_t count_entries; |
| 63 | uint16_t port; |
| 64 | }; |
| 65 | |
Shalabh Jain | 321c8b5 | 2012-02-22 12:37:06 -0800 | [diff] [blame] | 66 | struct diag_ctrl_event_mask { |
| 67 | uint32_t cmd_type; |
| 68 | uint32_t data_len; |
| 69 | uint8_t stream_id; |
| 70 | uint8_t status; |
| 71 | uint8_t event_config; |
| 72 | uint32_t event_mask_size; |
| 73 | /* Copy event mask here */ |
| 74 | } __packed; |
| 75 | |
| 76 | struct diag_ctrl_log_mask { |
| 77 | uint32_t cmd_type; |
| 78 | uint32_t data_len; |
| 79 | uint8_t stream_id; |
| 80 | uint8_t status; |
| 81 | uint8_t equip_id; |
| 82 | uint32_t num_items; /* Last log code for this equip_id */ |
| 83 | uint32_t log_mask_size; /* Size of log mask stored in log_mask[] */ |
| 84 | /* Copy log mask here */ |
| 85 | } __packed; |
| 86 | |
| 87 | struct diag_ctrl_msg_mask { |
| 88 | uint32_t cmd_type; |
| 89 | uint32_t data_len; |
| 90 | uint8_t stream_id; |
| 91 | uint8_t status; |
| 92 | uint8_t msg_mode; |
| 93 | uint16_t ssid_first; /* Start of range of supported SSIDs */ |
| 94 | uint16_t ssid_last; /* Last SSID in range */ |
| 95 | uint32_t msg_mask_size; /* ssid_last - ssid_first + 1 */ |
| 96 | /* Copy msg mask here */ |
| 97 | } __packed; |
| 98 | |
Ravi Aravamudhan | d09f877 | 2012-12-20 14:48:30 -0800 | [diff] [blame] | 99 | struct diag_ctrl_feature_mask { |
| 100 | uint32_t ctrl_pkt_id; |
| 101 | uint32_t ctrl_pkt_data_len; |
| 102 | uint32_t feature_mask_len; |
| 103 | /* Copy feature mask here */ |
| 104 | } __packed; |
| 105 | |
Dixon Peterson | f2d449c | 2013-02-01 18:02:20 -0800 | [diff] [blame] | 106 | struct diag_ctrl_msg_diagmode { |
| 107 | uint32_t ctrl_pkt_id; |
| 108 | uint32_t ctrl_pkt_data_len; |
| 109 | uint32_t version; |
| 110 | uint32_t sleep_vote; |
| 111 | uint32_t real_time; |
| 112 | uint32_t use_nrt_values; |
| 113 | uint32_t commit_threshold; |
| 114 | uint32_t sleep_threshold; |
| 115 | uint32_t sleep_time; |
| 116 | uint32_t drain_timer_val; |
| 117 | uint32_t event_stale_timer_val; |
| 118 | } __packed; |
| 119 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 120 | void diagfwd_cntl_init(void); |
| 121 | void diagfwd_cntl_exit(void); |
| 122 | void diag_read_smd_cntl_work_fn(struct work_struct *); |
Dixon Peterson | 3ff84ea | 2012-12-21 20:16:18 -0800 | [diff] [blame] | 123 | void diag_notify_ctrl_update_fn(struct work_struct *work); |
Dixon Peterson | 66fb11b | 2012-12-04 20:30:54 -0800 | [diff] [blame] | 124 | void diag_clean_reg_fn(struct work_struct *work); |
| 125 | int diag_process_smd_cntl_read_data(struct diag_smd_info *smd_info, void *buf, |
| 126 | int total_recd); |
Dixon Peterson | f2d449c | 2013-02-01 18:02:20 -0800 | [diff] [blame] | 127 | void diag_send_diag_mode_update(int real_time); |
| 128 | void diag_send_diag_mode_update_by_smd(struct diag_smd_info *smd_info, |
| 129 | int real_time); |
Dixon Peterson | 29aebee | 2012-04-06 12:44:08 -0700 | [diff] [blame] | 130 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 131 | #endif |