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 #ifndef _CASSINI_H
27 #define _CASSINI_H
28
29
30
31
32
33
34 #define CAS_ID_REV2 0x02
35 #define CAS_ID_REVPLUS 0x10
36 #define CAS_ID_REVPLUS02u 0x11
37 #define CAS_ID_REVSATURNB2 0x30
38
39
40
41
42
43
44
45
46
47 #define REG_CAWR 0x0004
48 #define CAWR_RX_DMA_WEIGHT_SHIFT 0
49 #define CAWR_RX_DMA_WEIGHT_MASK 0x03
50 #define CAWR_TX_DMA_WEIGHT_SHIFT 2
51 #define CAWR_TX_DMA_WEIGHT_MASK 0x0C
52 #define CAWR_RR_DIS 0x10
53
54
55
56
57
58
59 #define REG_INF_BURST 0x0008
60 #define INF_BURST_EN 0x1
61
62
63
64
65
66
67 #define REG_INTR_STATUS 0x000C
68 #define INTR_TX_INTME 0x00000001
69
70
71 #define INTR_TX_ALL 0x00000002
72
73
74
75
76 #define INTR_TX_DONE 0x00000004
77
78 #define INTR_TX_TAG_ERROR 0x00000008
79
80 #define INTR_RX_DONE 0x00000010
81
82
83
84
85 #define INTR_RX_BUF_UNAVAIL 0x00000020
86
87 #define INTR_RX_TAG_ERROR 0x00000040
88
89 #define INTR_RX_COMP_FULL 0x00000080
90
91
92
93
94 #define INTR_RX_BUF_AE 0x00000100
95
96
97
98 #define INTR_RX_COMP_AF 0x00000200
99
100
101
102
103 #define INTR_RX_LEN_MISMATCH 0x00000400
104
105
106
107
108
109
110 #define INTR_SUMMARY 0x00001000
111
112
113
114
115 #define INTR_PCS_STATUS 0x00002000
116 #define INTR_TX_MAC_STATUS 0x00004000
117
118 #define INTR_RX_MAC_STATUS 0x00008000
119
120 #define INTR_MAC_CTRL_STATUS 0x00010000
121
122
123 #define INTR_MIF_STATUS 0x00020000
124
125 #define INTR_PCI_ERROR_STATUS 0x00040000
126
127
128 #define INTR_TX_COMP_3_MASK 0xFFF80000
129
130 #define INTR_TX_COMP_3_SHIFT 19
131 #define INTR_ERROR_MASK (INTR_MIF_STATUS | INTR_PCI_ERROR_STATUS | \
132 INTR_PCS_STATUS | INTR_RX_LEN_MISMATCH | \
133 INTR_TX_MAC_STATUS | INTR_RX_MAC_STATUS | \
134 INTR_TX_TAG_ERROR | INTR_RX_TAG_ERROR | \
135 INTR_MAC_CTRL_STATUS)
136
137
138
139
140
141 #define REG_INTR_MASK 0x0010
142
143
144
145
146
147 #define REG_ALIAS_CLEAR 0x0014
148
149
150
151
152
153 #define REG_INTR_STATUS_ALIAS 0x001C
154
155
156
157 #define REG_PCI_ERR_STATUS 0x1000
158 #define PCI_ERR_BADACK 0x01
159
160
161 #define PCI_ERR_DTRTO 0x02
162
163 #define PCI_ERR_OTHER 0x04
164 #define PCI_ERR_BIM_DMA_WRITE 0x08
165
166 #define PCI_ERR_BIM_DMA_READ 0x10
167
168 #define PCI_ERR_BIM_DMA_TIMEOUT 0x20
169
170
171
172
173
174
175 #define REG_PCI_ERR_STATUS_MASK 0x1004
176
177
178
179
180 #define REG_BIM_CFG 0x1008
181 #define BIM_CFG_RESERVED0 0x001
182 #define BIM_CFG_RESERVED1 0x002
183 #define BIM_CFG_64BIT_DISABLE 0x004
184 #define BIM_CFG_66MHZ 0x008
185 #define BIM_CFG_32BIT 0x010
186 #define BIM_CFG_DPAR_INTR_ENABLE 0x020
187 #define BIM_CFG_RMA_INTR_ENABLE 0x040
188 #define BIM_CFG_RTA_INTR_ENABLE 0x080
189 #define BIM_CFG_RESERVED2 0x100
190 #define BIM_CFG_BIM_DISABLE 0x200
191
192 #define BIM_CFG_BIM_STATUS 0x400
193
194 #define BIM_CFG_PERROR_BLOCK 0x800
195
196
197
198 #define REG_BIM_DIAG 0x100C
199 #define BIM_DIAG_MSTR_SM_MASK 0x3FFFFF00
200
201 #define BIM_DIAG_BRST_SM_MASK 0x7F
202
203
204
205
206
207 #define REG_SW_RESET 0x1010
208 #define SW_RESET_TX 0x00000001
209
210 #define SW_RESET_RX 0x00000002
211
212 #define SW_RESET_RSTOUT 0x00000004
213
214
215
216
217
218 #define SW_RESET_BLOCK_PCS_SLINK 0x00000008
219
220
221
222 #define SW_RESET_BREQ_SM_MASK 0x00007F00
223 #define SW_RESET_PCIARB_SM_MASK 0x00070000
224
225
226
227
228
229
230
231
232 #define SW_RESET_RDPCI_SM_MASK 0x00300000
233
234
235
236 #define SW_RESET_RDARB_SM_MASK 0x00C00000
237
238
239
240
241 #define SW_RESET_WRPCI_SM_MASK 0x06000000
242
243
244
245 #define SW_RESET_WRARB_SM_MASK 0x38000000
246
247
248
249
250
251
252
253
254
255
256
257 #define REG_MINUS_BIM_DATAPATH_TEST 0x1018
258
259
260
261
262
263
264
265 #define REG_BIM_LOCAL_DEV_EN 0x1020
266
267 #define BIM_LOCAL_DEV_PAD 0x01
268
269
270
271
272 #define BIM_LOCAL_DEV_PROM 0x02
273 #define BIM_LOCAL_DEV_EXT 0x04
274
275 #define BIM_LOCAL_DEV_SOFT_0 0x08
276 #define BIM_LOCAL_DEV_SOFT_1 0x10
277 #define BIM_LOCAL_DEV_HW_RESET 0x20
278
279
280
281
282
283
284 #define REG_BIM_BUFFER_ADDR 0x1024
285
286 #define BIM_BUFFER_ADDR_MASK 0x3F
287 #define BIM_BUFFER_WR_SELECT 0x40
288
289
290 #define REG_BIM_BUFFER_DATA_LOW 0x1028
291 #define REG_BIM_BUFFER_DATA_HI 0x102C
292
293
294
295
296 #define REG_BIM_RAM_BIST 0x102C
297
298 #define BIM_RAM_BIST_RD_START 0x01
299 #define BIM_RAM_BIST_WR_START 0x02
300
301
302 #define BIM_RAM_BIST_RD_PASS 0x04
303
304 #define BIM_RAM_BIST_WR_PASS 0x08
305
306
307 #define BIM_RAM_BIST_RD_LOW_PASS 0x10
308 #define BIM_RAM_BIST_RD_HI_PASS 0x20
309 #define BIM_RAM_BIST_WR_LOW_PASS 0x40
310
311
312 #define BIM_RAM_BIST_WR_HI_PASS 0x80
313
314
315
316
317
318
319 #define REG_BIM_DIAG_MUX 0x1030
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341 #define REG_PLUS_PROBE_MUX_SELECT 0x1034
342 #define PROBE_MUX_EN 0x80000000
343
344
345 #define PROBE_MUX_SUB_MUX_MASK 0x0000FF00
346
347
348
349
350 #define PROBE_MUX_SEL_HI_MASK 0x000000F0
351
352
353 #define PROBE_MUX_SEL_LOW_MASK 0x0000000F
354
355
356
357
358
359 #define REG_PLUS_INTR_MASK_1 0x1038
360
361 #define REG_PLUS_INTRN_MASK(x) (REG_PLUS_INTR_MASK_1 + ((x) - 1)*16)
362
363
364
365
366
367 #define INTR_RX_DONE_ALT 0x01
368 #define INTR_RX_COMP_FULL_ALT 0x02
369 #define INTR_RX_COMP_AF_ALT 0x04
370 #define INTR_RX_BUF_UNAVAIL_1 0x08
371 #define INTR_RX_BUF_AE_1 0x10
372 #define INTRN_MASK_RX_EN 0x80
373 #define INTRN_MASK_CLEAR_ALL (INTR_RX_DONE_ALT | \
374 INTR_RX_COMP_FULL_ALT | \
375 INTR_RX_COMP_AF_ALT | \
376 INTR_RX_BUF_UNAVAIL_1 | \
377 INTR_RX_BUF_AE_1)
378 #define REG_PLUS_INTR_STATUS_1 0x103C
379
380 #define REG_PLUS_INTRN_STATUS(x) (REG_PLUS_INTR_STATUS_1 + ((x) - 1)*16)
381 #define INTR_STATUS_ALT_INTX_EN 0x80
382
383
384 #define REG_PLUS_ALIAS_CLEAR_1 0x1040
385
386 #define REG_PLUS_ALIASN_CLEAR(x) (REG_PLUS_ALIAS_CLEAR_1 + ((x) - 1)*16)
387
388 #define REG_PLUS_INTR_STATUS_ALIAS_1 0x1044
389
390 #define REG_PLUS_INTRN_STATUS_ALIAS(x) (REG_PLUS_INTR_STATUS_ALIAS_1 + ((x) - 1)*16)
391
392 #define REG_SATURN_PCFG 0x106c
393
394
395 #define SATURN_PCFG_TLA 0x00000001
396 #define SATURN_PCFG_FLA 0x00000002
397 #define SATURN_PCFG_CLA 0x00000004
398 #define SATURN_PCFG_LLA 0x00000008
399 #define SATURN_PCFG_RLA 0x00000010
400 #define SATURN_PCFG_PDS 0x00000020
401
402 #define SATURN_PCFG_MTP 0x00000080
403 #define SATURN_PCFG_GMO 0x00000100
404
405
406 #define SATURN_PCFG_FSI 0x00000200
407
408
409
410 #define SATURN_PCFG_LAD 0x00000800
411
412
413
414
415
416
417
418 #define MAX_TX_RINGS_SHIFT 2
419 #define MAX_TX_RINGS (1 << MAX_TX_RINGS_SHIFT)
420 #define MAX_TX_RINGS_MASK (MAX_TX_RINGS - 1)
421
422
423
424
425
426 #define REG_TX_CFG 0x2004
427 #define TX_CFG_DMA_EN 0x00000001
428
429
430 #define TX_CFG_FIFO_PIO_SEL 0x00000002
431
432
433
434
435 #define TX_CFG_DESC_RING0_MASK 0x0000003C
436
437 #define TX_CFG_DESC_RING0_SHIFT 2
438 #define TX_CFG_DESC_RINGN_MASK(a) (TX_CFG_DESC_RING0_MASK << (a)*4)
439 #define TX_CFG_DESC_RINGN_SHIFT(a) (TX_CFG_DESC_RING0_SHIFT + (a)*4)
440 #define TX_CFG_PACED_MODE 0x00100000
441
442
443
444 #define TX_CFG_DMA_RDPIPE_DIS 0x01000000
445 #define TX_CFG_COMPWB_Q1 0x02000000
446
447
448 #define TX_CFG_COMPWB_Q2 0x04000000
449
450
451 #define TX_CFG_COMPWB_Q3 0x08000000
452
453
454 #define TX_CFG_COMPWB_Q4 0x10000000
455
456
457 #define TX_CFG_INTR_COMPWB_DIS 0x20000000
458
459 #define TX_CFG_CTX_SEL_MASK 0xC0000000
460
461
462
463
464
465
466
467
468
469
470
471
472 #define TX_CFG_CTX_SEL_SHIFT 30
473
474
475
476
477 #define REG_TX_FIFO_WRITE_PTR 0x2014
478 #define REG_TX_FIFO_SHADOW_WRITE_PTR 0x2018
479
480
481 #define REG_TX_FIFO_READ_PTR 0x201C
482 #define REG_TX_FIFO_SHADOW_READ_PTR 0x2020
483
484
485
486 #define REG_TX_FIFO_PKT_CNT 0x2024
487
488
489 #define REG_TX_SM_1 0x2028
490 #define TX_SM_1_CHAIN_MASK 0x000003FF
491 #define TX_SM_1_CSUM_MASK 0x00000C00
492 #define TX_SM_1_FIFO_LOAD_MASK 0x0003F000
493
494 #define TX_SM_1_FIFO_UNLOAD_MASK 0x003C0000
495 #define TX_SM_1_CACHE_MASK 0x03C00000
496
497 #define TX_SM_1_CBQ_ARB_MASK 0xF8000000
498
499 #define REG_TX_SM_2 0x202C
500 #define TX_SM_2_COMP_WB_MASK 0x07
501 #define TX_SM_2_SUB_LOAD_MASK 0x38
502 #define TX_SM_2_KICK_MASK 0xC0
503
504
505
506
507 #define REG_TX_DATA_PTR_LOW 0x2030
508 #define REG_TX_DATA_PTR_HI 0x2034
509
510
511
512
513
514
515
516 #define REG_TX_KICK0 0x2038
517 #define REG_TX_KICKN(x) (REG_TX_KICK0 + (x)*4)
518 #define REG_TX_COMP0 0x2048
519 #define REG_TX_COMPN(x) (REG_TX_COMP0 + (x)*4)
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537 #define TX_COMPWB_SIZE 8
538 #define REG_TX_COMPWB_DB_LOW 0x2058
539
540 #define REG_TX_COMPWB_DB_HI 0x205C
541
542 #define TX_COMPWB_MSB_MASK 0x00000000000000FFULL
543 #define TX_COMPWB_MSB_SHIFT 0
544 #define TX_COMPWB_LSB_MASK 0x000000000000FF00ULL
545 #define TX_COMPWB_LSB_SHIFT 8
546 #define TX_COMPWB_NEXT(x) ((x) >> 16)
547
548
549
550 #define REG_TX_DB0_LOW 0x2060
551 #define REG_TX_DB0_HI 0x2064
552 #define REG_TX_DBN_LOW(x) (REG_TX_DB0_LOW + (x)*8)
553 #define REG_TX_DBN_HI(x) (REG_TX_DB0_HI + (x)*8)
554
555
556
557
558
559
560
561
562
563
564 #define REG_TX_MAXBURST_0 0x2080
565 #define REG_TX_MAXBURST_1 0x2084
566 #define REG_TX_MAXBURST_2 0x2088
567 #define REG_TX_MAXBURST_3 0x208C
568
569
570
571
572
573
574
575
576 #define REG_TX_FIFO_ADDR 0x2104
577 #define REG_TX_FIFO_TAG 0x2108
578 #define REG_TX_FIFO_DATA_LOW 0x210C
579 #define REG_TX_FIFO_DATA_HI_T1 0x2110
580 #define REG_TX_FIFO_DATA_HI_T0 0x2114
581 #define REG_TX_FIFO_SIZE 0x2118
582
583
584
585
586 #define REG_TX_RAMBIST 0x211C
587 #define TX_RAMBIST_STATE 0x01C0
588
589 #define TX_RAMBIST_RAM33A_PASS 0x0020
590 #define TX_RAMBIST_RAM32A_PASS 0x0010
591 #define TX_RAMBIST_RAM33B_PASS 0x0008
592 #define TX_RAMBIST_RAM32B_PASS 0x0004
593 #define TX_RAMBIST_SUMMARY 0x0002
594 #define TX_RAMBIST_START 0x0001
595
596
597
598 #define MAX_RX_DESC_RINGS 2
599 #define MAX_RX_COMP_RINGS 4
600
601
602
603
604
605
606 #define REG_RX_CFG 0x4000
607 #define RX_CFG_DMA_EN 0x00000001
608
609
610
611
612
613 #define RX_CFG_DESC_RING_MASK 0x0000001E
614
615
616 #define RX_CFG_DESC_RING_SHIFT 1
617 #define RX_CFG_COMP_RING_MASK 0x000001E0
618
619 #define RX_CFG_COMP_RING_SHIFT 5
620 #define RX_CFG_BATCH_DIS 0x00000200
621
622
623 #define RX_CFG_SWIVEL_MASK 0x00001C00
624
625
626
627
628
629
630
631
632 #define RX_CFG_SWIVEL_SHIFT 10
633
634
635 #define RX_CFG_DESC_RING1_MASK 0x000F0000
636
637
638 #define RX_CFG_DESC_RING1_SHIFT 16
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653 #define REG_RX_PAGE_SIZE 0x4004
654 #define RX_PAGE_SIZE_MASK 0x00000003
655
656
657
658
659
660
661
662 #define RX_PAGE_SIZE_SHIFT 0
663 #define RX_PAGE_SIZE_MTU_COUNT_MASK 0x00007800
664
665
666 #define RX_PAGE_SIZE_MTU_COUNT_SHIFT 11
667 #define RX_PAGE_SIZE_MTU_STRIDE_MASK 0x18000000
668
669
670
671
672
673
674 #define RX_PAGE_SIZE_MTU_STRIDE_SHIFT 27
675 #define RX_PAGE_SIZE_MTU_OFF_MASK 0xC0000000
676
677
678
679
680
681
682 #define RX_PAGE_SIZE_MTU_OFF_SHIFT 30
683
684
685
686
687
688 #define REG_RX_FIFO_WRITE_PTR 0x4008
689 #define REG_RX_FIFO_READ_PTR 0x400C
690 #define REG_RX_IPP_FIFO_SHADOW_WRITE_PTR 0x4010
691
692 #define REG_RX_IPP_FIFO_SHADOW_READ_PTR 0x4014
693
694 #define REG_RX_IPP_FIFO_READ_PTR 0x400C
695
696
697
698
699
700 #define REG_RX_DEBUG 0x401C
701 #define RX_DEBUG_LOAD_STATE_MASK 0x0000000F
702
703
704
705
706
707
708
709
710
711 #define RX_DEBUG_LM_STATE_MASK 0x00000070
712
713
714
715
716
717
718
719
720 #define RX_DEBUG_FC_STATE_MASK 0x000000180
721
722
723
724
725
726 #define RX_DEBUG_DATA_STATE_MASK 0x000001E00
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744 #define RX_DEBUG_DESC_STATE_MASK 0x0001E000
745
746
747
748
749
750
751
752
753
754
755
756 #define RX_DEBUG_INTR_READ_PTR_MASK 0x30000000
757
758 #define RX_DEBUG_INTR_WRITE_PTR_MASK 0xC0000000
759
760
761
762
763
764
765
766
767
768
769
770 #define REG_RX_PAUSE_THRESH 0x4020
771 #define RX_PAUSE_THRESH_QUANTUM 64
772 #define RX_PAUSE_THRESH_OFF_MASK 0x000001FF
773
774
775 #define RX_PAUSE_THRESH_OFF_SHIFT 0
776 #define RX_PAUSE_THRESH_ON_MASK 0x001FF000
777
778
779
780
781
782
783 #define RX_PAUSE_THRESH_ON_SHIFT 12
784
785
786
787
788
789
790
791 #define REG_RX_KICK 0x4024
792
793
794
795
796 #define REG_RX_DB_LOW 0x4028
797
798 #define REG_RX_DB_HI 0x402C
799
800 #define REG_RX_CB_LOW 0x4030
801
802 #define REG_RX_CB_HI 0x4034
803
804
805
806
807
808 #define REG_RX_COMP 0x4038
809
810
811
812
813
814
815
816
817
818
819
820 #define REG_RX_COMP_HEAD 0x403C
821 #define REG_RX_COMP_TAIL 0x4040
822
823
824
825
826 #define REG_RX_BLANK 0x4044
827
828 #define RX_BLANK_INTR_PKT_MASK 0x000001FF
829
830
831
832
833
834 #define RX_BLANK_INTR_PKT_SHIFT 0
835 #define RX_BLANK_INTR_TIME_MASK 0x3FFFF000
836
837
838
839
840
841
842 #define RX_BLANK_INTR_TIME_SHIFT 12
843
844
845
846
847
848 #define REG_RX_AE_THRESH 0x4048
849
850 #define RX_AE_THRESH_FREE_MASK 0x00001FFF
851
852
853
854 #define RX_AE_THRESH_FREE_SHIFT 0
855 #define RX_AE_THRESH_COMP_MASK 0x0FFFE000
856
857
858
859
860 #define RX_AE_THRESH_COMP_SHIFT 13
861
862
863
864
865
866
867
868 #define REG_RX_RED 0x404C
869 #define RX_RED_4K_6K_FIFO_MASK 0x000000FF
870 #define RX_RED_6K_8K_FIFO_MASK 0x0000FF00
871 #define RX_RED_8K_10K_FIFO_MASK 0x00FF0000
872 #define RX_RED_10K_12K_FIFO_MASK 0xFF000000
873
874
875
876
877
878 #define REG_RX_FIFO_FULLNESS 0x4050
879 #define RX_FIFO_FULLNESS_RX_FIFO_MASK 0x3FF80000
880 #define RX_FIFO_FULLNESS_IPP_FIFO_MASK 0x0007FF00
881 #define RX_FIFO_FULLNESS_RX_PKT_MASK 0x000000FF
882 #define REG_RX_IPP_PACKET_COUNT 0x4054
883 #define REG_RX_WORK_DMA_PTR_LOW 0x4058
884 #define REG_RX_WORK_DMA_PTR_HI 0x405C
885
886
887
888
889
890
891
892 #define REG_RX_BIST 0x4060
893 #define RX_BIST_32A_PASS 0x80000000
894 #define RX_BIST_33A_PASS 0x40000000
895 #define RX_BIST_32B_PASS 0x20000000
896 #define RX_BIST_33B_PASS 0x10000000
897 #define RX_BIST_32C_PASS 0x08000000
898 #define RX_BIST_33C_PASS 0x04000000
899 #define RX_BIST_IPP_32A_PASS 0x02000000
900 #define RX_BIST_IPP_33A_PASS 0x01000000
901 #define RX_BIST_IPP_32B_PASS 0x00800000
902 #define RX_BIST_IPP_33B_PASS 0x00400000
903 #define RX_BIST_IPP_32C_PASS 0x00200000
904 #define RX_BIST_IPP_33C_PASS 0x00100000
905 #define RX_BIST_CTRL_32_PASS 0x00800000
906 #define RX_BIST_CTRL_33_PASS 0x00400000
907 #define RX_BIST_REAS_26A_PASS 0x00200000
908 #define RX_BIST_REAS_26B_PASS 0x00100000
909 #define RX_BIST_REAS_27_PASS 0x00080000
910 #define RX_BIST_STATE_MASK 0x00078000
911 #define RX_BIST_SUMMARY 0x00000002
912
913
914
915
916 #define RX_BIST_START 0x00000001
917
918
919
920
921
922
923
924 #define REG_RX_CTRL_FIFO_WRITE_PTR 0x4064
925
926 #define REG_RX_CTRL_FIFO_READ_PTR 0x4068
927
928
929
930
931
932
933 #define REG_RX_BLANK_ALIAS_READ 0x406C
934
935 #define RX_BAR_INTR_PACKET_MASK 0x000001FF
936
937
938
939
940
941
942 #define RX_BAR_INTR_TIME_MASK 0x3FFFF000
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957 #define REG_RX_FIFO_ADDR 0x4080
958 #define REG_RX_FIFO_TAG 0x4084
959 #define REG_RX_FIFO_DATA_LOW 0x4088
960 #define REG_RX_FIFO_DATA_HI_T0 0x408C
961 #define REG_RX_FIFO_DATA_HI_T1 0x4090
962
963
964
965
966
967
968
969
970 #define REG_RX_CTRL_FIFO_ADDR 0x4094
971
972 #define REG_RX_CTRL_FIFO_DATA_LOW 0x4098
973
974 #define REG_RX_CTRL_FIFO_DATA_MID 0x409C
975
976 #define REG_RX_CTRL_FIFO_DATA_HI 0x4100
977
978 #define RX_CTRL_FIFO_DATA_HI_CTRL 0x0001
979 #define RX_CTRL_FIFO_DATA_HI_FLOW_MASK 0x007E
980
981
982
983
984 #define REG_RX_IPP_FIFO_ADDR 0x4104
985 #define REG_RX_IPP_FIFO_TAG 0x4108
986 #define REG_RX_IPP_FIFO_DATA_LOW 0x410C
987 #define REG_RX_IPP_FIFO_DATA_HI_T0 0x4110
988
989 #define REG_RX_IPP_FIFO_DATA_HI_T1 0x4114
990
991
992
993
994
995
996
997
998 #define REG_RX_HEADER_PAGE_PTR_LOW 0x4118
999
1000 #define REG_RX_HEADER_PAGE_PTR_HI 0x411C
1001
1002 #define REG_RX_MTU_PAGE_PTR_LOW 0x4120
1003
1004 #define REG_RX_MTU_PAGE_PTR_HI 0x4124
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016 #define REG_RX_TABLE_ADDR 0x4128
1017
1018 #define RX_TABLE_ADDR_MASK 0x0000003F
1019
1020 #define REG_RX_TABLE_DATA_LOW 0x412C
1021
1022 #define REG_RX_TABLE_DATA_MID 0x4130
1023
1024 #define REG_RX_TABLE_DATA_HI 0x4134
1025
1026
1027
1028
1029
1030
1031 #define REG_PLUS_RX_DB1_LOW 0x4200
1032
1033 #define REG_PLUS_RX_DB1_HI 0x4204
1034
1035 #define REG_PLUS_RX_CB1_LOW 0x4208
1036
1037 #define REG_PLUS_RX_CB1_HI 0x420C
1038
1039 #define REG_PLUS_RX_CBN_LOW(x) (REG_PLUS_RX_CB1_LOW + 8*((x) - 1))
1040 #define REG_PLUS_RX_CBN_HI(x) (REG_PLUS_RX_CB1_HI + 8*((x) - 1))
1041 #define REG_PLUS_RX_KICK1 0x4220
1042 #define REG_PLUS_RX_COMP1 0x4224
1043
1044 #define REG_PLUS_RX_COMP1_HEAD 0x4228
1045
1046 #define REG_PLUS_RX_COMP1_TAIL 0x422C
1047
1048 #define REG_PLUS_RX_COMPN_HEAD(x) (REG_PLUS_RX_COMP1_HEAD + 8*((x) - 1))
1049 #define REG_PLUS_RX_COMPN_TAIL(x) (REG_PLUS_RX_COMP1_TAIL + 8*((x) - 1))
1050 #define REG_PLUS_RX_AE1_THRESH 0x4240
1051
1052 #define RX_AE1_THRESH_FREE_MASK RX_AE_THRESH_FREE_MASK
1053 #define RX_AE1_THRESH_FREE_SHIFT RX_AE_THRESH_FREE_SHIFT
1054
1055
1056
1057
1058
1059
1060 #define REG_HP_CFG 0x4140
1061
1062 #define HP_CFG_PARSE_EN 0x00000001
1063 #define HP_CFG_NUM_CPU_MASK 0x000000FC
1064
1065 #define HP_CFG_NUM_CPU_SHIFT 2
1066 #define HP_CFG_SYN_INC_MASK 0x00000100
1067
1068
1069 #define HP_CFG_TCP_THRESH_MASK 0x000FFE00
1070
1071
1072 #define HP_CFG_TCP_THRESH_SHIFT 9
1073
1074
1075
1076
1077
1078
1079
1080 #define REG_HP_INSTR_RAM_ADDR 0x4144
1081
1082 #define HP_INSTR_RAM_ADDR_MASK 0x01F
1083 #define REG_HP_INSTR_RAM_DATA_LOW 0x4148
1084
1085 #define HP_INSTR_RAM_LOW_OUTMASK_MASK 0x0000FFFF
1086 #define HP_INSTR_RAM_LOW_OUTMASK_SHIFT 0
1087 #define HP_INSTR_RAM_LOW_OUTSHIFT_MASK 0x000F0000
1088 #define HP_INSTR_RAM_LOW_OUTSHIFT_SHIFT 16
1089 #define HP_INSTR_RAM_LOW_OUTEN_MASK 0x00300000
1090 #define HP_INSTR_RAM_LOW_OUTEN_SHIFT 20
1091 #define HP_INSTR_RAM_LOW_OUTARG_MASK 0xFFC00000
1092 #define HP_INSTR_RAM_LOW_OUTARG_SHIFT 22
1093 #define REG_HP_INSTR_RAM_DATA_MID 0x414C
1094
1095 #define HP_INSTR_RAM_MID_OUTARG_MASK 0x00000003
1096 #define HP_INSTR_RAM_MID_OUTARG_SHIFT 0
1097 #define HP_INSTR_RAM_MID_OUTOP_MASK 0x0000003C
1098 #define HP_INSTR_RAM_MID_OUTOP_SHIFT 2
1099 #define HP_INSTR_RAM_MID_FNEXT_MASK 0x000007C0
1100 #define HP_INSTR_RAM_MID_FNEXT_SHIFT 6
1101 #define HP_INSTR_RAM_MID_FOFF_MASK 0x0003F800
1102 #define HP_INSTR_RAM_MID_FOFF_SHIFT 11
1103 #define HP_INSTR_RAM_MID_SNEXT_MASK 0x007C0000
1104 #define HP_INSTR_RAM_MID_SNEXT_SHIFT 18
1105 #define HP_INSTR_RAM_MID_SOFF_MASK 0x3F800000
1106 #define HP_INSTR_RAM_MID_SOFF_SHIFT 23
1107 #define HP_INSTR_RAM_MID_OP_MASK 0xC0000000
1108 #define HP_INSTR_RAM_MID_OP_SHIFT 30
1109 #define REG_HP_INSTR_RAM_DATA_HI 0x4150
1110
1111 #define HP_INSTR_RAM_HI_VAL_MASK 0x0000FFFF
1112 #define HP_INSTR_RAM_HI_VAL_SHIFT 0
1113 #define HP_INSTR_RAM_HI_MASK_MASK 0xFFFF0000
1114 #define HP_INSTR_RAM_HI_MASK_SHIFT 16
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126 #define REG_HP_DATA_RAM_FDB_ADDR 0x4154
1127
1128 #define HP_DATA_RAM_FDB_DATA_MASK 0x001F
1129
1130
1131
1132 #define HP_DATA_RAM_FDB_FDB_MASK 0x3F00
1133
1134 #define REG_HP_DATA_RAM_DATA 0x4158
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145 #define REG_HP_FLOW_DB0 0x415C
1146 #define REG_HP_FLOW_DBN(x) (REG_HP_FLOW_DB0 + (x)*4)
1147
1148
1149
1150
1151
1152 #define REG_HP_STATE_MACHINE 0x418C
1153 #define REG_HP_STATUS0 0x4190
1154 #define HP_STATUS0_SAP_MASK 0xFFFF0000
1155 #define HP_STATUS0_L3_OFF_MASK 0x0000FE00
1156 #define HP_STATUS0_LB_CPUNUM_MASK 0x000001F8
1157
1158 #define HP_STATUS0_HRP_OPCODE_MASK 0x00000007
1159
1160 #define REG_HP_STATUS1 0x4194
1161 #define HP_STATUS1_ACCUR2_MASK 0xE0000000
1162 #define HP_STATUS1_FLOWID_MASK 0x1F800000
1163 #define HP_STATUS1_TCP_OFF_MASK 0x007F0000
1164 #define HP_STATUS1_TCP_SIZE_MASK 0x0000FFFF
1165
1166 #define REG_HP_STATUS2 0x4198
1167 #define HP_STATUS2_ACCUR2_MASK 0xF0000000
1168 #define HP_STATUS2_CSUM_OFF_MASK 0x07F00000
1169
1170 #define HP_STATUS2_ACCUR1_MASK 0x000FE000
1171 #define HP_STATUS2_FORCE_DROP 0x00001000
1172 #define HP_STATUS2_BWO_REASSM 0x00000800
1173
1174 #define HP_STATUS2_JH_SPLIT_EN 0x00000400
1175
1176 #define HP_STATUS2_FORCE_TCP_NOCHECK 0x00000200
1177
1178 #define HP_STATUS2_DATA_MASK_ZERO 0x00000100
1179
1180 #define HP_STATUS2_FORCE_TCP_CHECK 0x00000080
1181
1182 #define HP_STATUS2_MASK_TCP_THRESH 0x00000040
1183
1184 #define HP_STATUS2_NO_ASSIST 0x00000020
1185 #define HP_STATUS2_CTRL_PACKET_FLAG 0x00000010
1186 #define HP_STATUS2_TCP_FLAG_CHECK 0x00000008
1187 #define HP_STATUS2_SYN_FLAG 0x00000004
1188 #define HP_STATUS2_TCP_CHECK 0x00000002
1189 #define HP_STATUS2_TCP_NOCHECK 0x00000001
1190
1191
1192
1193
1194
1195
1196 #define REG_HP_RAM_BIST 0x419C
1197 #define HP_RAM_BIST_HP_DATA_PASS 0x80000000
1198 #define HP_RAM_BIST_HP_INSTR0_PASS 0x40000000
1199 #define HP_RAM_BIST_HP_INSTR1_PASS 0x20000000
1200 #define HP_RAM_BIST_HP_INSTR2_PASS 0x10000000
1201 #define HP_RAM_BIST_FDBM_AGE0_PASS 0x08000000
1202 #define HP_RAM_BIST_FDBM_AGE1_PASS 0x04000000
1203 #define HP_RAM_BIST_FDBM_FLOWID00_PASS 0x02000000
1204
1205 #define HP_RAM_BIST_FDBM_FLOWID10_PASS 0x01000000
1206
1207 #define HP_RAM_BIST_FDBM_FLOWID20_PASS 0x00800000
1208
1209 #define HP_RAM_BIST_FDBM_FLOWID30_PASS 0x00400000
1210
1211 #define HP_RAM_BIST_FDBM_FLOWID01_PASS 0x00200000
1212
1213 #define HP_RAM_BIST_FDBM_FLOWID11_PASS 0x00100000
1214
1215 #define HP_RAM_BIST_FDBM_FLOWID21_PASS 0x00080000
1216
1217 #define HP_RAM_BIST_FDBM_FLOWID31_PASS 0x00040000
1218
1219 #define HP_RAM_BIST_FDBM_TCPSEQ_PASS 0x00020000
1220
1221 #define HP_RAM_BIST_SUMMARY 0x00000002
1222 #define HP_RAM_BIST_START 0x00000001
1223
1224
1225
1226
1227
1228
1229 #define REG_MAC_TX_RESET 0x6000
1230
1231 #define REG_MAC_RX_RESET 0x6004
1232
1233
1234
1235 #define REG_MAC_SEND_PAUSE 0x6008
1236 #define MAC_SEND_PAUSE_TIME_MASK 0x0000FFFF
1237
1238
1239
1240 #define MAC_SEND_PAUSE_SEND 0x00010000
1241
1242
1243
1244
1245
1246
1247
1248
1249 #define REG_MAC_TX_STATUS 0x6010
1250 #define MAC_TX_FRAME_XMIT 0x0001
1251
1252 #define MAC_TX_UNDERRUN 0x0002
1253
1254
1255
1256 #define MAC_TX_MAX_PACKET_ERR 0x0004
1257
1258
1259 #define MAC_TX_COLL_NORMAL 0x0008
1260
1261 #define MAC_TX_COLL_EXCESS 0x0010
1262
1263 #define MAC_TX_COLL_LATE 0x0020
1264
1265 #define MAC_TX_COLL_FIRST 0x0040
1266
1267 #define MAC_TX_DEFER_TIMER 0x0080
1268
1269 #define MAC_TX_PEAK_ATTEMPTS 0x0100
1270
1271
1272 #define REG_MAC_RX_STATUS 0x6014
1273 #define MAC_RX_FRAME_RECV 0x0001
1274
1275 #define MAC_RX_OVERFLOW 0x0002
1276
1277 #define MAC_RX_FRAME_COUNT 0x0004
1278
1279 #define MAC_RX_ALIGN_ERR 0x0008
1280
1281 #define MAC_RX_CRC_ERR 0x0010
1282
1283 #define MAC_RX_LEN_ERR 0x0020
1284
1285 #define MAC_RX_VIOL_ERR 0x0040
1286
1287
1288
1289 #define REG_MAC_CTRL_STATUS 0x6018
1290 #define MAC_CTRL_PAUSE_RECEIVED 0x00000001
1291
1292
1293
1294 #define MAC_CTRL_PAUSE_STATE 0x00000002
1295
1296
1297
1298 #define MAC_CTRL_NOPAUSE_STATE 0x00000004
1299
1300
1301
1302 #define MAC_CTRL_PAUSE_TIME_MASK 0xFFFF0000
1303
1304
1305
1306
1307
1308
1309 #define REG_MAC_TX_MASK 0x6020
1310
1311 #define REG_MAC_RX_MASK 0x6024
1312
1313 #define REG_MAC_CTRL_MASK 0x6028
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325 #define REG_MAC_TX_CFG 0x6030
1326 #define MAC_TX_CFG_EN 0x0001
1327
1328
1329
1330
1331
1332
1333 #define MAC_TX_CFG_IGNORE_CARRIER 0x0002
1334
1335
1336
1337 #define MAC_TX_CFG_IGNORE_COLL 0x0004
1338
1339
1340
1341 #define MAC_TX_CFG_IPG_EN 0x0008
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357 #define MAC_TX_CFG_NEVER_GIVE_UP_EN 0x0010
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369 #define MAC_TX_CFG_NEVER_GIVE_UP_LIM 0x0020
1370
1371
1372
1373
1374
1375
1376
1377 #define MAC_TX_CFG_NO_BACKOFF 0x0040
1378
1379
1380
1381
1382
1383 #define MAC_TX_CFG_SLOW_DOWN 0x0080
1384
1385
1386
1387
1388
1389
1390
1391
1392 #define MAC_TX_CFG_NO_FCS 0x0100
1393
1394
1395
1396
1397
1398
1399 #define MAC_TX_CFG_CARRIER_EXTEND 0x0200
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420 #define REG_MAC_RX_CFG 0x6034
1421 #define MAC_RX_CFG_EN 0x0001
1422 #define MAC_RX_CFG_STRIP_PAD 0x0002
1423
1424 #define MAC_RX_CFG_STRIP_FCS 0x0004
1425
1426
1427 #define MAC_RX_CFG_PROMISC_EN 0x0008
1428 #define MAC_RX_CFG_PROMISC_GROUP_EN 0x0010
1429
1430
1431 #define MAC_RX_CFG_HASH_FILTER_EN 0x0020
1432
1433 #define MAC_RX_CFG_ADDR_FILTER_EN 0x0040
1434
1435
1436
1437
1438 #define MAC_RX_CFG_DISABLE_DISCARD 0x0080
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448 #define MAC_RX_CFG_CARRIER_EXTEND 0x0100
1449
1450
1451
1452
1453
1454
1455
1456 #define REG_MAC_CTRL_CFG 0x6038
1457 #define MAC_CTRL_CFG_SEND_PAUSE_EN 0x0001
1458
1459
1460 #define MAC_CTRL_CFG_RECV_PAUSE_EN 0x0002
1461
1462 #define MAC_CTRL_CFG_PASS_CTRL 0x0004
1463
1464
1465
1466
1467
1468
1469
1470
1471 #define REG_MAC_XIF_CFG 0x603C
1472 #define MAC_XIF_TX_MII_OUTPUT_EN 0x0001
1473
1474 #define MAC_XIF_MII_INT_LOOPBACK 0x0002
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484 #define MAC_XIF_DISABLE_ECHO 0x0004
1485
1486
1487
1488
1489
1490
1491
1492
1493 #define MAC_XIF_GMII_MODE 0x0008
1494
1495 #define MAC_XIF_MII_BUFFER_OUTPUT_EN 0x0010
1496
1497
1498
1499 #define MAC_XIF_LINK_LED 0x0020
1500 #define MAC_XIF_FDPLX_LED 0x0040
1501
1502 #define REG_MAC_IPG0 0x6040
1503
1504 #define REG_MAC_IPG1 0x6044
1505
1506 #define REG_MAC_IPG2 0x6048
1507
1508 #define REG_MAC_SLOT_TIME 0x604C
1509
1510 #define REG_MAC_FRAMESIZE_MIN 0x6050
1511
1512
1513
1514
1515
1516 #define REG_MAC_FRAMESIZE_MAX 0x6054
1517 #define MAC_FRAMESIZE_MAX_BURST_MASK 0x3FFF0000
1518 #define MAC_FRAMESIZE_MAX_BURST_SHIFT 16
1519 #define MAC_FRAMESIZE_MAX_FRAME_MASK 0x00007FFF
1520 #define MAC_FRAMESIZE_MAX_FRAME_SHIFT 0
1521 #define REG_MAC_PA_SIZE 0x6058
1522
1523
1524
1525
1526
1527
1528 #define REG_MAC_JAM_SIZE 0x605C
1529
1530
1531
1532 #define REG_MAC_ATTEMPT_LIMIT 0x6060
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544 #define REG_MAC_CTRL_TYPE 0x6064
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571 #define REG_MAC_ADDR0 0x6080
1572 #define REG_MAC_ADDRN(x) (REG_MAC_ADDR0 + (x)*4)
1573 #define REG_MAC_ADDR_FILTER0 0x614C
1574
1575 #define REG_MAC_ADDR_FILTER1 0x6150
1576
1577 #define REG_MAC_ADDR_FILTER2 0x6154
1578
1579 #define REG_MAC_ADDR_FILTER2_1_MASK 0x6158
1580
1581
1582
1583 #define REG_MAC_ADDR_FILTER0_MASK 0x615C
1584
1585
1586
1587
1588
1589
1590
1591 #define REG_MAC_HASH_TABLE0 0x6160
1592 #define REG_MAC_HASH_TABLEN(x) (REG_MAC_HASH_TABLE0 + (x)*4)
1593
1594
1595
1596
1597
1598 #define REG_MAC_COLL_NORMAL 0x61A0
1599
1600 #define REG_MAC_COLL_FIRST 0x61A4
1601
1602
1603 #define REG_MAC_COLL_EXCESS 0x61A8
1604
1605 #define REG_MAC_COLL_LATE 0x61AC
1606 #define REG_MAC_TIMER_DEFER 0x61B0
1607
1608
1609 #define REG_MAC_ATTEMPTS_PEAK 0x61B4
1610 #define REG_MAC_RECV_FRAME 0x61B8
1611 #define REG_MAC_LEN_ERR 0x61BC
1612 #define REG_MAC_ALIGN_ERR 0x61C0
1613 #define REG_MAC_FCS_ERR 0x61C4
1614 #define REG_MAC_RX_CODE_ERR 0x61C8
1615
1616
1617
1618 #define REG_MAC_RANDOM_SEED 0x61CC
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637 #define REG_MAC_STATE_MACHINE 0x61D0
1638 #define MAC_SM_RLM_MASK 0x07800000
1639 #define MAC_SM_RLM_SHIFT 23
1640 #define MAC_SM_RX_FC_MASK 0x00700000
1641 #define MAC_SM_RX_FC_SHIFT 20
1642 #define MAC_SM_TLM_MASK 0x000F0000
1643 #define MAC_SM_TLM_SHIFT 16
1644 #define MAC_SM_ENCAP_SM_MASK 0x0000F000
1645 #define MAC_SM_ENCAP_SM_SHIFT 12
1646 #define MAC_SM_TX_REQ_MASK 0x00000C00
1647 #define MAC_SM_TX_REQ_SHIFT 10
1648 #define MAC_SM_TX_FC_MASK 0x000003C0
1649 #define MAC_SM_TX_FC_SHIFT 6
1650 #define MAC_SM_FIFO_WRITE_SEL_MASK 0x00000038
1651 #define MAC_SM_FIFO_WRITE_SEL_SHIFT 3
1652 #define MAC_SM_TX_FIFO_EMPTY_MASK 0x00000007
1653 #define MAC_SM_TX_FIFO_EMPTY_SHIFT 0
1654
1655
1656
1657
1658 #define REG_MIF_BIT_BANG_CLOCK 0x6200
1659
1660
1661
1662 #define REG_MIF_BIT_BANG_DATA 0x6204
1663
1664 #define REG_MIF_BIT_BANG_OUTPUT_EN 0x6208
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677 #define REG_MIF_FRAME 0x620C
1678 #define MIF_FRAME_START_MASK 0xC0000000
1679
1680
1681 #define MIF_FRAME_ST 0x40000000
1682 #define MIF_FRAME_OPCODE_MASK 0x30000000
1683
1684
1685 #define MIF_FRAME_OP_READ 0x20000000
1686 #define MIF_FRAME_OP_WRITE 0x10000000
1687 #define MIF_FRAME_PHY_ADDR_MASK 0x0F800000
1688
1689
1690
1691
1692 #define MIF_FRAME_PHY_ADDR_SHIFT 23
1693 #define MIF_FRAME_REG_ADDR_MASK 0x007C0000
1694
1695
1696
1697 #define MIF_FRAME_REG_ADDR_SHIFT 18
1698 #define MIF_FRAME_TURN_AROUND_MSB 0x00020000
1699
1700
1701 #define MIF_FRAME_TURN_AROUND_LSB 0x00010000
1702
1703
1704
1705
1706
1707
1708 #define MIF_FRAME_DATA_MASK 0x0000FFFF
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722 #define REG_MIF_CFG 0x6210
1723 #define MIF_CFG_PHY_SELECT 0x0001
1724
1725 #define MIF_CFG_POLL_EN 0x0002
1726
1727
1728 #define MIF_CFG_BB_MODE 0x0004
1729
1730 #define MIF_CFG_POLL_REG_MASK 0x00F8
1731
1732
1733
1734 #define MIF_CFG_POLL_REG_SHIFT 3
1735 #define MIF_CFG_MDIO_0 0x0100
1736
1737
1738
1739
1740
1741
1742
1743
1744 #define MIF_CFG_MDIO_1 0x0200
1745
1746
1747
1748
1749
1750
1751
1752
1753 #define MIF_CFG_POLL_PHY_MASK 0x7C00
1754
1755 #define MIF_CFG_POLL_PHY_SHIFT 10
1756
1757
1758
1759
1760
1761
1762 #define REG_MIF_MASK 0x6214
1763
1764
1765 #define REG_MIF_STATUS 0x6218
1766 #define MIF_STATUS_POLL_DATA_MASK 0xFFFF0000
1767
1768
1769
1770 #define MIF_STATUS_POLL_DATA_SHIFT 16
1771 #define MIF_STATUS_POLL_STATUS_MASK 0x0000FFFF
1772
1773
1774
1775
1776
1777 #define MIF_STATUS_POLL_STATUS_SHIFT 0
1778
1779
1780 #define REG_MIF_STATE_MACHINE 0x621C
1781 #define MIF_SM_CONTROL_MASK 0x07
1782
1783 #define MIF_SM_EXECUTION_MASK 0x60
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797 #define REG_PCS_MII_CTRL 0x9000
1798 #define PCS_MII_CTRL_1000_SEL 0x0040
1799
1800 #define PCS_MII_CTRL_COLLISION_TEST 0x0080
1801
1802
1803
1804 #define PCS_MII_CTRL_DUPLEX 0x0100
1805
1806
1807 #define PCS_MII_RESTART_AUTONEG 0x0200
1808
1809
1810 #define PCS_MII_ISOLATE 0x0400
1811
1812 #define PCS_MII_POWER_DOWN 0x0800
1813
1814 #define PCS_MII_AUTONEG_EN 0x1000
1815
1816
1817
1818
1819
1820
1821 #define PCS_MII_10_100_SEL 0x2000
1822
1823 #define PCS_MII_RESET 0x8000
1824
1825
1826
1827 #define REG_PCS_MII_STATUS 0x9004
1828 #define PCS_MII_STATUS_EXTEND_CAP 0x0001
1829 #define PCS_MII_STATUS_JABBER_DETECT 0x0002
1830 #define PCS_MII_STATUS_LINK_STATUS 0x0004
1831
1832
1833
1834
1835
1836 #define PCS_MII_STATUS_AUTONEG_ABLE 0x0008
1837
1838 #define PCS_MII_STATUS_REMOTE_FAULT 0x0010
1839
1840
1841
1842 #define PCS_MII_STATUS_AUTONEG_COMP 0x0020
1843
1844
1845
1846 #define PCS_MII_STATUS_EXTEND_STATUS 0x0100
1847
1848
1849
1850
1851
1852
1853
1854 #define REG_PCS_MII_ADVERT 0x9008
1855
1856 #define PCS_MII_ADVERT_FD 0x0020
1857
1858 #define PCS_MII_ADVERT_HD 0x0040
1859
1860 #define PCS_MII_ADVERT_SYM_PAUSE 0x0080
1861
1862 #define PCS_MII_ADVERT_ASYM_PAUSE 0x0100
1863
1864 #define PCS_MII_ADVERT_RF_MASK 0x3000
1865
1866
1867
1868
1869
1870
1871
1872 #define PCS_MII_ADVERT_ACK 0x4000
1873 #define PCS_MII_ADVERT_NEXT_PAGE 0x8000
1874
1875
1876
1877
1878 #define REG_PCS_MII_LPA 0x900C
1879
1880 #define PCS_MII_LPA_FD PCS_MII_ADVERT_FD
1881 #define PCS_MII_LPA_HD PCS_MII_ADVERT_HD
1882 #define PCS_MII_LPA_SYM_PAUSE PCS_MII_ADVERT_SYM_PAUSE
1883 #define PCS_MII_LPA_ASYM_PAUSE PCS_MII_ADVERT_ASYM_PAUSE
1884 #define PCS_MII_LPA_RF_MASK PCS_MII_ADVERT_RF_MASK
1885 #define PCS_MII_LPA_ACK PCS_MII_ADVERT_ACK
1886 #define PCS_MII_LPA_NEXT_PAGE PCS_MII_ADVERT_NEXT_PAGE
1887
1888
1889 #define REG_PCS_CFG 0x9010
1890 #define PCS_CFG_EN 0x01
1891
1892
1893 #define PCS_CFG_SD_OVERRIDE 0x02
1894
1895
1896 #define PCS_CFG_SD_ACTIVE_LOW 0x04
1897
1898
1899
1900 #define PCS_CFG_JITTER_STUDY_MASK 0x18
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910 #define PCS_CFG_10MS_TIMER_OVERRIDE 0x20
1911
1912
1913
1914
1915
1916 #define REG_PCS_STATE_MACHINE 0x9014
1917
1918 #define PCS_SM_TX_STATE_MASK 0x0000000F
1919
1920
1921
1922 #define PCS_SM_RX_STATE_MASK 0x000000F0
1923
1924
1925 #define PCS_SM_WORD_SYNC_STATE_MASK 0x00000700
1926
1927 #define PCS_SM_SEQ_DETECT_STATE_MASK 0x00001800
1928
1929
1930
1931
1932 #define PCS_SM_LINK_STATE_MASK 0x0001E000
1933 #define SM_LINK_STATE_UP 0x00016000
1934
1935 #define PCS_SM_LOSS_LINK_C 0x00100000
1936
1937
1938 #define PCS_SM_LOSS_LINK_SYNC 0x00200000
1939
1940 #define PCS_SM_LOSS_SIGNAL_DETECT 0x00400000
1941
1942
1943
1944 #define PCS_SM_NO_LINK_BREAKLINK 0x01000000
1945
1946
1947
1948
1949
1950
1951
1952
1953 #define PCS_SM_NO_LINK_SERDES 0x02000000
1954
1955
1956 #define PCS_SM_NO_LINK_C 0x04000000
1957
1958 #define PCS_SM_NO_LINK_SYNC 0x08000000
1959
1960 #define PCS_SM_NO_LINK_WAIT_C 0x10000000
1961
1962 #define PCS_SM_NO_LINK_NO_IDLE 0x20000000
1963
1964
1965
1966
1967
1968
1969
1970
1971 #define REG_PCS_INTR_STATUS 0x9018
1972 #define PCS_INTR_STATUS_LINK_CHANGE 0x04
1973
1974
1975
1976
1977
1978
1979 #define REG_PCS_DATAPATH_MODE 0x9050
1980 #define PCS_DATAPATH_MODE_MII 0x00
1981
1982
1983
1984
1985 #define PCS_DATAPATH_MODE_SERDES 0x02
1986
1987
1988
1989 #define REG_PCS_SERDES_CTRL 0x9054
1990 #define PCS_SERDES_CTRL_LOOPBACK 0x01
1991
1992 #define PCS_SERDES_CTRL_SYNCD_EN 0x02
1993
1994
1995
1996 #define PCS_SERDES_CTRL_LOCKREF 0x04
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012 #define REG_PCS_SHARED_OUTPUT_SEL 0x9058
2013 #define PCS_SOS_PROM_ADDR_MASK 0x0007
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023 #define REG_PCS_SERDES_STATE 0x905C
2024 #define PCS_SERDES_STATE_MASK 0x03
2025
2026
2027
2028
2029
2030 #define REG_PCS_PACKET_COUNT 0x9060
2031 #define PCS_PACKET_COUNT_TX 0x000007FF
2032 #define PCS_PACKET_COUNT_RX 0x07FF0000
2033
2034
2035
2036
2037
2038
2039
2040 #define REG_EXPANSION_ROM_RUN_START 0x100000
2041
2042 #define REG_EXPANSION_ROM_RUN_END 0x17FFFF
2043
2044 #define REG_SECOND_LOCALBUS_START 0x180000
2045
2046 #define REG_SECOND_LOCALBUS_END 0x1FFFFF
2047
2048
2049 #define REG_ENTROPY_START REG_SECOND_LOCALBUS_START
2050 #define REG_ENTROPY_DATA (REG_ENTROPY_START + 0x00)
2051 #define REG_ENTROPY_STATUS (REG_ENTROPY_START + 0x04)
2052 #define ENTROPY_STATUS_DRDY 0x01
2053 #define ENTROPY_STATUS_BUSY 0x02
2054 #define ENTROPY_STATUS_CIPHER 0x04
2055 #define ENTROPY_STATUS_BYPASS_MASK 0x18
2056 #define REG_ENTROPY_MODE (REG_ENTROPY_START + 0x05)
2057 #define ENTROPY_MODE_KEY_MASK 0x07
2058 #define ENTROPY_MODE_ENCRYPT 0x40
2059 #define REG_ENTROPY_RAND_REG (REG_ENTROPY_START + 0x06)
2060 #define REG_ENTROPY_RESET (REG_ENTROPY_START + 0x07)
2061 #define ENTROPY_RESET_DES_IO 0x01
2062 #define ENTROPY_RESET_STC_MODE 0x02
2063 #define ENTROPY_RESET_KEY_CACHE 0x04
2064 #define ENTROPY_RESET_IV 0x08
2065 #define REG_ENTROPY_IV (REG_ENTROPY_START + 0x08)
2066 #define REG_ENTROPY_KEY0 (REG_ENTROPY_START + 0x10)
2067 #define REG_ENTROPY_KEYN(x) (REG_ENTROPY_KEY0 + 4*(x))
2068
2069
2070 #define PHY_LUCENT_B0 0x00437421
2071 #define LUCENT_MII_REG 0x1F
2072
2073 #define PHY_NS_DP83065 0x20005c78
2074 #define DP83065_MII_MEM 0x16
2075 #define DP83065_MII_REGD 0x1D
2076 #define DP83065_MII_REGE 0x1E
2077
2078 #define PHY_BROADCOM_5411 0x00206071
2079 #define PHY_BROADCOM_B0 0x00206050
2080 #define BROADCOM_MII_REG4 0x14
2081 #define BROADCOM_MII_REG5 0x15
2082 #define BROADCOM_MII_REG7 0x17
2083 #define BROADCOM_MII_REG8 0x18
2084
2085 #define CAS_MII_ANNPTR 0x07
2086 #define CAS_MII_ANNPRR 0x08
2087 #define CAS_MII_1000_CTRL 0x09
2088 #define CAS_MII_1000_STATUS 0x0A
2089 #define CAS_MII_1000_EXTEND 0x0F
2090
2091 #define CAS_BMSR_1000_EXTEND 0x0100
2092
2093
2094
2095
2096
2097
2098 #define CAS_BMCR_SPEED1000 0x0040
2099
2100 #define CAS_ADVERTISE_1000HALF 0x0100
2101 #define CAS_ADVERTISE_1000FULL 0x0200
2102 #define CAS_ADVERTISE_PAUSE 0x0400
2103 #define CAS_ADVERTISE_ASYM_PAUSE 0x0800
2104
2105
2106 #define CAS_LPA_PAUSE CAS_ADVERTISE_PAUSE
2107 #define CAS_LPA_ASYM_PAUSE CAS_ADVERTISE_ASYM_PAUSE
2108
2109
2110 #define CAS_LPA_1000HALF 0x0400
2111 #define CAS_LPA_1000FULL 0x0800
2112
2113 #define CAS_EXTEND_1000XFULL 0x8000
2114 #define CAS_EXTEND_1000XHALF 0x4000
2115 #define CAS_EXTEND_1000TFULL 0x2000
2116 #define CAS_EXTEND_1000THALF 0x1000
2117
2118
2119 typedef struct cas_hp_inst {
2120 const char *note;
2121
2122 u16 mask, val;
2123
2124 u8 op;
2125 u8 soff, snext;
2126 u8 foff, fnext;
2127
2128 u8 outop;
2129
2130 u16 outarg;
2131 u8 outenab;
2132
2133 u8 outshift;
2134 u16 outmask;
2135 } cas_hp_inst_t;
2136
2137
2138 #define OP_EQ 0
2139 #define OP_LT 1
2140 #define OP_GT 2
2141 #define OP_NP 3
2142
2143
2144 #define CL_REG 0
2145 #define LD_FID 1
2146 #define LD_SEQ 2
2147 #define LD_CTL 3
2148 #define LD_SAP 4
2149 #define LD_R1 5
2150 #define LD_L3 6
2151 #define LD_SUM 7
2152 #define LD_HDR 8
2153 #define IM_FID 9
2154 #define IM_SEQ 10
2155 #define IM_SAP 11
2156 #define IM_R1 12
2157 #define IM_CTL 13
2158 #define LD_LEN 14
2159 #define ST_FLG 15
2160
2161
2162 #define S1_PCKT 0
2163 #define S1_VLAN 1
2164 #define S1_CFI 2
2165 #define S1_8023 3
2166 #define S1_LLC 4
2167 #define S1_LLCc 5
2168 #define S1_IPV4 6
2169 #define S1_IPV4c 7
2170 #define S1_IPV4F 8
2171 #define S1_TCP44 9
2172 #define S1_IPV6 10
2173 #define S1_IPV6L 11
2174 #define S1_IPV6c 12
2175 #define S1_TCP64 13
2176 #define S1_TCPSQ 14
2177 #define S1_TCPFG 15
2178 #define S1_TCPHL 16
2179 #define S1_TCPHc 17
2180 #define S1_CLNP 18
2181 #define S1_CLNP2 19
2182 #define S1_DROP 20
2183 #define S2_HTTP 21
2184 #define S1_ESP4 22
2185 #define S1_AH4 23
2186 #define S1_ESP6 24
2187 #define S1_AH6 25
2188
2189 #define CAS_PROG_IP46TCP4_PREAMBLE \
2190 { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0, S1_PCKT, \
2191 CL_REG, 0x3ff, 1, 0x0, 0x0000}, \
2192 { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023, \
2193 IM_CTL, 0x00a, 3, 0x0, 0xffff}, \
2194 { "CFI?", 0x1000, 0x1000, OP_EQ, 0, S1_DROP, 1, S1_8023, \
2195 CL_REG, 0x000, 0, 0x0, 0x0000}, \
2196 { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4, \
2197 CL_REG, 0x000, 0, 0x0, 0x0000}, \
2198 { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S1_CLNP, \
2199 CL_REG, 0x000, 0, 0x0, 0x0000}, \
2200 { "LLCc?", 0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S1_CLNP, \
2201 CL_REG, 0x000, 0, 0x0, 0x0000}, \
2202 { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6, \
2203 LD_SAP, 0x100, 3, 0x0, 0xffff}, \
2204 { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S1_CLNP, \
2205 LD_SUM, 0x00a, 1, 0x0, 0x0000}, \
2206 { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S1_CLNP, \
2207 LD_LEN, 0x03e, 1, 0x0, 0xffff}, \
2208 { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S1_TCPSQ, 0, S1_CLNP, \
2209 LD_FID, 0x182, 1, 0x0, 0xffff}, \
2210 { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S1_IPV6L, 0, S1_CLNP, \
2211 LD_SUM, 0x015, 1, 0x0, 0x0000}, \
2212 { "IPV6 len", 0xf000, 0x6000, OP_EQ, 0, S1_IPV6c, 0, S1_CLNP, \
2213 IM_R1, 0x128, 1, 0x0, 0xffff}, \
2214 { "IPV6 cont?", 0x0000, 0x0000, OP_EQ, 3, S1_TCP64, 0, S1_CLNP, \
2215 LD_FID, 0x484, 1, 0x0, 0xffff}, \
2216 { "TCP64?", 0xff00, 0x0600, OP_EQ, 18, S1_TCPSQ, 0, S1_CLNP, \
2217 LD_LEN, 0x03f, 1, 0x0, 0xffff}
2218
2219 #ifdef USE_HP_IP46TCP4
2220 static cas_hp_inst_t cas_prog_ip46tcp4tab[] = {
2221 CAS_PROG_IP46TCP4_PREAMBLE,
2222 { "TCP seq",
2223 0x0000, 0x0000, OP_EQ, 0, S1_TCPFG, 4, S1_TCPFG, LD_SEQ,
2224 0x081, 3, 0x0, 0xffff},
2225 { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHL, 0,
2226 S1_TCPHL, ST_FLG, 0x045, 3, 0x0, 0x002f},
2227 { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0,
2228 S1_TCPHc, LD_R1, 0x205, 3, 0xB, 0xf000},
2229 { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0,
2230 S1_PCKT, LD_HDR, 0x0ff, 3, 0x0, 0xffff},
2231 { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2,
2232 IM_CTL, 0x001, 3, 0x0, 0x0001},
2233 { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2234 IM_CTL, 0x000, 0, 0x0, 0x0000},
2235 { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2236 IM_CTL, 0x080, 3, 0x0, 0xffff},
2237 { NULL },
2238 };
2239 #ifdef HP_IP46TCP4_DEFAULT
2240 #define CAS_HP_FIRMWARE cas_prog_ip46tcp4tab
2241 #endif
2242 #endif
2243
2244
2245
2246
2247
2248 #ifdef USE_HP_IP46TCP4NOHTTP
2249 static cas_hp_inst_t cas_prog_ip46tcp4nohttptab[] = {
2250 CAS_PROG_IP46TCP4_PREAMBLE,
2251 { "TCP seq",
2252 0xFFFF, 0x0080, OP_EQ, 0, S2_HTTP, 0, S1_TCPFG, LD_SEQ,
2253 0x081, 3, 0x0, 0xffff} ,
2254 { "TCP control flags", 0xFFFF, 0x8080, OP_EQ, 0, S2_HTTP, 0,
2255 S1_TCPHL, ST_FLG, 0x145, 2, 0x0, 0x002f, },
2256 { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, S1_TCPHc,
2257 LD_R1, 0x205, 3, 0xB, 0xf000},
2258 { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2259 LD_HDR, 0x0ff, 3, 0x0, 0xffff},
2260 { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2,
2261 IM_CTL, 0x001, 3, 0x0, 0x0001},
2262 { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2263 CL_REG, 0x002, 3, 0x0, 0x0000},
2264 { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2265 IM_CTL, 0x080, 3, 0x0, 0xffff},
2266 { "No HTTP", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2267 IM_CTL, 0x044, 3, 0x0, 0xffff},
2268 { NULL },
2269 };
2270 #ifdef HP_IP46TCP4NOHTTP_DEFAULT
2271 #define CAS_HP_FIRMWARE cas_prog_ip46tcp4nohttptab
2272 #endif
2273 #endif
2274
2275
2276 #define S3_IPV6c 11
2277 #define S3_TCP64 12
2278 #define S3_TCPSQ 13
2279 #define S3_TCPFG 14
2280 #define S3_TCPHL 15
2281 #define S3_TCPHc 16
2282 #define S3_FRAG 17
2283 #define S3_FOFF 18
2284 #define S3_CLNP 19
2285
2286 #ifdef USE_HP_IP4FRAG
2287 static cas_hp_inst_t cas_prog_ip4fragtab[] = {
2288 { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0, S1_PCKT,
2289 CL_REG, 0x3ff, 1, 0x0, 0x0000},
2290 { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023,
2291 IM_CTL, 0x00a, 3, 0x0, 0xffff},
2292 { "CFI?", 0x1000, 0x1000, OP_EQ, 0, S3_CLNP, 1, S1_8023,
2293 CL_REG, 0x000, 0, 0x0, 0x0000},
2294 { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4,
2295 CL_REG, 0x000, 0, 0x0, 0x0000},
2296 { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S3_CLNP,
2297 CL_REG, 0x000, 0, 0x0, 0x0000},
2298 { "LLCc?",0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S3_CLNP,
2299 CL_REG, 0x000, 0, 0x0, 0x0000},
2300 { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6,
2301 LD_SAP, 0x100, 3, 0x0, 0xffff},
2302 { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S3_CLNP,
2303 LD_SUM, 0x00a, 1, 0x0, 0x0000},
2304 { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S3_FRAG,
2305 LD_LEN, 0x03e, 3, 0x0, 0xffff},
2306 { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S3_TCPSQ, 0, S3_CLNP,
2307 LD_FID, 0x182, 3, 0x0, 0xffff},
2308 { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S3_IPV6c, 0, S3_CLNP,
2309 LD_SUM, 0x015, 1, 0x0, 0x0000},
2310 { "IPV6 cont?", 0xf000, 0x6000, OP_EQ, 3, S3_TCP64, 0, S3_CLNP,
2311 LD_FID, 0x484, 1, 0x0, 0xffff},
2312 { "TCP64?", 0xff00, 0x0600, OP_EQ, 18, S3_TCPSQ, 0, S3_CLNP,
2313 LD_LEN, 0x03f, 1, 0x0, 0xffff},
2314 { "TCP seq",
2315 0x0000, 0x0000, OP_EQ, 0, S3_TCPFG, 4, S3_TCPFG, LD_SEQ,
2316 0x081, 3, 0x0, 0xffff},
2317 { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S3_TCPHL, 0,
2318 S3_TCPHL, ST_FLG, 0x045, 3, 0x0, 0x002f},
2319 { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S3_TCPHc, 0, S3_TCPHc,
2320 LD_R1, 0x205, 3, 0xB, 0xf000},
2321 { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2322 LD_HDR, 0x0ff, 3, 0x0, 0xffff},
2323 { "IP4 Fragment", 0x0000, 0x0000, OP_EQ, 0, S3_FOFF, 0, S3_FOFF,
2324 LD_FID, 0x103, 3, 0x0, 0xffff},
2325 { "IP4 frag offset", 0x0000, 0x0000, OP_EQ, 0, S3_FOFF, 0, S3_FOFF,
2326 LD_SEQ, 0x040, 1, 0xD, 0xfff8},
2327 { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2328 IM_CTL, 0x001, 3, 0x0, 0x0001},
2329 { NULL },
2330 };
2331 #ifdef HP_IP4FRAG_DEFAULT
2332 #define CAS_HP_FIRMWARE cas_prog_ip4fragtab
2333 #endif
2334 #endif
2335
2336
2337
2338
2339 #ifdef USE_HP_IP46TCP4BATCH
2340 static cas_hp_inst_t cas_prog_ip46tcp4batchtab[] = {
2341 CAS_PROG_IP46TCP4_PREAMBLE,
2342 { "TCP seq",
2343 0x0000, 0x0000, OP_EQ, 0, S1_TCPFG, 0, S1_TCPFG, LD_SEQ,
2344 0x081, 3, 0x0, 0xffff},
2345 { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHL, 0,
2346 S1_TCPHL, ST_FLG, 0x000, 3, 0x0, 0x0000},
2347 { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0,
2348 S1_TCPHc, LD_R1, 0x205, 3, 0xB, 0xf000},
2349 { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0,
2350 S1_PCKT, IM_CTL, 0x040, 3, 0x0, 0xffff},
2351 { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2352 IM_CTL, 0x001, 3, 0x0, 0x0001},
2353 { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0,
2354 S1_PCKT, IM_CTL, 0x080, 3, 0x0, 0xffff},
2355 { NULL },
2356 };
2357 #ifdef HP_IP46TCP4BATCH_DEFAULT
2358 #define CAS_HP_FIRMWARE cas_prog_ip46tcp4batchtab
2359 #endif
2360 #endif
2361
2362
2363
2364
2365
2366 #ifdef USE_HP_WORKAROUND
2367 static cas_hp_inst_t cas_prog_workaroundtab[] = {
2368 { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0,
2369 S1_PCKT, CL_REG, 0x3ff, 1, 0x0, 0x0000} ,
2370 { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023,
2371 IM_CTL, 0x04a, 3, 0x0, 0xffff},
2372 { "CFI?", 0x1000, 0x1000, OP_EQ, 0, S1_CLNP, 1, S1_8023,
2373 CL_REG, 0x000, 0, 0x0, 0x0000},
2374 { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4,
2375 CL_REG, 0x000, 0, 0x0, 0x0000},
2376 { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S1_CLNP,
2377 CL_REG, 0x000, 0, 0x0, 0x0000},
2378 { "LLCc?", 0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S1_CLNP,
2379 CL_REG, 0x000, 0, 0x0, 0x0000},
2380 { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6,
2381 IM_SAP, 0x6AE, 3, 0x0, 0xffff},
2382 { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S1_CLNP,
2383 LD_SUM, 0x00a, 1, 0x0, 0x0000},
2384 { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S1_CLNP,
2385 LD_LEN, 0x03e, 1, 0x0, 0xffff},
2386 { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S1_TCPSQ, 0, S1_CLNP,
2387 LD_FID, 0x182, 3, 0x0, 0xffff},
2388 { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S1_IPV6L, 0, S1_CLNP,
2389 LD_SUM, 0x015, 1, 0x0, 0x0000},
2390 { "IPV6 len", 0xf000, 0x6000, OP_EQ, 0, S1_IPV6c, 0, S1_CLNP,
2391 IM_R1, 0x128, 1, 0x0, 0xffff},
2392 { "IPV6 cont?", 0x0000, 0x0000, OP_EQ, 3, S1_TCP64, 0, S1_CLNP,
2393 LD_FID, 0x484, 1, 0x0, 0xffff},
2394 { "TCP64?", 0xff00, 0x0600, OP_EQ, 18, S1_TCPSQ, 0, S1_CLNP,
2395 LD_LEN, 0x03f, 1, 0x0, 0xffff},
2396 { "TCP seq",
2397 0x0000, 0x0000, OP_EQ, 0, S1_TCPFG, 4, S1_TCPFG, LD_SEQ,
2398 0x081, 3, 0x0, 0xffff},
2399 { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHL, 0,
2400 S1_TCPHL, ST_FLG, 0x045, 3, 0x0, 0x002f},
2401 { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, S1_TCPHc,
2402 LD_R1, 0x205, 3, 0xB, 0xf000},
2403 { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0,
2404 S1_PCKT, LD_HDR, 0x0ff, 3, 0x0, 0xffff},
2405 { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2,
2406 IM_SAP, 0x6AE, 3, 0x0, 0xffff} ,
2407 { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2408 IM_CTL, 0x001, 3, 0x0, 0x0001},
2409 { NULL },
2410 };
2411 #ifdef HP_WORKAROUND_DEFAULT
2412 #define CAS_HP_FIRMWARE cas_prog_workaroundtab
2413 #endif
2414 #endif
2415
2416 #ifdef USE_HP_ENCRYPT
2417 static cas_hp_inst_t cas_prog_encryptiontab[] = {
2418 { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0,
2419 S1_PCKT, CL_REG, 0x3ff, 1, 0x0, 0x0000},
2420 { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023,
2421 IM_CTL, 0x00a, 3, 0x0, 0xffff},
2422 #if 0
2423
2424
2425 00,
2426 #endif
2427 { "CFI?",
2428 0x1000, 0x1000, OP_EQ, 0, S1_CLNP, 1, S1_8023,
2429 CL_REG, 0x000, 0, 0x0, 0x0000},
2430 { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4,
2431 CL_REG, 0x000, 0, 0x0, 0x0000},
2432 { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S1_CLNP,
2433 CL_REG, 0x000, 0, 0x0, 0x0000},
2434 { "LLCc?", 0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S1_CLNP,
2435 CL_REG, 0x000, 0, 0x0, 0x0000},
2436 { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6,
2437 LD_SAP, 0x100, 3, 0x0, 0xffff},
2438 { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S1_CLNP,
2439 LD_SUM, 0x00a, 1, 0x0, 0x0000},
2440 { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S1_CLNP,
2441 LD_LEN, 0x03e, 1, 0x0, 0xffff},
2442 { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S1_TCPSQ, 0, S1_ESP4,
2443 LD_FID, 0x182, 1, 0x0, 0xffff},
2444 { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S1_IPV6L, 0, S1_CLNP,
2445 LD_SUM, 0x015, 1, 0x0, 0x0000},
2446 { "IPV6 len", 0xf000, 0x6000, OP_EQ, 0, S1_IPV6c, 0, S1_CLNP,
2447 IM_R1, 0x128, 1, 0x0, 0xffff},
2448 { "IPV6 cont?", 0x0000, 0x0000, OP_EQ, 3, S1_TCP64, 0, S1_CLNP,
2449 LD_FID, 0x484, 1, 0x0, 0xffff},
2450 { "TCP64?",
2451 #if 0
2452
2453 #endif
2454 0xff00, 0x0600, OP_EQ, 12, S1_TCPSQ, 0, S1_ESP6, LD_LEN,
2455 0x03f, 1, 0x0, 0xffff},
2456 { "TCP seq",
2457 0xFFFF, 0x0080, OP_EQ, 0, S2_HTTP, 0, S1_TCPFG, LD_SEQ,
2458 0x081, 3, 0x0, 0xffff},
2459 { "TCP control flags", 0xFFFF, 0x8080, OP_EQ, 0, S2_HTTP, 0,
2460 S1_TCPHL, ST_FLG, 0x145, 2, 0x0, 0x002f},
2461 { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, S1_TCPHc,
2462 LD_R1, 0x205, 3, 0xB, 0xf000} ,
2463 { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0,
2464 S1_PCKT, LD_HDR, 0x0ff, 3, 0x0, 0xffff},
2465 { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2,
2466 IM_CTL, 0x001, 3, 0x0, 0x0001},
2467 { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2468 CL_REG, 0x002, 3, 0x0, 0x0000},
2469 { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2470 IM_CTL, 0x080, 3, 0x0, 0xffff},
2471 { "No HTTP", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT,
2472 IM_CTL, 0x044, 3, 0x0, 0xffff},
2473 { "IPV4 ESP encrypted?",
2474 0x00ff, 0x0032, OP_EQ, 0, S1_CLNP2, 0, S1_AH4, IM_CTL,
2475 0x021, 1, 0x0, 0xffff},
2476 { "IPV4 AH encrypted?",
2477 0x00ff, 0x0033, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP, IM_CTL,
2478 0x021, 1, 0x0, 0xffff},
2479 { "IPV6 ESP encrypted?",
2480 #if 0
2481
2482 #endif
2483 0xff00, 0x3200, OP_EQ, 0, S1_CLNP2, 0, S1_AH6, IM_CTL,
2484 0x021, 1, 0x0, 0xffff},
2485 { "IPV6 AH encrypted?",
2486 #if 0
2487
2488 #endif
2489 0xff00, 0x3300, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP, IM_CTL,
2490 0x021, 1, 0x0, 0xffff},
2491 { NULL },
2492 };
2493 #ifdef HP_ENCRYPT_DEFAULT
2494 #define CAS_HP_FIRMWARE cas_prog_encryptiontab
2495 #endif
2496 #endif
2497
2498 static cas_hp_inst_t cas_prog_null[] = { {NULL} };
2499 #ifdef HP_NULL_DEFAULT
2500 #define CAS_HP_FIRMWARE cas_prog_null
2501 #endif
2502
2503
2504 #define CAS_PHY_UNKNOWN 0x00
2505 #define CAS_PHY_SERDES 0x01
2506 #define CAS_PHY_MII_MDIO0 0x02
2507 #define CAS_PHY_MII_MDIO1 0x04
2508 #define CAS_PHY_MII(x) ((x) & (CAS_PHY_MII_MDIO0 | CAS_PHY_MII_MDIO1))
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521 #define DESC_RING_I_TO_S(x) (32*(1 << (x)))
2522 #define COMP_RING_I_TO_S(x) (128*(1 << (x)))
2523 #define TX_DESC_RING_INDEX 4
2524 #define RX_DESC_RING_INDEX 4
2525 #define RX_COMP_RING_INDEX 4
2526
2527 #if (TX_DESC_RING_INDEX > 8) || (TX_DESC_RING_INDEX < 0)
2528 #error TX_DESC_RING_INDEX must be between 0 and 8
2529 #endif
2530
2531 #if (RX_DESC_RING_INDEX > 8) || (RX_DESC_RING_INDEX < 0)
2532 #error RX_DESC_RING_INDEX must be between 0 and 8
2533 #endif
2534
2535 #if (RX_COMP_RING_INDEX > 8) || (RX_COMP_RING_INDEX < 0)
2536 #error RX_COMP_RING_INDEX must be between 0 and 8
2537 #endif
2538
2539 #define N_TX_RINGS MAX_TX_RINGS
2540 #define N_TX_RINGS_MASK MAX_TX_RINGS_MASK
2541 #define N_RX_DESC_RINGS MAX_RX_DESC_RINGS
2542 #define N_RX_COMP_RINGS 0x1
2543
2544
2545 #define N_RX_FLOWS 64
2546
2547 #define TX_DESC_RING_SIZE DESC_RING_I_TO_S(TX_DESC_RING_INDEX)
2548 #define RX_DESC_RING_SIZE DESC_RING_I_TO_S(RX_DESC_RING_INDEX)
2549 #define RX_COMP_RING_SIZE COMP_RING_I_TO_S(RX_COMP_RING_INDEX)
2550 #define TX_DESC_RINGN_INDEX(x) TX_DESC_RING_INDEX
2551 #define RX_DESC_RINGN_INDEX(x) RX_DESC_RING_INDEX
2552 #define RX_COMP_RINGN_INDEX(x) RX_COMP_RING_INDEX
2553 #define TX_DESC_RINGN_SIZE(x) TX_DESC_RING_SIZE
2554 #define RX_DESC_RINGN_SIZE(x) RX_DESC_RING_SIZE
2555 #define RX_COMP_RINGN_SIZE(x) RX_COMP_RING_SIZE
2556
2557
2558 #define CAS_BASE(x, y) (((y) << (x ## _SHIFT)) & (x ## _MASK))
2559 #define CAS_VAL(x, y) (((y) & (x ## _MASK)) >> (x ## _SHIFT))
2560 #define CAS_TX_RINGN_BASE(y) ((TX_DESC_RINGN_INDEX(y) << \
2561 TX_CFG_DESC_RINGN_SHIFT(y)) & \
2562 TX_CFG_DESC_RINGN_MASK(y))
2563
2564
2565 #define CAS_MIN_PAGE_SHIFT 11
2566 #define CAS_JUMBO_PAGE_SHIFT 13
2567 #define CAS_MAX_PAGE_SHIFT 14
2568
2569 #define TX_DESC_BUFLEN_MASK 0x0000000000003FFFULL
2570
2571 #define TX_DESC_BUFLEN_SHIFT 0
2572 #define TX_DESC_CSUM_START_MASK 0x00000000001F8000ULL
2573
2574
2575
2576
2577
2578 #define TX_DESC_CSUM_START_SHIFT 15
2579 #define TX_DESC_CSUM_STUFF_MASK 0x000000001FE00000ULL
2580
2581
2582
2583
2584 #define TX_DESC_CSUM_STUFF_SHIFT 21
2585 #define TX_DESC_CSUM_EN 0x0000000020000000ULL
2586 #define TX_DESC_EOF 0x0000000040000000ULL
2587 #define TX_DESC_SOF 0x0000000080000000ULL
2588 #define TX_DESC_INTME 0x0000000100000000ULL
2589 #define TX_DESC_NO_CRC 0x0000000200000000ULL
2590
2591
2592
2593 struct cas_tx_desc {
2594 __le64 control;
2595 __le64 buffer;
2596 };
2597
2598
2599
2600
2601
2602 struct cas_rx_desc {
2603 __le64 index;
2604 __le64 buffer;
2605 };
2606
2607
2608
2609 #define RX_COMP1_DATA_SIZE_MASK 0x0000000007FFE000ULL
2610 #define RX_COMP1_DATA_SIZE_SHIFT 13
2611 #define RX_COMP1_DATA_OFF_MASK 0x000001FFF8000000ULL
2612 #define RX_COMP1_DATA_OFF_SHIFT 27
2613 #define RX_COMP1_DATA_INDEX_MASK 0x007FFE0000000000ULL
2614 #define RX_COMP1_DATA_INDEX_SHIFT 41
2615 #define RX_COMP1_SKIP_MASK 0x0180000000000000ULL
2616 #define RX_COMP1_SKIP_SHIFT 55
2617 #define RX_COMP1_RELEASE_NEXT 0x0200000000000000ULL
2618 #define RX_COMP1_SPLIT_PKT 0x0400000000000000ULL
2619 #define RX_COMP1_RELEASE_FLOW 0x0800000000000000ULL
2620 #define RX_COMP1_RELEASE_DATA 0x1000000000000000ULL
2621 #define RX_COMP1_RELEASE_HDR 0x2000000000000000ULL
2622 #define RX_COMP1_TYPE_MASK 0xC000000000000000ULL
2623 #define RX_COMP1_TYPE_SHIFT 62
2624
2625
2626 #define RX_COMP2_NEXT_INDEX_MASK 0x00000007FFE00000ULL
2627 #define RX_COMP2_NEXT_INDEX_SHIFT 21
2628 #define RX_COMP2_HDR_SIZE_MASK 0x00000FF800000000ULL
2629 #define RX_COMP2_HDR_SIZE_SHIFT 35
2630 #define RX_COMP2_HDR_OFF_MASK 0x0003F00000000000ULL
2631 #define RX_COMP2_HDR_OFF_SHIFT 44
2632 #define RX_COMP2_HDR_INDEX_MASK 0xFFFC000000000000ULL
2633 #define RX_COMP2_HDR_INDEX_SHIFT 50
2634
2635
2636 #define RX_COMP3_SMALL_PKT 0x0000000000000001ULL
2637 #define RX_COMP3_JUMBO_PKT 0x0000000000000002ULL
2638 #define RX_COMP3_JUMBO_HDR_SPLIT_EN 0x0000000000000004ULL
2639 #define RX_COMP3_CSUM_START_MASK 0x000000000007F000ULL
2640 #define RX_COMP3_CSUM_START_SHIFT 12
2641 #define RX_COMP3_FLOWID_MASK 0x0000000001F80000ULL
2642 #define RX_COMP3_FLOWID_SHIFT 19
2643 #define RX_COMP3_OPCODE_MASK 0x000000000E000000ULL
2644 #define RX_COMP3_OPCODE_SHIFT 25
2645 #define RX_COMP3_FORCE_FLAG 0x0000000010000000ULL
2646 #define RX_COMP3_NO_ASSIST 0x0000000020000000ULL
2647 #define RX_COMP3_LOAD_BAL_MASK 0x000001F800000000ULL
2648 #define RX_COMP3_LOAD_BAL_SHIFT 35
2649 #define RX_PLUS_COMP3_ENC_PKT 0x0000020000000000ULL
2650 #define RX_COMP3_L3_HEAD_OFF_MASK 0x0000FE0000000000ULL
2651 #define RX_COMP3_L3_HEAD_OFF_SHIFT 41
2652 #define RX_PLUS_COMP_L3_HEAD_OFF_MASK 0x0000FC0000000000ULL
2653 #define RX_PLUS_COMP_L3_HEAD_OFF_SHIFT 42
2654 #define RX_COMP3_SAP_MASK 0xFFFF000000000000ULL
2655 #define RX_COMP3_SAP_SHIFT 48
2656
2657
2658 #define RX_COMP4_TCP_CSUM_MASK 0x000000000000FFFFULL
2659 #define RX_COMP4_TCP_CSUM_SHIFT 0
2660 #define RX_COMP4_PKT_LEN_MASK 0x000000003FFF0000ULL
2661 #define RX_COMP4_PKT_LEN_SHIFT 16
2662 #define RX_COMP4_PERFECT_MATCH_MASK 0x00000003C0000000ULL
2663 #define RX_COMP4_PERFECT_MATCH_SHIFT 30
2664 #define RX_COMP4_ZERO 0x0000080000000000ULL
2665 #define RX_COMP4_HASH_VAL_MASK 0x0FFFF00000000000ULL
2666 #define RX_COMP4_HASH_VAL_SHIFT 44
2667 #define RX_COMP4_HASH_PASS 0x1000000000000000ULL
2668 #define RX_COMP4_BAD 0x4000000000000000ULL
2669 #define RX_COMP4_LEN_MISMATCH 0x8000000000000000ULL
2670
2671
2672
2673
2674
2675 #define RX_INDEX_NUM_MASK 0x0000000000000FFFULL
2676 #define RX_INDEX_NUM_SHIFT 0
2677 #define RX_INDEX_RING_MASK 0x0000000000001000ULL
2678 #define RX_INDEX_RING_SHIFT 12
2679 #define RX_INDEX_RELEASE 0x0000000000002000ULL
2680
2681 struct cas_rx_comp {
2682 __le64 word1;
2683 __le64 word2;
2684 __le64 word3;
2685 __le64 word4;
2686 };
2687
2688 enum link_state {
2689 link_down = 0,
2690 link_aneg,
2691 link_force_try,
2692 link_force_ret,
2693 link_force_ok,
2694 link_up
2695 };
2696
2697 typedef struct cas_page {
2698 struct list_head list;
2699 struct page *buffer;
2700 dma_addr_t dma_addr;
2701 int used;
2702 } cas_page_t;
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716 #define INIT_BLOCK_TX (TX_DESC_RING_SIZE)
2717 #define INIT_BLOCK_RX_DESC (RX_DESC_RING_SIZE)
2718 #define INIT_BLOCK_RX_COMP (RX_COMP_RING_SIZE)
2719
2720 struct cas_init_block {
2721 struct cas_rx_comp rxcs[N_RX_COMP_RINGS][INIT_BLOCK_RX_COMP];
2722 struct cas_rx_desc rxds[N_RX_DESC_RINGS][INIT_BLOCK_RX_DESC];
2723 struct cas_tx_desc txds[N_TX_RINGS][INIT_BLOCK_TX];
2724 __le64 tx_compwb;
2725 };
2726
2727
2728
2729
2730
2731 #define TX_TINY_BUF_LEN 0x100
2732 #define TX_TINY_BUF_BLOCK ((INIT_BLOCK_TX + 1)*TX_TINY_BUF_LEN)
2733
2734 struct cas_tiny_count {
2735 int nbufs;
2736 int used;
2737 };
2738
2739 struct cas {
2740 spinlock_t lock;
2741 spinlock_t tx_lock[N_TX_RINGS];
2742 spinlock_t stat_lock[N_TX_RINGS + 1];
2743 spinlock_t rx_inuse_lock;
2744 spinlock_t rx_spare_lock;
2745
2746 void __iomem *regs;
2747 int tx_new[N_TX_RINGS], tx_old[N_TX_RINGS];
2748 int rx_old[N_RX_DESC_RINGS];
2749 int rx_cur[N_RX_COMP_RINGS], rx_new[N_RX_COMP_RINGS];
2750 int rx_last[N_RX_DESC_RINGS];
2751
2752 struct napi_struct napi;
2753
2754
2755
2756 int hw_running;
2757 int opened;
2758 struct mutex pm_mutex;
2759
2760 struct cas_init_block *init_block;
2761 struct cas_tx_desc *init_txds[MAX_TX_RINGS];
2762 struct cas_rx_desc *init_rxds[MAX_RX_DESC_RINGS];
2763 struct cas_rx_comp *init_rxcs[MAX_RX_COMP_RINGS];
2764
2765
2766
2767 struct sk_buff *tx_skbs[N_TX_RINGS][TX_DESC_RING_SIZE];
2768 struct sk_buff_head rx_flows[N_RX_FLOWS];
2769 cas_page_t *rx_pages[N_RX_DESC_RINGS][RX_DESC_RING_SIZE];
2770 struct list_head rx_spare_list, rx_inuse_list;
2771 int rx_spares_needed;
2772
2773
2774
2775 struct cas_tiny_count tx_tiny_use[N_TX_RINGS][TX_DESC_RING_SIZE];
2776 u8 *tx_tiny_bufs[N_TX_RINGS];
2777
2778 u32 msg_enable;
2779
2780
2781 struct net_device_stats net_stats[N_TX_RINGS + 1];
2782
2783 u32 pci_cfg[64 >> 2];
2784 u8 pci_revision;
2785
2786 int phy_type;
2787 int phy_addr;
2788 u32 phy_id;
2789 #define CAS_FLAG_1000MB_CAP 0x00000001
2790 #define CAS_FLAG_REG_PLUS 0x00000002
2791 #define CAS_FLAG_TARGET_ABORT 0x00000004
2792 #define CAS_FLAG_SATURN 0x00000008
2793 #define CAS_FLAG_RXD_POST_MASK 0x000000F0
2794 #define CAS_FLAG_RXD_POST_SHIFT 4
2795 #define CAS_FLAG_RXD_POST(x) ((1 << (CAS_FLAG_RXD_POST_SHIFT + (x))) & \
2796 CAS_FLAG_RXD_POST_MASK)
2797 #define CAS_FLAG_ENTROPY_DEV 0x00000100
2798 #define CAS_FLAG_NO_HW_CSUM 0x00000200
2799 u32 cas_flags;
2800 int packet_min;
2801 int tx_fifo_size;
2802 int rx_fifo_size;
2803 int rx_pause_off;
2804 int rx_pause_on;
2805 int crc_size;
2806
2807 int pci_irq_INTC;
2808 int min_frame_size;
2809
2810
2811 int page_size;
2812 int page_order;
2813 int mtu_stride;
2814
2815 u32 mac_rx_cfg;
2816
2817
2818 int link_cntl;
2819 int link_fcntl;
2820 enum link_state lstate;
2821 struct timer_list link_timer;
2822 int timer_ticks;
2823 struct work_struct reset_task;
2824 #if 0
2825 atomic_t reset_task_pending;
2826 #else
2827 atomic_t reset_task_pending;
2828 atomic_t reset_task_pending_mtu;
2829 atomic_t reset_task_pending_spare;
2830 atomic_t reset_task_pending_all;
2831 #endif
2832
2833
2834 #define LINK_TRANSITION_UNKNOWN 0
2835 #define LINK_TRANSITION_ON_FAILURE 1
2836 #define LINK_TRANSITION_STILL_FAILED 2
2837 #define LINK_TRANSITION_LINK_UP 3
2838 #define LINK_TRANSITION_LINK_CONFIG 4
2839 #define LINK_TRANSITION_LINK_DOWN 5
2840 #define LINK_TRANSITION_REQUESTED_RESET 6
2841 int link_transition;
2842 int link_transition_jiffies_valid;
2843 unsigned long link_transition_jiffies;
2844
2845
2846 u8 orig_cacheline_size;
2847 #define CAS_PREF_CACHELINE_SIZE 0x20
2848
2849
2850 int casreg_len;
2851 u64 pause_entered;
2852 u16 pause_last_time_recvd;
2853
2854 dma_addr_t block_dvma, tx_tiny_dvma[N_TX_RINGS];
2855 struct pci_dev *pdev;
2856 struct net_device *dev;
2857 #if defined(CONFIG_OF)
2858 struct device_node *of_node;
2859 #endif
2860
2861
2862 u16 fw_load_addr;
2863 u32 fw_size;
2864 u8 *fw_data;
2865 };
2866
2867 #define TX_DESC_NEXT(r, x) (((x) + 1) & (TX_DESC_RINGN_SIZE(r) - 1))
2868 #define RX_DESC_ENTRY(r, x) ((x) & (RX_DESC_RINGN_SIZE(r) - 1))
2869 #define RX_COMP_ENTRY(r, x) ((x) & (RX_COMP_RINGN_SIZE(r) - 1))
2870
2871 #define TX_BUFF_COUNT(r, x, y) ((x) <= (y) ? ((y) - (x)) : \
2872 (TX_DESC_RINGN_SIZE(r) - (x) + (y)))
2873
2874 #define TX_BUFFS_AVAIL(cp, i) ((cp)->tx_old[(i)] <= (cp)->tx_new[(i)] ? \
2875 (cp)->tx_old[(i)] + (TX_DESC_RINGN_SIZE(i) - 1) - (cp)->tx_new[(i)] : \
2876 (cp)->tx_old[(i)] - (cp)->tx_new[(i)] - 1)
2877
2878 #define CAS_ALIGN(addr, align) \
2879 (((unsigned long) (addr) + ((align) - 1UL)) & ~((align) - 1))
2880
2881 #define RX_FIFO_SIZE 16384
2882 #define EXPANSION_ROM_SIZE 65536
2883
2884 #define CAS_MC_EXACT_MATCH_SIZE 15
2885 #define CAS_MC_HASH_SIZE 256
2886 #define CAS_MC_HASH_MAX (CAS_MC_EXACT_MATCH_SIZE + \
2887 CAS_MC_HASH_SIZE)
2888
2889 #define TX_TARGET_ABORT_LEN 0x20
2890 #define RX_SWIVEL_OFF_VAL 0x2
2891 #define RX_AE_FREEN_VAL(x) (RX_DESC_RINGN_SIZE(x) >> 1)
2892 #define RX_AE_COMP_VAL (RX_COMP_RING_SIZE >> 1)
2893 #define RX_BLANK_INTR_PKT_VAL 0x05
2894 #define RX_BLANK_INTR_TIME_VAL 0x0F
2895 #define HP_TCP_THRESH_VAL 1530
2896
2897 #define RX_SPARE_COUNT (RX_DESC_RING_SIZE >> 1)
2898 #define RX_SPARE_RECOVER_VAL (RX_SPARE_COUNT >> 2)
2899
2900 #endif