diff options
author | Amit Kumar Salecha <amit@netxen.com> | 2009-09-05 13:43:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-07 04:53:13 -0400 |
commit | 195c5f9829407857cba86f083caec6302b1fd8e1 (patch) | |
tree | d208ca059eaa3f6dd0dd4fb23226f84584a341e4 /drivers | |
parent | d0725e4d3ccf603c4fcf3589850cb464c927d42a (diff) |
netxen: pre calculate register addresses
For registers accessed in fast path (interrupt / softirq)
avoid expensive I/O address translation. These registers
are directly mapped in PCI bar 0 and do not require
any window checks.
Signed-off-by: Amit Kumar Salecha <amit@netxen.com>
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 75 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_ctx.c | 21 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_ethtool.c | 5 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 176 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_init.c | 34 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 90 |
6 files changed, 210 insertions, 191 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 30a38163b23b..5bbc40be9de6 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -584,11 +584,11 @@ struct netxen_adapter_stats { | |||
584 | */ | 584 | */ |
585 | struct nx_host_rds_ring { | 585 | struct nx_host_rds_ring { |
586 | u32 producer; | 586 | u32 producer; |
587 | u32 crb_rcv_producer; | ||
588 | u32 num_desc; | 587 | u32 num_desc; |
589 | u32 dma_size; | 588 | u32 dma_size; |
590 | u32 skb_size; | 589 | u32 skb_size; |
591 | u32 flags; | 590 | u32 flags; |
591 | void __iomem *crb_rcv_producer; | ||
592 | struct rcv_desc *desc_head; | 592 | struct rcv_desc *desc_head; |
593 | struct netxen_rx_buffer *rx_buf_arr; | 593 | struct netxen_rx_buffer *rx_buf_arr; |
594 | struct list_head free_list; | 594 | struct list_head free_list; |
@@ -598,9 +598,9 @@ struct nx_host_rds_ring { | |||
598 | 598 | ||
599 | struct nx_host_sds_ring { | 599 | struct nx_host_sds_ring { |
600 | u32 consumer; | 600 | u32 consumer; |
601 | u32 crb_sts_consumer; | ||
602 | u32 crb_intr_mask; | ||
603 | u32 num_desc; | 601 | u32 num_desc; |
602 | void __iomem *crb_sts_consumer; | ||
603 | void __iomem *crb_intr_mask; | ||
604 | 604 | ||
605 | struct status_desc *desc_head; | 605 | struct status_desc *desc_head; |
606 | struct netxen_adapter *adapter; | 606 | struct netxen_adapter *adapter; |
@@ -617,8 +617,8 @@ struct nx_host_tx_ring { | |||
617 | u32 producer; | 617 | u32 producer; |
618 | __le32 *hw_consumer; | 618 | __le32 *hw_consumer; |
619 | u32 sw_consumer; | 619 | u32 sw_consumer; |
620 | u32 crb_cmd_producer; | 620 | void __iomem *crb_cmd_producer; |
621 | u32 crb_cmd_consumer; | 621 | void __iomem *crb_cmd_consumer; |
622 | u32 num_desc; | 622 | u32 num_desc; |
623 | 623 | ||
624 | struct netdev_queue *txq; | 624 | struct netdev_queue *txq; |
@@ -1163,7 +1163,7 @@ struct netxen_adapter { | |||
1163 | u32 irq; | 1163 | u32 irq; |
1164 | u32 temp; | 1164 | u32 temp; |
1165 | 1165 | ||
1166 | u32 msi_tgt_status; | 1166 | u32 int_vec_bit; |
1167 | u32 heartbit; | 1167 | u32 heartbit; |
1168 | 1168 | ||
1169 | struct netxen_adapter_stats stats; | 1169 | struct netxen_adapter_stats stats; |
@@ -1180,16 +1180,23 @@ struct netxen_adapter { | |||
1180 | int (*init_port) (struct netxen_adapter *, int); | 1180 | int (*init_port) (struct netxen_adapter *, int); |
1181 | int (*stop_port) (struct netxen_adapter *); | 1181 | int (*stop_port) (struct netxen_adapter *); |
1182 | 1182 | ||
1183 | u32 (*hw_read_wx)(struct netxen_adapter *, ulong); | 1183 | u32 (*crb_read)(struct netxen_adapter *, ulong); |
1184 | int (*hw_write_wx)(struct netxen_adapter *, ulong, u32); | 1184 | int (*crb_write)(struct netxen_adapter *, ulong, u32); |
1185 | |||
1185 | int (*pci_mem_read)(struct netxen_adapter *, u64, void *, int); | 1186 | int (*pci_mem_read)(struct netxen_adapter *, u64, void *, int); |
1186 | int (*pci_mem_write)(struct netxen_adapter *, u64, void *, int); | 1187 | int (*pci_mem_write)(struct netxen_adapter *, u64, void *, int); |
1187 | int (*pci_write_immediate)(struct netxen_adapter *, u64, u32); | 1188 | |
1188 | u32 (*pci_read_immediate)(struct netxen_adapter *, u64); | ||
1189 | unsigned long (*pci_set_window)(struct netxen_adapter *, | 1189 | unsigned long (*pci_set_window)(struct netxen_adapter *, |
1190 | unsigned long long); | 1190 | unsigned long long); |
1191 | 1191 | ||
1192 | struct netxen_legacy_intr_set legacy_intr; | 1192 | u32 (*io_read)(struct netxen_adapter *, void __iomem *); |
1193 | void (*io_write)(struct netxen_adapter *, void __iomem *, u32); | ||
1194 | |||
1195 | void __iomem *tgt_mask_reg; | ||
1196 | void __iomem *pci_int_reg; | ||
1197 | void __iomem *tgt_status_reg; | ||
1198 | void __iomem *crb_int_state_reg; | ||
1199 | void __iomem *isr_int_vec; | ||
1193 | 1200 | ||
1194 | struct msix_entry msix_entries[MSIX_ENTRIES_PER_ADAPTER]; | 1201 | struct msix_entry msix_entries[MSIX_ENTRIES_PER_ADAPTER]; |
1195 | 1202 | ||
@@ -1223,9 +1230,13 @@ int netxen_p2_nic_set_mac_addr(struct netxen_adapter *adapter, u8 *addr); | |||
1223 | int netxen_p3_nic_set_mac_addr(struct netxen_adapter *adapter, u8 *addr); | 1230 | int netxen_p3_nic_set_mac_addr(struct netxen_adapter *adapter, u8 *addr); |
1224 | 1231 | ||
1225 | #define NXRD32(adapter, off) \ | 1232 | #define NXRD32(adapter, off) \ |
1226 | (adapter->hw_read_wx(adapter, off)) | 1233 | (adapter->crb_read(adapter, off)) |
1227 | #define NXWR32(adapter, off, val) \ | 1234 | #define NXWR32(adapter, off, val) \ |
1228 | (adapter->hw_write_wx(adapter, off, val)) | 1235 | (adapter->crb_write(adapter, off, val)) |
1236 | #define NXRDIO(adapter, addr) \ | ||
1237 | (adapter->io_read(adapter, addr)) | ||
1238 | #define NXWRIO(adapter, addr, val) \ | ||
1239 | (adapter->io_write(adapter, addr, val)) | ||
1229 | 1240 | ||
1230 | int netxen_pcie_sem_lock(struct netxen_adapter *, int, u32); | 1241 | int netxen_pcie_sem_lock(struct netxen_adapter *, int, u32); |
1231 | void netxen_pcie_sem_unlock(struct netxen_adapter *, int); | 1242 | void netxen_pcie_sem_unlock(struct netxen_adapter *, int); |
@@ -1255,40 +1266,6 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter); | |||
1255 | void netxen_nic_get_firmware_info(struct netxen_adapter *adapter); | 1266 | void netxen_nic_get_firmware_info(struct netxen_adapter *adapter); |
1256 | int netxen_nic_wol_supported(struct netxen_adapter *adapter); | 1267 | int netxen_nic_wol_supported(struct netxen_adapter *adapter); |
1257 | 1268 | ||
1258 | u32 netxen_nic_hw_read_wx_128M(struct netxen_adapter *adapter, ulong off); | ||
1259 | int netxen_nic_hw_write_wx_128M(struct netxen_adapter *adapter, | ||
1260 | ulong off, u32 data); | ||
1261 | int netxen_nic_pci_mem_read_128M(struct netxen_adapter *adapter, | ||
1262 | u64 off, void *data, int size); | ||
1263 | int netxen_nic_pci_mem_write_128M(struct netxen_adapter *adapter, | ||
1264 | u64 off, void *data, int size); | ||
1265 | int netxen_nic_pci_write_immediate_128M(struct netxen_adapter *adapter, | ||
1266 | u64 off, u32 data); | ||
1267 | u32 netxen_nic_pci_read_immediate_128M(struct netxen_adapter *adapter, u64 off); | ||
1268 | void netxen_nic_pci_write_normalize_128M(struct netxen_adapter *adapter, | ||
1269 | u64 off, u32 data); | ||
1270 | u32 netxen_nic_pci_read_normalize_128M(struct netxen_adapter *adapter, u64 off); | ||
1271 | unsigned long netxen_nic_pci_set_window_128M(struct netxen_adapter *adapter, | ||
1272 | unsigned long long addr); | ||
1273 | void netxen_nic_pci_change_crbwindow_128M(struct netxen_adapter *adapter, | ||
1274 | u32 wndw); | ||
1275 | |||
1276 | u32 netxen_nic_hw_read_wx_2M(struct netxen_adapter *adapter, ulong off); | ||
1277 | int netxen_nic_hw_write_wx_2M(struct netxen_adapter *adapter, | ||
1278 | ulong off, u32 data); | ||
1279 | int netxen_nic_pci_mem_read_2M(struct netxen_adapter *adapter, | ||
1280 | u64 off, void *data, int size); | ||
1281 | int netxen_nic_pci_mem_write_2M(struct netxen_adapter *adapter, | ||
1282 | u64 off, void *data, int size); | ||
1283 | int netxen_nic_pci_write_immediate_2M(struct netxen_adapter *adapter, | ||
1284 | u64 off, u32 data); | ||
1285 | u32 netxen_nic_pci_read_immediate_2M(struct netxen_adapter *adapter, u64 off); | ||
1286 | void netxen_nic_pci_write_normalize_2M(struct netxen_adapter *adapter, | ||
1287 | u64 off, u32 data); | ||
1288 | u32 netxen_nic_pci_read_normalize_2M(struct netxen_adapter *adapter, u64 off); | ||
1289 | unsigned long netxen_nic_pci_set_window_2M(struct netxen_adapter *adapter, | ||
1290 | unsigned long long addr); | ||
1291 | |||
1292 | /* Functions from netxen_nic_init.c */ | 1269 | /* Functions from netxen_nic_init.c */ |
1293 | int netxen_init_dummy_dma(struct netxen_adapter *adapter); | 1270 | int netxen_init_dummy_dma(struct netxen_adapter *adapter); |
1294 | void netxen_free_dummy_dma(struct netxen_adapter *adapter); | 1271 | void netxen_free_dummy_dma(struct netxen_adapter *adapter); |
@@ -1316,13 +1293,15 @@ int netxen_rom_se(struct netxen_adapter *adapter, int addr); | |||
1316 | int netxen_alloc_sw_resources(struct netxen_adapter *adapter); | 1293 | int netxen_alloc_sw_resources(struct netxen_adapter *adapter); |
1317 | void netxen_free_sw_resources(struct netxen_adapter *adapter); | 1294 | void netxen_free_sw_resources(struct netxen_adapter *adapter); |
1318 | 1295 | ||
1296 | void netxen_setup_hwops(struct netxen_adapter *adapter); | ||
1297 | void __iomem *netxen_get_ioaddr(struct netxen_adapter *, u32); | ||
1298 | |||
1319 | int netxen_alloc_hw_resources(struct netxen_adapter *adapter); | 1299 | int netxen_alloc_hw_resources(struct netxen_adapter *adapter); |
1320 | void netxen_free_hw_resources(struct netxen_adapter *adapter); | 1300 | void netxen_free_hw_resources(struct netxen_adapter *adapter); |
1321 | 1301 | ||
1322 | void netxen_release_rx_buffers(struct netxen_adapter *adapter); | 1302 | void netxen_release_rx_buffers(struct netxen_adapter *adapter); |
1323 | void netxen_release_tx_buffers(struct netxen_adapter *adapter); | 1303 | void netxen_release_tx_buffers(struct netxen_adapter *adapter); |
1324 | 1304 | ||
1325 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter); | ||
1326 | int netxen_init_firmware(struct netxen_adapter *adapter); | 1305 | int netxen_init_firmware(struct netxen_adapter *adapter); |
1327 | void netxen_nic_clear_stats(struct netxen_adapter *adapter); | 1306 | void netxen_nic_clear_stats(struct netxen_adapter *adapter); |
1328 | void netxen_watchdog_task(struct work_struct *work); | 1307 | void netxen_watchdog_task(struct work_struct *work); |
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c index 8ab5773e47d6..33f82db01293 100644 --- a/drivers/net/netxen/netxen_nic_ctx.c +++ b/drivers/net/netxen/netxen_nic_ctx.c | |||
@@ -229,7 +229,8 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
229 | rds_ring = &recv_ctx->rds_rings[i]; | 229 | rds_ring = &recv_ctx->rds_rings[i]; |
230 | 230 | ||
231 | reg = le32_to_cpu(prsp_rds[i].host_producer_crb); | 231 | reg = le32_to_cpu(prsp_rds[i].host_producer_crb); |
232 | rds_ring->crb_rcv_producer = NETXEN_NIC_REG(reg - 0x200); | 232 | rds_ring->crb_rcv_producer = netxen_get_ioaddr(adapter, |
233 | NETXEN_NIC_REG(reg - 0x200)); | ||
233 | } | 234 | } |
234 | 235 | ||
235 | prsp_sds = ((nx_cardrsp_sds_ring_t *) | 236 | prsp_sds = ((nx_cardrsp_sds_ring_t *) |
@@ -239,10 +240,12 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
239 | sds_ring = &recv_ctx->sds_rings[i]; | 240 | sds_ring = &recv_ctx->sds_rings[i]; |
240 | 241 | ||
241 | reg = le32_to_cpu(prsp_sds[i].host_consumer_crb); | 242 | reg = le32_to_cpu(prsp_sds[i].host_consumer_crb); |
242 | sds_ring->crb_sts_consumer = NETXEN_NIC_REG(reg - 0x200); | 243 | sds_ring->crb_sts_consumer = netxen_get_ioaddr(adapter, |
244 | NETXEN_NIC_REG(reg - 0x200)); | ||
243 | 245 | ||
244 | reg = le32_to_cpu(prsp_sds[i].interrupt_crb); | 246 | reg = le32_to_cpu(prsp_sds[i].interrupt_crb); |
245 | sds_ring->crb_intr_mask = NETXEN_NIC_REG(reg - 0x200); | 247 | sds_ring->crb_intr_mask = netxen_get_ioaddr(adapter, |
248 | NETXEN_NIC_REG(reg - 0x200)); | ||
246 | } | 249 | } |
247 | 250 | ||
248 | recv_ctx->state = le32_to_cpu(prsp->host_ctx_state); | 251 | recv_ctx->state = le32_to_cpu(prsp->host_ctx_state); |
@@ -342,7 +345,8 @@ nx_fw_cmd_create_tx_ctx(struct netxen_adapter *adapter) | |||
342 | 345 | ||
343 | if (err == NX_RCODE_SUCCESS) { | 346 | if (err == NX_RCODE_SUCCESS) { |
344 | temp = le32_to_cpu(prsp->cds_ring.host_producer_crb); | 347 | temp = le32_to_cpu(prsp->cds_ring.host_producer_crb); |
345 | tx_ring->crb_cmd_producer = NETXEN_NIC_REG(temp - 0x200); | 348 | tx_ring->crb_cmd_producer = netxen_get_ioaddr(adapter, |
349 | NETXEN_NIC_REG(temp - 0x200)); | ||
346 | #if 0 | 350 | #if 0 |
347 | adapter->tx_state = | 351 | adapter->tx_state = |
348 | le32_to_cpu(prsp->host_ctx_state); | 352 | le32_to_cpu(prsp->host_ctx_state); |
@@ -651,7 +655,8 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter) | |||
651 | 655 | ||
652 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) | 656 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) |
653 | rds_ring->crb_rcv_producer = | 657 | rds_ring->crb_rcv_producer = |
654 | recv_crb_registers[port].crb_rcv_producer[ring]; | 658 | netxen_get_ioaddr(adapter, |
659 | recv_crb_registers[port].crb_rcv_producer[ring]); | ||
655 | } | 660 | } |
656 | 661 | ||
657 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 662 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { |
@@ -670,10 +675,12 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter) | |||
670 | sds_ring->desc_head = (struct status_desc *)addr; | 675 | sds_ring->desc_head = (struct status_desc *)addr; |
671 | 676 | ||
672 | sds_ring->crb_sts_consumer = | 677 | sds_ring->crb_sts_consumer = |
673 | recv_crb_registers[port].crb_sts_consumer[ring]; | 678 | netxen_get_ioaddr(adapter, |
679 | recv_crb_registers[port].crb_sts_consumer[ring]); | ||
674 | 680 | ||
675 | sds_ring->crb_intr_mask = | 681 | sds_ring->crb_intr_mask = |
676 | recv_crb_registers[port].sw_int_mask[ring]; | 682 | netxen_get_ioaddr(adapter, |
683 | recv_crb_registers[port].sw_int_mask[ring]); | ||
677 | } | 684 | } |
678 | 685 | ||
679 | 686 | ||
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index e376a1c4eb06..d18832ce4b58 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -84,18 +84,17 @@ static void | |||
84 | netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo) | 84 | netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo) |
85 | { | 85 | { |
86 | struct netxen_adapter *adapter = netdev_priv(dev); | 86 | struct netxen_adapter *adapter = netdev_priv(dev); |
87 | unsigned long flags; | ||
88 | u32 fw_major = 0; | 87 | u32 fw_major = 0; |
89 | u32 fw_minor = 0; | 88 | u32 fw_minor = 0; |
90 | u32 fw_build = 0; | 89 | u32 fw_build = 0; |
91 | 90 | ||
92 | strncpy(drvinfo->driver, netxen_nic_driver_name, 32); | 91 | strncpy(drvinfo->driver, netxen_nic_driver_name, 32); |
93 | strncpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, 32); | 92 | strncpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, 32); |
94 | write_lock_irqsave(&adapter->adapter_lock, flags); | 93 | read_lock(&adapter->adapter_lock); |
95 | fw_major = NXRD32(adapter, NETXEN_FW_VERSION_MAJOR); | 94 | fw_major = NXRD32(adapter, NETXEN_FW_VERSION_MAJOR); |
96 | fw_minor = NXRD32(adapter, NETXEN_FW_VERSION_MINOR); | 95 | fw_minor = NXRD32(adapter, NETXEN_FW_VERSION_MINOR); |
97 | fw_build = NXRD32(adapter, NETXEN_FW_VERSION_SUB); | 96 | fw_build = NXRD32(adapter, NETXEN_FW_VERSION_SUB); |
98 | write_unlock_irqrestore(&adapter->adapter_lock, flags); | 97 | read_unlock(&adapter->adapter_lock); |
99 | sprintf(drvinfo->fw_version, "%d.%d.%d", fw_major, fw_minor, fw_build); | 98 | sprintf(drvinfo->fw_version, "%d.%d.%d", fw_major, fw_minor, fw_build); |
100 | 99 | ||
101 | strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); | 100 | strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index d0ac8fabd423..cbfd6102e455 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -1050,7 +1050,7 @@ int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac) | |||
1050 | /* | 1050 | /* |
1051 | * Changes the CRB window to the specified window. | 1051 | * Changes the CRB window to the specified window. |
1052 | */ | 1052 | */ |
1053 | void | 1053 | static void |
1054 | netxen_nic_pci_change_crbwindow_128M(struct netxen_adapter *adapter, u32 wndw) | 1054 | netxen_nic_pci_change_crbwindow_128M(struct netxen_adapter *adapter, u32 wndw) |
1055 | { | 1055 | { |
1056 | void __iomem *offset; | 1056 | void __iomem *offset; |
@@ -1163,61 +1163,68 @@ netxen_nic_pci_set_crbwindow_2M(struct netxen_adapter *adapter, ulong *off) | |||
1163 | (ulong)adapter->ahw.pci_base0; | 1163 | (ulong)adapter->ahw.pci_base0; |
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | int | 1166 | static int |
1167 | netxen_nic_hw_write_wx_128M(struct netxen_adapter *adapter, ulong off, u32 data) | 1167 | netxen_nic_hw_write_wx_128M(struct netxen_adapter *adapter, ulong off, u32 data) |
1168 | { | 1168 | { |
1169 | unsigned long flags; | ||
1169 | void __iomem *addr; | 1170 | void __iomem *addr; |
1170 | 1171 | ||
1171 | if (ADDR_IN_WINDOW1(off)) { | 1172 | if (ADDR_IN_WINDOW1(off)) |
1172 | addr = NETXEN_CRB_NORMALIZE(adapter, off); | 1173 | addr = NETXEN_CRB_NORMALIZE(adapter, off); |
1174 | else | ||
1175 | addr = pci_base_offset(adapter, off); | ||
1176 | |||
1177 | BUG_ON(!addr); | ||
1178 | |||
1179 | if (ADDR_IN_WINDOW1(off)) { /* Window 1 */ | ||
1180 | read_lock(&adapter->adapter_lock); | ||
1181 | writel(data, addr); | ||
1182 | read_unlock(&adapter->adapter_lock); | ||
1173 | } else { /* Window 0 */ | 1183 | } else { /* Window 0 */ |
1184 | write_lock_irqsave(&adapter->adapter_lock, flags); | ||
1174 | addr = pci_base_offset(adapter, off); | 1185 | addr = pci_base_offset(adapter, off); |
1175 | netxen_nic_pci_change_crbwindow_128M(adapter, 0); | 1186 | netxen_nic_pci_change_crbwindow_128M(adapter, 0); |
1176 | } | 1187 | writel(data, addr); |
1177 | |||
1178 | if (!addr) { | ||
1179 | netxen_nic_pci_change_crbwindow_128M(adapter, 1); | 1188 | netxen_nic_pci_change_crbwindow_128M(adapter, 1); |
1180 | return 1; | 1189 | write_unlock_irqrestore(&adapter->adapter_lock, flags); |
1181 | } | 1190 | } |
1182 | 1191 | ||
1183 | writel(data, addr); | ||
1184 | |||
1185 | if (!ADDR_IN_WINDOW1(off)) | ||
1186 | netxen_nic_pci_change_crbwindow_128M(adapter, 1); | ||
1187 | |||
1188 | return 0; | 1192 | return 0; |
1189 | } | 1193 | } |
1190 | 1194 | ||
1191 | u32 | 1195 | static u32 |
1192 | netxen_nic_hw_read_wx_128M(struct netxen_adapter *adapter, ulong off) | 1196 | netxen_nic_hw_read_wx_128M(struct netxen_adapter *adapter, ulong off) |
1193 | { | 1197 | { |
1198 | unsigned long flags; | ||
1194 | void __iomem *addr; | 1199 | void __iomem *addr; |
1195 | u32 data; | 1200 | u32 data; |
1196 | 1201 | ||
1197 | if (ADDR_IN_WINDOW1(off)) { /* Window 1 */ | 1202 | if (ADDR_IN_WINDOW1(off)) |
1198 | addr = NETXEN_CRB_NORMALIZE(adapter, off); | 1203 | addr = NETXEN_CRB_NORMALIZE(adapter, off); |
1199 | } else { /* Window 0 */ | 1204 | else |
1200 | addr = pci_base_offset(adapter, off); | 1205 | addr = pci_base_offset(adapter, off); |
1201 | netxen_nic_pci_change_crbwindow_128M(adapter, 0); | ||
1202 | } | ||
1203 | |||
1204 | if (!addr) { | ||
1205 | netxen_nic_pci_change_crbwindow_128M(adapter, 1); | ||
1206 | return 1; | ||
1207 | } | ||
1208 | 1206 | ||
1209 | data = readl(addr); | 1207 | BUG_ON(!addr); |
1210 | 1208 | ||
1211 | if (!ADDR_IN_WINDOW1(off)) | 1209 | if (ADDR_IN_WINDOW1(off)) { /* Window 1 */ |
1210 | read_lock(&adapter->adapter_lock); | ||
1211 | data = readl(addr); | ||
1212 | read_unlock(&adapter->adapter_lock); | ||
1213 | } else { /* Window 0 */ | ||
1214 | write_lock_irqsave(&adapter->adapter_lock, flags); | ||
1215 | netxen_nic_pci_change_crbwindow_128M(adapter, 0); | ||
1216 | data = readl(addr); | ||
1212 | netxen_nic_pci_change_crbwindow_128M(adapter, 1); | 1217 | netxen_nic_pci_change_crbwindow_128M(adapter, 1); |
1218 | write_unlock_irqrestore(&adapter->adapter_lock, flags); | ||
1219 | } | ||
1213 | 1220 | ||
1214 | return data; | 1221 | return data; |
1215 | } | 1222 | } |
1216 | 1223 | ||
1217 | int | 1224 | static int |
1218 | netxen_nic_hw_write_wx_2M(struct netxen_adapter *adapter, ulong off, u32 data) | 1225 | netxen_nic_hw_write_wx_2M(struct netxen_adapter *adapter, ulong off, u32 data) |
1219 | { | 1226 | { |
1220 | unsigned long flags = 0; | 1227 | unsigned long flags; |
1221 | int rv; | 1228 | int rv; |
1222 | 1229 | ||
1223 | rv = netxen_nic_pci_get_crb_addr_2M(adapter, &off); | 1230 | rv = netxen_nic_pci_get_crb_addr_2M(adapter, &off); |
@@ -1243,10 +1250,10 @@ netxen_nic_hw_write_wx_2M(struct netxen_adapter *adapter, ulong off, u32 data) | |||
1243 | return 0; | 1250 | return 0; |
1244 | } | 1251 | } |
1245 | 1252 | ||
1246 | u32 | 1253 | static u32 |
1247 | netxen_nic_hw_read_wx_2M(struct netxen_adapter *adapter, ulong off) | 1254 | netxen_nic_hw_read_wx_2M(struct netxen_adapter *adapter, ulong off) |
1248 | { | 1255 | { |
1249 | unsigned long flags = 0; | 1256 | unsigned long flags; |
1250 | int rv; | 1257 | int rv; |
1251 | u32 data; | 1258 | u32 data; |
1252 | 1259 | ||
@@ -1293,7 +1300,7 @@ netxen_nic_pci_mem_bound_check(struct netxen_adapter *adapter, | |||
1293 | 1300 | ||
1294 | static int netxen_pci_set_window_warning_count; | 1301 | static int netxen_pci_set_window_warning_count; |
1295 | 1302 | ||
1296 | unsigned long | 1303 | static unsigned long |
1297 | netxen_nic_pci_set_window_128M(struct netxen_adapter *adapter, | 1304 | netxen_nic_pci_set_window_128M(struct netxen_adapter *adapter, |
1298 | unsigned long long addr) | 1305 | unsigned long long addr) |
1299 | { | 1306 | { |
@@ -1357,22 +1364,56 @@ netxen_nic_pci_set_window_128M(struct netxen_adapter *adapter, | |||
1357 | return addr; | 1364 | return addr; |
1358 | } | 1365 | } |
1359 | 1366 | ||
1360 | /* | 1367 | /* window 1 registers only */ |
1361 | * Note : only 32-bit writes! | 1368 | static void netxen_nic_io_write_128M(struct netxen_adapter *adapter, |
1362 | */ | 1369 | void __iomem *addr, u32 data) |
1363 | int netxen_nic_pci_write_immediate_128M(struct netxen_adapter *adapter, | ||
1364 | u64 off, u32 data) | ||
1365 | { | 1370 | { |
1366 | writel(data, (void __iomem *)(PCI_OFFSET_SECOND_RANGE(adapter, off))); | 1371 | read_lock(&adapter->adapter_lock); |
1367 | return 0; | 1372 | writel(data, addr); |
1373 | read_unlock(&adapter->adapter_lock); | ||
1374 | } | ||
1375 | |||
1376 | static u32 netxen_nic_io_read_128M(struct netxen_adapter *adapter, | ||
1377 | void __iomem *addr) | ||
1378 | { | ||
1379 | u32 val; | ||
1380 | |||
1381 | read_lock(&adapter->adapter_lock); | ||
1382 | val = readl(addr); | ||
1383 | read_unlock(&adapter->adapter_lock); | ||
1384 | |||
1385 | return val; | ||
1368 | } | 1386 | } |
1369 | 1387 | ||
1370 | u32 netxen_nic_pci_read_immediate_128M(struct netxen_adapter *adapter, u64 off) | 1388 | static void netxen_nic_io_write_2M(struct netxen_adapter *adapter, |
1389 | void __iomem *addr, u32 data) | ||
1371 | { | 1390 | { |
1372 | return readl((void __iomem *)(pci_base_offset(adapter, off))); | 1391 | writel(data, addr); |
1392 | } | ||
1393 | |||
1394 | static u32 netxen_nic_io_read_2M(struct netxen_adapter *adapter, | ||
1395 | void __iomem *addr) | ||
1396 | { | ||
1397 | return readl(addr); | ||
1398 | } | ||
1399 | |||
1400 | void __iomem * | ||
1401 | netxen_get_ioaddr(struct netxen_adapter *adapter, u32 offset) | ||
1402 | { | ||
1403 | ulong off = offset; | ||
1404 | |||
1405 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | ||
1406 | if (offset < NETXEN_CRB_PCIX_HOST2 && | ||
1407 | offset > NETXEN_CRB_PCIX_HOST) | ||
1408 | return PCI_OFFSET_SECOND_RANGE(adapter, offset); | ||
1409 | return NETXEN_CRB_NORMALIZE(adapter, offset); | ||
1410 | } | ||
1411 | |||
1412 | BUG_ON(netxen_nic_pci_get_crb_addr_2M(adapter, &off)); | ||
1413 | return (void __iomem *)off; | ||
1373 | } | 1414 | } |
1374 | 1415 | ||
1375 | unsigned long | 1416 | static unsigned long |
1376 | netxen_nic_pci_set_window_2M(struct netxen_adapter *adapter, | 1417 | netxen_nic_pci_set_window_2M(struct netxen_adapter *adapter, |
1377 | unsigned long long addr) | 1418 | unsigned long long addr) |
1378 | { | 1419 | { |
@@ -1616,7 +1657,7 @@ netxen_nic_pci_mem_write_direct(struct netxen_adapter *adapter, u64 off, | |||
1616 | 1657 | ||
1617 | #define MAX_CTL_CHECK 1000 | 1658 | #define MAX_CTL_CHECK 1000 |
1618 | 1659 | ||
1619 | int | 1660 | static int |
1620 | netxen_nic_pci_mem_write_128M(struct netxen_adapter *adapter, | 1661 | netxen_nic_pci_mem_write_128M(struct netxen_adapter *adapter, |
1621 | u64 off, void *data, int size) | 1662 | u64 off, void *data, int size) |
1622 | { | 1663 | { |
@@ -1709,7 +1750,7 @@ netxen_nic_pci_mem_write_128M(struct netxen_adapter *adapter, | |||
1709 | return ret; | 1750 | return ret; |
1710 | } | 1751 | } |
1711 | 1752 | ||
1712 | int | 1753 | static int |
1713 | netxen_nic_pci_mem_read_128M(struct netxen_adapter *adapter, | 1754 | netxen_nic_pci_mem_read_128M(struct netxen_adapter *adapter, |
1714 | u64 off, void *data, int size) | 1755 | u64 off, void *data, int size) |
1715 | { | 1756 | { |
@@ -1800,7 +1841,7 @@ netxen_nic_pci_mem_read_128M(struct netxen_adapter *adapter, | |||
1800 | return 0; | 1841 | return 0; |
1801 | } | 1842 | } |
1802 | 1843 | ||
1803 | int | 1844 | static int |
1804 | netxen_nic_pci_mem_write_2M(struct netxen_adapter *adapter, | 1845 | netxen_nic_pci_mem_write_2M(struct netxen_adapter *adapter, |
1805 | u64 off, void *data, int size) | 1846 | u64 off, void *data, int size) |
1806 | { | 1847 | { |
@@ -1828,8 +1869,8 @@ netxen_nic_pci_mem_write_2M(struct netxen_adapter *adapter, | |||
1828 | 1869 | ||
1829 | if ((size != 8) || (off0 != 0)) { | 1870 | if ((size != 8) || (off0 != 0)) { |
1830 | for (i = 0; i < loop; i++) { | 1871 | for (i = 0; i < loop; i++) { |
1831 | if (adapter->pci_mem_read(adapter, off8 + (i << 3), | 1872 | if (adapter->pci_mem_read(adapter, |
1832 | &word[i], 8)) | 1873 | off8 + (i << 3), &word[i], 8)) |
1833 | return -1; | 1874 | return -1; |
1834 | } | 1875 | } |
1835 | } | 1876 | } |
@@ -1900,7 +1941,7 @@ netxen_nic_pci_mem_write_2M(struct netxen_adapter *adapter, | |||
1900 | return ret; | 1941 | return ret; |
1901 | } | 1942 | } |
1902 | 1943 | ||
1903 | int | 1944 | static int |
1904 | netxen_nic_pci_mem_read_2M(struct netxen_adapter *adapter, | 1945 | netxen_nic_pci_mem_read_2M(struct netxen_adapter *adapter, |
1905 | u64 off, void *data, int size) | 1946 | u64 off, void *data, int size) |
1906 | { | 1947 | { |
@@ -1998,20 +2039,43 @@ netxen_nic_pci_mem_read_2M(struct netxen_adapter *adapter, | |||
1998 | return 0; | 2039 | return 0; |
1999 | } | 2040 | } |
2000 | 2041 | ||
2001 | /* | 2042 | void |
2002 | * Note : only 32-bit writes! | 2043 | netxen_setup_hwops(struct netxen_adapter *adapter) |
2003 | */ | ||
2004 | int netxen_nic_pci_write_immediate_2M(struct netxen_adapter *adapter, | ||
2005 | u64 off, u32 data) | ||
2006 | { | 2044 | { |
2007 | NXWR32(adapter, off, data); | 2045 | adapter->init_port = netxen_niu_xg_init_port; |
2046 | adapter->stop_port = netxen_niu_disable_xg_port; | ||
2008 | 2047 | ||
2009 | return 0; | 2048 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { |
2010 | } | 2049 | adapter->crb_read = netxen_nic_hw_read_wx_128M, |
2050 | adapter->crb_write = netxen_nic_hw_write_wx_128M, | ||
2051 | adapter->pci_set_window = netxen_nic_pci_set_window_128M, | ||
2052 | adapter->pci_mem_read = netxen_nic_pci_mem_read_128M, | ||
2053 | adapter->pci_mem_write = netxen_nic_pci_mem_write_128M, | ||
2054 | adapter->io_read = netxen_nic_io_read_128M, | ||
2055 | adapter->io_write = netxen_nic_io_write_128M, | ||
2056 | |||
2057 | adapter->macaddr_set = netxen_p2_nic_set_mac_addr; | ||
2058 | adapter->set_multi = netxen_p2_nic_set_multi; | ||
2059 | adapter->set_mtu = netxen_nic_set_mtu_xgb; | ||
2060 | adapter->set_promisc = netxen_p2_nic_set_promisc; | ||
2011 | 2061 | ||
2012 | u32 netxen_nic_pci_read_immediate_2M(struct netxen_adapter *adapter, u64 off) | 2062 | } else { |
2013 | { | 2063 | adapter->crb_read = netxen_nic_hw_read_wx_2M, |
2014 | return NXRD32(adapter, off); | 2064 | adapter->crb_write = netxen_nic_hw_write_wx_2M, |
2065 | adapter->pci_set_window = netxen_nic_pci_set_window_2M, | ||
2066 | adapter->pci_mem_read = netxen_nic_pci_mem_read_2M, | ||
2067 | adapter->pci_mem_write = netxen_nic_pci_mem_write_2M, | ||
2068 | adapter->io_read = netxen_nic_io_read_2M, | ||
2069 | adapter->io_write = netxen_nic_io_write_2M, | ||
2070 | |||
2071 | adapter->set_mtu = nx_fw_cmd_set_mtu; | ||
2072 | adapter->set_promisc = netxen_p3_nic_set_promisc; | ||
2073 | adapter->macaddr_set = netxen_p3_nic_set_mac_addr; | ||
2074 | adapter->set_multi = netxen_p3_nic_set_multi; | ||
2075 | |||
2076 | adapter->phy_read = nx_fw_cmd_query_phy; | ||
2077 | adapter->phy_write = nx_fw_cmd_set_phy; | ||
2078 | } | ||
2015 | } | 2079 | } |
2016 | 2080 | ||
2017 | int netxen_nic_get_board_info(struct netxen_adapter *adapter) | 2081 | int netxen_nic_get_board_info(struct netxen_adapter *adapter) |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 534994dc167f..485b947932a1 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -323,29 +323,6 @@ err_out: | |||
323 | return -ENOMEM; | 323 | return -ENOMEM; |
324 | } | 324 | } |
325 | 325 | ||
326 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter) | ||
327 | { | ||
328 | adapter->init_port = netxen_niu_xg_init_port; | ||
329 | adapter->stop_port = netxen_niu_disable_xg_port; | ||
330 | |||
331 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | ||
332 | adapter->macaddr_set = netxen_p2_nic_set_mac_addr; | ||
333 | adapter->set_multi = netxen_p2_nic_set_multi; | ||
334 | adapter->set_mtu = netxen_nic_set_mtu_xgb; | ||
335 | adapter->set_promisc = netxen_p2_nic_set_promisc; | ||
336 | } else { | ||
337 | adapter->set_mtu = nx_fw_cmd_set_mtu; | ||
338 | adapter->set_promisc = netxen_p3_nic_set_promisc; | ||
339 | adapter->macaddr_set = netxen_p3_nic_set_mac_addr; | ||
340 | adapter->set_multi = netxen_p3_nic_set_multi; | ||
341 | |||
342 | if (adapter->ahw.port_type == NETXEN_NIC_GBE) { | ||
343 | adapter->phy_read = nx_fw_cmd_query_phy; | ||
344 | adapter->phy_write = nx_fw_cmd_set_phy; | ||
345 | } | ||
346 | } | ||
347 | } | ||
348 | |||
349 | /* | 326 | /* |
350 | * netxen_decode_crb_addr(0 - utility to translate from internal Phantom CRB | 327 | * netxen_decode_crb_addr(0 - utility to translate from internal Phantom CRB |
351 | * address to external PCI CRB address. | 328 | * address to external PCI CRB address. |
@@ -1395,7 +1372,7 @@ skip: | |||
1395 | 1372 | ||
1396 | if (count) { | 1373 | if (count) { |
1397 | sds_ring->consumer = consumer; | 1374 | sds_ring->consumer = consumer; |
1398 | NXWR32(adapter, sds_ring->crb_sts_consumer, consumer); | 1375 | NXWRIO(adapter, sds_ring->crb_sts_consumer, consumer); |
1399 | } | 1376 | } |
1400 | 1377 | ||
1401 | return count; | 1378 | return count; |
@@ -1513,7 +1490,7 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid, | |||
1513 | 1490 | ||
1514 | if (count) { | 1491 | if (count) { |
1515 | rds_ring->producer = producer; | 1492 | rds_ring->producer = producer; |
1516 | NXWR32(adapter, rds_ring->crb_rcv_producer, | 1493 | NXWRIO(adapter, rds_ring->crb_rcv_producer, |
1517 | (producer-1) & (rds_ring->num_desc-1)); | 1494 | (producer-1) & (rds_ring->num_desc-1)); |
1518 | 1495 | ||
1519 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | 1496 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { |
@@ -1529,9 +1506,10 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid, | |||
1529 | (rds_ring->num_desc - 1))); | 1506 | (rds_ring->num_desc - 1))); |
1530 | netxen_set_msg_ctxid(msg, adapter->portnum); | 1507 | netxen_set_msg_ctxid(msg, adapter->portnum); |
1531 | netxen_set_msg_opcode(msg, NETXEN_RCV_PRODUCER(ringid)); | 1508 | netxen_set_msg_opcode(msg, NETXEN_RCV_PRODUCER(ringid)); |
1532 | writel(msg, | 1509 | read_lock(&adapter->adapter_lock); |
1533 | DB_NORMALIZE(adapter, | 1510 | writel(msg, DB_NORMALIZE(adapter, |
1534 | NETXEN_RCV_PRODUCER_OFFSET)); | 1511 | NETXEN_RCV_PRODUCER_OFFSET)); |
1512 | read_unlock(&adapter->adapter_lock); | ||
1535 | } | 1513 | } |
1536 | } | 1514 | } |
1537 | } | 1515 | } |
@@ -1573,7 +1551,7 @@ netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, | |||
1573 | 1551 | ||
1574 | if (count) { | 1552 | if (count) { |
1575 | rds_ring->producer = producer; | 1553 | rds_ring->producer = producer; |
1576 | NXWR32(adapter, rds_ring->crb_rcv_producer, | 1554 | NXWRIO(adapter, rds_ring->crb_rcv_producer, |
1577 | (producer - 1) & (rds_ring->num_desc - 1)); | 1555 | (producer - 1) & (rds_ring->num_desc - 1)); |
1578 | } | 1556 | } |
1579 | spin_unlock(&rds_ring->lock); | 1557 | spin_unlock(&rds_ring->lock); |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 7038e1baaf4f..b2fd7132bc36 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -116,7 +116,7 @@ void | |||
116 | netxen_nic_update_cmd_producer(struct netxen_adapter *adapter, | 116 | netxen_nic_update_cmd_producer(struct netxen_adapter *adapter, |
117 | struct nx_host_tx_ring *tx_ring) | 117 | struct nx_host_tx_ring *tx_ring) |
118 | { | 118 | { |
119 | NXWR32(adapter, tx_ring->crb_cmd_producer, tx_ring->producer); | 119 | NXWRIO(adapter, tx_ring->crb_cmd_producer, tx_ring->producer); |
120 | 120 | ||
121 | if (netxen_tx_avail(tx_ring) <= TX_STOP_THRESH) { | 121 | if (netxen_tx_avail(tx_ring) <= TX_STOP_THRESH) { |
122 | netif_stop_queue(adapter->netdev); | 122 | netif_stop_queue(adapter->netdev); |
@@ -133,7 +133,7 @@ static inline void | |||
133 | netxen_nic_update_cmd_consumer(struct netxen_adapter *adapter, | 133 | netxen_nic_update_cmd_consumer(struct netxen_adapter *adapter, |
134 | struct nx_host_tx_ring *tx_ring) | 134 | struct nx_host_tx_ring *tx_ring) |
135 | { | 135 | { |
136 | NXWR32(adapter, tx_ring->crb_cmd_consumer, tx_ring->sw_consumer); | 136 | NXWRIO(adapter, tx_ring->crb_cmd_consumer, tx_ring->sw_consumer); |
137 | } | 137 | } |
138 | 138 | ||
139 | static uint32_t msi_tgt_status[8] = { | 139 | static uint32_t msi_tgt_status[8] = { |
@@ -149,18 +149,17 @@ static inline void netxen_nic_disable_int(struct nx_host_sds_ring *sds_ring) | |||
149 | { | 149 | { |
150 | struct netxen_adapter *adapter = sds_ring->adapter; | 150 | struct netxen_adapter *adapter = sds_ring->adapter; |
151 | 151 | ||
152 | NXWR32(adapter, sds_ring->crb_intr_mask, 0); | 152 | NXWRIO(adapter, sds_ring->crb_intr_mask, 0); |
153 | } | 153 | } |
154 | 154 | ||
155 | static inline void netxen_nic_enable_int(struct nx_host_sds_ring *sds_ring) | 155 | static inline void netxen_nic_enable_int(struct nx_host_sds_ring *sds_ring) |
156 | { | 156 | { |
157 | struct netxen_adapter *adapter = sds_ring->adapter; | 157 | struct netxen_adapter *adapter = sds_ring->adapter; |
158 | 158 | ||
159 | NXWR32(adapter, sds_ring->crb_intr_mask, 0x1); | 159 | NXWRIO(adapter, sds_ring->crb_intr_mask, 0x1); |
160 | 160 | ||
161 | if (!NETXEN_IS_MSI_FAMILY(adapter)) | 161 | if (!NETXEN_IS_MSI_FAMILY(adapter)) |
162 | adapter->pci_write_immediate(adapter, | 162 | NXWRIO(adapter, adapter->tgt_mask_reg, 0xfbff); |
163 | adapter->legacy_intr.tgt_mask_reg, 0xfbff); | ||
164 | } | 163 | } |
165 | 164 | ||
166 | static int | 165 | static int |
@@ -556,10 +555,22 @@ netxen_setup_intr(struct netxen_adapter *adapter) | |||
556 | legacy_intrp = &legacy_intr[adapter->ahw.pci_func]; | 555 | legacy_intrp = &legacy_intr[adapter->ahw.pci_func]; |
557 | else | 556 | else |
558 | legacy_intrp = &legacy_intr[0]; | 557 | legacy_intrp = &legacy_intr[0]; |
559 | adapter->legacy_intr.int_vec_bit = legacy_intrp->int_vec_bit; | 558 | |
560 | adapter->legacy_intr.tgt_status_reg = legacy_intrp->tgt_status_reg; | 559 | adapter->int_vec_bit = legacy_intrp->int_vec_bit; |
561 | adapter->legacy_intr.tgt_mask_reg = legacy_intrp->tgt_mask_reg; | 560 | adapter->tgt_status_reg = netxen_get_ioaddr(adapter, |
562 | adapter->legacy_intr.pci_int_reg = legacy_intrp->pci_int_reg; | 561 | legacy_intrp->tgt_status_reg); |
562 | adapter->tgt_mask_reg = netxen_get_ioaddr(adapter, | ||
563 | legacy_intrp->tgt_mask_reg); | ||
564 | adapter->pci_int_reg = netxen_get_ioaddr(adapter, | ||
565 | legacy_intrp->pci_int_reg); | ||
566 | adapter->isr_int_vec = netxen_get_ioaddr(adapter, ISR_INT_VECTOR); | ||
567 | |||
568 | if (adapter->ahw.revision_id >= NX_P3_B1) | ||
569 | adapter->crb_int_state_reg = netxen_get_ioaddr(adapter, | ||
570 | ISR_INT_STATE_REG); | ||
571 | else | ||
572 | adapter->crb_int_state_reg = netxen_get_ioaddr(adapter, | ||
573 | CRB_INT_VECTOR); | ||
563 | 574 | ||
564 | netxen_set_msix_bit(pdev, 0); | 575 | netxen_set_msix_bit(pdev, 0); |
565 | 576 | ||
@@ -586,8 +597,8 @@ netxen_setup_intr(struct netxen_adapter *adapter) | |||
586 | 597 | ||
587 | if (use_msi && !pci_enable_msi(pdev)) { | 598 | if (use_msi && !pci_enable_msi(pdev)) { |
588 | adapter->flags |= NETXEN_NIC_MSI_ENABLED; | 599 | adapter->flags |= NETXEN_NIC_MSI_ENABLED; |
589 | adapter->msi_tgt_status = | 600 | adapter->tgt_status_reg = netxen_get_ioaddr(adapter, |
590 | msi_tgt_status[adapter->ahw.pci_func]; | 601 | msi_tgt_status[adapter->ahw.pci_func]); |
591 | dev_info(&pdev->dev, "using msi interrupts\n"); | 602 | dev_info(&pdev->dev, "using msi interrupts\n"); |
592 | adapter->msix_entries[0].vector = pdev->irq; | 603 | adapter->msix_entries[0].vector = pdev->irq; |
593 | return; | 604 | return; |
@@ -647,14 +658,6 @@ netxen_setup_pci_map(struct netxen_adapter *adapter) | |||
647 | mem_len = pci_resource_len(pdev, 0); | 658 | mem_len = pci_resource_len(pdev, 0); |
648 | pci_len0 = 0; | 659 | pci_len0 = 0; |
649 | 660 | ||
650 | adapter->hw_write_wx = netxen_nic_hw_write_wx_128M; | ||
651 | adapter->hw_read_wx = netxen_nic_hw_read_wx_128M; | ||
652 | adapter->pci_read_immediate = netxen_nic_pci_read_immediate_128M; | ||
653 | adapter->pci_write_immediate = netxen_nic_pci_write_immediate_128M; | ||
654 | adapter->pci_set_window = netxen_nic_pci_set_window_128M; | ||
655 | adapter->pci_mem_read = netxen_nic_pci_mem_read_128M; | ||
656 | adapter->pci_mem_write = netxen_nic_pci_mem_write_128M; | ||
657 | |||
658 | /* 128 Meg of memory */ | 661 | /* 128 Meg of memory */ |
659 | if (mem_len == NETXEN_PCI_128MB_SIZE) { | 662 | if (mem_len == NETXEN_PCI_128MB_SIZE) { |
660 | mem_ptr0 = ioremap(mem_base, FIRST_PAGE_GROUP_SIZE); | 663 | mem_ptr0 = ioremap(mem_base, FIRST_PAGE_GROUP_SIZE); |
@@ -667,14 +670,6 @@ netxen_setup_pci_map(struct netxen_adapter *adapter) | |||
667 | mem_ptr2 = ioremap(mem_base + THIRD_PAGE_GROUP_START - | 670 | mem_ptr2 = ioremap(mem_base + THIRD_PAGE_GROUP_START - |
668 | SECOND_PAGE_GROUP_START, THIRD_PAGE_GROUP_SIZE); | 671 | SECOND_PAGE_GROUP_START, THIRD_PAGE_GROUP_SIZE); |
669 | } else if (mem_len == NETXEN_PCI_2MB_SIZE) { | 672 | } else if (mem_len == NETXEN_PCI_2MB_SIZE) { |
670 | adapter->hw_write_wx = netxen_nic_hw_write_wx_2M; | ||
671 | adapter->hw_read_wx = netxen_nic_hw_read_wx_2M; | ||
672 | adapter->pci_read_immediate = netxen_nic_pci_read_immediate_2M; | ||
673 | adapter->pci_write_immediate = | ||
674 | netxen_nic_pci_write_immediate_2M; | ||
675 | adapter->pci_set_window = netxen_nic_pci_set_window_2M; | ||
676 | adapter->pci_mem_read = netxen_nic_pci_mem_read_2M; | ||
677 | adapter->pci_mem_write = netxen_nic_pci_mem_write_2M; | ||
678 | 673 | ||
679 | mem_ptr0 = pci_ioremap_bar(pdev, 0); | 674 | mem_ptr0 = pci_ioremap_bar(pdev, 0); |
680 | if (mem_ptr0 == NULL) { | 675 | if (mem_ptr0 == NULL) { |
@@ -698,6 +693,8 @@ netxen_setup_pci_map(struct netxen_adapter *adapter) | |||
698 | return -EIO; | 693 | return -EIO; |
699 | } | 694 | } |
700 | 695 | ||
696 | netxen_setup_hwops(adapter); | ||
697 | |||
701 | dev_info(&pdev->dev, "%dMB memory map\n", (int)(mem_len>>20)); | 698 | dev_info(&pdev->dev, "%dMB memory map\n", (int)(mem_len>>20)); |
702 | 699 | ||
703 | adapter->ahw.pci_base0 = mem_ptr0; | 700 | adapter->ahw.pci_base0 = mem_ptr0; |
@@ -990,8 +987,10 @@ netxen_nic_attach(struct netxen_adapter *adapter) | |||
990 | 987 | ||
991 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | 988 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { |
992 | tx_ring = adapter->tx_ring; | 989 | tx_ring = adapter->tx_ring; |
993 | tx_ring->crb_cmd_producer = crb_cmd_producer[adapter->portnum]; | 990 | tx_ring->crb_cmd_producer = netxen_get_ioaddr(adapter, |
994 | tx_ring->crb_cmd_consumer = crb_cmd_consumer[adapter->portnum]; | 991 | crb_cmd_producer[adapter->portnum]); |
992 | tx_ring->crb_cmd_consumer = netxen_get_ioaddr(adapter, | ||
993 | crb_cmd_consumer[adapter->portnum]); | ||
995 | 994 | ||
996 | tx_ring->producer = 0; | 995 | tx_ring->producer = 0; |
997 | tx_ring->sw_consumer = 0; | 996 | tx_ring->sw_consumer = 0; |
@@ -1213,8 +1212,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1213 | goto err_out_iounmap; | 1212 | goto err_out_iounmap; |
1214 | } | 1213 | } |
1215 | 1214 | ||
1216 | netxen_initialize_adapter_ops(adapter); | ||
1217 | |||
1218 | /* Mezz cards have PCI function 0,2,3 enabled */ | 1215 | /* Mezz cards have PCI function 0,2,3 enabled */ |
1219 | switch (adapter->ahw.board_type) { | 1216 | switch (adapter->ahw.board_type) { |
1220 | case NETXEN_BRDTYPE_P2_SB31_10G_IMEZ: | 1217 | case NETXEN_BRDTYPE_P2_SB31_10G_IMEZ: |
@@ -1870,41 +1867,37 @@ static irqreturn_t netxen_intr(int irq, void *data) | |||
1870 | struct netxen_adapter *adapter = sds_ring->adapter; | 1867 | struct netxen_adapter *adapter = sds_ring->adapter; |
1871 | u32 status = 0; | 1868 | u32 status = 0; |
1872 | 1869 | ||
1873 | status = adapter->pci_read_immediate(adapter, ISR_INT_VECTOR); | 1870 | status = readl(adapter->isr_int_vec); |
1874 | 1871 | ||
1875 | if (!(status & adapter->legacy_intr.int_vec_bit)) | 1872 | if (!(status & adapter->int_vec_bit)) |
1876 | return IRQ_NONE; | 1873 | return IRQ_NONE; |
1877 | 1874 | ||
1878 | if (adapter->ahw.revision_id >= NX_P3_B1) { | 1875 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { |
1879 | /* check interrupt state machine, to be sure */ | 1876 | /* check interrupt state machine, to be sure */ |
1880 | status = adapter->pci_read_immediate(adapter, | 1877 | status = readl(adapter->crb_int_state_reg); |
1881 | ISR_INT_STATE_REG); | ||
1882 | if (!ISR_LEGACY_INT_TRIGGERED(status)) | 1878 | if (!ISR_LEGACY_INT_TRIGGERED(status)) |
1883 | return IRQ_NONE; | 1879 | return IRQ_NONE; |
1884 | 1880 | ||
1885 | } else { | 1881 | } else { |
1886 | unsigned long our_int = 0; | 1882 | unsigned long our_int = 0; |
1887 | 1883 | ||
1888 | our_int = NXRD32(adapter, CRB_INT_VECTOR); | 1884 | our_int = readl(adapter->crb_int_state_reg); |
1889 | 1885 | ||
1890 | /* not our interrupt */ | 1886 | /* not our interrupt */ |
1891 | if (!test_and_clear_bit((7 + adapter->portnum), &our_int)) | 1887 | if (!test_and_clear_bit((7 + adapter->portnum), &our_int)) |
1892 | return IRQ_NONE; | 1888 | return IRQ_NONE; |
1893 | 1889 | ||
1894 | /* claim interrupt */ | 1890 | /* claim interrupt */ |
1895 | NXWR32(adapter, CRB_INT_VECTOR, (our_int & 0xffffffff)); | 1891 | writel((our_int & 0xffffffff), adapter->crb_int_state_reg); |
1896 | } | ||
1897 | 1892 | ||
1898 | /* clear interrupt */ | 1893 | /* clear interrupt */ |
1899 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) | ||
1900 | netxen_nic_disable_int(sds_ring); | 1894 | netxen_nic_disable_int(sds_ring); |
1895 | } | ||
1901 | 1896 | ||
1902 | adapter->pci_write_immediate(adapter, | 1897 | writel(0xffffffff, adapter->tgt_status_reg); |
1903 | adapter->legacy_intr.tgt_status_reg, | ||
1904 | 0xffffffff); | ||
1905 | /* read twice to ensure write is flushed */ | 1898 | /* read twice to ensure write is flushed */ |
1906 | adapter->pci_read_immediate(adapter, ISR_INT_VECTOR); | 1899 | readl(adapter->isr_int_vec); |
1907 | adapter->pci_read_immediate(adapter, ISR_INT_VECTOR); | 1900 | readl(adapter->isr_int_vec); |
1908 | 1901 | ||
1909 | napi_schedule(&sds_ring->napi); | 1902 | napi_schedule(&sds_ring->napi); |
1910 | 1903 | ||
@@ -1917,8 +1910,7 @@ static irqreturn_t netxen_msi_intr(int irq, void *data) | |||
1917 | struct netxen_adapter *adapter = sds_ring->adapter; | 1910 | struct netxen_adapter *adapter = sds_ring->adapter; |
1918 | 1911 | ||
1919 | /* clear interrupt */ | 1912 | /* clear interrupt */ |
1920 | adapter->pci_write_immediate(adapter, | 1913 | writel(0xffffffff, adapter->tgt_status_reg); |
1921 | adapter->msi_tgt_status, 0xffffffff); | ||
1922 | 1914 | ||
1923 | napi_schedule(&sds_ring->napi); | 1915 | napi_schedule(&sds_ring->napi); |
1924 | return IRQ_HANDLED; | 1916 | return IRQ_HANDLED; |