aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/netxen/netxen_nic.h102
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c6
-rw-r--r--drivers/net/netxen/netxen_nic_init.c2
-rw-r--r--drivers/net/netxen/netxen_nic_main.c30
-rw-r--r--drivers/net/netxen/netxen_nic_phan_reg.h14
5 files changed, 124 insertions, 30 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 91f25e0a638e..6ce93fcbed32 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -937,6 +937,7 @@ struct netxen_adapter {
937 struct netxen_ring_ctx *ctx_desc; 937 struct netxen_ring_ctx *ctx_desc;
938 struct pci_dev *ctx_desc_pdev; 938 struct pci_dev *ctx_desc_pdev;
939 dma_addr_t ctx_desc_phys_addr; 939 dma_addr_t ctx_desc_phys_addr;
940 int intr_scheme;
940 int (*enable_phy_interrupts) (struct netxen_adapter *); 941 int (*enable_phy_interrupts) (struct netxen_adapter *);
941 int (*disable_phy_interrupts) (struct netxen_adapter *); 942 int (*disable_phy_interrupts) (struct netxen_adapter *);
942 void (*handle_phy_intr) (struct netxen_adapter *); 943 void (*handle_phy_intr) (struct netxen_adapter *);
@@ -1080,37 +1081,106 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev);
1080 1081
1081static inline void netxen_nic_disable_int(struct netxen_adapter *adapter) 1082static inline void netxen_nic_disable_int(struct netxen_adapter *adapter)
1082{ 1083{
1083 /* 1084 uint32_t mask = 0x7ff;
1084 * ISR_INT_MASK: Can be read from window 0 or 1. 1085 int retries = 32;
1085 */ 1086
1086 writel(0x7ff, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)); 1087 DPRINTK(1, INFO, "Entered ISR Disable \n");
1088
1089 switch (adapter->portnum) {
1090 case 0:
1091 writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
1092 break;
1093 case 1:
1094 writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
1095 break;
1096 case 2:
1097 writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
1098 break;
1099 case 3:
1100 writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
1101 break;
1102 }
1103
1104 if (adapter->intr_scheme != -1 &&
1105 adapter->intr_scheme != INTR_SCHEME_PERPORT) {
1106 writel(mask,
1107 (void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)));
1108 }
1109
1110 /* Window = 0 or 1 */
1111 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
1112 do {
1113 writel(0xffffffff, (void *)
1114 (PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_STATUS)));
1115 mask = readl((void *)
1116 (pci_base_offset(adapter, ISR_INT_VECTOR)));
1117 if (!(mask & 0x80))
1118 break;
1119 udelay(10);
1120 } while (--retries);
1121
1122 if (!retries) {
1123 printk(KERN_NOTICE "%s: Failed to disable interrupt completely\n",
1124 netxen_nic_driver_name);
1125 }
1126 }
1127
1128 DPRINTK(1, INFO, "Done with Disable Int\n");
1087 1129
1130 return;
1088} 1131}
1089 1132
1090static inline void netxen_nic_enable_int(struct netxen_adapter *adapter) 1133static inline void netxen_nic_enable_int(struct netxen_adapter *adapter)
1091{ 1134{
1092 u32 mask; 1135 u32 mask;
1093 1136
1094 switch (adapter->ahw.board_type) { 1137 DPRINTK(1, INFO, "Entered ISR Enable \n");
1095 case NETXEN_NIC_GBE: 1138
1096 mask = 0x77b; 1139 if (adapter->intr_scheme != -1 &&
1140 adapter->intr_scheme != INTR_SCHEME_PERPORT) {
1141 switch (adapter->ahw.board_type) {
1142 case NETXEN_NIC_GBE:
1143 mask = 0x77b;
1144 break;
1145 case NETXEN_NIC_XGBE:
1146 mask = 0x77f;
1147 break;
1148 default:
1149 mask = 0x7ff;
1150 break;
1151 }
1152
1153 writel(mask,
1154 (void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)));
1155 }
1156 switch (adapter->portnum) {
1157 case 0:
1158 writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
1097 break; 1159 break;
1098 case NETXEN_NIC_XGBE: 1160 case 1:
1099 mask = 0x77f; 1161 writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
1100 break; 1162 break;
1101 default: 1163 case 2:
1102 mask = 0x7ff; 1164 writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
1165 break;
1166 case 3:
1167 writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
1103 break; 1168 break;
1104 } 1169 }
1105 1170
1106 writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
1107
1108 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { 1171 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
1109 mask = 0xbff; 1172 mask = 0xbff;
1110 writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR)); 1173 if (adapter->intr_scheme != -1 &&
1111 writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, 1174 adapter->intr_scheme != INTR_SCHEME_PERPORT) {
1112 ISR_INT_TARGET_MASK)); 1175 writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
1176 }
1177 writel(mask,
1178 (void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_MASK)));
1113 } 1179 }
1180
1181 DPRINTK(1, INFO, "Done with enable Int\n");
1182
1183 return;
1114} 1184}
1115 1185
1116/* 1186/*
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index c012764d1145..2b40a5a19c47 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -392,7 +392,11 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
392 return err; 392 return err;
393 } 393 }
394 } 394 }
395 DPRINTK(INFO, "Recieve Peg ready too. starting stuff\n"); 395 adapter->intr_scheme = readl(
396 NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_FW));
397 printk(KERN_NOTICE "%s: FW capabilities:0x%x\n", netdev->name,
398 adapter->intr_scheme);
399 DPRINTK(INFO, "Receive Peg ready too. starting stuff\n");
396 400
397 addr = netxen_alloc(adapter->ahw.pdev, 401 addr = netxen_alloc(adapter->ahw.pdev,
398 sizeof(struct netxen_ring_ctx) + 402 sizeof(struct netxen_ring_ctx) +
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index bb23f4c360db..15f6dc5a1cf7 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -139,6 +139,8 @@ int netxen_init_firmware(struct netxen_adapter *adapter)
139 return err; 139 return err;
140 } 140 }
141 /* Window 1 call */ 141 /* Window 1 call */
142 writel(INTR_SCHEME_PERPORT,
143 NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_HOST));
142 writel(MPORT_MULTI_FUNCTION_MODE, 144 writel(MPORT_MULTI_FUNCTION_MODE,
143 NETXEN_CRB_NORMALIZE(adapter, CRB_MPORT_MODE)); 145 NETXEN_CRB_NORMALIZE(adapter, CRB_MPORT_MODE));
144 writel(PHAN_INITIALIZE_ACK, 146 writel(PHAN_INITIALIZE_ACK,
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 663bc47c1f63..dba8e6b29ff3 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -308,7 +308,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
308 308
309 adapter->netdev = netdev; 309 adapter->netdev = netdev;
310 adapter->pdev = pdev; 310 adapter->pdev = pdev;
311
312 /* this will be read from FW later */
313 adapter->intr_scheme = -1;
314
315 /* This will be reset for mezz cards */
311 adapter->portnum = pci_func_id; 316 adapter->portnum = pci_func_id;
317 adapter->status &= ~NETXEN_NETDEV_STATUS;
312 318
313 netdev->open = netxen_nic_open; 319 netdev->open = netxen_nic_open;
314 netdev->stop = netxen_nic_close; 320 netdev->stop = netxen_nic_close;
@@ -1100,28 +1106,26 @@ static int
1100netxen_handle_int(struct netxen_adapter *adapter, struct net_device *netdev) 1106netxen_handle_int(struct netxen_adapter *adapter, struct net_device *netdev)
1101{ 1107{
1102 u32 ret = 0; 1108 u32 ret = 0;
1109 u32 our_int = 0;
1103 1110
1104 DPRINTK(INFO, "Entered handle ISR\n"); 1111 DPRINTK(INFO, "Entered handle ISR\n");
1105 adapter->stats.ints++; 1112 adapter->stats.ints++;
1106 1113
1107 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { 1114 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
1108 int count = 0;
1109 u32 mask;
1110 u32 our_int = 0;
1111 our_int = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR)); 1115 our_int = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
1112 /* not our interrupt */ 1116 /* not our interrupt */
1113 if ((our_int & (0x80 << adapter->portnum)) == 0) 1117 if ((our_int & (0x80 << adapter->portnum)) == 0)
1114 return ret; 1118 return ret;
1115 netxen_nic_disable_int(adapter); 1119 }
1116 /* Window = 0 or 1 */
1117 do {
1118 writel(0xffffffff, PCI_OFFSET_SECOND_RANGE(adapter,
1119 ISR_INT_TARGET_STATUS));
1120 mask = readl(pci_base_offset(adapter, ISR_INT_VECTOR));
1121 } while (((mask & 0x80) != 0) && (++count < 32));
1122 if ((mask & 0x80) != 0)
1123 printk("Could not disable interrupt completely\n");
1124 1120
1121 netxen_nic_disable_int(adapter);
1122
1123 if (adapter->intr_scheme == INTR_SCHEME_PERPORT) {
1124 /* claim interrupt */
1125 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
1126 writel(our_int & ~((u32)(0x80 << adapter->portnum)),
1127 NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
1128 }
1125 } 1129 }
1126 1130
1127 if (netxen_nic_rx_has_work(adapter) || netxen_nic_tx_has_work(adapter)) { 1131 if (netxen_nic_rx_has_work(adapter) || netxen_nic_tx_has_work(adapter)) {
@@ -1133,7 +1137,7 @@ netxen_handle_int(struct netxen_adapter *adapter, struct net_device *netdev)
1133 } else { 1137 } else {
1134 static unsigned int intcount = 0; 1138 static unsigned int intcount = 0;
1135 if ((++intcount & 0xfff) == 0xfff) 1139 if ((++intcount & 0xfff) == 0xfff)
1136 printk(KERN_ERR 1140 DPRINTK(KERN_ERR
1137 "%s: %s interrupt %d while in poll\n", 1141 "%s: %s interrupt %d while in poll\n",
1138 netxen_nic_driver_name, netdev->name, 1142 netxen_nic_driver_name, netdev->name,
1139 intcount); 1143 intcount);
diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h b/drivers/net/netxen/netxen_nic_phan_reg.h
index 9457fc7249c8..10fe6fafa6f6 100644
--- a/drivers/net/netxen/netxen_nic_phan_reg.h
+++ b/drivers/net/netxen/netxen_nic_phan_reg.h
@@ -114,6 +114,20 @@
114#define CRB_V2P_3 NETXEN_NIC_REG(0x29c) 114#define CRB_V2P_3 NETXEN_NIC_REG(0x29c)
115#define CRB_V2P(port) (CRB_V2P_0+((port)*4)) 115#define CRB_V2P(port) (CRB_V2P_0+((port)*4))
116#define CRB_DRIVER_VERSION NETXEN_NIC_REG(0x2a0) 116#define CRB_DRIVER_VERSION NETXEN_NIC_REG(0x2a0)
117/* sw int status/mask registers */
118#define CRB_SW_INT_MASK_0 NETXEN_NIC_REG(0x1d8)
119#define CRB_SW_INT_MASK_1 NETXEN_NIC_REG(0x1e0)
120#define CRB_SW_INT_MASK_2 NETXEN_NIC_REG(0x1e4)
121#define CRB_SW_INT_MASK_3 NETXEN_NIC_REG(0x1e8)
122
123/*
124 * capabilities register, can be used to selectively enable/disable features
125 * for backward compability
126 */
127#define CRB_NIC_CAPABILITIES_HOST NETXEN_NIC_REG(0x1a8)
128#define CRB_NIC_CAPABILITIES_FW NETXEN_NIC_REG(0x1dc)
129
130#define INTR_SCHEME_PERPORT 0x1
117 131
118/* used for ethtool tests */ 132/* used for ethtool tests */
119#define CRB_SCRATCHPAD_TEST NETXEN_NIC_REG(0x280) 133#define CRB_SCRATCHPAD_TEST NETXEN_NIC_REG(0x280)