aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBen Cahill <ben.m.cahill@intel.com>2007-11-28 22:10:08 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:05:32 -0500
commit075416cd18cb4a7ed057d9a96b388bc23b43c4b1 (patch)
treed790e709ef6295befdf47b7004cebd02dd784742 /drivers
parente3851447664113bccf9b23af0308e266872a735c (diff)
iwlwifi: document command header and "alive" responses
Document command header and "alive" responses Signed-off-by: Ben Cahill <ben.m.cahill@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-commands.h85
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-commands.h160
2 files changed, 192 insertions, 53 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
index 794db78c932e..3d3c7e3d37ea 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
@@ -121,7 +121,7 @@ enum {
121 REPLY_TX_PWR_TABLE_CMD = 0x97, 121 REPLY_TX_PWR_TABLE_CMD = 0x97,
122 MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ 122 MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */
123 123
124 /* BT config command */ 124 /* Bluetooth device coexistance config command */
125 REPLY_BT_CONFIG = 0x9b, 125 REPLY_BT_CONFIG = 0x9b,
126 126
127 /* 4965 Statistics */ 127 /* 4965 Statistics */
@@ -144,25 +144,42 @@ enum {
144 * 144 *
145 *****************************************************************************/ 145 *****************************************************************************/
146 146
147/* iwl3945_cmd_header flags value */
147#define IWL_CMD_FAILED_MSK 0x40 148#define IWL_CMD_FAILED_MSK 0x40
148 149
150/**
151 * struct iwl3945_cmd_header
152 *
153 * This header format appears in the beginning of each command sent from the
154 * driver, and each response/notification received from uCode.
155 */
149struct iwl3945_cmd_header { 156struct iwl3945_cmd_header {
150 u8 cmd; 157 u8 cmd; /* Command ID: REPLY_RXON, etc. */
151 u8 flags; 158 u8 flags; /* IWL_CMD_* */
152 /* We have 15 LSB to use as we please (MSB indicates 159 /*
153 * a frame Rx'd from the HW). We encode the following 160 * The driver sets up the sequence number to values of its chosing.
154 * information into the sequence field: 161 * uCode does not use this value, but passes it back to the driver
162 * when sending the response to each driver-originated command, so
163 * the driver can match the response to the command. Since the values
164 * don't get used by uCode, the driver may set up an arbitrary format.
165 *
166 * There is one exception: uCode sets bit 15 when it originates
167 * the response/notification, i.e. when the response/notification
168 * is not a direct response to a command sent by the driver. For
169 * example, uCode issues REPLY_3945_RX when it sends a received frame
170 * to the driver; it is not a direct response to any driver command.
155 * 171 *
156 * 0:7 index in fifo 172 * The Linux driver uses the following format:
157 * 8:13 fifo selection
158 * 14:14 bit indicating if this packet references the 'extra'
159 * storage at the end of the memory queue
160 * 15:15 (Rx indication)
161 * 173 *
174 * 0:7 index/position within Tx queue
175 * 8:13 Tx queue selection
176 * 14:14 driver sets this to indicate command is in the 'huge'
177 * storage at the end of the command buffers, i.e. scan cmd
178 * 15:15 uCode sets this in uCode-originated response/notification
162 */ 179 */
163 __le16 sequence; 180 __le16 sequence;
164 181
165 /* command data follows immediately */ 182 /* command or response/notification data follows immediately */
166 u8 data[0]; 183 u8 data[0];
167} __attribute__ ((packed)); 184} __attribute__ ((packed));
168 185
@@ -176,15 +193,22 @@ struct iwl3945_cmd_header {
176#define INITIALIZE_SUBTYPE (9) 193#define INITIALIZE_SUBTYPE (9)
177 194
178/* 195/*
179 * REPLY_ALIVE = 0x1 (response only, not a command) 196 * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command)
197 *
198 * uCode issues this "initialize alive" notification once the initialization
199 * uCode image has completed its work, and is ready to load the runtime image.
200 * This is the *first* "alive" notification that the driver will receive after
201 * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
202 *
203 * See comments documenting "BSM" (bootstrap state machine).
180 */ 204 */
181struct iwl3945_alive_resp { 205struct iwl3945_init_alive_resp {
182 u8 ucode_minor; 206 u8 ucode_minor;
183 u8 ucode_major; 207 u8 ucode_major;
184 __le16 reserved1; 208 __le16 reserved1;
185 u8 sw_rev[8]; 209 u8 sw_rev[8];
186 u8 ver_type; 210 u8 ver_type;
187 u8 ver_subtype; 211 u8 ver_subtype; /* "9" for initialize alive */
188 __le16 reserved2; 212 __le16 reserved2;
189 __le32 log_event_table_ptr; 213 __le32 log_event_table_ptr;
190 __le32 error_event_table_ptr; 214 __le32 error_event_table_ptr;
@@ -192,16 +216,39 @@ struct iwl3945_alive_resp {
192 __le32 is_valid; 216 __le32 is_valid;
193} __attribute__ ((packed)); 217} __attribute__ ((packed));
194 218
195struct iwl3945_init_alive_resp { 219
220/**
221 * REPLY_ALIVE = 0x1 (response only, not a command)
222 *
223 * uCode issues this "alive" notification once the runtime image is ready
224 * to receive commands from the driver. This is the *second* "alive"
225 * notification that the driver will receive after rebooting uCode;
226 * this "alive" is indicated by subtype field != 9.
227 *
228 * See comments documenting "BSM" (bootstrap state machine).
229 *
230 * This response includes two pointers to structures within the device's
231 * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
232 *
233 * 1) log_event_table_ptr indicates base of the event log. This traces
234 * a 256-entry history of uCode execution within a circular buffer.
235 *
236 * 2) error_event_table_ptr indicates base of the error log. This contains
237 * information about any uCode error that occurs.
238 *
239 * The Linux driver can print both logs to the system log when a uCode error
240 * occurs.
241 */
242struct iwl3945_alive_resp {
196 u8 ucode_minor; 243 u8 ucode_minor;
197 u8 ucode_major; 244 u8 ucode_major;
198 __le16 reserved1; 245 __le16 reserved1;
199 u8 sw_rev[8]; 246 u8 sw_rev[8];
200 u8 ver_type; 247 u8 ver_type;
201 u8 ver_subtype; 248 u8 ver_subtype; /* not "9" for runtime alive */
202 __le16 reserved2; 249 __le16 reserved2;
203 __le32 log_event_table_ptr; 250 __le32 log_event_table_ptr; /* SRAM address for event log */
204 __le32 error_event_table_ptr; 251 __le32 error_event_table_ptr; /* SRAM address for error log */
205 __le32 timestamp; 252 __le32 timestamp;
206 __le32 is_valid; 253 __le32 is_valid;
207} __attribute__ ((packed)); 254} __attribute__ ((packed));
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
index 9910939f5a32..bde3aa018bba 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
@@ -120,7 +120,7 @@ enum {
120 REPLY_TX_PWR_TABLE_CMD = 0x97, 120 REPLY_TX_PWR_TABLE_CMD = 0x97,
121 MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ 121 MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */
122 122
123 /* BT config command */ 123 /* Bluetooth device coexistance config command */
124 REPLY_BT_CONFIG = 0x9b, 124 REPLY_BT_CONFIG = 0x9b,
125 125
126 /* 4965 Statistics */ 126 /* 4965 Statistics */
@@ -151,25 +151,42 @@ enum {
151 * 151 *
152 *****************************************************************************/ 152 *****************************************************************************/
153 153
154/* iwl4965_cmd_header flags value */
154#define IWL_CMD_FAILED_MSK 0x40 155#define IWL_CMD_FAILED_MSK 0x40
155 156
157/**
158 * struct iwl4965_cmd_header
159 *
160 * This header format appears in the beginning of each command sent from the
161 * driver, and each response/notification received from uCode.
162 */
156struct iwl4965_cmd_header { 163struct iwl4965_cmd_header {
157 u8 cmd; 164 u8 cmd; /* Command ID: REPLY_RXON, etc. */
158 u8 flags; 165 u8 flags; /* IWL_CMD_* */
159 /* We have 15 LSB to use as we please (MSB indicates 166 /*
160 * a frame Rx'd from the HW). We encode the following 167 * The driver sets up the sequence number to values of its chosing.
161 * information into the sequence field: 168 * uCode does not use this value, but passes it back to the driver
169 * when sending the response to each driver-originated command, so
170 * the driver can match the response to the command. Since the values
171 * don't get used by uCode, the driver may set up an arbitrary format.
162 * 172 *
163 * 0:7 index in fifo 173 * There is one exception: uCode sets bit 15 when it originates
164 * 8:13 fifo selection 174 * the response/notification, i.e. when the response/notification
165 * 14:14 bit indicating if this packet references the 'extra' 175 * is not a direct response to a command sent by the driver. For
166 * storage at the end of the memory queue 176 * example, uCode issues REPLY_3945_RX when it sends a received frame
167 * 15:15 (Rx indication) 177 * to the driver; it is not a direct response to any driver command.
168 * 178 *
179 * The Linux driver uses the following format:
180 *
181 * 0:7 index/position within Tx queue
182 * 8:13 Tx queue selection
183 * 14:14 driver sets this to indicate command is in the 'huge'
184 * storage at the end of the command buffers, i.e. scan cmd
185 * 15:15 uCode sets this in uCode-originated response/notification
169 */ 186 */
170 __le16 sequence; 187 __le16 sequence;
171 188
172 /* command data follows immediately */ 189 /* command or response/notification data follows immediately */
173 u8 data[0]; 190 u8 data[0];
174} __attribute__ ((packed)); 191} __attribute__ ((packed));
175 192
@@ -218,28 +235,28 @@ struct iwl4965_cmd_header {
218#define RATE_MCS_HT_DUP_POS 5 235#define RATE_MCS_HT_DUP_POS 5
219#define RATE_MCS_HT_DUP_MSK 0x20 236#define RATE_MCS_HT_DUP_MSK 0x20
220 237
221/* (1) HT format, (0) legacy format in bits 7:0 */ 238/* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */
222#define RATE_MCS_FLAGS_POS 8 239#define RATE_MCS_FLAGS_POS 8
223#define RATE_MCS_HT_POS 8 240#define RATE_MCS_HT_POS 8
224#define RATE_MCS_HT_MSK 0x100 241#define RATE_MCS_HT_MSK 0x100
225 242
226/* (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */ 243/* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */
227#define RATE_MCS_CCK_POS 9 244#define RATE_MCS_CCK_POS 9
228#define RATE_MCS_CCK_MSK 0x200 245#define RATE_MCS_CCK_MSK 0x200
229 246
230/* (1) Use Green Field preamble */ 247/* Bit 10: (1) Use Green Field preamble */
231#define RATE_MCS_GF_POS 10 248#define RATE_MCS_GF_POS 10
232#define RATE_MCS_GF_MSK 0x400 249#define RATE_MCS_GF_MSK 0x400
233 250
234/* (1) Use 40Mhz FAT channel width, (0) use 20 MHz legacy channel width */ 251/* Bit 11: (1) Use 40Mhz FAT chnl width, (0) use 20 MHz legacy chnl width */
235#define RATE_MCS_FAT_POS 11 252#define RATE_MCS_FAT_POS 11
236#define RATE_MCS_FAT_MSK 0x800 253#define RATE_MCS_FAT_MSK 0x800
237 254
238/* (1) Duplicate data on both 20MHz channels. FAT (bit 11) must be set. */ 255/* Bit 12: (1) Duplicate data on both 20MHz chnls. FAT (bit 11) must be set. */
239#define RATE_MCS_DUP_POS 12 256#define RATE_MCS_DUP_POS 12
240#define RATE_MCS_DUP_MSK 0x1000 257#define RATE_MCS_DUP_MSK 0x1000
241 258
242/* (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */ 259/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */
243#define RATE_MCS_SGI_POS 13 260#define RATE_MCS_SGI_POS 13
244#define RATE_MCS_SGI_MSK 0x2000 261#define RATE_MCS_SGI_MSK 0x2000
245 262
@@ -266,45 +283,120 @@ struct iwl4965_cmd_header {
266#define INITIALIZE_SUBTYPE (9) 283#define INITIALIZE_SUBTYPE (9)
267 284
268/* 285/*
269 * REPLY_ALIVE = 0x1 (response only, not a command) 286 * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command)
287 *
288 * uCode issues this "initialize alive" notification once the initialization
289 * uCode image has completed its work, and is ready to load the runtime image.
290 * This is the *first* "alive" notification that the driver will receive after
291 * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
292 *
293 * See comments documenting "BSM" (bootstrap state machine).
294 *
295 * For 4965, this notification contains important calibration data for
296 * calculating txpower settings:
297 *
298 * 1) Power supply voltage indication. The voltage sensor outputs higher
299 * values for lower voltage, and vice versa.
300 *
301 * 2) Temperature measurement parameters, for each of two channel widths
302 * (20 MHz and 40 MHz) supported by the radios. Temperature sensing
303 * is done via one of the receiver chains, and channel width influences
304 * the results.
305 *
306 * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation,
307 * for each of 5 frequency ranges.
270 */ 308 */
271struct iwl4965_alive_resp { 309struct iwl4965_init_alive_resp {
272 u8 ucode_minor; 310 u8 ucode_minor;
273 u8 ucode_major; 311 u8 ucode_major;
274 __le16 reserved1; 312 __le16 reserved1;
275 u8 sw_rev[8]; 313 u8 sw_rev[8];
276 u8 ver_type; 314 u8 ver_type;
277 u8 ver_subtype; 315 u8 ver_subtype; /* "9" for initialize alive */
278 __le16 reserved2; 316 __le16 reserved2;
279 __le32 log_event_table_ptr; 317 __le32 log_event_table_ptr;
280 __le32 error_event_table_ptr; 318 __le32 error_event_table_ptr;
281 __le32 timestamp; 319 __le32 timestamp;
282 __le32 is_valid; 320 __le32 is_valid;
321
322 /* calibration values from "initialize" uCode */
323 __le32 voltage; /* signed, higher value is lower voltage */
324 __le32 therm_r1[2]; /* signed, 1st for normal, 2nd for FAT channel*/
325 __le32 therm_r2[2]; /* signed */
326 __le32 therm_r3[2]; /* signed */
327 __le32 therm_r4[2]; /* signed */
328 __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups,
329 * 2 Tx chains */
283} __attribute__ ((packed)); 330} __attribute__ ((packed));
284 331
285struct iwl4965_init_alive_resp { 332
333/**
334 * REPLY_ALIVE = 0x1 (response only, not a command)
335 *
336 * uCode issues this "alive" notification once the runtime image is ready
337 * to receive commands from the driver. This is the *second* "alive"
338 * notification that the driver will receive after rebooting uCode;
339 * this "alive" is indicated by subtype field != 9.
340 *
341 * See comments documenting "BSM" (bootstrap state machine).
342 *
343 * This response includes two pointers to structures within the device's
344 * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
345 *
346 * 1) log_event_table_ptr indicates base of the event log. This traces
347 * a 256-entry history of uCode execution within a circular buffer.
348 * Its header format is:
349 *
350 * __le32 log_size; log capacity (in number of entries)
351 * __le32 type; (1) timestamp with each entry, (0) no timestamp
352 * __le32 wraps; # times uCode has wrapped to top of circular buffer
353 * __le32 write_index; next circular buffer entry that uCode would fill
354 *
355 * The header is followed by the circular buffer of log entries. Entries
356 * with timestamps have the following format:
357 *
358 * __le32 event_id; range 0 - 1500
359 * __le32 timestamp; low 32 bits of TSF (of network, if associated)
360 * __le32 data; event_id-specific data value
361 *
362 * Entries without timestamps contain only event_id and data.
363 *
364 * 2) error_event_table_ptr indicates base of the error log. This contains
365 * information about any uCode error that occurs. For 4965, the format
366 * of the error log is:
367 *
368 * __le32 valid; (nonzero) valid, (0) log is empty
369 * __le32 error_id; type of error
370 * __le32 pc; program counter
371 * __le32 blink1; branch link
372 * __le32 blink2; branch link
373 * __le32 ilink1; interrupt link
374 * __le32 ilink2; interrupt link
375 * __le32 data1; error-specific data
376 * __le32 data2; error-specific data
377 * __le32 line; source code line of error
378 * __le32 bcon_time; beacon timer
379 * __le32 tsf_low; network timestamp function timer
380 * __le32 tsf_hi; network timestamp function timer
381 *
382 * The Linux driver can print both logs to the system log when a uCode error
383 * occurs.
384 */
385struct iwl4965_alive_resp {
286 u8 ucode_minor; 386 u8 ucode_minor;
287 u8 ucode_major; 387 u8 ucode_major;
288 __le16 reserved1; 388 __le16 reserved1;
289 u8 sw_rev[8]; 389 u8 sw_rev[8];
290 u8 ver_type; 390 u8 ver_type;
291 u8 ver_subtype; 391 u8 ver_subtype; /* not "9" for runtime alive */
292 __le16 reserved2; 392 __le16 reserved2;
293 __le32 log_event_table_ptr; 393 __le32 log_event_table_ptr; /* SRAM address for event log */
294 __le32 error_event_table_ptr; 394 __le32 error_event_table_ptr; /* SRAM address for error log */
295 __le32 timestamp; 395 __le32 timestamp;
296 __le32 is_valid; 396 __le32 is_valid;
297
298 /* calibration values from "initialize" uCode */
299 __le32 voltage; /* signed */
300 __le32 therm_r1[2]; /* signed 1st for normal, 2nd for FAT channel */
301 __le32 therm_r2[2]; /* signed */
302 __le32 therm_r3[2]; /* signed */
303 __le32 therm_r4[2]; /* signed */
304 __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups,
305 * 2 Tx chains */
306} __attribute__ ((packed)); 397} __attribute__ ((packed));
307 398
399
308union tsf { 400union tsf {
309 u8 byte[8]; 401 u8 byte[8];
310 __le16 word[4]; 402 __le16 word[4];