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 __NETXEN_NIC_HW_H_
27#define __NETXEN_NIC_HW_H_
28
29
30#define NETXEN_MEMADDR_MAX (128 * 1024 * 1024)
31
32struct netxen_adapter;
33
34#define NETXEN_PCI_MAPSIZE_BYTES (NETXEN_PCI_MAPSIZE << 20)
35
36void netxen_nic_set_link_parameters(struct netxen_adapter *adapter);
37
38
39
40#define _netxen_crb_get_bit(var, bit) ((var >> bit) & 0x1)
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59#define netxen_gb_tx_flowctl(config_word) \
60 ((config_word) |= 1 << 4)
61#define netxen_gb_rx_flowctl(config_word) \
62 ((config_word) |= 1 << 5)
63#define netxen_gb_tx_reset_pb(config_word) \
64 ((config_word) |= 1 << 16)
65#define netxen_gb_rx_reset_pb(config_word) \
66 ((config_word) |= 1 << 17)
67#define netxen_gb_tx_reset_mac(config_word) \
68 ((config_word) |= 1 << 18)
69#define netxen_gb_rx_reset_mac(config_word) \
70 ((config_word) |= 1 << 19)
71
72#define netxen_gb_unset_tx_flowctl(config_word) \
73 ((config_word) &= ~(1 << 4))
74#define netxen_gb_unset_rx_flowctl(config_word) \
75 ((config_word) &= ~(1 << 5))
76
77#define netxen_gb_get_tx_synced(config_word) \
78 _netxen_crb_get_bit((config_word), 1)
79#define netxen_gb_get_rx_synced(config_word) \
80 _netxen_crb_get_bit((config_word), 3)
81#define netxen_gb_get_tx_flowctl(config_word) \
82 _netxen_crb_get_bit((config_word), 4)
83#define netxen_gb_get_rx_flowctl(config_word) \
84 _netxen_crb_get_bit((config_word), 5)
85#define netxen_gb_get_soft_reset(config_word) \
86 _netxen_crb_get_bit((config_word), 31)
87
88#define netxen_gb_get_stationaddress_low(config_word) ((config_word) >> 16)
89
90#define netxen_gb_set_mii_mgmt_clockselect(config_word, val) \
91 ((config_word) |= ((val) & 0x07))
92#define netxen_gb_mii_mgmt_reset(config_word) \
93 ((config_word) |= 1 << 31)
94#define netxen_gb_mii_mgmt_unset(config_word) \
95 ((config_word) &= ~(1 << 31))
96
97
98
99
100
101
102
103#define netxen_gb_mii_mgmt_set_read_cycle(config_word) \
104 ((config_word) |= 1 << 0)
105#define netxen_gb_mii_mgmt_reg_addr(config_word, val) \
106 ((config_word) |= ((val) & 0x1F))
107#define netxen_gb_mii_mgmt_phy_addr(config_word, val) \
108 ((config_word) |= (((val) & 0x1F) << 8))
109
110
111
112
113
114
115
116
117#define netxen_get_gb_mii_mgmt_busy(config_word) \
118 _netxen_crb_get_bit(config_word, 0)
119#define netxen_get_gb_mii_mgmt_scanning(config_word) \
120 _netxen_crb_get_bit(config_word, 1)
121#define netxen_get_gb_mii_mgmt_notvalid(config_word) \
122 _netxen_crb_get_bit(config_word, 2)
123
124
125
126
127
128
129
130
131
132
133
134#define netxen_xg_set_xg0_mask(config_word) \
135 ((config_word) |= 1 << 0)
136#define netxen_xg_set_xg1_mask(config_word) \
137 ((config_word) |= 1 << 3)
138
139#define netxen_xg_get_xg0_mask(config_word) \
140 _netxen_crb_get_bit((config_word), 0)
141#define netxen_xg_get_xg1_mask(config_word) \
142 _netxen_crb_get_bit((config_word), 3)
143
144#define netxen_xg_unset_xg0_mask(config_word) \
145 ((config_word) &= ~(1 << 0))
146#define netxen_xg_unset_xg1_mask(config_word) \
147 ((config_word) &= ~(1 << 3))
148
149
150
151
152
153
154
155
156
157
158
159#define netxen_gb_set_gb0_mask(config_word) \
160 ((config_word) |= 1 << 0)
161#define netxen_gb_set_gb1_mask(config_word) \
162 ((config_word) |= 1 << 2)
163#define netxen_gb_set_gb2_mask(config_word) \
164 ((config_word) |= 1 << 4)
165#define netxen_gb_set_gb3_mask(config_word) \
166 ((config_word) |= 1 << 6)
167
168#define netxen_gb_get_gb0_mask(config_word) \
169 _netxen_crb_get_bit((config_word), 0)
170#define netxen_gb_get_gb1_mask(config_word) \
171 _netxen_crb_get_bit((config_word), 2)
172#define netxen_gb_get_gb2_mask(config_word) \
173 _netxen_crb_get_bit((config_word), 4)
174#define netxen_gb_get_gb3_mask(config_word) \
175 _netxen_crb_get_bit((config_word), 6)
176
177#define netxen_gb_unset_gb0_mask(config_word) \
178 ((config_word) &= ~(1 << 0))
179#define netxen_gb_unset_gb1_mask(config_word) \
180 ((config_word) &= ~(1 << 2))
181#define netxen_gb_unset_gb2_mask(config_word) \
182 ((config_word) &= ~(1 << 4))
183#define netxen_gb_unset_gb3_mask(config_word) \
184 ((config_word) &= ~(1 << 6))
185
186
187
188
189
190#define NETXEN_NIU_GB_MII_MGMT_ADDR_CONTROL 0
191#define NETXEN_NIU_GB_MII_MGMT_ADDR_STATUS 1
192#define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_ID_0 2
193#define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_ID_1 3
194#define NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG 4
195#define NETXEN_NIU_GB_MII_MGMT_ADDR_LNKPART 5
196#define NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG_MORE 6
197#define NETXEN_NIU_GB_MII_MGMT_ADDR_NEXTPAGE_XMIT 7
198#define NETXEN_NIU_GB_MII_MGMT_ADDR_LNKPART_NEXTPAGE 8
199#define NETXEN_NIU_GB_MII_MGMT_ADDR_1000BT_CONTROL 9
200#define NETXEN_NIU_GB_MII_MGMT_ADDR_1000BT_STATUS 10
201#define NETXEN_NIU_GB_MII_MGMT_ADDR_EXTENDED_STATUS 15
202#define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_CONTROL 16
203#define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS 17
204#define NETXEN_NIU_GB_MII_MGMT_ADDR_INT_ENABLE 18
205#define NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS 19
206#define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_CONTROL_MORE 20
207#define NETXEN_NIU_GB_MII_MGMT_ADDR_RECV_ERROR_COUNT 21
208#define NETXEN_NIU_GB_MII_MGMT_ADDR_LED_CONTROL 24
209#define NETXEN_NIU_GB_MII_MGMT_ADDR_LED_OVERRIDE 25
210#define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_CONTROL_MORE_YET 26
211#define NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS_MORE 27
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232#define netxen_get_phy_speed(config_word) (((config_word) >> 14) & 0x03)
233
234#define netxen_set_phy_speed(config_word, val) \
235 ((config_word) |= ((val & 0x03) << 14))
236#define netxen_set_phy_duplex(config_word) \
237 ((config_word) |= 1 << 13)
238#define netxen_clear_phy_duplex(config_word) \
239 ((config_word) &= ~(1 << 13))
240
241#define netxen_get_phy_link(config_word) \
242 _netxen_crb_get_bit(config_word, 10)
243#define netxen_get_phy_duplex(config_word) \
244 _netxen_crb_get_bit(config_word, 13)
245
246
247
248
249
250
251
252
253#define netxen_get_niu_enable_ge(config_word) \
254 _netxen_crb_get_bit(config_word, 1)
255
256#define NETXEN_NIU_NON_PROMISC_MODE 0
257#define NETXEN_NIU_PROMISC_MODE 1
258#define NETXEN_NIU_ALLMULTI_MODE 2
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273#define netxen_xg_soft_reset(config_word) \
274 ((config_word) |= 1 << 4)
275
276typedef struct {
277 unsigned valid;
278 unsigned start_128M;
279 unsigned end_128M;
280 unsigned start_2M;
281} crb_128M_2M_sub_block_map_t;
282
283typedef struct {
284 crb_128M_2M_sub_block_map_t sub_block[16];
285} crb_128M_2M_block_map_t;
286
287#endif
288