Blame view

drivers/staging/vt6655/desc.h 10 KB
5449c685a   Forest Bond   Staging: Add pris...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  /*
   * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
   * All rights reserved.
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation; either version 2 of the License, or
   * (at your option) any later version.
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License along
   * with this program; if not, write to the Free Software Foundation, Inc.,
   * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   *
   * File: desc.h
   *
   * Purpose:The header file of descriptor
   *
   * Revision History:
   *
   * Author: Tevin Chen
   *
   * Date: May 21, 1996
   *
   */
5449c685a   Forest Bond   Staging: Add pris...
30
31
32
33
34
  #ifndef __DESC_H__
  #define __DESC_H__
  
  #include <linux/types.h>
  #include <linux/mm.h>
52c4130bd   Malcolm Priestley   staging: vt6655: ...
35
  #include "linux/ieee80211.h"
5449c685a   Forest Bond   Staging: Add pris...
36
  #include "ttype.h"
5449c685a   Forest Bond   Staging: Add pris...
37
  #include "tether.h"
612822f5d   Jim Lieb   Staging: vt665x: ...
38

795a8f9aa   Igor Bezukh   Staging: vt6655: ...
39
40
  #define B_OWNED_BY_CHIP     1
  #define B_OWNED_BY_HOST     0
5449c685a   Forest Bond   Staging: Add pris...
41
42
43
44
  
  //
  // Bits in the RSR register
  //
795a8f9aa   Igor Bezukh   Staging: vt6655: ...
45
46
47
48
49
50
51
52
53
  #define RSR_ADDRBROAD       0x80
  #define RSR_ADDRMULTI       0x40
  #define RSR_ADDRUNI         0x00
  #define RSR_IVLDTYP         0x20
  #define RSR_IVLDLEN         0x10        // invalid len (> 2312 byte)
  #define RSR_BSSIDOK         0x08
  #define RSR_CRCOK           0x04
  #define RSR_BCNSSIDOK       0x02
  #define RSR_ADDROK          0x01
5449c685a   Forest Bond   Staging: Add pris...
54
55
56
57
  
  //
  // Bits in the new RSR register
  //
795a8f9aa   Igor Bezukh   Staging: vt6655: ...
58
59
60
61
62
  #define NEWRSR_DECRYPTOK    0x10
  #define NEWRSR_CFPIND       0x08
  #define NEWRSR_HWUTSF       0x04
  #define NEWRSR_BCNHITAID    0x02
  #define NEWRSR_BCNHITAID0   0x01
5449c685a   Forest Bond   Staging: Add pris...
63
64
65
66
  
  //
  // Bits in the TSR0 register
  //
795a8f9aa   Igor Bezukh   Staging: vt6655: ...
67
68
69
  #define TSR0_PWRSTS1_2      0xC0
  #define TSR0_PWRSTS7        0x20
  #define TSR0_NCR            0x1F
5449c685a   Forest Bond   Staging: Add pris...
70
71
72
73
  
  //
  // Bits in the TSR1 register
  //
795a8f9aa   Igor Bezukh   Staging: vt6655: ...
74
75
76
77
78
79
  #define TSR1_TERR           0x80
  #define TSR1_PWRSTS4_6      0x70
  #define TSR1_RETRYTMO       0x08
  #define TSR1_TMO            0x04
  #define TSR1_PWRSTS3        0x02
  #define ACK_DATA            0x01
5449c685a   Forest Bond   Staging: Add pris...
80
81
82
83
  
  //
  // Bits in the TCR register
  //
795a8f9aa   Igor Bezukh   Staging: vt6655: ...
84
85
86
  #define EDMSDU              0x04        // end of sdu
  #define TCR_EDP             0x02        // end of packet
  #define TCR_STP             0x01        // start of packet
5449c685a   Forest Bond   Staging: Add pris...
87
88
  
  // max transmit or receive buffer size
795a8f9aa   Igor Bezukh   Staging: vt6655: ...
89
  #define CB_MAX_BUF_SIZE     2900U
78a717d82   Joe Perches   staging:vt6655:de...
90
  					// NOTE: must be multiple of 4
795a8f9aa   Igor Bezukh   Staging: vt6655: ...
91
92
  #define CB_MAX_TX_BUF_SIZE          CB_MAX_BUF_SIZE
  #define CB_MAX_RX_BUF_SIZE_NORMAL   CB_MAX_BUF_SIZE
5449c685a   Forest Bond   Staging: Add pris...
93

795a8f9aa   Igor Bezukh   Staging: vt6655: ...
94
  #define CB_BEACON_BUF_SIZE  512U
5449c685a   Forest Bond   Staging: Add pris...
95

795a8f9aa   Igor Bezukh   Staging: vt6655: ...
96
97
98
99
  #define CB_MAX_RX_DESC      128
  #define CB_MIN_RX_DESC      16
  #define CB_MAX_TX_DESC      64
  #define CB_MIN_TX_DESC      16
5449c685a   Forest Bond   Staging: Add pris...
100

795a8f9aa   Igor Bezukh   Staging: vt6655: ...
101
  #define CB_MAX_RECEIVED_PACKETS     16
78a717d82   Joe Perches   staging:vt6655:de...
102
103
104
105
  					// limit our receive routine to indicating
  					// this many at a time for 2 reasons:
  					// 1. driver flow control to protocol layer
  					// 2. limit the time used in ISR routine
5449c685a   Forest Bond   Staging: Add pris...
106

795a8f9aa   Igor Bezukh   Staging: vt6655: ...
107
108
109
  #define CB_EXTRA_RD_NUM     32
  #define CB_RD_NUM           32
  #define CB_TD_NUM           32
5449c685a   Forest Bond   Staging: Add pris...
110

5449c685a   Forest Bond   Staging: Add pris...
111
112
113
114
115
116
117
118
119
  // max number of physical segments
  // in a single NDIS packet. Above this threshold, the packet
  // is copied into a single physically contiguous buffer
  #define CB_MAX_SEGMENT      4
  
  #define CB_MIN_MAP_REG_NUM  4
  #define CB_MAX_MAP_REG_NUM  CB_MAX_TX_DESC
  
  #define CB_PROTOCOL_RESERVED_SECTION    16
5449c685a   Forest Bond   Staging: Add pris...
120
121
122
123
124
125
126
127
  // if retrys excess 15 times , tx will abort, and
  // if tx fifo underflow, tx will fail
  // we should try to resend it
  #define CB_MAX_TX_ABORT_RETRY   3
  
  #ifdef __BIG_ENDIAN
  
  // WMAC definition FIFO Control
795a8f9aa   Igor Bezukh   Staging: vt6655: ...
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
  #define FIFOCTL_AUTO_FB_1   0x0010
  #define FIFOCTL_AUTO_FB_0   0x0008
  #define FIFOCTL_GRPACK      0x0004
  #define FIFOCTL_11GA        0x0003
  #define FIFOCTL_11GB        0x0002
  #define FIFOCTL_11B         0x0001
  #define FIFOCTL_11A         0x0000
  #define FIFOCTL_RTS         0x8000
  #define FIFOCTL_ISDMA0      0x4000
  #define FIFOCTL_GENINT      0x2000
  #define FIFOCTL_TMOEN       0x1000
  #define FIFOCTL_LRETRY      0x0800
  #define FIFOCTL_CRCDIS      0x0400
  #define FIFOCTL_NEEDACK     0x0200
  #define FIFOCTL_LHEAD       0x0100
5449c685a   Forest Bond   Staging: Add pris...
143
144
  
  //WMAC definition Frag Control
795a8f9aa   Igor Bezukh   Staging: vt6655: ...
145
146
147
148
149
150
151
152
  #define FRAGCTL_AES         0x0003
  #define FRAGCTL_TKIP        0x0002
  #define FRAGCTL_LEGACY      0x0001
  #define FRAGCTL_NONENCRYPT  0x0000
  #define FRAGCTL_ENDFRAG     0x0300
  #define FRAGCTL_MIDFRAG     0x0200
  #define FRAGCTL_STAFRAG     0x0100
  #define FRAGCTL_NONFRAG     0x0000
5449c685a   Forest Bond   Staging: Add pris...
153
154
  
  #else
795a8f9aa   Igor Bezukh   Staging: vt6655: ...
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
  #define FIFOCTL_AUTO_FB_1   0x1000
  #define FIFOCTL_AUTO_FB_0   0x0800
  #define FIFOCTL_GRPACK      0x0400
  #define FIFOCTL_11GA        0x0300
  #define FIFOCTL_11GB        0x0200
  #define FIFOCTL_11B         0x0100
  #define FIFOCTL_11A         0x0000
  #define FIFOCTL_RTS         0x0080
  #define FIFOCTL_ISDMA0      0x0040
  #define FIFOCTL_GENINT      0x0020
  #define FIFOCTL_TMOEN       0x0010
  #define FIFOCTL_LRETRY      0x0008
  #define FIFOCTL_CRCDIS      0x0004
  #define FIFOCTL_NEEDACK     0x0002
  #define FIFOCTL_LHEAD       0x0001
5449c685a   Forest Bond   Staging: Add pris...
170
171
  
  //WMAC definition Frag Control
795a8f9aa   Igor Bezukh   Staging: vt6655: ...
172
173
174
175
176
177
178
179
  #define FRAGCTL_AES         0x0300
  #define FRAGCTL_TKIP        0x0200
  #define FRAGCTL_LEGACY      0x0100
  #define FRAGCTL_NONENCRYPT  0x0000
  #define FRAGCTL_ENDFRAG     0x0003
  #define FRAGCTL_MIDFRAG     0x0002
  #define FRAGCTL_STAFRAG     0x0001
  #define FRAGCTL_NONFRAG     0x0000
5449c685a   Forest Bond   Staging: Add pris...
180

795a8f9aa   Igor Bezukh   Staging: vt6655: ...
181
  #endif
5449c685a   Forest Bond   Staging: Add pris...
182

5449c685a   Forest Bond   Staging: Add pris...
183
184
185
186
187
188
189
190
191
192
193
  #define TYPE_TXDMA0     0
  #define TYPE_AC0DMA     1
  #define TYPE_ATIMDMA    2
  #define TYPE_SYNCDMA    3
  #define TYPE_MAXTD      2
  
  #define TYPE_BEACONDMA  4
  
  #define TYPE_RXDMA0     0
  #define TYPE_RXDMA1     1
  #define TYPE_MAXRD      2
5449c685a   Forest Bond   Staging: Add pris...
194
195
196
197
  // TD_INFO flags control bit
  #define TD_FLAGS_NETIF_SKB               0x01       // check if need release skb
  #define TD_FLAGS_PRIV_SKB                0x02       // check if called from private skb(hostap)
  #define TD_FLAGS_PS_RETRY                0x04       // check if PS STA frame re-transmit
5449c685a   Forest Bond   Staging: Add pris...
198

5449c685a   Forest Bond   Staging: Add pris...
199
200
201
202
203
  // ref_sk_buff is used for mapping the skb structure between pre-built driver-obj & running kernel.
  // Since different kernel version (2.4x) may change skb structure, i.e. pre-built driver-obj
  // may link to older skb that leads error.
  
  typedef struct tagDEVICE_RD_INFO {
78a717d82   Joe Perches   staging:vt6655:de...
204
205
206
  	struct sk_buff *skb;
  	dma_addr_t  skb_dma;
  	dma_addr_t  curr_desc;
5449c685a   Forest Bond   Staging: Add pris...
207
  } DEVICE_RD_INFO,   *PDEVICE_RD_INFO;
5449c685a   Forest Bond   Staging: Add pris...
208
209
210
  #ifdef __BIG_ENDIAN
  
  typedef struct tagRDES0 {
78a717d82   Joe Perches   staging:vt6655:de...
211
  	volatile unsigned short wResCount;
5449c685a   Forest Bond   Staging: Add pris...
212
  	union {
c17ce8c21   Charles Clément   Staging: vt6655: ...
213
  		volatile u16    f15Reserved;
5449c685a   Forest Bond   Staging: Add pris...
214
  		struct {
78a717d82   Joe Perches   staging:vt6655:de...
215
  			volatile u8 f8Reserved1;
737c3d708   Charles Clément   Staging: vt6655: ...
216
217
  			volatile u8 f1Owner:1;
  			volatile u8 f7Reserved:7;
5449c685a   Forest Bond   Staging: Add pris...
218
219
220
221
222
223
224
225
  		} __attribute__ ((__packed__));
  	} __attribute__ ((__packed__));
  } __attribute__ ((__packed__))
  SRDES0, *PSRDES0;
  
  #else
  
  typedef struct tagRDES0 {
78a717d82   Joe Perches   staging:vt6655:de...
226
227
228
  	unsigned short wResCount;
  	unsigned short f15Reserved:15;
  	unsigned short f1Owner:1;
5449c685a   Forest Bond   Staging: Add pris...
229
230
  } __attribute__ ((__packed__))
  SRDES0;
5449c685a   Forest Bond   Staging: Add pris...
231
232
233
  #endif
  
  typedef struct tagRDES1 {
78a717d82   Joe Perches   staging:vt6655:de...
234
235
  	unsigned short wReqCount;
  	unsigned short wReserved;
5449c685a   Forest Bond   Staging: Add pris...
236
237
238
239
240
241
242
  } __attribute__ ((__packed__))
  SRDES1;
  
  //
  // Rx descriptor
  //
  typedef struct tagSRxDesc {
78a717d82   Joe Perches   staging:vt6655:de...
243
244
245
246
  	volatile SRDES0 m_rd0RD0;
  	volatile SRDES1 m_rd1RD1;
  	volatile u32    buff_addr;
  	volatile u32    next_desc;
829127b43   Malcolm Priestley   staging: vt6655: ...
247
248
  	struct tagSRxDesc *next __aligned(8);
  	volatile PDEVICE_RD_INFO pRDInfo __aligned(8);
5449c685a   Forest Bond   Staging: Add pris...
249
  } __attribute__ ((__packed__))
a884847a1   Jim Lieb   Staging: vt665x: ...
250
251
  SRxDesc, *PSRxDesc;
  typedef const SRxDesc *PCSRxDesc;
5449c685a   Forest Bond   Staging: Add pris...
252
253
  
  #ifdef __BIG_ENDIAN
5449c685a   Forest Bond   Staging: Add pris...
254
  typedef struct tagTDES0 {
78a717d82   Joe Perches   staging:vt6655:de...
255
256
  	volatile    unsigned char byTSR0;
  	volatile    unsigned char byTSR1;
5449c685a   Forest Bond   Staging: Add pris...
257
  	union {
c17ce8c21   Charles Clément   Staging: vt6655: ...
258
  		volatile u16    f15Txtime;
5449c685a   Forest Bond   Staging: Add pris...
259
  		struct {
78a717d82   Joe Perches   staging:vt6655:de...
260
  			volatile u8 f8Reserved1;
737c3d708   Charles Clément   Staging: vt6655: ...
261
262
  			volatile u8 f1Owner:1;
  			volatile u8 f7Reserved:7;
5449c685a   Forest Bond   Staging: Add pris...
263
264
265
266
267
268
269
270
  		} __attribute__ ((__packed__));
  	} __attribute__ ((__packed__));
  } __attribute__ ((__packed__))
  STDES0, PSTDES0;
  
  #else
  
  typedef struct tagTDES0 {
78a717d82   Joe Perches   staging:vt6655:de...
271
272
273
274
  	volatile    unsigned char byTSR0;
  	volatile    unsigned char byTSR1;
  	volatile    unsigned short f15Txtime:15;
  	volatile    unsigned short f1Owner:1;
5449c685a   Forest Bond   Staging: Add pris...
275
276
277
278
  } __attribute__ ((__packed__))
  STDES0;
  
  #endif
5449c685a   Forest Bond   Staging: Add pris...
279
  typedef struct tagTDES1 {
78a717d82   Joe Perches   staging:vt6655:de...
280
281
282
  	volatile    unsigned short wReqCount;
  	volatile    unsigned char byTCR;
  	volatile    unsigned char byReserved;
5449c685a   Forest Bond   Staging: Add pris...
283
284
  } __attribute__ ((__packed__))
  STDES1;
78a717d82   Joe Perches   staging:vt6655:de...
285
286
287
288
289
290
291
292
293
  typedef struct tagDEVICE_TD_INFO {
  	struct sk_buff *skb;
  	unsigned char *buf;
  	dma_addr_t          skb_dma;
  	dma_addr_t          buf_dma;
  	dma_addr_t          curr_desc;
  	unsigned long dwReqCount;
  	unsigned long dwHeaderLength;
  	unsigned char byFlags;
5449c685a   Forest Bond   Staging: Add pris...
294
  } DEVICE_TD_INFO,    *PDEVICE_TD_INFO;
5449c685a   Forest Bond   Staging: Add pris...
295
296
297
298
  //
  // transmit descriptor
  //
  typedef struct tagSTxDesc {
78a717d82   Joe Perches   staging:vt6655:de...
299
300
301
302
  	volatile    STDES0  m_td0TD0;
  	volatile    STDES1  m_td1TD1;
  	volatile    u32    buff_addr;
  	volatile    u32    next_desc;
829127b43   Malcolm Priestley   staging: vt6655: ...
303
304
  	struct tagSTxDesc *next __aligned(8);
  	volatile    PDEVICE_TD_INFO pTDInfo __aligned(8);
5449c685a   Forest Bond   Staging: Add pris...
305
  } __attribute__ ((__packed__))
a884847a1   Jim Lieb   Staging: vt665x: ...
306
307
  STxDesc, *PSTxDesc;
  typedef const STxDesc *PCSTxDesc;
5449c685a   Forest Bond   Staging: Add pris...
308

5449c685a   Forest Bond   Staging: Add pris...
309
  typedef struct tagSTxSyncDesc {
78a717d82   Joe Perches   staging:vt6655:de...
310
311
312
313
314
315
  	volatile    STDES0  m_td0TD0;
  	volatile    STDES1  m_td1TD1;
  	volatile    u32 buff_addr; // pointer to logical buffer
  	volatile    u32 next_desc; // pointer to next logical descriptor
  	volatile    unsigned short m_wFIFOCtl;
  	volatile    unsigned short m_wTimeStamp;
829127b43   Malcolm Priestley   staging: vt6655: ...
316
317
  	struct tagSTxSyncDesc *next __aligned(8);
  	volatile    PDEVICE_TD_INFO pTDInfo __aligned(8);
5449c685a   Forest Bond   Staging: Add pris...
318
  } __attribute__ ((__packed__))
a884847a1   Jim Lieb   Staging: vt665x: ...
319
320
  STxSyncDesc, *PSTxSyncDesc;
  typedef const STxSyncDesc *PCSTxSyncDesc;
5449c685a   Forest Bond   Staging: Add pris...
321

5449c685a   Forest Bond   Staging: Add pris...
322
323
324
  //
  // RsvTime buffer header
  //
5449c685a   Forest Bond   Staging: Add pris...
325
  typedef struct tagSRrvTime_atim {
78a717d82   Joe Perches   staging:vt6655:de...
326
327
328
  	unsigned short wCTSTxRrvTime_ba;
  	unsigned short wTxRrvTime_a;
  } __attribute__ ((__packed__))
a884847a1   Jim Lieb   Staging: vt665x: ...
329
330
  SRrvTime_atim, *PSRrvTime_atim;
  typedef const SRrvTime_atim *PCSRrvTime_atim;
5449c685a   Forest Bond   Staging: Add pris...
331

edbae997a   Malcolm Priestley   staging: vt6655: ...
332
333
334
335
336
337
  /* Length, Service, and Signal fields of Phy for Tx */
  struct vnt_phy_field {
  	u8 signal;
  	u8 service;
  	__le16 len;
  } __packed;
864a5a37a   Malcolm Priestley   staging: vt6655: ...
338
339
340
341
342
  union vnt_phy_field_swap {
  	struct vnt_phy_field field_read;
  	u16 swap[2];
  	u32 field_write;
  };
5449c685a   Forest Bond   Staging: Add pris...
343
  //
5449c685a   Forest Bond   Staging: Add pris...
344
345
346
  // Tx FIFO header
  //
  typedef struct tagSTxBufHead {
78a717d82   Joe Perches   staging:vt6655:de...
347
348
349
350
351
352
353
  	u32 adwTxKey[4];
  	unsigned short wFIFOCtl;
  	unsigned short wTimeStamp;
  	unsigned short wFragCtl;
  	unsigned char byTxPower;
  	unsigned char wReserved;
  } __attribute__ ((__packed__))
a884847a1   Jim Lieb   Staging: vt665x: ...
354
355
  STxBufHead, *PSTxBufHead;
  typedef const STxBufHead *PCSTxBufHead;
5449c685a   Forest Bond   Staging: Add pris...
356

5449c685a   Forest Bond   Staging: Add pris...
357
  typedef struct tagSBEACONCtl {
78a717d82   Joe Perches   staging:vt6655:de...
358
359
360
361
362
  	u32 BufReady:1;
  	u32 TSF:15;
  	u32 BufLen:11;
  	u32 Reserved:5;
  } __attribute__ ((__packed__))
5449c685a   Forest Bond   Staging: Add pris...
363
  SBEACONCtl;
5449c685a   Forest Bond   Staging: Add pris...
364
  typedef struct tagSSecretKey {
78a717d82   Joe Perches   staging:vt6655:de...
365
366
367
  	u32 dwLowDword;
  	unsigned char byHighByte;
  } __attribute__ ((__packed__))
5449c685a   Forest Bond   Staging: Add pris...
368
369
370
  SSecretKey;
  
  typedef struct tagSKeyEntry {
78a717d82   Joe Perches   staging:vt6655:de...
371
372
373
374
375
376
377
378
379
  	unsigned char abyAddrHi[2];
  	unsigned short wKCTL;
  	unsigned char abyAddrLo[4];
  	u32 dwKey0[4];
  	u32 dwKey1[4];
  	u32 dwKey2[4];
  	u32 dwKey3[4];
  	u32 dwKey4[4];
  } __attribute__ ((__packed__))
5449c685a   Forest Bond   Staging: Add pris...
380
  SKeyEntry;
5449c685a   Forest Bond   Staging: Add pris...
381

5449c685a   Forest Bond   Staging: Add pris...
382
  #endif // __DESC_H__