iwlwifi: log as error when error detected
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-testmode.h
CommitLineData
4613e72d
CK
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 *
fb4961db 8 * Copyright(c) 2010 - 2012 Intel Corporation. All rights reserved.
4613e72d
CK
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
22 * USA
23 *
24 * The full GNU General Public License is included in this distribution
25 * in the file called LICENSE.GPL.
26 *
27 * Contact Information:
28 * Intel Linux Wireless <ilw@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
30 *
31 * BSD LICENSE
32 *
fb4961db 33 * Copyright(c) 2010 - 2012 Intel Corporation. All rights reserved.
4613e72d
CK
34 * All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 *
40 * * Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * * Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in
44 * the documentation and/or other materials provided with the
45 * distribution.
46 * * Neither the name Intel Corporation nor the names of its
47 * contributors may be used to endorse or promote products derived
48 * from this software without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
51 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
52 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
53 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
54 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
56 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 *
62 *****************************************************************************/
63#ifndef __IWL_TESTMODE_H__
64#define __IWL_TESTMODE_H__
65
66#include <linux/types.h>
67
68
4466320f
WYG
69/*
70 * Commands from user space to kernel space(IWL_TM_CMD_ID_APP2DEV_XX) and
4613e72d 71 * from and kernel space to user space(IWL_TM_CMD_ID_DEV2APP_XX).
4466320f
WYG
72 * The command ID is carried with IWL_TM_ATTR_COMMAND.
73 *
74 * @IWL_TM_CMD_APP2DEV_UCODE:
75 * commands from user application to the uCode,
76 * the actual uCode host command ID is carried with
77 * IWL_TM_ATTR_UCODE_CMD_ID
78 *
72bcacc2
HK
79 * @IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32:
80 * @IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE32:
81 * @IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8:
4466320f
WYG
82 * commands from user applicaiton to access register
83 *
84 * @IWL_TM_CMD_APP2DEV_GET_DEVICENAME: retrieve device name
85 * @IWL_TM_CMD_APP2DEV_LOAD_INIT_FW: load initial uCode image
86 * @IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB: perform calibration
87 * @IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW: load runtime uCode image
88 * @IWL_TM_CMD_APP2DEV_GET_EEPROM: request EEPROM data
89 * @IWL_TM_CMD_APP2DEV_FIXRATE_REQ: set fix MCS
90 * commands fom user space for pure driver level operations
91 *
92 * @IWL_TM_CMD_APP2DEV_BEGIN_TRACE:
93 * @IWL_TM_CMD_APP2DEV_END_TRACE:
94 * @IWL_TM_CMD_APP2DEV_READ_TRACE:
95 * commands fom user space for uCode trace operations
96 *
97 * @IWL_TM_CMD_DEV2APP_SYNC_RSP:
98 * commands from kernel space to carry the synchronous response
99 * to user application
100 * @IWL_TM_CMD_DEV2APP_UCODE_RX_PKT:
101 * commands from kernel space to multicast the spontaneous messages
102 * to user application
103 * @IWL_TM_CMD_DEV2APP_EEPROM_RSP:
104 * commands from kernel space to carry the eeprom response
105 * to user application
306713fd 106 *
e98a1939
WYG
107 * @IWL_TM_CMD_APP2DEV_OWNERSHIP:
108 * commands from user application to own change the ownership of the uCode
109 * if application has the ownership, the only host command from
110 * testmode will deliver to uCode. Default owner is driver
306713fd 111 *
72bcacc2
HK
112 * @IWL_TM_CMD_APP2DEV_INDIRECT_REG_READ32:
113 * @IWL_TM_CMD_APP2DEV_INDIRECT_REG_WRITE32:
0a79bb57 114 * commands from user application to indirectly access peripheral register
72bcacc2 115 *
306713fd
HK
116 * @IWL_TM_CMD_APP2DEV_READ_SRAM:
117 * @IWL_TM_CMD_APP2DEV_DUMP_SRAM:
0a79bb57 118 * commands from user application to read data in sram
306713fd 119 *
0a79bb57 120 * @IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW: load Wake On Wireless LAN uCode image
e1a38fe1 121 * @IWL_TM_CMD_APP2DEV_GET_FW_VERSION: retrieve uCode version
0bec12b8 122 * @IWL_TM_CMD_APP2DEV_GET_DEVICE_ID: retrieve ID information in device
668bd6a8 123 * @IWL_TM_CMD_APP2DEV_GET_FW_INFO:
0a79bb57 124 * retrieve information of existing loaded uCode image
d4af19fe 125 *
4613e72d
CK
126 */
127enum iwl_tm_cmd_t {
4466320f 128 IWL_TM_CMD_APP2DEV_UCODE = 1,
72bcacc2
HK
129 IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32 = 2,
130 IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE32 = 3,
131 IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8 = 4,
4466320f
WYG
132 IWL_TM_CMD_APP2DEV_GET_DEVICENAME = 5,
133 IWL_TM_CMD_APP2DEV_LOAD_INIT_FW = 6,
134 IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB = 7,
135 IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW = 8,
136 IWL_TM_CMD_APP2DEV_GET_EEPROM = 9,
137 IWL_TM_CMD_APP2DEV_FIXRATE_REQ = 10,
138 IWL_TM_CMD_APP2DEV_BEGIN_TRACE = 11,
139 IWL_TM_CMD_APP2DEV_END_TRACE = 12,
140 IWL_TM_CMD_APP2DEV_READ_TRACE = 13,
141 IWL_TM_CMD_DEV2APP_SYNC_RSP = 14,
142 IWL_TM_CMD_DEV2APP_UCODE_RX_PKT = 15,
143 IWL_TM_CMD_DEV2APP_EEPROM_RSP = 16,
e98a1939 144 IWL_TM_CMD_APP2DEV_OWNERSHIP = 17,
72bcacc2
HK
145 IWL_TM_CMD_APP2DEV_INDIRECT_REG_READ32 = 18,
146 IWL_TM_CMD_APP2DEV_INDIRECT_REG_WRITE32 = 19,
306713fd
HK
147 IWL_TM_CMD_APP2DEV_READ_SRAM = 20,
148 IWL_TM_CMD_APP2DEV_DUMP_SRAM = 21,
d4af19fe 149 IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW = 22,
e1a38fe1 150 IWL_TM_CMD_APP2DEV_GET_FW_VERSION = 23,
0bec12b8 151 IWL_TM_CMD_APP2DEV_GET_DEVICE_ID = 24,
668bd6a8
KH
152 IWL_TM_CMD_APP2DEV_GET_FW_INFO = 25,
153 IWL_TM_CMD_MAX = 26,
4613e72d
CK
154};
155
4466320f
WYG
156/*
157 * Atrribute filed in testmode command
158 * See enum iwl_tm_cmd_t.
159 *
160 * @IWL_TM_ATTR_NOT_APPLICABLE:
161 * The attribute is not applicable or invalid
162 * @IWL_TM_ATTR_COMMAND:
163 * From user space to kernel space:
164 * the command either destines to ucode, driver, or register;
165 * From kernel space to user space:
166 * the command either carries synchronous response,
167 * or the spontaneous message multicast from the device;
168 *
169 * @IWL_TM_ATTR_UCODE_CMD_ID:
170 * @IWL_TM_ATTR_UCODE_CMD_DATA:
171 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_UCODE,
172 * The mandatory fields are :
173 * IWL_TM_ATTR_UCODE_CMD_ID for recognizable command ID;
174 * IWL_TM_ATTR_COMMAND_FLAG for the flags of the commands;
175 * The optional fields are:
176 * IWL_TM_ATTR_UCODE_CMD_DATA for the actual command payload
177 * to the ucode
178 *
179 * @IWL_TM_ATTR_REG_OFFSET:
180 * @IWL_TM_ATTR_REG_VALUE8:
181 * @IWL_TM_ATTR_REG_VALUE32:
182 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_REG_XXX,
183 * The mandatory fields are:
184 * IWL_TM_ATTR_REG_OFFSET for the offset of the target register;
185 * IWL_TM_ATTR_REG_VALUE8 or IWL_TM_ATTR_REG_VALUE32 for value
186 *
187 * @IWL_TM_ATTR_SYNC_RSP:
188 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_SYNC_RSP,
189 * The mandatory fields are:
190 * IWL_TM_ATTR_SYNC_RSP for the data content responding to the user
191 * application command
192 *
193 * @IWL_TM_ATTR_UCODE_RX_PKT:
194 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_UCODE_RX_PKT,
195 * The mandatory fields are:
196 * IWL_TM_ATTR_UCODE_RX_PKT for the data content multicast to the user
197 * application
198 *
199 * @IWL_TM_ATTR_EEPROM:
200 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_EEPROM,
201 * The mandatory fields are:
202 * IWL_TM_ATTR_EEPROM for the data content responging to the user
203 * application
204 *
205 * @IWL_TM_ATTR_TRACE_ADDR:
206 * @IWL_TM_ATTR_TRACE_SIZE:
207 * @IWL_TM_ATTR_TRACE_DUMP:
208 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_XXX_TRACE,
209 * The mandatory fields are:
210 * IWL_TM_ATTR_MEM_TRACE_ADDR for the trace address
211 * IWL_TM_ATTR_MEM_TRACE_SIZE for the trace buffer size
212 * IWL_TM_ATTR_MEM_TRACE_DUMP for the trace dump
213 *
214 * @IWL_TM_ATTR_FIXRATE:
215 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_FIXRATE_REQ,
216 * The mandatory fields are:
217 * IWL_TM_ATTR_FIXRATE for the fixed rate
218 *
e98a1939
WYG
219 * @IWL_TM_ATTR_UCODE_OWNER:
220 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_OWNERSHIP,
221 * The mandatory fields are:
222 * IWL_TM_ATTR_UCODE_OWNER for the new owner
306713fd
HK
223 *
224 * @IWL_TM_ATTR_SRAM_ADDR:
225 * @IWL_TM_ATTR_SRAM_SIZE:
226 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_READ_SRAM,
227 * The mandatory fields are:
228 * IWL_TM_ATTR_SRAM_ADDR for the address in sram
229 * IWL_TM_ATTR_SRAM_SIZE for the buffer size of data reading
230 *
231 * @IWL_TM_ATTR_SRAM_DUMP:
232 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_DUMP_SRAM,
233 * IWL_TM_ATTR_SRAM_DUMP for the data in sram
234 *
e1a38fe1
HK
235 * @IWL_TM_ATTR_FW_VERSION:
236 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_GET_FW_VERSION,
237 * IWL_TM_ATTR_FW_VERSION for the uCode version
238 *
0bec12b8
HK
239 * @IWL_TM_ATTR_DEVICE_ID:
240 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_GET_DEVICE_ID,
241 * IWL_TM_ATTR_DEVICE_ID for the device ID information
242 *
668bd6a8
KH
243 * @IWL_TM_ATTR_FW_TYPE:
244 * @IWL_TM_ATTR_FW_INST_SIZE:
245 * @IWL_TM_ATTR_FW_DATA_SIZE:
246 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_GET_FW_INFO,
247 * The mandatory fields are:
248 * IWL_TM_ATTR_FW_TYPE for the uCode type (INIT/RUNTIME/...)
249 * IWL_TM_ATTR_FW_INST_SIZE for the size of instruction section
250 * IWL_TM_ATTR_FW_DATA_SIZE for the size of data section
251 *
4466320f 252 */
4613e72d 253enum iwl_tm_attr_t {
4466320f
WYG
254 IWL_TM_ATTR_NOT_APPLICABLE = 0,
255 IWL_TM_ATTR_COMMAND = 1,
256 IWL_TM_ATTR_UCODE_CMD_ID = 2,
257 IWL_TM_ATTR_UCODE_CMD_DATA = 3,
258 IWL_TM_ATTR_REG_OFFSET = 4,
259 IWL_TM_ATTR_REG_VALUE8 = 5,
260 IWL_TM_ATTR_REG_VALUE32 = 6,
261 IWL_TM_ATTR_SYNC_RSP = 7,
262 IWL_TM_ATTR_UCODE_RX_PKT = 8,
263 IWL_TM_ATTR_EEPROM = 9,
264 IWL_TM_ATTR_TRACE_ADDR = 10,
265 IWL_TM_ATTR_TRACE_SIZE = 11,
266 IWL_TM_ATTR_TRACE_DUMP = 12,
267 IWL_TM_ATTR_FIXRATE = 13,
e98a1939 268 IWL_TM_ATTR_UCODE_OWNER = 14,
306713fd
HK
269 IWL_TM_ATTR_SRAM_ADDR = 15,
270 IWL_TM_ATTR_SRAM_SIZE = 16,
271 IWL_TM_ATTR_SRAM_DUMP = 17,
e1a38fe1 272 IWL_TM_ATTR_FW_VERSION = 18,
0bec12b8 273 IWL_TM_ATTR_DEVICE_ID = 19,
668bd6a8
KH
274 IWL_TM_ATTR_FW_TYPE = 20,
275 IWL_TM_ATTR_FW_INST_SIZE = 21,
276 IWL_TM_ATTR_FW_DATA_SIZE = 22,
277 IWL_TM_ATTR_MAX = 23,
4613e72d
CK
278};
279
7a4e5281 280/* uCode trace buffer */
49b72100
WYG
281#define TRACE_BUFF_SIZE_MAX 0x200000
282#define TRACE_BUFF_SIZE_MIN 0x20000
283#define TRACE_BUFF_SIZE_DEF TRACE_BUFF_SIZE_MIN
7a4e5281 284#define TRACE_BUFF_PADD 0x2000
e056a653
HK
285
286/* Maximum data size of each dump it packet */
287#define DUMP_CHUNK_SIZE (PAGE_SIZE - 1024)
4613e72d 288
b07f08a5
KH
289/* Address offset of data segment in SRAM */
290#define SRAM_DATA_SEG_OFFSET 0x800000
291
4613e72d 292#endif
This page took 0.102852 seconds and 5 git commands to generate.