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