aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/netxen/netxen_nic_main.c')
-rw-r--r--drivers/net/netxen/netxen_nic_main.c97
1 files changed, 97 insertions, 0 deletions
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index a66ff58366cf..56f8197b953b 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -156,6 +156,103 @@ static inline void netxen_nic_update_cmd_consumer(struct netxen_adapter *adapter
156#define ADAPTER_LIST_SIZE 12 156#define ADAPTER_LIST_SIZE 12
157int netxen_cards_found; 157int netxen_cards_found;
158 158
159static void netxen_nic_disable_int(struct netxen_adapter *adapter)
160{
161 uint32_t mask = 0x7ff;
162 int retries = 32;
163
164 DPRINTK(1, INFO, "Entered ISR Disable \n");
165
166 switch (adapter->portnum) {
167 case 0:
168 writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
169 break;
170 case 1:
171 writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
172 break;
173 case 2:
174 writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
175 break;
176 case 3:
177 writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
178 break;
179 }
180
181 if (adapter->intr_scheme != -1 &&
182 adapter->intr_scheme != INTR_SCHEME_PERPORT)
183 writel(mask,PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
184
185 /* Window = 0 or 1 */
186 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
187 do {
188 writel(0xffffffff,
189 PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_STATUS));
190 mask = readl(pci_base_offset(adapter, ISR_INT_VECTOR));
191 if (!(mask & 0x80))
192 break;
193 udelay(10);
194 } while (--retries);
195
196 if (!retries) {
197 printk(KERN_NOTICE "%s: Failed to disable interrupt completely\n",
198 netxen_nic_driver_name);
199 }
200 }
201
202 DPRINTK(1, INFO, "Done with Disable Int\n");
203}
204
205static void netxen_nic_enable_int(struct netxen_adapter *adapter)
206{
207 u32 mask;
208
209 DPRINTK(1, INFO, "Entered ISR Enable \n");
210
211 if (adapter->intr_scheme != -1 &&
212 adapter->intr_scheme != INTR_SCHEME_PERPORT) {
213 switch (adapter->ahw.board_type) {
214 case NETXEN_NIC_GBE:
215 mask = 0x77b;
216 break;
217 case NETXEN_NIC_XGBE:
218 mask = 0x77f;
219 break;
220 default:
221 mask = 0x7ff;
222 break;
223 }
224
225 writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
226 }
227
228 switch (adapter->portnum) {
229 case 0:
230 writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
231 break;
232 case 1:
233 writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
234 break;
235 case 2:
236 writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
237 break;
238 case 3:
239 writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
240 break;
241 }
242
243 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
244 mask = 0xbff;
245 if (adapter->intr_scheme != -1 &&
246 adapter->intr_scheme != INTR_SCHEME_PERPORT) {
247 writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
248 }
249 writel(mask,
250 PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_MASK));
251 }
252
253 DPRINTK(1, INFO, "Done with enable Int\n");
254}
255
159/* 256/*
160 * netxen_nic_probe() 257 * netxen_nic_probe()
161 * 258 *