diff options
Diffstat (limited to 'drivers/net/netxen/netxen_nic_main.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 08780ef1c1f8..ce838f7c8b0f 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -23,6 +23,7 @@ | |||
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/slab.h> | ||
26 | #include <linux/vmalloc.h> | 27 | #include <linux/vmalloc.h> |
27 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
28 | #include "netxen_nic_hw.h" | 29 | #include "netxen_nic_hw.h" |
@@ -604,16 +605,14 @@ netxen_cleanup_pci_map(struct netxen_adapter *adapter) | |||
604 | static int | 605 | static int |
605 | netxen_setup_pci_map(struct netxen_adapter *adapter) | 606 | netxen_setup_pci_map(struct netxen_adapter *adapter) |
606 | { | 607 | { |
607 | void __iomem *mem_ptr0 = NULL; | ||
608 | void __iomem *mem_ptr1 = NULL; | ||
609 | void __iomem *mem_ptr2 = NULL; | ||
610 | void __iomem *db_ptr = NULL; | 608 | void __iomem *db_ptr = NULL; |
611 | 609 | ||
612 | resource_size_t mem_base, db_base; | 610 | resource_size_t mem_base, db_base; |
613 | unsigned long mem_len, db_len = 0, pci_len0 = 0; | 611 | unsigned long mem_len, db_len = 0; |
614 | 612 | ||
615 | struct pci_dev *pdev = adapter->pdev; | 613 | struct pci_dev *pdev = adapter->pdev; |
616 | int pci_func = adapter->ahw.pci_func; | 614 | int pci_func = adapter->ahw.pci_func; |
615 | struct netxen_hardware_context *ahw = &adapter->ahw; | ||
617 | 616 | ||
618 | int err = 0; | 617 | int err = 0; |
619 | 618 | ||
@@ -630,24 +629,40 @@ netxen_setup_pci_map(struct netxen_adapter *adapter) | |||
630 | 629 | ||
631 | /* 128 Meg of memory */ | 630 | /* 128 Meg of memory */ |
632 | if (mem_len == NETXEN_PCI_128MB_SIZE) { | 631 | if (mem_len == NETXEN_PCI_128MB_SIZE) { |
633 | mem_ptr0 = ioremap(mem_base, FIRST_PAGE_GROUP_SIZE); | 632 | |
634 | mem_ptr1 = ioremap(mem_base + SECOND_PAGE_GROUP_START, | 633 | ahw->pci_base0 = ioremap(mem_base, FIRST_PAGE_GROUP_SIZE); |
634 | ahw->pci_base1 = ioremap(mem_base + SECOND_PAGE_GROUP_START, | ||
635 | SECOND_PAGE_GROUP_SIZE); | 635 | SECOND_PAGE_GROUP_SIZE); |
636 | mem_ptr2 = ioremap(mem_base + THIRD_PAGE_GROUP_START, | 636 | ahw->pci_base2 = ioremap(mem_base + THIRD_PAGE_GROUP_START, |
637 | THIRD_PAGE_GROUP_SIZE); | 637 | THIRD_PAGE_GROUP_SIZE); |
638 | pci_len0 = FIRST_PAGE_GROUP_SIZE; | 638 | if (ahw->pci_base0 == NULL || ahw->pci_base1 == NULL || |
639 | ahw->pci_base2 == NULL) { | ||
640 | dev_err(&pdev->dev, "failed to map PCI bar 0\n"); | ||
641 | err = -EIO; | ||
642 | goto err_out; | ||
643 | } | ||
644 | |||
645 | ahw->pci_len0 = FIRST_PAGE_GROUP_SIZE; | ||
646 | |||
639 | } else if (mem_len == NETXEN_PCI_32MB_SIZE) { | 647 | } else if (mem_len == NETXEN_PCI_32MB_SIZE) { |
640 | mem_ptr1 = ioremap(mem_base, SECOND_PAGE_GROUP_SIZE); | 648 | |
641 | mem_ptr2 = ioremap(mem_base + THIRD_PAGE_GROUP_START - | 649 | ahw->pci_base1 = ioremap(mem_base, SECOND_PAGE_GROUP_SIZE); |
650 | ahw->pci_base2 = ioremap(mem_base + THIRD_PAGE_GROUP_START - | ||
642 | SECOND_PAGE_GROUP_START, THIRD_PAGE_GROUP_SIZE); | 651 | SECOND_PAGE_GROUP_START, THIRD_PAGE_GROUP_SIZE); |
652 | if (ahw->pci_base1 == NULL || ahw->pci_base2 == NULL) { | ||
653 | dev_err(&pdev->dev, "failed to map PCI bar 0\n"); | ||
654 | err = -EIO; | ||
655 | goto err_out; | ||
656 | } | ||
657 | |||
643 | } else if (mem_len == NETXEN_PCI_2MB_SIZE) { | 658 | } else if (mem_len == NETXEN_PCI_2MB_SIZE) { |
644 | 659 | ||
645 | mem_ptr0 = pci_ioremap_bar(pdev, 0); | 660 | ahw->pci_base0 = pci_ioremap_bar(pdev, 0); |
646 | if (mem_ptr0 == NULL) { | 661 | if (ahw->pci_base0 == NULL) { |
647 | dev_err(&pdev->dev, "failed to map PCI bar 0\n"); | 662 | dev_err(&pdev->dev, "failed to map PCI bar 0\n"); |
648 | return -EIO; | 663 | return -EIO; |
649 | } | 664 | } |
650 | pci_len0 = mem_len; | 665 | ahw->pci_len0 = mem_len; |
651 | } else { | 666 | } else { |
652 | return -EIO; | 667 | return -EIO; |
653 | } | 668 | } |
@@ -656,11 +671,6 @@ netxen_setup_pci_map(struct netxen_adapter *adapter) | |||
656 | 671 | ||
657 | dev_info(&pdev->dev, "%dMB memory map\n", (int)(mem_len>>20)); | 672 | dev_info(&pdev->dev, "%dMB memory map\n", (int)(mem_len>>20)); |
658 | 673 | ||
659 | adapter->ahw.pci_base0 = mem_ptr0; | ||
660 | adapter->ahw.pci_len0 = pci_len0; | ||
661 | adapter->ahw.pci_base1 = mem_ptr1; | ||
662 | adapter->ahw.pci_base2 = mem_ptr2; | ||
663 | |||
664 | if (NX_IS_REVISION_P3P(adapter->ahw.revision_id)) { | 674 | if (NX_IS_REVISION_P3P(adapter->ahw.revision_id)) { |
665 | adapter->ahw.ocm_win_crb = netxen_get_ioaddr(adapter, | 675 | adapter->ahw.ocm_win_crb = netxen_get_ioaddr(adapter, |
666 | NETXEN_PCIX_PS_REG(PCIX_OCM_WINDOW_REG(pci_func))); | 676 | NETXEN_PCIX_PS_REG(PCIX_OCM_WINDOW_REG(pci_func))); |
@@ -1246,8 +1256,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1246 | int pci_func_id = PCI_FUNC(pdev->devfn); | 1256 | int pci_func_id = PCI_FUNC(pdev->devfn); |
1247 | uint8_t revision_id; | 1257 | uint8_t revision_id; |
1248 | 1258 | ||
1249 | if (pdev->revision >= NX_P3_A0 && pdev->revision < NX_P3_B1) { | 1259 | if (pdev->revision >= NX_P3_A0 && pdev->revision <= NX_P3_B1) { |
1250 | pr_warning("%s: chip revisions between 0x%x-0x%x" | 1260 | pr_warning("%s: chip revisions between 0x%x-0x%x " |
1251 | "will not be enabled.\n", | 1261 | "will not be enabled.\n", |
1252 | module_name(THIS_MODULE), NX_P3_A0, NX_P3_B1); | 1262 | module_name(THIS_MODULE), NX_P3_A0, NX_P3_B1); |
1253 | return -ENODEV; | 1263 | return -ENODEV; |