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