aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_main.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-03-05 05:45:22 -0500
committerIngo Molnar <mingo@elte.hu>2009-03-05 05:45:22 -0500
commita140feab42d1cfd811930ab76104559c19dfc4b0 (patch)
tree41fd871990e888dd5616a6bf1891a1ff307221df /drivers/net/netxen/netxen_nic_main.c
parent1075414b06109a99b0e87601e84c74a95bd45681 (diff)
parentfec6c6fec3e20637bee5d276fb61dd8b49a3f9cc (diff)
Merge commit 'v2.6.29-rc7' into core/locking
Diffstat (limited to 'drivers/net/netxen/netxen_nic_main.c')
-rw-r--r--drivers/net/netxen/netxen_nic_main.c95
1 files changed, 25 insertions, 70 deletions
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 645d384fe87e..13087782ac40 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -76,6 +76,7 @@ static void netxen_nic_poll_controller(struct net_device *netdev);
76#endif 76#endif
77static irqreturn_t netxen_intr(int irq, void *data); 77static irqreturn_t netxen_intr(int irq, void *data);
78static irqreturn_t netxen_msi_intr(int irq, void *data); 78static irqreturn_t netxen_msi_intr(int irq, void *data);
79static irqreturn_t netxen_msix_intr(int irq, void *data);
79 80
80/* PCI Device ID Table */ 81/* PCI Device ID Table */
81#define ENTRY(device) \ 82#define ENTRY(device) \
@@ -200,9 +201,9 @@ static int nx_set_dma_mask(struct netxen_adapter *adapter, uint8_t revision_id)
200 adapter->pci_using_dac = 1; 201 adapter->pci_using_dac = 1;
201 return 0; 202 return 0;
202 } 203 }
204set_32_bit_mask:
203#endif /* CONFIG_IA64 */ 205#endif /* CONFIG_IA64 */
204 206
205set_32_bit_mask:
206 err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); 207 err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
207 if (!err) 208 if (!err)
208 err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); 209 err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
@@ -371,67 +372,6 @@ static void netxen_set_port_mode(struct netxen_adapter *adapter)
371 } 372 }
372} 373}
373 374
374#define PCI_CAP_ID_GEN 0x10
375
376static void netxen_pcie_strap_init(struct netxen_adapter *adapter)
377{
378 u32 pdevfuncsave;
379 u32 c8c9value = 0;
380 u32 chicken = 0;
381 u32 control = 0;
382 int i, pos;
383 struct pci_dev *pdev;
384
385 pdev = adapter->pdev;
386
387 adapter->hw_read_wx(adapter,
388 NETXEN_PCIE_REG(PCIE_CHICKEN3), &chicken, 4);
389 /* clear chicken3.25:24 */
390 chicken &= 0xFCFFFFFF;
391 /*
392 * if gen1 and B0, set F1020 - if gen 2, do nothing
393 * if gen2 set to F1000
394 */
395 pos = pci_find_capability(pdev, PCI_CAP_ID_GEN);
396 if (pos == 0xC0) {
397 pci_read_config_dword(pdev, pos + 0x10, &control);
398 if ((control & 0x000F0000) != 0x00020000) {
399 /* set chicken3.24 if gen1 */
400 chicken |= 0x01000000;
401 }
402 printk(KERN_INFO "%s Gen2 strapping detected\n",
403 netxen_nic_driver_name);
404 c8c9value = 0xF1000;
405 } else {
406 /* set chicken3.24 if gen1 */
407 chicken |= 0x01000000;
408 printk(KERN_INFO "%s Gen1 strapping detected\n",
409 netxen_nic_driver_name);
410 if (adapter->ahw.revision_id == NX_P3_B0)
411 c8c9value = 0xF1020;
412 else
413 c8c9value = 0;
414
415 }
416 adapter->hw_write_wx(adapter,
417 NETXEN_PCIE_REG(PCIE_CHICKEN3), &chicken, 4);
418
419 if (!c8c9value)
420 return;
421
422 pdevfuncsave = pdev->devfn;
423 if (pdevfuncsave & 0x07)
424 return;
425
426 for (i = 0; i < 8; i++) {
427 pci_read_config_dword(pdev, pos + 8, &control);
428 pci_read_config_dword(pdev, pos + 8, &control);
429 pci_write_config_dword(pdev, pos + 8, c8c9value);
430 pdev->devfn++;
431 }
432 pdev->devfn = pdevfuncsave;
433}
434
435static void netxen_set_msix_bit(struct pci_dev *pdev, int enable) 375static void netxen_set_msix_bit(struct pci_dev *pdev, int enable)
436{ 376{
437 u32 control; 377 u32 control;
@@ -648,7 +588,12 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
648 adapter->pci_mem_read = netxen_nic_pci_mem_read_2M; 588 adapter->pci_mem_read = netxen_nic_pci_mem_read_2M;
649 adapter->pci_mem_write = netxen_nic_pci_mem_write_2M; 589 adapter->pci_mem_write = netxen_nic_pci_mem_write_2M;
650 590
651 mem_ptr0 = ioremap(mem_base, mem_len); 591 mem_ptr0 = pci_ioremap_bar(pdev, 0);
592 if (mem_ptr0 == NULL) {
593 dev_err(&pdev->dev, "failed to map PCI bar 0\n");
594 return -EIO;
595 }
596
652 pci_len0 = mem_len; 597 pci_len0 = mem_len;
653 first_page_group_start = 0; 598 first_page_group_start = 0;
654 first_page_group_end = 0; 599 first_page_group_end = 0;
@@ -811,9 +756,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
811 } 756 }
812 netxen_load_firmware(adapter); 757 netxen_load_firmware(adapter);
813 758
814 if (NX_IS_REVISION_P3(revision_id))
815 netxen_pcie_strap_init(adapter);
816
817 if (NX_IS_REVISION_P2(revision_id)) { 759 if (NX_IS_REVISION_P2(revision_id)) {
818 760
819 /* Initialize multicast addr pool owners */ 761 /* Initialize multicast addr pool owners */
@@ -858,9 +800,12 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
858 * See if the firmware gave us a virtual-physical port mapping. 800 * See if the firmware gave us a virtual-physical port mapping.
859 */ 801 */
860 adapter->physical_port = adapter->portnum; 802 adapter->physical_port = adapter->portnum;
861 i = adapter->pci_read_normalize(adapter, CRB_V2P(adapter->portnum)); 803 if (adapter->fw_major < 4) {
862 if (i != 0x55555555) 804 i = adapter->pci_read_normalize(adapter,
863 adapter->physical_port = i; 805 CRB_V2P(adapter->portnum));
806 if (i != 0x55555555)
807 adapter->physical_port = i;
808 }
864 809
865 adapter->flags &= ~(NETXEN_NIC_MSI_ENABLED | NETXEN_NIC_MSIX_ENABLED); 810 adapter->flags &= ~(NETXEN_NIC_MSI_ENABLED | NETXEN_NIC_MSIX_ENABLED);
866 811
@@ -1084,7 +1029,9 @@ static int netxen_nic_open(struct net_device *netdev)
1084 for (ring = 0; ring < adapter->max_rds_rings; ring++) 1029 for (ring = 0; ring < adapter->max_rds_rings; ring++)
1085 netxen_post_rx_buffers(adapter, ctx, ring); 1030 netxen_post_rx_buffers(adapter, ctx, ring);
1086 } 1031 }
1087 if (NETXEN_IS_MSI_FAMILY(adapter)) 1032 if (adapter->flags & NETXEN_NIC_MSIX_ENABLED)
1033 handler = netxen_msix_intr;
1034 else if (adapter->flags & NETXEN_NIC_MSI_ENABLED)
1088 handler = netxen_msi_intr; 1035 handler = netxen_msi_intr;
1089 else { 1036 else {
1090 flags |= IRQF_SHARED; 1037 flags |= IRQF_SHARED;
@@ -1612,6 +1559,14 @@ static irqreturn_t netxen_msi_intr(int irq, void *data)
1612 return IRQ_HANDLED; 1559 return IRQ_HANDLED;
1613} 1560}
1614 1561
1562static irqreturn_t netxen_msix_intr(int irq, void *data)
1563{
1564 struct netxen_adapter *adapter = data;
1565
1566 napi_schedule(&adapter->napi);
1567 return IRQ_HANDLED;
1568}
1569
1615static int netxen_nic_poll(struct napi_struct *napi, int budget) 1570static int netxen_nic_poll(struct napi_struct *napi, int budget)
1616{ 1571{
1617 struct netxen_adapter *adapter = container_of(napi, struct netxen_adapter, napi); 1572 struct netxen_adapter *adapter = container_of(napi, struct netxen_adapter, napi);