]>
Commit | Line | Data |
---|---|---|
1bd3cbc1 EG |
1 | /****************************************************************************** |
2 | * | |
3 | * This file is provided under a dual BSD/GPLv2 license. When using or | |
4 | * redistributing this file, you may do so under either license. | |
5 | * | |
6 | * GPL LICENSE SUMMARY | |
7 | * | |
8 | * Copyright(c) 2014 Intel Corporation. All rights reserved. | |
8b4139dc | 9 | * Copyright(c) 2014 Intel Mobile Communications GmbH |
1bd3cbc1 EG |
10 | * |
11 | * This program is free software; you can redistribute it and/or modify | |
12 | * it under the terms of version 2 of the GNU General Public License as | |
13 | * published by the Free Software Foundation. | |
14 | * | |
15 | * This program is distributed in the hope that it will be useful, but | |
16 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | * General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU General Public License | |
21 | * along with this program; if not, write to the Free Software | |
22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, | |
23 | * USA | |
24 | * | |
25 | * The full GNU General Public License is included in this distribution | |
26 | * in the file called COPYING. | |
27 | * | |
28 | * Contact Information: | |
29 | * Intel Linux Wireless <ilw@linux.intel.com> | |
30 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | |
31 | * | |
32 | * BSD LICENSE | |
33 | * | |
34 | * Copyright(c) 2014 Intel Corporation. All rights reserved. | |
8b4139dc | 35 | * Copyright(c) 2014 Intel Mobile Communications GmbH |
1bd3cbc1 EG |
36 | * All rights reserved. |
37 | * | |
38 | * Redistribution and use in source and binary forms, with or without | |
39 | * modification, are permitted provided that the following conditions | |
40 | * are met: | |
41 | * | |
42 | * * Redistributions of source code must retain the above copyright | |
43 | * notice, this list of conditions and the following disclaimer. | |
44 | * * Redistributions in binary form must reproduce the above copyright | |
45 | * notice, this list of conditions and the following disclaimer in | |
46 | * the documentation and/or other materials provided with the | |
47 | * distribution. | |
48 | * * Neither the name Intel Corporation nor the names of its | |
49 | * contributors may be used to endorse or promote products derived | |
50 | * from this software without specific prior written permission. | |
51 | * | |
52 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
53 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
54 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
55 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
56 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
57 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
58 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
59 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
60 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
61 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
62 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
63 | *****************************************************************************/ | |
64 | ||
65 | #ifndef __fw_error_dump_h__ | |
66 | #define __fw_error_dump_h__ | |
67 | ||
68 | #include <linux/types.h> | |
69 | ||
70 | #define IWL_FW_ERROR_DUMP_BARKER 0x14789632 | |
71 | ||
72 | /** | |
73 | * enum iwl_fw_error_dump_type - types of data in the dump file | |
473ad712 | 74 | * @IWL_FW_ERROR_DUMP_CSR: Control Status Registers - from offset 0 |
7b445f35 | 75 | * @IWL_FW_ERROR_DUMP_RXF: |
4d075007 JB |
76 | * @IWL_FW_ERROR_DUMP_TXCMD: last TX command data, structured as |
77 | * &struct iwl_fw_error_dump_txcmd packets | |
06ddbf5a EG |
78 | * @IWL_FW_ERROR_DUMP_DEV_FW_INFO: struct %iwl_fw_error_dump_info |
79 | * info on the device / firmware. | |
c2d20201 | 80 | * @IWL_FW_ERROR_DUMP_FW_MONITOR: firmware monitor |
67c65f2c EG |
81 | * @IWL_FW_ERROR_DUMP_PRPH: range of periphery registers - there can be several |
82 | * sections like this in a single file. | |
06d51e0d | 83 | * @IWL_FW_ERROR_DUMP_FH_REGS: range of FH registers |
e06d8437 | 84 | * @IWL_FW_ERROR_DUMP_MEM: chunk of memory |
b6eaa45a EG |
85 | * @IWL_FW_ERROR_DUMP_ERROR_INFO: description of what triggered this dump. |
86 | * Structured as &struct iwl_fw_error_dump_trigger_desc. | |
1bd3cbc1 EG |
87 | */ |
88 | enum iwl_fw_error_dump_type { | |
a549b296 | 89 | /* 0 is deprecated */ |
473ad712 | 90 | IWL_FW_ERROR_DUMP_CSR = 1, |
7b445f35 | 91 | IWL_FW_ERROR_DUMP_RXF = 2, |
4d075007 | 92 | IWL_FW_ERROR_DUMP_TXCMD = 3, |
06ddbf5a | 93 | IWL_FW_ERROR_DUMP_DEV_FW_INFO = 4, |
c2d20201 | 94 | IWL_FW_ERROR_DUMP_FW_MONITOR = 5, |
67c65f2c | 95 | IWL_FW_ERROR_DUMP_PRPH = 6, |
06d51e0d LK |
96 | IWL_FW_ERROR_DUMP_TXF = 7, |
97 | IWL_FW_ERROR_DUMP_FH_REGS = 8, | |
e06d8437 | 98 | IWL_FW_ERROR_DUMP_MEM = 9, |
b6eaa45a | 99 | IWL_FW_ERROR_DUMP_ERROR_INFO = 10, |
1bd3cbc1 EG |
100 | |
101 | IWL_FW_ERROR_DUMP_MAX, | |
102 | }; | |
103 | ||
104 | /** | |
105 | * struct iwl_fw_error_dump_data - data for one type | |
106 | * @type: %enum iwl_fw_error_dump_type | |
d4849277 EG |
107 | * @len: the length starting from %data |
108 | * @data: the data itself | |
1bd3cbc1 EG |
109 | */ |
110 | struct iwl_fw_error_dump_data { | |
111 | __le32 type; | |
112 | __le32 len; | |
113 | __u8 data[]; | |
7b445f35 | 114 | } __packed; |
1bd3cbc1 EG |
115 | |
116 | /** | |
117 | * struct iwl_fw_error_dump_file - the layout of the header of the file | |
118 | * @barker: must be %IWL_FW_ERROR_DUMP_BARKER | |
119 | * @file_len: the length of all the file starting from %barker | |
120 | * @data: array of %struct iwl_fw_error_dump_data | |
121 | */ | |
122 | struct iwl_fw_error_dump_file { | |
123 | __le32 barker; | |
124 | __le32 file_len; | |
125 | u8 data[0]; | |
7b445f35 | 126 | } __packed; |
1bd3cbc1 | 127 | |
4d075007 JB |
128 | /** |
129 | * struct iwl_fw_error_dump_txcmd - TX command data | |
130 | * @cmdlen: original length of command | |
131 | * @caplen: captured length of command (may be less) | |
132 | * @data: captured command data, @caplen bytes | |
133 | */ | |
134 | struct iwl_fw_error_dump_txcmd { | |
135 | __le32 cmdlen; | |
136 | __le32 caplen; | |
137 | u8 data[]; | |
138 | } __packed; | |
139 | ||
04fd2c28 LK |
140 | /** |
141 | * struct iwl_fw_error_dump_fifo - RX/TX FIFO data | |
142 | * @fifo_num: number of FIFO (starting from 0) | |
143 | * @available_bytes: num of bytes available in FIFO (may be less than FIFO size) | |
144 | * @wr_ptr: position of write pointer | |
145 | * @rd_ptr: position of read pointer | |
146 | * @fence_ptr: position of fence pointer | |
147 | * @fence_mode: the current mode of the fence (before locking) - | |
148 | * 0=follow RD pointer ; 1 = freeze | |
149 | * @data: all of the FIFO's data | |
150 | */ | |
151 | struct iwl_fw_error_dump_fifo { | |
152 | __le32 fifo_num; | |
153 | __le32 available_bytes; | |
154 | __le32 wr_ptr; | |
155 | __le32 rd_ptr; | |
156 | __le32 fence_ptr; | |
157 | __le32 fence_mode; | |
158 | u8 data[]; | |
159 | } __packed; | |
160 | ||
06ddbf5a EG |
161 | enum iwl_fw_error_dump_family { |
162 | IWL_FW_ERROR_DUMP_FAMILY_7 = 7, | |
163 | IWL_FW_ERROR_DUMP_FAMILY_8 = 8, | |
164 | }; | |
165 | ||
166 | /** | |
167 | * struct iwl_fw_error_dump_info - info on the device / firmware | |
168 | * @device_family: the family of the device (7 / 8) | |
169 | * @hw_step: the step of the device | |
170 | * @fw_human_readable: human readable FW version | |
171 | * @dev_human_readable: name of the device | |
172 | * @bus_human_readable: name of the bus used | |
173 | */ | |
174 | struct iwl_fw_error_dump_info { | |
175 | __le32 device_family; | |
176 | __le32 hw_step; | |
177 | u8 fw_human_readable[FW_VER_HUMAN_READABLE_SZ]; | |
178 | u8 dev_human_readable[64]; | |
179 | u8 bus_human_readable[8]; | |
180 | } __packed; | |
181 | ||
c2d20201 | 182 | /** |
c544e9c4 | 183 | * struct iwl_fw_error_dump_fw_mon - FW monitor data |
c2d20201 EG |
184 | * @fw_mon_wr_ptr: the position of the write pointer in the cyclic buffer |
185 | * @fw_mon_base_ptr: base pointer of the data | |
186 | * @fw_mon_cycle_cnt: number of wrap arounds | |
187 | * @reserved: for future use | |
188 | * @data: captured data | |
189 | */ | |
c544e9c4 | 190 | struct iwl_fw_error_dump_fw_mon { |
c2d20201 EG |
191 | __le32 fw_mon_wr_ptr; |
192 | __le32 fw_mon_base_ptr; | |
193 | __le32 fw_mon_cycle_cnt; | |
194 | __le32 reserved[3]; | |
195 | u8 data[]; | |
196 | } __packed; | |
197 | ||
67c65f2c EG |
198 | /** |
199 | * struct iwl_fw_error_dump_prph - periphery registers data | |
200 | * @prph_start: address of the first register in this chunk | |
201 | * @data: the content of the registers | |
202 | */ | |
203 | struct iwl_fw_error_dump_prph { | |
204 | __le32 prph_start; | |
205 | __le32 data[]; | |
206 | }; | |
207 | ||
e06d8437 EG |
208 | enum iwl_fw_error_dump_mem_type { |
209 | IWL_FW_ERROR_DUMP_MEM_SRAM, | |
210 | IWL_FW_ERROR_DUMP_MEM_SMEM, | |
211 | }; | |
212 | ||
213 | /** | |
214 | * struct iwl_fw_error_dump_mem - chunk of memory | |
215 | * @type: %enum iwl_fw_error_dump_mem_type | |
216 | * @offset: the offset from which the memory was read | |
217 | * @data: the content of the memory | |
218 | */ | |
219 | struct iwl_fw_error_dump_mem { | |
220 | __le32 type; | |
221 | __le32 offset; | |
222 | u8 data[]; | |
223 | }; | |
224 | ||
4d075007 | 225 | /** |
1fa16056 | 226 | * iwl_fw_error_next_data - advance fw error dump data pointer |
4d075007 JB |
227 | * @data: previous data block |
228 | * Returns: next data block | |
229 | */ | |
230 | static inline struct iwl_fw_error_dump_data * | |
1fa16056 | 231 | iwl_fw_error_next_data(struct iwl_fw_error_dump_data *data) |
4d075007 JB |
232 | { |
233 | return (void *)(data->data + le32_to_cpu(data->len)); | |
234 | } | |
235 | ||
d2709ad7 EG |
236 | /** |
237 | * enum iwl_fw_dbg_trigger - triggers available | |
238 | * | |
239 | * @FW_DBG_TRIGGER_USER: trigger log collection by user | |
240 | * This should not be defined as a trigger to the driver, but a value the | |
241 | * driver should set to indicate that the trigger was initiated by the | |
242 | * user. | |
243 | * @FW_DBG_TRIGGER_FW_ASSERT: trigger log collection when the firmware asserts | |
9d761fd8 EG |
244 | * @FW_DBG_TRIGGER_MISSED_BEACONS: trigger log collection when beacons are |
245 | * missed. | |
f35d9c55 | 246 | * @FW_DBG_TRIGGER_CHANNEL_SWITCH: trigger log collection upon channel switch. |
917f39bb EG |
247 | * @FW_DBG_TRIGGER_FW_NOTIF: trigger log collection when the firmware sends a |
248 | * command response or a notification. | |
d2709ad7 EG |
249 | */ |
250 | enum iwl_fw_dbg_trigger { | |
251 | FW_DBG_TRIGGER_INVALID = 0, | |
252 | FW_DBG_TRIGGER_USER, | |
253 | FW_DBG_TRIGGER_FW_ASSERT, | |
9d761fd8 | 254 | FW_DBG_TRIGGER_MISSED_BEACONS, |
f35d9c55 | 255 | FW_DBG_TRIGGER_CHANNEL_SWITCH, |
917f39bb | 256 | FW_DBG_TRIGGER_FW_NOTIF, |
d2709ad7 EG |
257 | |
258 | /* must be last */ | |
259 | FW_DBG_TRIGGER_MAX, | |
260 | }; | |
261 | ||
b6eaa45a EG |
262 | /** |
263 | * struct iwl_fw_error_dump_trigger_desc - describes the trigger condition | |
264 | * @type: %enum iwl_fw_dbg_trigger | |
265 | * @data: raw data about what happened | |
266 | */ | |
267 | struct iwl_fw_error_dump_trigger_desc { | |
268 | __le32 type; | |
269 | u8 data[]; | |
270 | }; | |
271 | ||
1bd3cbc1 | 272 | #endif /* __fw_error_dump_h__ */ |