Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
i2400m.h
Go to the documentation of this file.
1 /*
2  * Intel Wireless WiMax Connection 2400m
3  * Host-Device protocol interface definitions
4  *
5  *
6  * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in
16  * the documentation and/or other materials provided with the
17  * distribution.
18  * * Neither the name of Intel Corporation nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  *
35  * Intel Corporation <[email protected]>
36  * Inaky Perez-Gonzalez <[email protected]>
37  * - Initial implementation
38  *
39  *
40  * This header defines the data structures and constants used to
41  * communicate with the device.
42  *
43  * BOOTMODE/BOOTROM/FIRMWARE UPLOAD PROTOCOL
44  *
45  * The firmware upload protocol is quite simple and only requires a
46  * handful of commands. See drivers/net/wimax/i2400m/fw.c for more
47  * details.
48  *
49  * The BCF data structure is for the firmware file header.
50  *
51  *
52  * THE DATA / CONTROL PROTOCOL
53  *
54  * This is the normal protocol spoken with the device once the
55  * firmware is uploaded. It transports data payloads and control
56  * messages back and forth.
57  *
58  * It consists 'messages' that pack one or more payloads each. The
59  * format is described in detail in drivers/net/wimax/i2400m/rx.c and
60  * tx.c.
61  *
62  *
63  * THE L3L4 PROTOCOL
64  *
65  * The term L3L4 refers to Layer 3 (the device), Layer 4 (the
66  * driver/host software).
67  *
68  * This is the control protocol used by the host to control the i2400m
69  * device (scan, connect, disconnect...). This is sent to / received
70  * as control frames. These frames consist of a header and zero or
71  * more TLVs with information. We call each control frame a "message".
72  *
73  * Each message is composed of:
74  *
75  * HEADER
76  * [TLV0 + PAYLOAD0]
77  * [TLV1 + PAYLOAD1]
78  * [...]
79  * [TLVN + PAYLOADN]
80  *
81  * The HEADER is defined by 'struct i2400m_l3l4_hdr'. The payloads are
82  * defined by a TLV structure (Type Length Value) which is a 'header'
83  * (struct i2400m_tlv_hdr) and then the payload.
84  *
85  * All integers are represented as Little Endian.
86  *
87  * - REQUESTS AND EVENTS
88  *
89  * The requests can be clasified as follows:
90  *
91  * COMMAND: implies a request from the host to the device requesting
92  * an action being performed. The device will reply with a
93  * message (with the same type as the command), status and
94  * no (TLV) payload. Execution of a command might cause
95  * events (of different type) to be sent later on as
96  * device's state changes.
97  *
98  * GET/SET: similar to COMMAND, but will not cause other
99  * EVENTs. The reply, in the case of GET, will contain
100  * TLVs with the requested information.
101  *
102  * EVENT: asynchronous messages sent from the device, maybe as a
103  * consequence of previous COMMANDs but disassociated from
104  * them.
105  *
106  * Only one request might be pending at the same time (ie: don't
107  * parallelize nor post another GET request before the previous
108  * COMMAND has been acknowledged with it's corresponding reply by the
109  * device).
110  *
111  * The different requests and their formats are described below:
112  *
113  * I2400M_MT_* Message types
114  * I2400M_MS_* Message status (for replies, events)
115  * i2400m_tlv_* TLVs
116  *
117  * data types are named 'struct i2400m_msg_OPNAME', OPNAME matching the
118  * operation.
119  */
120 
121 #ifndef __LINUX__WIMAX__I2400M_H__
122 #define __LINUX__WIMAX__I2400M_H__
123 
124 #include <linux/types.h>
125 
126 
127 /*
128  * Host Device Interface (HDI) common to all busses
129  */
130 
131 /* Boot-mode (firmware upload mode) commands */
132 
133 /* Header for the firmware file */
140  __le32 date; /* BCD YYYMMDD */
141  __le32 size; /* in dwords */
142  __le32 key_size; /* in dwords */
143  __le32 modulus_size; /* in dwords */
144  __le32 exponent_size; /* in dwords */
146 } __attribute__ ((packed));
148 /* Boot mode opcodes */
155 };
157 /* Boot mode command masks and stuff */
159  I2400M_BRH_SIGNATURE = 0xcbbc0000,
168 };
169 
170 
181  __le32 command; /* Compose with enum i2400_brh */
185  char payload[0];
186 } __attribute__ ((packed));
189 /*
190  * Data / control protocol
191  */
192 
193 /* Packet types for the host-device interface */
194 enum i2400m_pt {
197  I2400M_PT_TRACE, /* For device debug */
198  I2400M_PT_RESET_WARM, /* device reset */
199  I2400M_PT_RESET_COLD, /* USB[transport] reset, like reconnect */
200  I2400M_PT_EDATA, /* Extended RX data */
202 };
203 
204 
205 /*
206  * Payload for a data packet
207  *
208  * This is prefixed to each and every outgoing DATA type.
209  */
212 } __attribute__((packed));
213 
214 
215 /*
216  * Payload for an extended data packet
217  *
218  * New in fw v1.4
219  *
220  * @reorder: if this payload has to be reorder or not (and how)
221  * @cs: the type of data in the packet, as defined per (802.16e
222  * T11.13.19.1). Currently only 2 (IPv4 packet) supported.
223  *
224  * This is prefixed to each and every INCOMING DATA packet.
225  */
227  __le32 reorder; /* bits defined in i2400m_ro */
230 } __attribute__((packed));
232 enum i2400m_cs {
235 };
236 
237 enum i2400m_ro {
243  I2400M_RO_FBN = 0x07ff,
245  I2400M_RO_SN = 0x07ff,
247 };
248 
254 };
255 
256 
257 /* Misc constants */
258 enum {
259  I2400M_PL_ALIGN = 16, /* Payload data size alignment */
262  /* protocol barkers: sync sequences; for notifications they
263  * are sent in groups of four. */
267  I2400M_NBOOT_BARKER = 0xdeadbeef,
268  I2400M_SBOOT_BARKER = 0x0ff1c1a1,
270  I2400M_ACK_BARKER = 0xfeedbabe,
271  I2400M_D2H_MSG_BARKER = 0xbeefbabe,
272 };
273 
274 
275 /*
276  * Hardware payload descriptor
277  *
278  * Bitfields encoded in a struct to enforce typing semantics.
279  *
280  * Look in rx.c and tx.c for a full description of the format.
281  */
282 struct i2400m_pld {
284 } __attribute__ ((packed));
286 #define I2400M_PLD_SIZE_MASK 0x00003fff
287 #define I2400M_PLD_TYPE_SHIFT 16
288 #define I2400M_PLD_TYPE_MASK 0x000f0000
289 
290 /*
291  * Header for a TX message or RX message
292  *
293  * @barker: preamble
294  * @size: used for management of the FIFO queue buffer; before
295  * sending, this is converted to be a real preamble. This
296  * indicates the real size of the TX message that starts at this
297  * point. If the highest bit is set, then this message is to be
298  * skipped.
299  * @sequence: sequence number of this message
300  * @offset: offset where the message itself starts -- see the comments
301  * in the file header about message header and payload descriptor
302  * alignment.
303  * @num_pls: number of payloads in this message
304  * @padding: amount of padding bytes at the end of the message to make
305  * it be of block-size aligned
306  *
307  * Look in rx.c and tx.c for a full description of the format.
308  */
310  union {
312  __u32 size; /* same size type as barker!! */
313  };
314  union {
316  __u32 offset; /* same size type as barker!! */
317  };
322  struct i2400m_pld pld[0];
323 } __attribute__ ((packed));
324 
326 
327 /*
328  * L3/L4 control protocol
329  */
331 enum {
332  /* Interface version */
334 };
336 /* Message types */
337 enum i2400m_mt {
341 
374 };
375 
376 
377 /*
378  * Message Ack Status codes
379  *
380  * When a message is replied-to, this status is reported.
381  */
382 enum i2400m_ms {
400 };
401 
402 
421 };
422 
423 
426  __le16 length; /* payload's */
427  __u8 pl[0];
428 } __attribute__((packed));
433  __le16 length; /* payload's */
438  struct i2400m_tlv_hdr pl[0];
439 } __attribute__((packed));
440 
441 
464 };
465 
466 
475 } __attribute__((packed));
484 } __attribute__((packed));
485 
492 } __attribute__((packed));
493 
498 };
499 
502  __u8 sw_rf_switch; /* 1 ON, 2 OFF */
503  __u8 hw_rf_switch; /* 1 ON, 2 OFF */
505 } __attribute__((packed));
506 
508 enum {
511 };
512 
515  __le32 status; /* 1 ON, 2 OFF */
516 } __attribute__((packed));
517 
518 
522 };
523 
527 } __attribute__((packed));
528 
532  __le32 idle_timeout; /* 100 to 300000 ms [5min], 100 increments
533  * 0 disabled */
535 } __attribute__((packed));
536 
542 };
543 
547 } __attribute__((packed));
548 
550 /* New in v1.4 */
553  __le32 timeout; /* 100 to 300000 ms [5min], 100 increments
554  * 0 disabled */
555 } __attribute__((packed));
556 
557 /* New in v1.4 -- for backward compat, will be removed */
560  __u8 format; /* 0 old format, 1 enhanced */
562 } __attribute__((packed));
563 
564 /* New in v1.4 */
567  __u8 reorder; /* 0 disabled, 1 enabled */
569 } __attribute__((packed));
570 
571 
572 #endif /* #ifndef __LINUX__WIMAX__I2400M_H__ */