aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/atm/nicstar.h
diff options
context:
space:
mode:
authorchas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>2010-05-29 05:03:44 -0400
committerDavid S. Miller <davem@davemloft.net>2010-05-31 03:27:46 -0400
commit098fde114bf6655f4b75d71dbea208d039fc1de3 (patch)
treeea889dae935d8ca04508694929a0d17fde42ac1a /drivers/atm/nicstar.h
parent741a00be1f6bfa027225f44703ab72a741b757b7 (diff)
atm: [nicstar] reformatted with Lindent
Signed-off-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/atm/nicstar.h')
-rw-r--r--drivers/atm/nicstar.h578
1 files changed, 255 insertions, 323 deletions
diff --git a/drivers/atm/nicstar.h b/drivers/atm/nicstar.h
index 6010e3daa6a2..43eb2db1fb88 100644
--- a/drivers/atm/nicstar.h
+++ b/drivers/atm/nicstar.h
@@ -1,5 +1,4 @@
1/****************************************************************************** 1/*
2 *
3 * nicstar.h 2 * nicstar.h
4 * 3 *
5 * Header file for the nicstar device driver. 4 * Header file for the nicstar device driver.
@@ -8,15 +7,12 @@
8 * PowerPC support by Jay Talbott (jay_talbott@mcg.mot.com) April 1999 7 * PowerPC support by Jay Talbott (jay_talbott@mcg.mot.com) April 1999
9 * 8 *
10 * (C) INESC 1998 9 * (C) INESC 1998
11 * 10 */
12 ******************************************************************************/
13
14 11
15#ifndef _LINUX_NICSTAR_H_ 12#ifndef _LINUX_NICSTAR_H_
16#define _LINUX_NICSTAR_H_ 13#define _LINUX_NICSTAR_H_
17 14
18 15/* Includes */
19/* Includes *******************************************************************/
20 16
21#include <linux/types.h> 17#include <linux/types.h>
22#include <linux/pci.h> 18#include <linux/pci.h>
@@ -25,12 +21,11 @@
25#include <linux/atmdev.h> 21#include <linux/atmdev.h>
26#include <linux/atm_nicstar.h> 22#include <linux/atm_nicstar.h>
27 23
28 24/* Options */
29/* Options ********************************************************************/
30 25
31#define NS_MAX_CARDS 4 /* Maximum number of NICStAR based cards 26#define NS_MAX_CARDS 4 /* Maximum number of NICStAR based cards
32 controlled by the device driver. Must 27 controlled by the device driver. Must
33 be <= 5 */ 28 be <= 5 */
34 29
35#undef RCQ_SUPPORT /* Do not define this for now */ 30#undef RCQ_SUPPORT /* Do not define this for now */
36 31
@@ -43,7 +38,7 @@
43#define NS_VPIBITS 2 /* 0, 1, 2, or 8 */ 38#define NS_VPIBITS 2 /* 0, 1, 2, or 8 */
44 39
45#define NS_MAX_RCTSIZE 4096 /* Number of entries. 4096 or 16384. 40#define NS_MAX_RCTSIZE 4096 /* Number of entries. 4096 or 16384.
46 Define 4096 only if (all) your card(s) 41 Define 4096 only if (all) your card(s)
47 have 32K x 32bit SRAM, in which case 42 have 32K x 32bit SRAM, in which case
48 setting this to 16384 will just waste a 43 setting this to 16384 will just waste a
49 lot of memory. 44 lot of memory.
@@ -51,33 +46,32 @@
51 128K x 32bit SRAM will limit the maximum 46 128K x 32bit SRAM will limit the maximum
52 VCI. */ 47 VCI. */
53 48
54/*#define NS_PCI_LATENCY 64*/ /* Must be a multiple of 32 */ 49 /*#define NS_PCI_LATENCY 64*//* Must be a multiple of 32 */
55 50
56 /* Number of buffers initially allocated */ 51 /* Number of buffers initially allocated */
57#define NUM_SB 32 /* Must be even */ 52#define NUM_SB 32 /* Must be even */
58#define NUM_LB 24 /* Must be even */ 53#define NUM_LB 24 /* Must be even */
59#define NUM_HB 8 /* Pre-allocated huge buffers */ 54#define NUM_HB 8 /* Pre-allocated huge buffers */
60#define NUM_IOVB 48 /* Iovec buffers */ 55#define NUM_IOVB 48 /* Iovec buffers */
61 56
62 /* Lower level for count of buffers */ 57 /* Lower level for count of buffers */
63#define MIN_SB 8 /* Must be even */ 58#define MIN_SB 8 /* Must be even */
64#define MIN_LB 8 /* Must be even */ 59#define MIN_LB 8 /* Must be even */
65#define MIN_HB 6 60#define MIN_HB 6
66#define MIN_IOVB 8 61#define MIN_IOVB 8
67 62
68 /* Upper level for count of buffers */ 63 /* Upper level for count of buffers */
69#define MAX_SB 64 /* Must be even, <= 508 */ 64#define MAX_SB 64 /* Must be even, <= 508 */
70#define MAX_LB 48 /* Must be even, <= 508 */ 65#define MAX_LB 48 /* Must be even, <= 508 */
71#define MAX_HB 10 66#define MAX_HB 10
72#define MAX_IOVB 80 67#define MAX_IOVB 80
73 68
74 /* These are the absolute maximum allowed for the ioctl() */ 69 /* These are the absolute maximum allowed for the ioctl() */
75#define TOP_SB 256 /* Must be even, <= 508 */ 70#define TOP_SB 256 /* Must be even, <= 508 */
76#define TOP_LB 128 /* Must be even, <= 508 */ 71#define TOP_LB 128 /* Must be even, <= 508 */
77#define TOP_HB 64 72#define TOP_HB 64
78#define TOP_IOVB 256 73#define TOP_IOVB 256
79 74
80
81#define MAX_TBD_PER_VC 1 /* Number of TBDs before a TSR */ 75#define MAX_TBD_PER_VC 1 /* Number of TBDs before a TSR */
82#define MAX_TBD_PER_SCQ 10 /* Only meaningful for variable rate SCQs */ 76#define MAX_TBD_PER_SCQ 10 /* Only meaningful for variable rate SCQs */
83 77
@@ -89,15 +83,12 @@
89 83
90#define PCR_TOLERANCE (1.0001) 84#define PCR_TOLERANCE (1.0001)
91 85
92 86/* ESI stuff */
93
94/* ESI stuff ******************************************************************/
95 87
96#define NICSTAR_EPROM_MAC_ADDR_OFFSET 0x6C 88#define NICSTAR_EPROM_MAC_ADDR_OFFSET 0x6C
97#define NICSTAR_EPROM_MAC_ADDR_OFFSET_ALT 0xF6 89#define NICSTAR_EPROM_MAC_ADDR_OFFSET_ALT 0xF6
98 90
99 91/* #defines */
100/* #defines *******************************************************************/
101 92
102#define NS_IOREMAP_SIZE 4096 93#define NS_IOREMAP_SIZE 4096
103 94
@@ -123,22 +114,19 @@
123#define NS_SMSKBSIZE (NS_SMBUFSIZE + NS_AAL0_HEADER) 114#define NS_SMSKBSIZE (NS_SMBUFSIZE + NS_AAL0_HEADER)
124#define NS_LGSKBSIZE (NS_SMBUFSIZE + NS_LGBUFSIZE) 115#define NS_LGSKBSIZE (NS_SMBUFSIZE + NS_LGBUFSIZE)
125 116
117/* NICStAR structures located in host memory */
126 118
127/* NICStAR structures located in host memory **********************************/ 119/*
128 120 * RSQ - Receive Status Queue
129
130
131/* RSQ - Receive Status Queue
132 * 121 *
133 * Written by the NICStAR, read by the device driver. 122 * Written by the NICStAR, read by the device driver.
134 */ 123 */
135 124
136typedef struct ns_rsqe 125typedef struct ns_rsqe {
137{ 126 u32 word_1;
138 u32 word_1; 127 u32 buffer_handle;
139 u32 buffer_handle; 128 u32 final_aal5_crc32;
140 u32 final_aal5_crc32; 129 u32 word_4;
141 u32 word_4;
142} ns_rsqe; 130} ns_rsqe;
143 131
144#define ns_rsqe_vpi(ns_rsqep) \ 132#define ns_rsqe_vpi(ns_rsqep) \
@@ -175,30 +163,27 @@ typedef struct ns_rsqe
175#define ns_rsqe_cellcount(ns_rsqep) \ 163#define ns_rsqe_cellcount(ns_rsqep) \
176 (le32_to_cpu((ns_rsqep)->word_4) & 0x000001FF) 164 (le32_to_cpu((ns_rsqep)->word_4) & 0x000001FF)
177#define ns_rsqe_init(ns_rsqep) \ 165#define ns_rsqe_init(ns_rsqep) \
178 ((ns_rsqep)->word_4 = cpu_to_le32(0x00000000)) 166 ((ns_rsqep)->word_4 = cpu_to_le32(0x00000000))
179 167
180#define NS_RSQ_NUM_ENTRIES (NS_RSQSIZE / 16) 168#define NS_RSQ_NUM_ENTRIES (NS_RSQSIZE / 16)
181#define NS_RSQ_ALIGNMENT NS_RSQSIZE 169#define NS_RSQ_ALIGNMENT NS_RSQSIZE
182 170
183 171/*
184 172 * RCQ - Raw Cell Queue
185/* RCQ - Raw Cell Queue
186 * 173 *
187 * Written by the NICStAR, read by the device driver. 174 * Written by the NICStAR, read by the device driver.
188 */ 175 */
189 176
190typedef struct cell_payload 177typedef struct cell_payload {
191{ 178 u32 word[12];
192 u32 word[12];
193} cell_payload; 179} cell_payload;
194 180
195typedef struct ns_rcqe 181typedef struct ns_rcqe {
196{ 182 u32 word_1;
197 u32 word_1; 183 u32 word_2;
198 u32 word_2; 184 u32 word_3;
199 u32 word_3; 185 u32 word_4;
200 u32 word_4; 186 cell_payload payload;
201 cell_payload payload;
202} ns_rcqe; 187} ns_rcqe;
203 188
204#define NS_RCQE_SIZE 64 /* bytes */ 189#define NS_RCQE_SIZE 64 /* bytes */
@@ -210,28 +195,25 @@ typedef struct ns_rcqe
210#define ns_rcqe_nextbufhandle(ns_rcqep) \ 195#define ns_rcqe_nextbufhandle(ns_rcqep) \
211 (le32_to_cpu((ns_rcqep)->word_2)) 196 (le32_to_cpu((ns_rcqep)->word_2))
212 197
213 198/*
214 199 * SCQ - Segmentation Channel Queue
215/* SCQ - Segmentation Channel Queue
216 * 200 *
217 * Written by the device driver, read by the NICStAR. 201 * Written by the device driver, read by the NICStAR.
218 */ 202 */
219 203
220typedef struct ns_scqe 204typedef struct ns_scqe {
221{ 205 u32 word_1;
222 u32 word_1; 206 u32 word_2;
223 u32 word_2; 207 u32 word_3;
224 u32 word_3; 208 u32 word_4;
225 u32 word_4;
226} ns_scqe; 209} ns_scqe;
227 210
228 /* NOTE: SCQ entries can be either a TBD (Transmit Buffer Descriptors) 211 /* NOTE: SCQ entries can be either a TBD (Transmit Buffer Descriptors)
229 or TSR (Transmit Status Requests) */ 212 or TSR (Transmit Status Requests) */
230 213
231#define NS_SCQE_TYPE_TBD 0x00000000 214#define NS_SCQE_TYPE_TBD 0x00000000
232#define NS_SCQE_TYPE_TSR 0x80000000 215#define NS_SCQE_TYPE_TSR 0x80000000
233 216
234
235#define NS_TBD_EOPDU 0x40000000 217#define NS_TBD_EOPDU 0x40000000
236#define NS_TBD_AAL0 0x00000000 218#define NS_TBD_AAL0 0x00000000
237#define NS_TBD_AAL34 0x04000000 219#define NS_TBD_AAL34 0x04000000
@@ -253,10 +235,9 @@ typedef struct ns_scqe
253#define ns_tbd_mkword_4(gfc, vpi, vci, pt, clp) \ 235#define ns_tbd_mkword_4(gfc, vpi, vci, pt, clp) \
254 (cpu_to_le32((gfc) << 28 | (vpi) << 20 | (vci) << 4 | (pt) << 1 | (clp))) 236 (cpu_to_le32((gfc) << 28 | (vpi) << 20 | (vci) << 4 | (pt) << 1 | (clp)))
255 237
256
257#define NS_TSR_INTENABLE 0x20000000 238#define NS_TSR_INTENABLE 0x20000000
258 239
259#define NS_TSR_SCDISVBR 0xFFFF /* Use as scdi for VBR SCD */ 240#define NS_TSR_SCDISVBR 0xFFFF /* Use as scdi for VBR SCD */
260 241
261#define ns_tsr_mkword_1(flags) \ 242#define ns_tsr_mkword_1(flags) \
262 (cpu_to_le32(NS_SCQE_TYPE_TSR | (flags))) 243 (cpu_to_le32(NS_SCQE_TYPE_TSR | (flags)))
@@ -273,22 +254,20 @@ typedef struct ns_scqe
273 254
274#define NS_SCQE_SIZE 16 255#define NS_SCQE_SIZE 16
275 256
276 257/*
277 258 * TSQ - Transmit Status Queue
278/* TSQ - Transmit Status Queue
279 * 259 *
280 * Written by the NICStAR, read by the device driver. 260 * Written by the NICStAR, read by the device driver.
281 */ 261 */
282 262
283typedef struct ns_tsi 263typedef struct ns_tsi {
284{ 264 u32 word_1;
285 u32 word_1; 265 u32 word_2;
286 u32 word_2;
287} ns_tsi; 266} ns_tsi;
288 267
289 /* NOTE: The first word can be a status word copied from the TSR which 268 /* NOTE: The first word can be a status word copied from the TSR which
290 originated the TSI, or a timer overflow indicator. In this last 269 originated the TSI, or a timer overflow indicator. In this last
291 case, the value of the first word is all zeroes. */ 270 case, the value of the first word is all zeroes. */
292 271
293#define NS_TSI_EMPTY 0x80000000 272#define NS_TSI_EMPTY 0x80000000
294#define NS_TSI_TIMESTAMP_MASK 0x00FFFFFF 273#define NS_TSI_TIMESTAMP_MASK 0x00FFFFFF
@@ -301,12 +280,10 @@ typedef struct ns_tsi
301#define ns_tsi_init(ns_tsip) \ 280#define ns_tsi_init(ns_tsip) \
302 ((ns_tsip)->word_2 = cpu_to_le32(NS_TSI_EMPTY)) 281 ((ns_tsip)->word_2 = cpu_to_le32(NS_TSI_EMPTY))
303 282
304
305#define NS_TSQSIZE 8192 283#define NS_TSQSIZE 8192
306#define NS_TSQ_NUM_ENTRIES 1024 284#define NS_TSQ_NUM_ENTRIES 1024
307#define NS_TSQ_ALIGNMENT 8192 285#define NS_TSQ_ALIGNMENT 8192
308 286
309
310#define NS_TSI_SCDISVBR NS_TSR_SCDISVBR 287#define NS_TSI_SCDISVBR NS_TSR_SCDISVBR
311 288
312#define ns_tsi_tmrof(ns_tsip) \ 289#define ns_tsi_tmrof(ns_tsip) \
@@ -316,26 +293,22 @@ typedef struct ns_tsi
316#define ns_tsi_getscqpos(ns_tsip) \ 293#define ns_tsi_getscqpos(ns_tsip) \
317 (le32_to_cpu((ns_tsip)->word_1) & 0x00007FFF) 294 (le32_to_cpu((ns_tsip)->word_1) & 0x00007FFF)
318 295
296/* NICStAR structures located in local SRAM */
319 297
320 298/*
321/* NICStAR structures located in local SRAM ***********************************/ 299 * RCT - Receive Connection Table
322
323
324
325/* RCT - Receive Connection Table
326 * 300 *
327 * Written by both the NICStAR and the device driver. 301 * Written by both the NICStAR and the device driver.
328 */ 302 */
329 303
330typedef struct ns_rcte 304typedef struct ns_rcte {
331{ 305 u32 word_1;
332 u32 word_1; 306 u32 buffer_handle;
333 u32 buffer_handle; 307 u32 dma_address;
334 u32 dma_address; 308 u32 aal5_crc32;
335 u32 aal5_crc32;
336} ns_rcte; 309} ns_rcte;
337 310
338#define NS_RCTE_BSFB 0x00200000 /* Rev. D only */ 311#define NS_RCTE_BSFB 0x00200000 /* Rev. D only */
339#define NS_RCTE_NZGFC 0x00100000 312#define NS_RCTE_NZGFC 0x00100000
340#define NS_RCTE_CONNECTOPEN 0x00080000 313#define NS_RCTE_CONNECTOPEN 0x00080000
341#define NS_RCTE_AALMASK 0x00070000 314#define NS_RCTE_AALMASK 0x00070000
@@ -358,25 +331,21 @@ typedef struct ns_rcte
358#define NS_RCT_ENTRY_SIZE 4 /* Number of dwords */ 331#define NS_RCT_ENTRY_SIZE 4 /* Number of dwords */
359 332
360 /* NOTE: We could make macros to contruct the first word of the RCTE, 333 /* NOTE: We could make macros to contruct the first word of the RCTE,
361 but that doesn't seem to make much sense... */ 334 but that doesn't seem to make much sense... */
362
363
364 335
365/* FBD - Free Buffer Descriptor 336/*
337 * FBD - Free Buffer Descriptor
366 * 338 *
367 * Written by the device driver using via the command register. 339 * Written by the device driver using via the command register.
368 */ 340 */
369 341
370typedef struct ns_fbd 342typedef struct ns_fbd {
371{ 343 u32 buffer_handle;
372 u32 buffer_handle; 344 u32 dma_address;
373 u32 dma_address;
374} ns_fbd; 345} ns_fbd;
375 346
376 347/*
377 348 * TST - Transmit Schedule Table
378
379/* TST - Transmit Schedule Table
380 * 349 *
381 * Written by the device driver. 350 * Written by the device driver.
382 */ 351 */
@@ -385,40 +354,38 @@ typedef u32 ns_tste;
385 354
386#define NS_TST_OPCODE_MASK 0x60000000 355#define NS_TST_OPCODE_MASK 0x60000000
387 356
388#define NS_TST_OPCODE_NULL 0x00000000 /* Insert null cell */ 357#define NS_TST_OPCODE_NULL 0x00000000 /* Insert null cell */
389#define NS_TST_OPCODE_FIXED 0x20000000 /* Cell from a fixed rate channel */ 358#define NS_TST_OPCODE_FIXED 0x20000000 /* Cell from a fixed rate channel */
390#define NS_TST_OPCODE_VARIABLE 0x40000000 359#define NS_TST_OPCODE_VARIABLE 0x40000000
391#define NS_TST_OPCODE_END 0x60000000 /* Jump */ 360#define NS_TST_OPCODE_END 0x60000000 /* Jump */
392 361
393#define ns_tste_make(opcode, sramad) (opcode | sramad) 362#define ns_tste_make(opcode, sramad) (opcode | sramad)
394 363
395 /* NOTE: 364 /* NOTE:
396 365
397 - When the opcode is FIXED, sramad specifies the SRAM address of the 366 - When the opcode is FIXED, sramad specifies the SRAM address of the
398 SCD for that fixed rate channel. 367 SCD for that fixed rate channel.
399 - When the opcode is END, sramad specifies the SRAM address of the 368 - When the opcode is END, sramad specifies the SRAM address of the
400 location of the next TST entry to read. 369 location of the next TST entry to read.
401 */ 370 */
402 371
403 372/*
404 373 * SCD - Segmentation Channel Descriptor
405/* SCD - Segmentation Channel Descriptor
406 * 374 *
407 * Written by both the device driver and the NICStAR 375 * Written by both the device driver and the NICStAR
408 */ 376 */
409 377
410typedef struct ns_scd 378typedef struct ns_scd {
411{ 379 u32 word_1;
412 u32 word_1; 380 u32 word_2;
413 u32 word_2; 381 u32 partial_aal5_crc;
414 u32 partial_aal5_crc; 382 u32 reserved;
415 u32 reserved; 383 ns_scqe cache_a;
416 ns_scqe cache_a; 384 ns_scqe cache_b;
417 ns_scqe cache_b;
418} ns_scd; 385} ns_scd;
419 386
420#define NS_SCD_BASE_MASK_VAR 0xFFFFE000 /* Variable rate */ 387#define NS_SCD_BASE_MASK_VAR 0xFFFFE000 /* Variable rate */
421#define NS_SCD_BASE_MASK_FIX 0xFFFFFC00 /* Fixed rate */ 388#define NS_SCD_BASE_MASK_FIX 0xFFFFFC00 /* Fixed rate */
422#define NS_SCD_TAIL_MASK_VAR 0x00001FF0 389#define NS_SCD_TAIL_MASK_VAR 0x00001FF0
423#define NS_SCD_TAIL_MASK_FIX 0x000003F0 390#define NS_SCD_TAIL_MASK_FIX 0x000003F0
424#define NS_SCD_HEAD_MASK_VAR 0x00001FF0 391#define NS_SCD_HEAD_MASK_VAR 0x00001FF0
@@ -426,13 +393,9 @@ typedef struct ns_scd
426#define NS_SCD_XMITFOREVER 0x02000000 393#define NS_SCD_XMITFOREVER 0x02000000
427 394
428 /* NOTE: There are other fields in word 2 of the SCD, but as they should 395 /* NOTE: There are other fields in word 2 of the SCD, but as they should
429 not be needed in the device driver they are not defined here. */ 396 not be needed in the device driver they are not defined here. */
430
431
432
433
434/* NICStAR local SRAM memory map **********************************************/
435 397
398/* NICStAR local SRAM memory map */
436 399
437#define NS_RCT 0x00000 400#define NS_RCT 0x00000
438#define NS_RCT_32_END 0x03FFF 401#define NS_RCT_32_END 0x03FFF
@@ -455,100 +418,93 @@ typedef struct ns_scd
455#define NS_LGFBQ 0x1FC00 418#define NS_LGFBQ 0x1FC00
456#define NS_LGFBQ_END 0x1FFFF 419#define NS_LGFBQ_END 0x1FFFF
457 420
458 421/* NISCtAR operation registers */
459
460/* NISCtAR operation registers ************************************************/
461
462 422
463/* See Section 3.4 of `IDT77211 NICStAR User Manual' from www.idt.com */ 423/* See Section 3.4 of `IDT77211 NICStAR User Manual' from www.idt.com */
464 424
465enum ns_regs 425enum ns_regs {
466{ 426 DR0 = 0x00, /* Data Register 0 R/W */
467 DR0 = 0x00, /* Data Register 0 R/W*/ 427 DR1 = 0x04, /* Data Register 1 W */
468 DR1 = 0x04, /* Data Register 1 W */ 428 DR2 = 0x08, /* Data Register 2 W */
469 DR2 = 0x08, /* Data Register 2 W */ 429 DR3 = 0x0C, /* Data Register 3 W */
470 DR3 = 0x0C, /* Data Register 3 W */ 430 CMD = 0x10, /* Command W */
471 CMD = 0x10, /* Command W */ 431 CFG = 0x14, /* Configuration R/W */
472 CFG = 0x14, /* Configuration R/W */ 432 STAT = 0x18, /* Status R/W */
473 STAT = 0x18, /* Status R/W */ 433 RSQB = 0x1C, /* Receive Status Queue Base W */
474 RSQB = 0x1C, /* Receive Status Queue Base W */ 434 RSQT = 0x20, /* Receive Status Queue Tail R */
475 RSQT = 0x20, /* Receive Status Queue Tail R */ 435 RSQH = 0x24, /* Receive Status Queue Head W */
476 RSQH = 0x24, /* Receive Status Queue Head W */ 436 CDC = 0x28, /* Cell Drop Counter R/clear */
477 CDC = 0x28, /* Cell Drop Counter R/clear */ 437 VPEC = 0x2C, /* VPI/VCI Lookup Error Count R/clear */
478 VPEC = 0x2C, /* VPI/VCI Lookup Error Count R/clear */ 438 ICC = 0x30, /* Invalid Cell Count R/clear */
479 ICC = 0x30, /* Invalid Cell Count R/clear */ 439 RAWCT = 0x34, /* Raw Cell Tail R */
480 RAWCT = 0x34, /* Raw Cell Tail R */ 440 TMR = 0x38, /* Timer R */
481 TMR = 0x38, /* Timer R */ 441 TSTB = 0x3C, /* Transmit Schedule Table Base R/W */
482 TSTB = 0x3C, /* Transmit Schedule Table Base R/W */ 442 TSQB = 0x40, /* Transmit Status Queue Base W */
483 TSQB = 0x40, /* Transmit Status Queue Base W */ 443 TSQT = 0x44, /* Transmit Status Queue Tail R */
484 TSQT = 0x44, /* Transmit Status Queue Tail R */ 444 TSQH = 0x48, /* Transmit Status Queue Head W */
485 TSQH = 0x48, /* Transmit Status Queue Head W */ 445 GP = 0x4C, /* General Purpose R/W */
486 GP = 0x4C, /* General Purpose R/W */ 446 VPM = 0x50 /* VPI/VCI Mask W */
487 VPM = 0x50 /* VPI/VCI Mask W */
488}; 447};
489 448
490 449/* NICStAR commands issued to the CMD register */
491/* NICStAR commands issued to the CMD register ********************************/
492
493 450
494/* Top 4 bits are command opcode, lower 28 are parameters. */ 451/* Top 4 bits are command opcode, lower 28 are parameters. */
495 452
496#define NS_CMD_NO_OPERATION 0x00000000 453#define NS_CMD_NO_OPERATION 0x00000000
497 /* params always 0 */ 454 /* params always 0 */
498 455
499#define NS_CMD_OPENCLOSE_CONNECTION 0x20000000 456#define NS_CMD_OPENCLOSE_CONNECTION 0x20000000
500 /* b19{1=open,0=close} b18-2{SRAM addr} */ 457 /* b19{1=open,0=close} b18-2{SRAM addr} */
501 458
502#define NS_CMD_WRITE_SRAM 0x40000000 459#define NS_CMD_WRITE_SRAM 0x40000000
503 /* b18-2{SRAM addr} b1-0{burst size} */ 460 /* b18-2{SRAM addr} b1-0{burst size} */
504 461
505#define NS_CMD_READ_SRAM 0x50000000 462#define NS_CMD_READ_SRAM 0x50000000
506 /* b18-2{SRAM addr} */ 463 /* b18-2{SRAM addr} */
507 464
508#define NS_CMD_WRITE_FREEBUFQ 0x60000000 465#define NS_CMD_WRITE_FREEBUFQ 0x60000000
509 /* b0{large buf indicator} */ 466 /* b0{large buf indicator} */
510 467
511#define NS_CMD_READ_UTILITY 0x80000000 468#define NS_CMD_READ_UTILITY 0x80000000
512 /* b8{1=select UTL_CS1} b9{1=select UTL_CS0} b7-0{bus addr} */ 469 /* b8{1=select UTL_CS1} b9{1=select UTL_CS0} b7-0{bus addr} */
513 470
514#define NS_CMD_WRITE_UTILITY 0x90000000 471#define NS_CMD_WRITE_UTILITY 0x90000000
515 /* b8{1=select UTL_CS1} b9{1=select UTL_CS0} b7-0{bus addr} */ 472 /* b8{1=select UTL_CS1} b9{1=select UTL_CS0} b7-0{bus addr} */
516 473
517#define NS_CMD_OPEN_CONNECTION (NS_CMD_OPENCLOSE_CONNECTION | 0x00080000) 474#define NS_CMD_OPEN_CONNECTION (NS_CMD_OPENCLOSE_CONNECTION | 0x00080000)
518#define NS_CMD_CLOSE_CONNECTION NS_CMD_OPENCLOSE_CONNECTION 475#define NS_CMD_CLOSE_CONNECTION NS_CMD_OPENCLOSE_CONNECTION
519 476
520 477/* NICStAR configuration bits */
521/* NICStAR configuration bits *************************************************/ 478
522 479#define NS_CFG_SWRST 0x80000000 /* Software Reset */
523#define NS_CFG_SWRST 0x80000000 /* Software Reset */ 480#define NS_CFG_RXPATH 0x20000000 /* Receive Path Enable */
524#define NS_CFG_RXPATH 0x20000000 /* Receive Path Enable */ 481#define NS_CFG_SMBUFSIZE_MASK 0x18000000 /* Small Receive Buffer Size */
525#define NS_CFG_SMBUFSIZE_MASK 0x18000000 /* Small Receive Buffer Size */ 482#define NS_CFG_LGBUFSIZE_MASK 0x06000000 /* Large Receive Buffer Size */
526#define NS_CFG_LGBUFSIZE_MASK 0x06000000 /* Large Receive Buffer Size */ 483#define NS_CFG_EFBIE 0x01000000 /* Empty Free Buffer Queue
527#define NS_CFG_EFBIE 0x01000000 /* Empty Free Buffer Queue 484 Interrupt Enable */
528 Interrupt Enable */ 485#define NS_CFG_RSQSIZE_MASK 0x00C00000 /* Receive Status Queue Size */
529#define NS_CFG_RSQSIZE_MASK 0x00C00000 /* Receive Status Queue Size */ 486#define NS_CFG_ICACCEPT 0x00200000 /* Invalid Cell Accept */
530#define NS_CFG_ICACCEPT 0x00200000 /* Invalid Cell Accept */ 487#define NS_CFG_IGNOREGFC 0x00100000 /* Ignore General Flow Control */
531#define NS_CFG_IGNOREGFC 0x00100000 /* Ignore General Flow Control */ 488#define NS_CFG_VPIBITS_MASK 0x000C0000 /* VPI/VCI Bits Size Select */
532#define NS_CFG_VPIBITS_MASK 0x000C0000 /* VPI/VCI Bits Size Select */ 489#define NS_CFG_RCTSIZE_MASK 0x00030000 /* Receive Connection Table Size */
533#define NS_CFG_RCTSIZE_MASK 0x00030000 /* Receive Connection Table Size */ 490#define NS_CFG_VCERRACCEPT 0x00008000 /* VPI/VCI Error Cell Accept */
534#define NS_CFG_VCERRACCEPT 0x00008000 /* VPI/VCI Error Cell Accept */ 491#define NS_CFG_RXINT_MASK 0x00007000 /* End of Receive PDU Interrupt
535#define NS_CFG_RXINT_MASK 0x00007000 /* End of Receive PDU Interrupt 492 Handling */
536 Handling */ 493#define NS_CFG_RAWIE 0x00000800 /* Raw Cell Qu' Interrupt Enable */
537#define NS_CFG_RAWIE 0x00000800 /* Raw Cell Qu' Interrupt Enable */ 494#define NS_CFG_RSQAFIE 0x00000400 /* Receive Queue Almost Full
538#define NS_CFG_RSQAFIE 0x00000400 /* Receive Queue Almost Full 495 Interrupt Enable */
539 Interrupt Enable */ 496#define NS_CFG_RXRM 0x00000200 /* Receive RM Cells */
540#define NS_CFG_RXRM 0x00000200 /* Receive RM Cells */ 497#define NS_CFG_TMRROIE 0x00000080 /* Timer Roll Over Interrupt
541#define NS_CFG_TMRROIE 0x00000080 /* Timer Roll Over Interrupt 498 Enable */
542 Enable */ 499#define NS_CFG_TXEN 0x00000020 /* Transmit Operation Enable */
543#define NS_CFG_TXEN 0x00000020 /* Transmit Operation Enable */ 500#define NS_CFG_TXIE 0x00000010 /* Transmit Status Interrupt
544#define NS_CFG_TXIE 0x00000010 /* Transmit Status Interrupt 501 Enable */
545 Enable */ 502#define NS_CFG_TXURIE 0x00000008 /* Transmit Under-run Interrupt
546#define NS_CFG_TXURIE 0x00000008 /* Transmit Under-run Interrupt 503 Enable */
547 Enable */ 504#define NS_CFG_UMODE 0x00000004 /* Utopia Mode (cell/byte) Select */
548#define NS_CFG_UMODE 0x00000004 /* Utopia Mode (cell/byte) Select */ 505#define NS_CFG_TSQFIE 0x00000002 /* Transmit Status Queue Full
549#define NS_CFG_TSQFIE 0x00000002 /* Transmit Status Queue Full 506 Interrupt Enable */
550 Interrupt Enable */ 507#define NS_CFG_PHYIE 0x00000001 /* PHY Interrupt Enable */
551#define NS_CFG_PHYIE 0x00000001 /* PHY Interrupt Enable */
552 508
553#define NS_CFG_SMBUFSIZE_48 0x00000000 509#define NS_CFG_SMBUFSIZE_48 0x00000000
554#define NS_CFG_SMBUFSIZE_96 0x08000000 510#define NS_CFG_SMBUFSIZE_96 0x08000000
@@ -579,33 +535,29 @@ enum ns_regs
579#define NS_CFG_RXINT_624US 0x00003000 535#define NS_CFG_RXINT_624US 0x00003000
580#define NS_CFG_RXINT_899US 0x00004000 536#define NS_CFG_RXINT_899US 0x00004000
581 537
582 538/* NICStAR STATus bits */
583/* NICStAR STATus bits ********************************************************/ 539
584 540#define NS_STAT_SFBQC_MASK 0xFF000000 /* hi 8 bits Small Buffer Queue Count */
585#define NS_STAT_SFBQC_MASK 0xFF000000 /* hi 8 bits Small Buffer Queue Count */ 541#define NS_STAT_LFBQC_MASK 0x00FF0000 /* hi 8 bits Large Buffer Queue Count */
586#define NS_STAT_LFBQC_MASK 0x00FF0000 /* hi 8 bits Large Buffer Queue Count */ 542#define NS_STAT_TSIF 0x00008000 /* Transmit Status Queue Indicator */
587#define NS_STAT_TSIF 0x00008000 /* Transmit Status Queue Indicator */ 543#define NS_STAT_TXICP 0x00004000 /* Transmit Incomplete PDU */
588#define NS_STAT_TXICP 0x00004000 /* Transmit Incomplete PDU */ 544#define NS_STAT_TSQF 0x00001000 /* Transmit Status Queue Full */
589#define NS_STAT_TSQF 0x00001000 /* Transmit Status Queue Full */ 545#define NS_STAT_TMROF 0x00000800 /* Timer Overflow */
590#define NS_STAT_TMROF 0x00000800 /* Timer Overflow */ 546#define NS_STAT_PHYI 0x00000400 /* PHY Device Interrupt */
591#define NS_STAT_PHYI 0x00000400 /* PHY Device Interrupt */ 547#define NS_STAT_CMDBZ 0x00000200 /* Command Busy */
592#define NS_STAT_CMDBZ 0x00000200 /* Command Busy */ 548#define NS_STAT_SFBQF 0x00000100 /* Small Buffer Queue Full */
593#define NS_STAT_SFBQF 0x00000100 /* Small Buffer Queue Full */ 549#define NS_STAT_LFBQF 0x00000080 /* Large Buffer Queue Full */
594#define NS_STAT_LFBQF 0x00000080 /* Large Buffer Queue Full */ 550#define NS_STAT_RSQF 0x00000040 /* Receive Status Queue Full */
595#define NS_STAT_RSQF 0x00000040 /* Receive Status Queue Full */ 551#define NS_STAT_EOPDU 0x00000020 /* End of PDU */
596#define NS_STAT_EOPDU 0x00000020 /* End of PDU */ 552#define NS_STAT_RAWCF 0x00000010 /* Raw Cell Flag */
597#define NS_STAT_RAWCF 0x00000010 /* Raw Cell Flag */ 553#define NS_STAT_SFBQE 0x00000008 /* Small Buffer Queue Empty */
598#define NS_STAT_SFBQE 0x00000008 /* Small Buffer Queue Empty */ 554#define NS_STAT_LFBQE 0x00000004 /* Large Buffer Queue Empty */
599#define NS_STAT_LFBQE 0x00000004 /* Large Buffer Queue Empty */ 555#define NS_STAT_RSQAF 0x00000002 /* Receive Status Queue Almost Full */
600#define NS_STAT_RSQAF 0x00000002 /* Receive Status Queue Almost Full */
601 556
602#define ns_stat_sfbqc_get(stat) (((stat) & NS_STAT_SFBQC_MASK) >> 23) 557#define ns_stat_sfbqc_get(stat) (((stat) & NS_STAT_SFBQC_MASK) >> 23)
603#define ns_stat_lfbqc_get(stat) (((stat) & NS_STAT_LFBQC_MASK) >> 15) 558#define ns_stat_lfbqc_get(stat) (((stat) & NS_STAT_LFBQC_MASK) >> 15)
604 559
605 560/* #defines which depend on other #defines */
606
607/* #defines which depend on other #defines ************************************/
608
609 561
610#define NS_TST0 NS_TST_FRSCD 562#define NS_TST0 NS_TST_FRSCD
611#define NS_TST1 (NS_TST_FRSCD + NS_TST_NUM_ENTRIES + 1) 563#define NS_TST1 (NS_TST_FRSCD + NS_TST_NUM_ENTRIES + 1)
@@ -672,8 +624,7 @@ enum ns_regs
672#define NS_CFG_TSQFIE_OPT 0x00000000 624#define NS_CFG_TSQFIE_OPT 0x00000000
673#endif /* ENABLE_TSQFIE */ 625#endif /* ENABLE_TSQFIE */
674 626
675 627/* PCI stuff */
676/* PCI stuff ******************************************************************/
677 628
678#ifndef PCI_VENDOR_ID_IDT 629#ifndef PCI_VENDOR_ID_IDT
679#define PCI_VENDOR_ID_IDT 0x111D 630#define PCI_VENDOR_ID_IDT 0x111D
@@ -683,138 +634,119 @@ enum ns_regs
683#define PCI_DEVICE_ID_IDT_IDT77201 0x0001 634#define PCI_DEVICE_ID_IDT_IDT77201 0x0001
684#endif /* PCI_DEVICE_ID_IDT_IDT77201 */ 635#endif /* PCI_DEVICE_ID_IDT_IDT77201 */
685 636
686 637/* Device driver structures */
687
688/* Device driver structures ***************************************************/
689
690 638
691struct ns_skb_cb { 639struct ns_skb_cb {
692 u32 buf_type; /* BUF_SM/BUF_LG/BUF_NONE */ 640 u32 buf_type; /* BUF_SM/BUF_LG/BUF_NONE */
693}; 641};
694 642
695#define NS_SKB_CB(skb) ((struct ns_skb_cb *)((skb)->cb)) 643#define NS_SKB_CB(skb) ((struct ns_skb_cb *)((skb)->cb))
696 644
697typedef struct tsq_info 645typedef struct tsq_info {
698{ 646 void *org;
699 void *org; 647 ns_tsi *base;
700 ns_tsi *base; 648 ns_tsi *next;
701 ns_tsi *next; 649 ns_tsi *last;
702 ns_tsi *last;
703} tsq_info; 650} tsq_info;
704 651
705 652typedef struct scq_info {
706typedef struct scq_info 653 void *org;
707{ 654 ns_scqe *base;
708 void *org; 655 ns_scqe *last;
709 ns_scqe *base; 656 ns_scqe *next;
710 ns_scqe *last; 657 volatile ns_scqe *tail; /* Not related to the nicstar register */
711 ns_scqe *next; 658 unsigned num_entries;
712 volatile ns_scqe *tail; /* Not related to the nicstar register */ 659 struct sk_buff **skb; /* Pointer to an array of pointers
713 unsigned num_entries; 660 to the sk_buffs used for tx */
714 struct sk_buff **skb; /* Pointer to an array of pointers 661 u32 scd; /* SRAM address of the corresponding
715 to the sk_buffs used for tx */ 662 SCD */
716 u32 scd; /* SRAM address of the corresponding 663 int tbd_count; /* Only meaningful on variable rate */
717 SCD */ 664 wait_queue_head_t scqfull_waitq;
718 int tbd_count; /* Only meaningful on variable rate */ 665 volatile char full; /* SCQ full indicator */
719 wait_queue_head_t scqfull_waitq; 666 spinlock_t lock; /* SCQ spinlock */
720 volatile char full; /* SCQ full indicator */
721 spinlock_t lock; /* SCQ spinlock */
722} scq_info; 667} scq_info;
723 668
724 669typedef struct rsq_info {
725 670 void *org;
726typedef struct rsq_info 671 ns_rsqe *base;
727{ 672 ns_rsqe *next;
728 void *org; 673 ns_rsqe *last;
729 ns_rsqe *base;
730 ns_rsqe *next;
731 ns_rsqe *last;
732} rsq_info; 674} rsq_info;
733 675
734 676typedef struct skb_pool {
735typedef struct skb_pool 677 volatile int count; /* number of buffers in the queue */
736{ 678 struct sk_buff_head queue;
737 volatile int count; /* number of buffers in the queue */
738 struct sk_buff_head queue;
739} skb_pool; 679} skb_pool;
740 680
741/* NOTE: for small and large buffer pools, the count is not used, as the 681/* NOTE: for small and large buffer pools, the count is not used, as the
742 actual value used for buffer management is the one read from the 682 actual value used for buffer management is the one read from the
743 card. */ 683 card. */
744 684
745 685typedef struct vc_map {
746typedef struct vc_map 686 volatile unsigned int tx:1; /* TX vc? */
747{ 687 volatile unsigned int rx:1; /* RX vc? */
748 volatile unsigned int tx:1; /* TX vc? */ 688 struct atm_vcc *tx_vcc, *rx_vcc;
749 volatile unsigned int rx:1; /* RX vc? */ 689 struct sk_buff *rx_iov; /* RX iovector skb */
750 struct atm_vcc *tx_vcc, *rx_vcc; 690 scq_info *scq; /* To keep track of the SCQ */
751 struct sk_buff *rx_iov; /* RX iovector skb */ 691 u32 cbr_scd; /* SRAM address of the corresponding
752 scq_info *scq; /* To keep track of the SCQ */ 692 SCD. 0x00000000 for UBR/VBR/ABR */
753 u32 cbr_scd; /* SRAM address of the corresponding 693 int tbd_count;
754 SCD. 0x00000000 for UBR/VBR/ABR */
755 int tbd_count;
756} vc_map; 694} vc_map;
757 695
758 696struct ns_skb_data {
759struct ns_skb_data
760{
761 struct atm_vcc *vcc; 697 struct atm_vcc *vcc;
762 int iovcnt; 698 int iovcnt;
763}; 699};
764 700
765#define NS_SKB(skb) (((struct ns_skb_data *) (skb)->cb)) 701#define NS_SKB(skb) (((struct ns_skb_data *) (skb)->cb))
766 702
767 703typedef struct ns_dev {
768typedef struct ns_dev 704 int index; /* Card ID to the device driver */
769{ 705 int sram_size; /* In k x 32bit words. 32 or 128 */
770 int index; /* Card ID to the device driver */ 706 void __iomem *membase; /* Card's memory base address */
771 int sram_size; /* In k x 32bit words. 32 or 128 */ 707 unsigned long max_pcr;
772 void __iomem *membase; /* Card's memory base address */ 708 int rct_size; /* Number of entries */
773 unsigned long max_pcr; 709 int vpibits;
774 int rct_size; /* Number of entries */ 710 int vcibits;
775 int vpibits; 711 struct pci_dev *pcidev;
776 int vcibits; 712 struct atm_dev *atmdev;
777 struct pci_dev *pcidev; 713 tsq_info tsq;
778 struct atm_dev *atmdev; 714 rsq_info rsq;
779 tsq_info tsq; 715 scq_info *scq0, *scq1, *scq2; /* VBR SCQs */
780 rsq_info rsq; 716 skb_pool sbpool; /* Small buffers */
781 scq_info *scq0, *scq1, *scq2; /* VBR SCQs */ 717 skb_pool lbpool; /* Large buffers */
782 skb_pool sbpool; /* Small buffers */ 718 skb_pool hbpool; /* Pre-allocated huge buffers */
783 skb_pool lbpool; /* Large buffers */ 719 skb_pool iovpool; /* iovector buffers */
784 skb_pool hbpool; /* Pre-allocated huge buffers */ 720 volatile int efbie; /* Empty free buf. queue int. enabled */
785 skb_pool iovpool; /* iovector buffers */ 721 volatile u32 tst_addr; /* SRAM address of the TST in use */
786 volatile int efbie; /* Empty free buf. queue int. enabled */ 722 volatile int tst_free_entries;
787 volatile u32 tst_addr; /* SRAM address of the TST in use */ 723 vc_map vcmap[NS_MAX_RCTSIZE];
788 volatile int tst_free_entries; 724 vc_map *tste2vc[NS_TST_NUM_ENTRIES];
789 vc_map vcmap[NS_MAX_RCTSIZE]; 725 vc_map *scd2vc[NS_FRSCD_NUM];
790 vc_map *tste2vc[NS_TST_NUM_ENTRIES]; 726 buf_nr sbnr;
791 vc_map *scd2vc[NS_FRSCD_NUM]; 727 buf_nr lbnr;
792 buf_nr sbnr; 728 buf_nr hbnr;
793 buf_nr lbnr; 729 buf_nr iovnr;
794 buf_nr hbnr; 730 int sbfqc;
795 buf_nr iovnr; 731 int lbfqc;
796 int sbfqc; 732 u32 sm_handle;
797 int lbfqc; 733 u32 sm_addr;
798 u32 sm_handle; 734 u32 lg_handle;
799 u32 sm_addr; 735 u32 lg_addr;
800 u32 lg_handle; 736 struct sk_buff *rcbuf; /* Current raw cell buffer */
801 u32 lg_addr; 737 u32 rawch; /* Raw cell queue head */
802 struct sk_buff *rcbuf; /* Current raw cell buffer */ 738 unsigned intcnt; /* Interrupt counter */
803 u32 rawch; /* Raw cell queue head */ 739 spinlock_t int_lock; /* Interrupt lock */
804 unsigned intcnt; /* Interrupt counter */ 740 spinlock_t res_lock; /* Card resource lock */
805 spinlock_t int_lock; /* Interrupt lock */
806 spinlock_t res_lock; /* Card resource lock */
807} ns_dev; 741} ns_dev;
808 742
809
810 /* NOTE: Each tste2vc entry relates a given TST entry to the corresponding 743 /* NOTE: Each tste2vc entry relates a given TST entry to the corresponding
811 CBR vc. If the entry is not allocated, it must be NULL. 744 CBR vc. If the entry is not allocated, it must be NULL.
812 745
813 There are two TSTs so the driver can modify them on the fly 746 There are two TSTs so the driver can modify them on the fly
814 without stopping the transmission. 747 without stopping the transmission.
815
816 scd2vc allows us to find out unused fixed rate SCDs, because
817 they must have a NULL pointer here. */
818 748
749 scd2vc allows us to find out unused fixed rate SCDs, because
750 they must have a NULL pointer here. */
819 751
820#endif /* _LINUX_NICSTAR_H_ */ 752#endif /* _LINUX_NICSTAR_H_ */