aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2008-08-01 06:14:57 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-08-07 02:11:09 -0400
commitd71e1be8edd355668a12a18660da03ae993dd9df (patch)
treee646cf0778fae8e7dd15e1471f8b135f0d2a15c6 /drivers/net/netxen
parenta70f939338cae650f177ae79562ec44659788bb4 (diff)
netxen: fix legacy interrupts
Fix legacy interrupt mode for NX3031 chips, read pci interrupt state in hardware to guard against spurious interrupt. Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r--drivers/net/netxen/netxen_nic_hdr.h3
-rw-r--r--drivers/net/netxen/netxen_nic_main.c48
2 files changed, 34 insertions, 17 deletions
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h
index ccf6d70064bc..e8e8d73f6ed7 100644
--- a/drivers/net/netxen/netxen_nic_hdr.h
+++ b/drivers/net/netxen/netxen_nic_hdr.h
@@ -843,9 +843,11 @@ enum {
843 843
844#define PCIE_SETUP_FUNCTION (0x12040) 844#define PCIE_SETUP_FUNCTION (0x12040)
845#define PCIE_SETUP_FUNCTION2 (0x12048) 845#define PCIE_SETUP_FUNCTION2 (0x12048)
846#define PCIE_MISCCFG_RC (0x1206c)
846#define PCIE_TGT_SPLIT_CHICKEN (0x12080) 847#define PCIE_TGT_SPLIT_CHICKEN (0x12080)
847#define PCIE_CHICKEN3 (0x120c8) 848#define PCIE_CHICKEN3 (0x120c8)
848 849
850#define ISR_INT_STATE_REG (NETXEN_PCIX_PS_REG(PCIE_MISCCFG_RC))
849#define PCIE_MAX_MASTER_SPLIT (0x14048) 851#define PCIE_MAX_MASTER_SPLIT (0x14048)
850 852
851#define NETXEN_PORT_MODE_NONE 0 853#define NETXEN_PORT_MODE_NONE 0
@@ -861,6 +863,7 @@ enum {
861#define NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL (0x14) 863#define NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL (0x14)
862 864
863#define ISR_MSI_INT_TRIGGER(FUNC) (NETXEN_PCIX_PS_REG(PCIX_MSI_F(FUNC))) 865#define ISR_MSI_INT_TRIGGER(FUNC) (NETXEN_PCIX_PS_REG(PCIX_MSI_F(FUNC)))
866#define ISR_LEGACY_INT_TRIGGERED(VAL) (((VAL) & 0x300) == 0x200)
864 867
865/* 868/*
866 * PCI Interrupt Vector Values. 869 * PCI Interrupt Vector Values.
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 153b391917e4..320d010678cd 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -166,7 +166,8 @@ static void netxen_nic_disable_int(struct netxen_adapter *adapter)
166 if (!NETXEN_IS_MSI_FAMILY(adapter)) { 166 if (!NETXEN_IS_MSI_FAMILY(adapter)) {
167 do { 167 do {
168 adapter->pci_write_immediate(adapter, 168 adapter->pci_write_immediate(adapter,
169 ISR_INT_TARGET_STATUS, 0xffffffff); 169 adapter->legacy_intr.tgt_status_reg,
170 0xffffffff);
170 mask = adapter->pci_read_immediate(adapter, 171 mask = adapter->pci_read_immediate(adapter,
171 ISR_INT_VECTOR); 172 ISR_INT_VECTOR);
172 if (!(mask & 0x80)) 173 if (!(mask & 0x80))
@@ -175,7 +176,7 @@ static void netxen_nic_disable_int(struct netxen_adapter *adapter)
175 } while (--retries); 176 } while (--retries);
176 177
177 if (!retries) { 178 if (!retries) {
178 printk(KERN_NOTICE "%s: Failed to disable interrupt completely\n", 179 printk(KERN_NOTICE "%s: Failed to disable interrupt\n",
179 netxen_nic_driver_name); 180 netxen_nic_driver_name);
180 } 181 }
181 } else { 182 } else {
@@ -190,8 +191,6 @@ static void netxen_nic_enable_int(struct netxen_adapter *adapter)
190{ 191{
191 u32 mask; 192 u32 mask;
192 193
193 DPRINTK(1, INFO, "Entered ISR Enable \n");
194
195 if (adapter->intr_scheme != -1 && 194 if (adapter->intr_scheme != -1 &&
196 adapter->intr_scheme != INTR_SCHEME_PERPORT) { 195 adapter->intr_scheme != INTR_SCHEME_PERPORT) {
197 switch (adapter->ahw.board_type) { 196 switch (adapter->ahw.board_type) {
@@ -213,16 +212,13 @@ static void netxen_nic_enable_int(struct netxen_adapter *adapter)
213 212
214 if (!NETXEN_IS_MSI_FAMILY(adapter)) { 213 if (!NETXEN_IS_MSI_FAMILY(adapter)) {
215 mask = 0xbff; 214 mask = 0xbff;
216 if (adapter->intr_scheme != -1 && 215 if (adapter->intr_scheme == INTR_SCHEME_PERPORT)
217 adapter->intr_scheme != INTR_SCHEME_PERPORT) { 216 adapter->pci_write_immediate(adapter,
217 adapter->legacy_intr.tgt_mask_reg, mask);
218 else
218 adapter->pci_write_normalize(adapter, 219 adapter->pci_write_normalize(adapter,
219 CRB_INT_VECTOR, 0); 220 CRB_INT_VECTOR, 0);
220 }
221 adapter->pci_write_immediate(adapter,
222 ISR_INT_TARGET_MASK, mask);
223 } 221 }
224
225 DPRINTK(1, INFO, "Done with enable Int\n");
226} 222}
227 223
228static int nx_set_dma_mask(struct netxen_adapter *adapter, uint8_t revision_id) 224static int nx_set_dma_mask(struct netxen_adapter *adapter, uint8_t revision_id)
@@ -1538,15 +1534,33 @@ static irqreturn_t netxen_intr(int irq, void *data)
1538 struct netxen_adapter *adapter = data; 1534 struct netxen_adapter *adapter = data;
1539 u32 our_int = 0; 1535 u32 our_int = 0;
1540 1536
1541 our_int = adapter->pci_read_normalize(adapter, CRB_INT_VECTOR); 1537 u32 status = 0;
1542 /* not our interrupt */ 1538
1543 if ((our_int & (0x80 << adapter->portnum)) == 0) 1539 status = adapter->pci_read_immediate(adapter, ISR_INT_VECTOR);
1540
1541 if (!(status & adapter->legacy_intr.int_vec_bit))
1544 return IRQ_NONE; 1542 return IRQ_NONE;
1545 1543
1546 if (adapter->intr_scheme == INTR_SCHEME_PERPORT) { 1544 if (adapter->ahw.revision_id >= NX_P3_B1) {
1547 /* claim interrupt */ 1545 /* check interrupt state machine, to be sure */
1548 adapter->pci_write_normalize(adapter, CRB_INT_VECTOR, 1546 status = adapter->pci_read_immediate(adapter,
1547 ISR_INT_STATE_REG);
1548 if (!ISR_LEGACY_INT_TRIGGERED(status))
1549 return IRQ_NONE;
1550
1551 } else if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
1552
1553 our_int = adapter->pci_read_normalize(adapter, CRB_INT_VECTOR);
1554 /* not our interrupt */
1555 if ((our_int & (0x80 << adapter->portnum)) == 0)
1556 return IRQ_NONE;
1557
1558 if (adapter->intr_scheme == INTR_SCHEME_PERPORT) {
1559 /* claim interrupt */
1560 adapter->pci_write_normalize(adapter,
1561 CRB_INT_VECTOR,
1549 our_int & ~((u32)(0x80 << adapter->portnum))); 1562 our_int & ~((u32)(0x80 << adapter->portnum)));
1563 }
1550 } 1564 }
1551 1565
1552 netxen_handle_int(adapter); 1566 netxen_handle_int(adapter);