1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 #ifndef __DEV_IC_MTD8XXVAR_H__
32 #define __DEV_IC_MTD8XXVAR_H__
33
34 #define MTD_RX_LIST_CNT 64
35 #define MTD_TX_LIST_CNT 128
36
37
38
39
40 struct mtd_tx_desc {
41 u_int32_t td_tsw;
42 #define TSW_OWN 0x80000000U
43 #define TSW_TXERR 0x00008000U
44 #define TSW_ABORT 0x00002000U
45 #define TSW_CSL 0x00001000U
46 #define TSW_LC 0x00000800U
47 #define TSW_EC 0x00000400U
48 #define TSW_DFR 0x00000200U
49 #define TSW_HF 0x00000100U
50 #define TSW_NCR_MASK 0x000000FFU
51 #define TSW_NCR_SHIFT 0
52 #define TSW_NCR_GET(x) (((x) & TSW_NCR_MASK) >> TSW_NCR_SHIFT)
53
54 #define TSW_UNSENT 0x00001234U
55 u_int32_t td_tcw;
56 #define TCW_IC 0x80000000U
57 #define TCW_EIC 0x40000000U
58 #define TCW_LD 0x20000000U
59 #define TCW_FD 0x10000000U
60 #define TCW_CRC 0x08000000U
61 #define TCW_PAD 0x04000000U
62 #define TCW_RTLC 0x02000000U
63 #define TCW_PKTS_MASK 0x00003FF8U
64 #define TCW_PKTS_SHIFT 11
65 #define TCW_PKTS_GET(x) (((x) & TCW_PKTS_MASK) >> TCW_PKTS_SHIFT)
66
67 #define TCW_TBS_MASK 0x000007FFU
68 #define TCW_TBS_SHIFT 0
69 #define TCW_TBS_GET(x) (((x) & TCW_TBS_MASK) >> TCW_TBS_SHIFT)
70
71 u_int32_t td_buf;
72 u_int32_t td_next;
73 };
74
75
76
77
78
79 struct mtd_rx_desc {
80 u_int32_t rd_rsr;
81 #define RSR_OWN 0x80000000U
82 #define RSR_FLNG_MASK 0x0FFF0000U
83 #define RSR_FLNG_SHIFT 16
84 #define RSR_FLNG_GET(x) (((x) & RSR_FLNG_MASK) >> RSR_FLNG_SHIFT)
85
86 #define RSR_MAR 0x00004000U
87 #define RSR_BAR 0x00002000U
88 #define RSR_PHY 0x00001000U
89 #define RSR_FSD 0x00000800U
90 #define RSR_LSD 0x00000400U
91 #define RSR_ES 0x00000080U
92 #define RSR_RUNT 0x00000040U
93 #define RSR_LONG 0x00000020U
94 #define RSR_FAE 0x00000010U
95 #define RSR_CRC 0x00000008U
96 #define RSR_RXER 0x00000004U
97 u_int32_t rd_rcw;
98 #define RCW_RBS_MASK 0x000007FFU
99 #define RCW_RBS_SHIFT 0
100 #define RCW_RBS_GET(x) (((x) & RCW_RBS_MASK) >> RCW_RBS_SHIFT)
101 u_int32_t rd_buf;
102 u_int32_t rd_next;
103 };
104
105
106 struct mtd_list_data {
107 struct mtd_rx_desc mtd_rx_list[MTD_RX_LIST_CNT];
108 struct mtd_tx_desc mtd_tx_list[MTD_TX_LIST_CNT];
109 };
110
111
112 struct mtd_swdesc {
113 bus_dmamap_t sd_map;
114 struct mbuf *sd_mbuf;
115 };
116
117
118 struct mtd_chain_data {
119 struct mtd_swdesc mtd_rx_chain[MTD_RX_LIST_CNT];
120 struct mtd_swdesc mtd_tx_chain[MTD_TX_LIST_CNT];
121 int mtd_tx_prod;
122 int mtd_tx_cons;
123 int mtd_tx_cnt;
124 int mtd_rx_prod;
125 };
126
127
128 struct mtd_softc {
129 struct device sc_dev;
130 struct arpcom sc_arpcom;
131 struct mii_data sc_mii;
132 pci_product_id_t sc_devid;
133
134 bus_space_handle_t sc_bush;
135 bus_space_tag_t sc_bust;
136
137 struct mtd_list_data *mtd_ldata;
138 struct mtd_chain_data mtd_cdata;
139
140 bus_dma_tag_t sc_dmat;
141 bus_dmamap_t sc_listmap;
142 bus_dma_segment_t sc_listseg[1];
143 int sc_listnseg;
144 caddr_t sc_listkva;
145 bus_dmamap_t sc_rx_sparemap;
146 bus_dmamap_t sc_tx_sparemap;
147 };
148
149 __BEGIN_DECLS
150 void mtd_attach(struct mtd_softc *);
151 int mtd_intr(void *);
152 __END_DECLS
153
154 #endif