0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef _LINUX_NICSTAR_H_
0014 #define _LINUX_NICSTAR_H_
0015
0016
0017
0018 #include <linux/types.h>
0019 #include <linux/pci.h>
0020 #include <linux/idr.h>
0021 #include <linux/uio.h>
0022 #include <linux/skbuff.h>
0023 #include <linux/atmdev.h>
0024 #include <linux/atm_nicstar.h>
0025
0026
0027
0028 #define NS_MAX_CARDS 4
0029
0030
0031
0032 #undef RCQ_SUPPORT
0033
0034 #define NS_TST_NUM_ENTRIES 2340
0035 #define NS_TST_RESERVED 340
0036
0037 #define NS_SMBUFSIZE 48
0038 #define NS_LGBUFSIZE 16384
0039 #define NS_RSQSIZE 8192
0040 #define NS_VPIBITS 2
0041
0042 #define NS_MAX_RCTSIZE 4096
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054 #define NUM_SB 32
0055 #define NUM_LB 24
0056 #define NUM_HB 8
0057 #define NUM_IOVB 48
0058
0059
0060 #define MIN_SB 8
0061 #define MIN_LB 8
0062 #define MIN_HB 6
0063 #define MIN_IOVB 8
0064
0065
0066 #define MAX_SB 64
0067 #define MAX_LB 48
0068 #define MAX_HB 10
0069 #define MAX_IOVB 80
0070
0071
0072 #define TOP_SB 256
0073 #define TOP_LB 128
0074 #define TOP_HB 64
0075 #define TOP_IOVB 256
0076
0077 #define MAX_TBD_PER_VC 1
0078 #define MAX_TBD_PER_SCQ 10
0079
0080 #undef ENABLE_TSQFIE
0081
0082 #define SCQFULL_TIMEOUT (5 * HZ)
0083
0084 #define NS_POLL_PERIOD (HZ)
0085
0086 #define PCR_TOLERANCE (1.0001)
0087
0088
0089
0090 #define NICSTAR_EPROM_MAC_ADDR_OFFSET 0x6C
0091 #define NICSTAR_EPROM_MAC_ADDR_OFFSET_ALT 0xF6
0092
0093
0094
0095 #define NS_IOREMAP_SIZE 4096
0096
0097
0098
0099
0100
0101
0102 #define BUF_SM 0x00000000
0103 #define BUF_LG 0x00000001
0104 #define BUF_NONE 0xffffffff
0105
0106 #define NS_HBUFSIZE 65568
0107 #define NS_MAX_IOVECS (2 + (65568 - NS_SMBUFSIZE) / \
0108 (NS_LGBUFSIZE - (NS_LGBUFSIZE % 48)))
0109 #define NS_IOVBUFSIZE (NS_MAX_IOVECS * (sizeof(struct iovec)))
0110
0111 #define NS_SMBUFSIZE_USABLE (NS_SMBUFSIZE - NS_SMBUFSIZE % 48)
0112 #define NS_LGBUFSIZE_USABLE (NS_LGBUFSIZE - NS_LGBUFSIZE % 48)
0113
0114 #define NS_AAL0_HEADER (ATM_AAL0_SDU - ATM_CELL_PAYLOAD)
0115
0116 #define NS_SMSKBSIZE (NS_SMBUFSIZE + NS_AAL0_HEADER)
0117 #define NS_LGSKBSIZE (NS_SMBUFSIZE + NS_LGBUFSIZE)
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127 typedef struct ns_rsqe {
0128 u32 word_1;
0129 u32 buffer_handle;
0130 u32 final_aal5_crc32;
0131 u32 word_4;
0132 } ns_rsqe;
0133
0134 #define ns_rsqe_vpi(ns_rsqep) \
0135 ((le32_to_cpu((ns_rsqep)->word_1) & 0x00FF0000) >> 16)
0136 #define ns_rsqe_vci(ns_rsqep) \
0137 (le32_to_cpu((ns_rsqep)->word_1) & 0x0000FFFF)
0138
0139 #define NS_RSQE_VALID 0x80000000
0140 #define NS_RSQE_NZGFC 0x00004000
0141 #define NS_RSQE_EOPDU 0x00002000
0142 #define NS_RSQE_BUFSIZE 0x00001000
0143 #define NS_RSQE_CONGESTION 0x00000800
0144 #define NS_RSQE_CLP 0x00000400
0145 #define NS_RSQE_CRCERR 0x00000200
0146
0147 #define NS_RSQE_BUFSIZE_SM 0x00000000
0148 #define NS_RSQE_BUFSIZE_LG 0x00001000
0149
0150 #define ns_rsqe_valid(ns_rsqep) \
0151 (le32_to_cpu((ns_rsqep)->word_4) & NS_RSQE_VALID)
0152 #define ns_rsqe_nzgfc(ns_rsqep) \
0153 (le32_to_cpu((ns_rsqep)->word_4) & NS_RSQE_NZGFC)
0154 #define ns_rsqe_eopdu(ns_rsqep) \
0155 (le32_to_cpu((ns_rsqep)->word_4) & NS_RSQE_EOPDU)
0156 #define ns_rsqe_bufsize(ns_rsqep) \
0157 (le32_to_cpu((ns_rsqep)->word_4) & NS_RSQE_BUFSIZE)
0158 #define ns_rsqe_congestion(ns_rsqep) \
0159 (le32_to_cpu((ns_rsqep)->word_4) & NS_RSQE_CONGESTION)
0160 #define ns_rsqe_clp(ns_rsqep) \
0161 (le32_to_cpu((ns_rsqep)->word_4) & NS_RSQE_CLP)
0162 #define ns_rsqe_crcerr(ns_rsqep) \
0163 (le32_to_cpu((ns_rsqep)->word_4) & NS_RSQE_CRCERR)
0164
0165 #define ns_rsqe_cellcount(ns_rsqep) \
0166 (le32_to_cpu((ns_rsqep)->word_4) & 0x000001FF)
0167 #define ns_rsqe_init(ns_rsqep) \
0168 ((ns_rsqep)->word_4 = cpu_to_le32(0x00000000))
0169
0170 #define NS_RSQ_NUM_ENTRIES (NS_RSQSIZE / 16)
0171 #define NS_RSQ_ALIGNMENT NS_RSQSIZE
0172
0173
0174
0175
0176
0177
0178
0179 typedef struct cell_payload {
0180 u32 word[12];
0181 } cell_payload;
0182
0183 typedef struct ns_rcqe {
0184 u32 word_1;
0185 u32 word_2;
0186 u32 word_3;
0187 u32 word_4;
0188 cell_payload payload;
0189 } ns_rcqe;
0190
0191 #define NS_RCQE_SIZE 64
0192
0193 #define ns_rcqe_islast(ns_rcqep) \
0194 (le32_to_cpu((ns_rcqep)->word_2) != 0x00000000)
0195 #define ns_rcqe_cellheader(ns_rcqep) \
0196 (le32_to_cpu((ns_rcqep)->word_1))
0197 #define ns_rcqe_nextbufhandle(ns_rcqep) \
0198 (le32_to_cpu((ns_rcqep)->word_2))
0199
0200
0201
0202
0203
0204
0205
0206 typedef struct ns_scqe {
0207 u32 word_1;
0208 u32 word_2;
0209 u32 word_3;
0210 u32 word_4;
0211 } ns_scqe;
0212
0213
0214
0215
0216 #define NS_SCQE_TYPE_TBD 0x00000000
0217 #define NS_SCQE_TYPE_TSR 0x80000000
0218
0219 #define NS_TBD_EOPDU 0x40000000
0220 #define NS_TBD_AAL0 0x00000000
0221 #define NS_TBD_AAL34 0x04000000
0222 #define NS_TBD_AAL5 0x08000000
0223
0224 #define NS_TBD_VPI_MASK 0x0FF00000
0225 #define NS_TBD_VCI_MASK 0x000FFFF0
0226 #define NS_TBD_VC_MASK (NS_TBD_VPI_MASK | NS_TBD_VCI_MASK)
0227
0228 #define NS_TBD_VPI_SHIFT 20
0229 #define NS_TBD_VCI_SHIFT 4
0230
0231 #define ns_tbd_mkword_1(flags, m, n, buflen) \
0232 (cpu_to_le32((flags) | (m) << 23 | (n) << 16 | (buflen)))
0233 #define ns_tbd_mkword_1_novbr(flags, buflen) \
0234 (cpu_to_le32((flags) | (buflen) | 0x00810000))
0235 #define ns_tbd_mkword_3(control, pdulen) \
0236 (cpu_to_le32((control) << 16 | (pdulen)))
0237 #define ns_tbd_mkword_4(gfc, vpi, vci, pt, clp) \
0238 (cpu_to_le32((gfc) << 28 | (vpi) << 20 | (vci) << 4 | (pt) << 1 | (clp)))
0239
0240 #define NS_TSR_INTENABLE 0x20000000
0241
0242 #define NS_TSR_SCDISVBR 0xFFFF
0243
0244 #define ns_tsr_mkword_1(flags) \
0245 (cpu_to_le32(NS_SCQE_TYPE_TSR | (flags)))
0246 #define ns_tsr_mkword_2(scdi, scqi) \
0247 (cpu_to_le32((scdi) << 16 | 0x00008000 | (scqi)))
0248
0249 #define ns_scqe_is_tsr(ns_scqep) \
0250 (le32_to_cpu((ns_scqep)->word_1) & NS_SCQE_TYPE_TSR)
0251
0252 #define VBR_SCQ_NUM_ENTRIES 512
0253 #define VBR_SCQSIZE 8192
0254 #define CBR_SCQ_NUM_ENTRIES 64
0255 #define CBR_SCQSIZE 1024
0256
0257 #define NS_SCQE_SIZE 16
0258
0259
0260
0261
0262
0263
0264
0265 typedef struct ns_tsi {
0266 u32 word_1;
0267 u32 word_2;
0268 } ns_tsi;
0269
0270
0271
0272
0273
0274 #define NS_TSI_EMPTY 0x80000000
0275 #define NS_TSI_TIMESTAMP_MASK 0x00FFFFFF
0276
0277 #define ns_tsi_isempty(ns_tsip) \
0278 (le32_to_cpu((ns_tsip)->word_2) & NS_TSI_EMPTY)
0279 #define ns_tsi_gettimestamp(ns_tsip) \
0280 (le32_to_cpu((ns_tsip)->word_2) & NS_TSI_TIMESTAMP_MASK)
0281
0282 #define ns_tsi_init(ns_tsip) \
0283 ((ns_tsip)->word_2 = cpu_to_le32(NS_TSI_EMPTY))
0284
0285 #define NS_TSQSIZE 8192
0286 #define NS_TSQ_NUM_ENTRIES 1024
0287 #define NS_TSQ_ALIGNMENT 8192
0288
0289 #define NS_TSI_SCDISVBR NS_TSR_SCDISVBR
0290
0291 #define ns_tsi_tmrof(ns_tsip) \
0292 (le32_to_cpu((ns_tsip)->word_1) == 0x00000000)
0293 #define ns_tsi_getscdindex(ns_tsip) \
0294 ((le32_to_cpu((ns_tsip)->word_1) & 0xFFFF0000) >> 16)
0295 #define ns_tsi_getscqpos(ns_tsip) \
0296 (le32_to_cpu((ns_tsip)->word_1) & 0x00007FFF)
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306 typedef struct ns_rcte {
0307 u32 word_1;
0308 u32 buffer_handle;
0309 u32 dma_address;
0310 u32 aal5_crc32;
0311 } ns_rcte;
0312
0313 #define NS_RCTE_BSFB 0x00200000
0314 #define NS_RCTE_NZGFC 0x00100000
0315 #define NS_RCTE_CONNECTOPEN 0x00080000
0316 #define NS_RCTE_AALMASK 0x00070000
0317 #define NS_RCTE_AAL0 0x00000000
0318 #define NS_RCTE_AAL34 0x00010000
0319 #define NS_RCTE_AAL5 0x00020000
0320 #define NS_RCTE_RCQ 0x00030000
0321 #define NS_RCTE_RAWCELLINTEN 0x00008000
0322 #define NS_RCTE_RXCONSTCELLADDR 0x00004000
0323 #define NS_RCTE_BUFFVALID 0x00002000
0324 #define NS_RCTE_FBDSIZE 0x00001000
0325 #define NS_RCTE_EFCI 0x00000800
0326 #define NS_RCTE_CLP 0x00000400
0327 #define NS_RCTE_CRCERROR 0x00000200
0328 #define NS_RCTE_CELLCOUNT_MASK 0x000001FF
0329
0330 #define NS_RCTE_FBDSIZE_SM 0x00000000
0331 #define NS_RCTE_FBDSIZE_LG 0x00001000
0332
0333 #define NS_RCT_ENTRY_SIZE 4
0334
0335
0336
0337
0338
0339
0340
0341
0342
0343
0344 typedef struct ns_fbd {
0345 u32 buffer_handle;
0346 u32 dma_address;
0347 } ns_fbd;
0348
0349
0350
0351
0352
0353
0354
0355 typedef u32 ns_tste;
0356
0357 #define NS_TST_OPCODE_MASK 0x60000000
0358
0359 #define NS_TST_OPCODE_NULL 0x00000000
0360 #define NS_TST_OPCODE_FIXED 0x20000000
0361 #define NS_TST_OPCODE_VARIABLE 0x40000000
0362 #define NS_TST_OPCODE_END 0x60000000
0363
0364 #define ns_tste_make(opcode, sramad) (opcode | sramad)
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380 typedef struct ns_scd {
0381 u32 word_1;
0382 u32 word_2;
0383 u32 partial_aal5_crc;
0384 u32 reserved;
0385 ns_scqe cache_a;
0386 ns_scqe cache_b;
0387 } ns_scd;
0388
0389 #define NS_SCD_BASE_MASK_VAR 0xFFFFE000
0390 #define NS_SCD_BASE_MASK_FIX 0xFFFFFC00
0391 #define NS_SCD_TAIL_MASK_VAR 0x00001FF0
0392 #define NS_SCD_TAIL_MASK_FIX 0x000003F0
0393 #define NS_SCD_HEAD_MASK_VAR 0x00001FF0
0394 #define NS_SCD_HEAD_MASK_FIX 0x000003F0
0395 #define NS_SCD_XMITFOREVER 0x02000000
0396
0397
0398
0399
0400
0401
0402 #define NS_RCT 0x00000
0403 #define NS_RCT_32_END 0x03FFF
0404 #define NS_RCT_128_END 0x0FFFF
0405 #define NS_UNUSED_32 0x04000
0406 #define NS_UNUSED_128 0x10000
0407 #define NS_UNUSED_END 0x1BFFF
0408 #define NS_TST_FRSCD 0x1C000
0409 #define NS_TST_FRSCD_END 0x1E7DB
0410 #define NS_VRSCD2 0x1E7DC
0411 #define NS_VRSCD2_END 0x1E7E7
0412 #define NS_VRSCD1 0x1E7E8
0413 #define NS_VRSCD1_END 0x1E7F3
0414 #define NS_VRSCD0 0x1E7F4
0415 #define NS_VRSCD0_END 0x1E7FF
0416 #define NS_RXFIFO 0x1E800
0417 #define NS_RXFIFO_END 0x1F7FF
0418 #define NS_SMFBQ 0x1F800
0419 #define NS_SMFBQ_END 0x1FBFF
0420 #define NS_LGFBQ 0x1FC00
0421 #define NS_LGFBQ_END 0x1FFFF
0422
0423
0424
0425
0426
0427 enum ns_regs {
0428 DR0 = 0x00,
0429 DR1 = 0x04,
0430 DR2 = 0x08,
0431 DR3 = 0x0C,
0432 CMD = 0x10,
0433 CFG = 0x14,
0434 STAT = 0x18,
0435 RSQB = 0x1C,
0436 RSQT = 0x20,
0437 RSQH = 0x24,
0438 CDC = 0x28,
0439 VPEC = 0x2C,
0440 ICC = 0x30,
0441 RAWCT = 0x34,
0442 TMR = 0x38,
0443 TSTB = 0x3C,
0444 TSQB = 0x40,
0445 TSQT = 0x44,
0446 TSQH = 0x48,
0447 GP = 0x4C,
0448 VPM = 0x50
0449 };
0450
0451
0452
0453
0454
0455 #define NS_CMD_NO_OPERATION 0x00000000
0456
0457
0458 #define NS_CMD_OPENCLOSE_CONNECTION 0x20000000
0459
0460
0461 #define NS_CMD_WRITE_SRAM 0x40000000
0462
0463
0464 #define NS_CMD_READ_SRAM 0x50000000
0465
0466
0467 #define NS_CMD_WRITE_FREEBUFQ 0x60000000
0468
0469
0470 #define NS_CMD_READ_UTILITY 0x80000000
0471
0472
0473 #define NS_CMD_WRITE_UTILITY 0x90000000
0474
0475
0476 #define NS_CMD_OPEN_CONNECTION (NS_CMD_OPENCLOSE_CONNECTION | 0x00080000)
0477 #define NS_CMD_CLOSE_CONNECTION NS_CMD_OPENCLOSE_CONNECTION
0478
0479
0480
0481 #define NS_CFG_SWRST 0x80000000
0482 #define NS_CFG_RXPATH 0x20000000
0483 #define NS_CFG_SMBUFSIZE_MASK 0x18000000
0484 #define NS_CFG_LGBUFSIZE_MASK 0x06000000
0485 #define NS_CFG_EFBIE 0x01000000
0486
0487 #define NS_CFG_RSQSIZE_MASK 0x00C00000
0488 #define NS_CFG_ICACCEPT 0x00200000
0489 #define NS_CFG_IGNOREGFC 0x00100000
0490 #define NS_CFG_VPIBITS_MASK 0x000C0000
0491 #define NS_CFG_RCTSIZE_MASK 0x00030000
0492 #define NS_CFG_VCERRACCEPT 0x00008000
0493 #define NS_CFG_RXINT_MASK 0x00007000
0494
0495 #define NS_CFG_RAWIE 0x00000800
0496 #define NS_CFG_RSQAFIE 0x00000400
0497
0498 #define NS_CFG_RXRM 0x00000200
0499 #define NS_CFG_TMRROIE 0x00000080
0500
0501 #define NS_CFG_TXEN 0x00000020
0502 #define NS_CFG_TXIE 0x00000010
0503
0504 #define NS_CFG_TXURIE 0x00000008
0505
0506 #define NS_CFG_UMODE 0x00000004
0507 #define NS_CFG_TSQFIE 0x00000002
0508
0509 #define NS_CFG_PHYIE 0x00000001
0510
0511 #define NS_CFG_SMBUFSIZE_48 0x00000000
0512 #define NS_CFG_SMBUFSIZE_96 0x08000000
0513 #define NS_CFG_SMBUFSIZE_240 0x10000000
0514 #define NS_CFG_SMBUFSIZE_2048 0x18000000
0515
0516 #define NS_CFG_LGBUFSIZE_2048 0x00000000
0517 #define NS_CFG_LGBUFSIZE_4096 0x02000000
0518 #define NS_CFG_LGBUFSIZE_8192 0x04000000
0519 #define NS_CFG_LGBUFSIZE_16384 0x06000000
0520
0521 #define NS_CFG_RSQSIZE_2048 0x00000000
0522 #define NS_CFG_RSQSIZE_4096 0x00400000
0523 #define NS_CFG_RSQSIZE_8192 0x00800000
0524
0525 #define NS_CFG_VPIBITS_0 0x00000000
0526 #define NS_CFG_VPIBITS_1 0x00040000
0527 #define NS_CFG_VPIBITS_2 0x00080000
0528 #define NS_CFG_VPIBITS_8 0x000C0000
0529
0530 #define NS_CFG_RCTSIZE_4096_ENTRIES 0x00000000
0531 #define NS_CFG_RCTSIZE_8192_ENTRIES 0x00010000
0532 #define NS_CFG_RCTSIZE_16384_ENTRIES 0x00020000
0533
0534 #define NS_CFG_RXINT_NOINT 0x00000000
0535 #define NS_CFG_RXINT_NODELAY 0x00001000
0536 #define NS_CFG_RXINT_314US 0x00002000
0537 #define NS_CFG_RXINT_624US 0x00003000
0538 #define NS_CFG_RXINT_899US 0x00004000
0539
0540
0541
0542 #define NS_STAT_SFBQC_MASK 0xFF000000
0543 #define NS_STAT_LFBQC_MASK 0x00FF0000
0544 #define NS_STAT_TSIF 0x00008000
0545 #define NS_STAT_TXICP 0x00004000
0546 #define NS_STAT_TSQF 0x00001000
0547 #define NS_STAT_TMROF 0x00000800
0548 #define NS_STAT_PHYI 0x00000400
0549 #define NS_STAT_CMDBZ 0x00000200
0550 #define NS_STAT_SFBQF 0x00000100
0551 #define NS_STAT_LFBQF 0x00000080
0552 #define NS_STAT_RSQF 0x00000040
0553 #define NS_STAT_EOPDU 0x00000020
0554 #define NS_STAT_RAWCF 0x00000010
0555 #define NS_STAT_SFBQE 0x00000008
0556 #define NS_STAT_LFBQE 0x00000004
0557 #define NS_STAT_RSQAF 0x00000002
0558
0559 #define ns_stat_sfbqc_get(stat) (((stat) & NS_STAT_SFBQC_MASK) >> 23)
0560 #define ns_stat_lfbqc_get(stat) (((stat) & NS_STAT_LFBQC_MASK) >> 15)
0561
0562
0563
0564 #define NS_TST0 NS_TST_FRSCD
0565 #define NS_TST1 (NS_TST_FRSCD + NS_TST_NUM_ENTRIES + 1)
0566
0567 #define NS_FRSCD (NS_TST1 + NS_TST_NUM_ENTRIES + 1)
0568 #define NS_FRSCD_SIZE 12
0569 #define NS_FRSCD_NUM ((NS_TST_FRSCD_END + 1 - NS_FRSCD) / NS_FRSCD_SIZE)
0570
0571 #if (NS_SMBUFSIZE == 48)
0572 #define NS_CFG_SMBUFSIZE NS_CFG_SMBUFSIZE_48
0573 #elif (NS_SMBUFSIZE == 96)
0574 #define NS_CFG_SMBUFSIZE NS_CFG_SMBUFSIZE_96
0575 #elif (NS_SMBUFSIZE == 240)
0576 #define NS_CFG_SMBUFSIZE NS_CFG_SMBUFSIZE_240
0577 #elif (NS_SMBUFSIZE == 2048)
0578 #define NS_CFG_SMBUFSIZE NS_CFG_SMBUFSIZE_2048
0579 #else
0580 #error NS_SMBUFSIZE is incorrect in nicstar.h
0581 #endif
0582
0583 #if (NS_LGBUFSIZE == 2048)
0584 #define NS_CFG_LGBUFSIZE NS_CFG_LGBUFSIZE_2048
0585 #elif (NS_LGBUFSIZE == 4096)
0586 #define NS_CFG_LGBUFSIZE NS_CFG_LGBUFSIZE_4096
0587 #elif (NS_LGBUFSIZE == 8192)
0588 #define NS_CFG_LGBUFSIZE NS_CFG_LGBUFSIZE_8192
0589 #elif (NS_LGBUFSIZE == 16384)
0590 #define NS_CFG_LGBUFSIZE NS_CFG_LGBUFSIZE_16384
0591 #else
0592 #error NS_LGBUFSIZE is incorrect in nicstar.h
0593 #endif
0594
0595 #if (NS_RSQSIZE == 2048)
0596 #define NS_CFG_RSQSIZE NS_CFG_RSQSIZE_2048
0597 #elif (NS_RSQSIZE == 4096)
0598 #define NS_CFG_RSQSIZE NS_CFG_RSQSIZE_4096
0599 #elif (NS_RSQSIZE == 8192)
0600 #define NS_CFG_RSQSIZE NS_CFG_RSQSIZE_8192
0601 #else
0602 #error NS_RSQSIZE is incorrect in nicstar.h
0603 #endif
0604
0605 #if (NS_VPIBITS == 0)
0606 #define NS_CFG_VPIBITS NS_CFG_VPIBITS_0
0607 #elif (NS_VPIBITS == 1)
0608 #define NS_CFG_VPIBITS NS_CFG_VPIBITS_1
0609 #elif (NS_VPIBITS == 2)
0610 #define NS_CFG_VPIBITS NS_CFG_VPIBITS_2
0611 #elif (NS_VPIBITS == 8)
0612 #define NS_CFG_VPIBITS NS_CFG_VPIBITS_8
0613 #else
0614 #error NS_VPIBITS is incorrect in nicstar.h
0615 #endif
0616
0617 #ifdef RCQ_SUPPORT
0618 #define NS_CFG_RAWIE_OPT NS_CFG_RAWIE
0619 #else
0620 #define NS_CFG_RAWIE_OPT 0x00000000
0621 #endif
0622
0623 #ifdef ENABLE_TSQFIE
0624 #define NS_CFG_TSQFIE_OPT NS_CFG_TSQFIE
0625 #else
0626 #define NS_CFG_TSQFIE_OPT 0x00000000
0627 #endif
0628
0629
0630
0631 #ifndef PCI_VENDOR_ID_IDT
0632 #define PCI_VENDOR_ID_IDT 0x111D
0633 #endif
0634
0635 #ifndef PCI_DEVICE_ID_IDT_IDT77201
0636 #define PCI_DEVICE_ID_IDT_IDT77201 0x0001
0637 #endif
0638
0639
0640
0641 struct ns_skb_prv {
0642 u32 buf_type;
0643 u32 dma;
0644 int iovcnt;
0645 };
0646
0647 #define NS_PRV_BUFTYPE(skb) \
0648 (((struct ns_skb_prv *)(ATM_SKB(skb)+1))->buf_type)
0649 #define NS_PRV_DMA(skb) \
0650 (((struct ns_skb_prv *)(ATM_SKB(skb)+1))->dma)
0651 #define NS_PRV_IOVCNT(skb) \
0652 (((struct ns_skb_prv *)(ATM_SKB(skb)+1))->iovcnt)
0653
0654 typedef struct tsq_info {
0655 void *org;
0656 dma_addr_t dma;
0657 ns_tsi *base;
0658 ns_tsi *next;
0659 ns_tsi *last;
0660 } tsq_info;
0661
0662 typedef struct scq_info {
0663 void *org;
0664 dma_addr_t dma;
0665 ns_scqe *base;
0666 ns_scqe *last;
0667 ns_scqe *next;
0668 volatile ns_scqe *tail;
0669 unsigned num_entries;
0670 struct sk_buff **skb;
0671
0672 u32 scd;
0673
0674 int tbd_count;
0675 wait_queue_head_t scqfull_waitq;
0676 volatile char full;
0677 spinlock_t lock;
0678 } scq_info;
0679
0680 typedef struct rsq_info {
0681 void *org;
0682 dma_addr_t dma;
0683 ns_rsqe *base;
0684 ns_rsqe *next;
0685 ns_rsqe *last;
0686 } rsq_info;
0687
0688 typedef struct skb_pool {
0689 volatile int count;
0690 struct sk_buff_head queue;
0691 } skb_pool;
0692
0693
0694
0695
0696
0697 typedef struct vc_map {
0698 volatile unsigned int tx:1;
0699 volatile unsigned int rx:1;
0700 struct atm_vcc *tx_vcc, *rx_vcc;
0701 struct sk_buff *rx_iov;
0702 scq_info *scq;
0703 u32 cbr_scd;
0704
0705 int tbd_count;
0706 } vc_map;
0707
0708 typedef struct ns_dev {
0709 int index;
0710 int sram_size;
0711 void __iomem *membase;
0712 unsigned long max_pcr;
0713 int rct_size;
0714 int vpibits;
0715 int vcibits;
0716 struct pci_dev *pcidev;
0717 struct idr idr;
0718 struct atm_dev *atmdev;
0719 tsq_info tsq;
0720 rsq_info rsq;
0721 scq_info *scq0, *scq1, *scq2;
0722 skb_pool sbpool;
0723 skb_pool lbpool;
0724 skb_pool hbpool;
0725 skb_pool iovpool;
0726 volatile int efbie;
0727 volatile u32 tst_addr;
0728 volatile int tst_free_entries;
0729 vc_map vcmap[NS_MAX_RCTSIZE];
0730 vc_map *tste2vc[NS_TST_NUM_ENTRIES];
0731 vc_map *scd2vc[NS_FRSCD_NUM];
0732 buf_nr sbnr;
0733 buf_nr lbnr;
0734 buf_nr hbnr;
0735 buf_nr iovnr;
0736 int sbfqc;
0737 int lbfqc;
0738 struct sk_buff *sm_handle;
0739 u32 sm_addr;
0740 struct sk_buff *lg_handle;
0741 u32 lg_addr;
0742 struct sk_buff *rcbuf;
0743 struct ns_rcqe *rawcell;
0744 u32 rawch;
0745 unsigned intcnt;
0746 spinlock_t int_lock;
0747 spinlock_t res_lock;
0748 } ns_dev;
0749
0750
0751
0752
0753
0754
0755
0756
0757
0758
0759 #endif