diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2009-02-24 19:39:21 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-24 19:39:21 -0500 |
commit | 97daee83b0fd2361cc70be6f3d6ecda69def2103 (patch) | |
tree | 6374f99d06b2d29c32c99952a066721fc0c09762 /drivers | |
parent | dbf64b10fa5b339d8b6e949f97c0d00750b08ca8 (diff) |
netxen: refactor pci probe
Split pci probe function into smaller logical blocks.
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_main.c | 384 |
1 files changed, 203 insertions, 181 deletions
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 9d6e68fe0c94..c2b551fd711f 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -457,6 +457,202 @@ static const struct net_device_ops netxen_netdev_ops = { | |||
457 | #endif | 457 | #endif |
458 | }; | 458 | }; |
459 | 459 | ||
460 | static void | ||
461 | netxen_setup_intr(struct netxen_adapter *adapter) | ||
462 | { | ||
463 | struct netxen_legacy_intr_set *legacy_intrp; | ||
464 | struct pci_dev *pdev = adapter->pdev; | ||
465 | |||
466 | adapter->flags &= ~(NETXEN_NIC_MSI_ENABLED | NETXEN_NIC_MSIX_ENABLED); | ||
467 | adapter->intr_scheme = -1; | ||
468 | adapter->msi_mode = -1; | ||
469 | |||
470 | if (adapter->ahw.revision_id >= NX_P3_B0) | ||
471 | legacy_intrp = &legacy_intr[adapter->ahw.pci_func]; | ||
472 | else | ||
473 | legacy_intrp = &legacy_intr[0]; | ||
474 | adapter->legacy_intr.int_vec_bit = legacy_intrp->int_vec_bit; | ||
475 | adapter->legacy_intr.tgt_status_reg = legacy_intrp->tgt_status_reg; | ||
476 | adapter->legacy_intr.tgt_mask_reg = legacy_intrp->tgt_mask_reg; | ||
477 | adapter->legacy_intr.pci_int_reg = legacy_intrp->pci_int_reg; | ||
478 | |||
479 | netxen_set_msix_bit(pdev, 0); | ||
480 | |||
481 | if (adapter->msix_supported) { | ||
482 | |||
483 | netxen_init_msix_entries(adapter); | ||
484 | if (pci_enable_msix(pdev, adapter->msix_entries, | ||
485 | MSIX_ENTRIES_PER_ADAPTER)) | ||
486 | goto request_msi; | ||
487 | |||
488 | adapter->flags |= NETXEN_NIC_MSIX_ENABLED; | ||
489 | netxen_set_msix_bit(pdev, 1); | ||
490 | dev_info(&pdev->dev, "using msi-x interrupts\n"); | ||
491 | |||
492 | } else { | ||
493 | request_msi: | ||
494 | if (use_msi && !pci_enable_msi(pdev)) { | ||
495 | adapter->flags |= NETXEN_NIC_MSI_ENABLED; | ||
496 | dev_info(&pdev->dev, "using msi interrupts\n"); | ||
497 | } else | ||
498 | dev_info(&pdev->dev, "using legacy interrupts\n"); | ||
499 | } | ||
500 | } | ||
501 | |||
502 | static void | ||
503 | netxen_teardown_intr(struct netxen_adapter *adapter) | ||
504 | { | ||
505 | if (adapter->flags & NETXEN_NIC_MSIX_ENABLED) | ||
506 | pci_disable_msix(adapter->pdev); | ||
507 | if (adapter->flags & NETXEN_NIC_MSI_ENABLED) | ||
508 | pci_disable_msi(adapter->pdev); | ||
509 | } | ||
510 | |||
511 | static void | ||
512 | netxen_cleanup_pci_map(struct netxen_adapter *adapter) | ||
513 | { | ||
514 | if (adapter->ahw.db_base != NULL) | ||
515 | iounmap(adapter->ahw.db_base); | ||
516 | if (adapter->ahw.pci_base0 != NULL) | ||
517 | iounmap(adapter->ahw.pci_base0); | ||
518 | if (adapter->ahw.pci_base1 != NULL) | ||
519 | iounmap(adapter->ahw.pci_base1); | ||
520 | if (adapter->ahw.pci_base2 != NULL) | ||
521 | iounmap(adapter->ahw.pci_base2); | ||
522 | } | ||
523 | |||
524 | static int | ||
525 | netxen_setup_pci_map(struct netxen_adapter *adapter) | ||
526 | { | ||
527 | void __iomem *mem_ptr0 = NULL; | ||
528 | void __iomem *mem_ptr1 = NULL; | ||
529 | void __iomem *mem_ptr2 = NULL; | ||
530 | void __iomem *db_ptr = NULL; | ||
531 | |||
532 | unsigned long first_page_group_end; | ||
533 | unsigned long first_page_group_start; | ||
534 | unsigned long mem_base, mem_len, db_base, db_len = 0, pci_len0 = 0; | ||
535 | |||
536 | struct pci_dev *pdev = adapter->pdev; | ||
537 | int pci_func = adapter->ahw.pci_func; | ||
538 | |||
539 | int err = 0; | ||
540 | |||
541 | /* | ||
542 | * Set the CRB window to invalid. If any register in window 0 is | ||
543 | * accessed it should set the window to 0 and then reset it to 1. | ||
544 | */ | ||
545 | adapter->curr_window = 255; | ||
546 | adapter->ahw.qdr_sn_window = -1; | ||
547 | adapter->ahw.ddr_mn_window = -1; | ||
548 | |||
549 | /* remap phys address */ | ||
550 | mem_base = pci_resource_start(pdev, 0); /* 0 is for BAR 0 */ | ||
551 | mem_len = pci_resource_len(pdev, 0); | ||
552 | pci_len0 = 0; | ||
553 | |||
554 | adapter->hw_write_wx = netxen_nic_hw_write_wx_128M; | ||
555 | adapter->hw_read_wx = netxen_nic_hw_read_wx_128M; | ||
556 | adapter->pci_read_immediate = netxen_nic_pci_read_immediate_128M; | ||
557 | adapter->pci_write_immediate = netxen_nic_pci_write_immediate_128M; | ||
558 | adapter->pci_read_normalize = netxen_nic_pci_read_normalize_128M; | ||
559 | adapter->pci_write_normalize = netxen_nic_pci_write_normalize_128M; | ||
560 | adapter->pci_set_window = netxen_nic_pci_set_window_128M; | ||
561 | adapter->pci_mem_read = netxen_nic_pci_mem_read_128M; | ||
562 | adapter->pci_mem_write = netxen_nic_pci_mem_write_128M; | ||
563 | |||
564 | /* 128 Meg of memory */ | ||
565 | if (mem_len == NETXEN_PCI_128MB_SIZE) { | ||
566 | mem_ptr0 = ioremap(mem_base, FIRST_PAGE_GROUP_SIZE); | ||
567 | mem_ptr1 = ioremap(mem_base + SECOND_PAGE_GROUP_START, | ||
568 | SECOND_PAGE_GROUP_SIZE); | ||
569 | mem_ptr2 = ioremap(mem_base + THIRD_PAGE_GROUP_START, | ||
570 | THIRD_PAGE_GROUP_SIZE); | ||
571 | first_page_group_start = FIRST_PAGE_GROUP_START; | ||
572 | first_page_group_end = FIRST_PAGE_GROUP_END; | ||
573 | } else if (mem_len == NETXEN_PCI_32MB_SIZE) { | ||
574 | mem_ptr1 = ioremap(mem_base, SECOND_PAGE_GROUP_SIZE); | ||
575 | mem_ptr2 = ioremap(mem_base + THIRD_PAGE_GROUP_START - | ||
576 | SECOND_PAGE_GROUP_START, THIRD_PAGE_GROUP_SIZE); | ||
577 | first_page_group_start = 0; | ||
578 | first_page_group_end = 0; | ||
579 | } else if (mem_len == NETXEN_PCI_2MB_SIZE) { | ||
580 | adapter->hw_write_wx = netxen_nic_hw_write_wx_2M; | ||
581 | adapter->hw_read_wx = netxen_nic_hw_read_wx_2M; | ||
582 | adapter->pci_read_immediate = netxen_nic_pci_read_immediate_2M; | ||
583 | adapter->pci_write_immediate = | ||
584 | netxen_nic_pci_write_immediate_2M; | ||
585 | adapter->pci_read_normalize = netxen_nic_pci_read_normalize_2M; | ||
586 | adapter->pci_write_normalize = | ||
587 | netxen_nic_pci_write_normalize_2M; | ||
588 | adapter->pci_set_window = netxen_nic_pci_set_window_2M; | ||
589 | adapter->pci_mem_read = netxen_nic_pci_mem_read_2M; | ||
590 | adapter->pci_mem_write = netxen_nic_pci_mem_write_2M; | ||
591 | |||
592 | mem_ptr0 = pci_ioremap_bar(pdev, 0); | ||
593 | if (mem_ptr0 == NULL) { | ||
594 | dev_err(&pdev->dev, "failed to map PCI bar 0\n"); | ||
595 | return -EIO; | ||
596 | } | ||
597 | pci_len0 = mem_len; | ||
598 | first_page_group_start = 0; | ||
599 | first_page_group_end = 0; | ||
600 | |||
601 | adapter->ahw.ddr_mn_window = 0; | ||
602 | adapter->ahw.qdr_sn_window = 0; | ||
603 | |||
604 | adapter->ahw.mn_win_crb = 0x100000 + PCIX_MN_WINDOW + | ||
605 | (pci_func * 0x20); | ||
606 | adapter->ahw.ms_win_crb = 0x100000 + PCIX_SN_WINDOW; | ||
607 | if (pci_func < 4) | ||
608 | adapter->ahw.ms_win_crb += (pci_func * 0x20); | ||
609 | else | ||
610 | adapter->ahw.ms_win_crb += | ||
611 | 0xA0 + ((pci_func - 4) * 0x10); | ||
612 | } else { | ||
613 | return -EIO; | ||
614 | } | ||
615 | |||
616 | dev_info(&pdev->dev, "%dMB memory map\n", (int)(mem_len>>20)); | ||
617 | |||
618 | adapter->ahw.pci_base0 = mem_ptr0; | ||
619 | adapter->ahw.pci_len0 = pci_len0; | ||
620 | adapter->ahw.first_page_group_start = first_page_group_start; | ||
621 | adapter->ahw.first_page_group_end = first_page_group_end; | ||
622 | adapter->ahw.pci_base1 = mem_ptr1; | ||
623 | adapter->ahw.pci_base2 = mem_ptr2; | ||
624 | |||
625 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | ||
626 | goto skip_doorbell; | ||
627 | |||
628 | db_base = pci_resource_start(pdev, 4); /* doorbell is on bar 4 */ | ||
629 | db_len = pci_resource_len(pdev, 4); | ||
630 | |||
631 | if (db_len == 0) { | ||
632 | printk(KERN_ERR "%s: doorbell is disabled\n", | ||
633 | netxen_nic_driver_name); | ||
634 | err = -EIO; | ||
635 | goto err_out; | ||
636 | } | ||
637 | |||
638 | db_ptr = ioremap(db_base, NETXEN_DB_MAPSIZE_BYTES); | ||
639 | if (!db_ptr) { | ||
640 | printk(KERN_ERR "%s: Failed to allocate doorbell map.", | ||
641 | netxen_nic_driver_name); | ||
642 | err = -EIO; | ||
643 | goto err_out; | ||
644 | } | ||
645 | |||
646 | skip_doorbell: | ||
647 | adapter->ahw.db_base = db_ptr; | ||
648 | adapter->ahw.db_len = db_len; | ||
649 | return 0; | ||
650 | |||
651 | err_out: | ||
652 | netxen_cleanup_pci_map(adapter); | ||
653 | return err; | ||
654 | } | ||
655 | |||
460 | static int | 656 | static int |
461 | netxen_start_firmware(struct netxen_adapter *adapter) | 657 | netxen_start_firmware(struct netxen_adapter *adapter) |
462 | { | 658 | { |
@@ -521,20 +717,10 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
521 | { | 717 | { |
522 | struct net_device *netdev = NULL; | 718 | struct net_device *netdev = NULL; |
523 | struct netxen_adapter *adapter = NULL; | 719 | struct netxen_adapter *adapter = NULL; |
524 | void __iomem *mem_ptr0 = NULL; | ||
525 | void __iomem *mem_ptr1 = NULL; | ||
526 | void __iomem *mem_ptr2 = NULL; | ||
527 | unsigned long first_page_group_end; | ||
528 | unsigned long first_page_group_start; | ||
529 | |||
530 | |||
531 | u8 __iomem *db_ptr = NULL; | ||
532 | unsigned long mem_base, mem_len, db_base, db_len = 0, pci_len0 = 0; | ||
533 | int i = 0, err; | 720 | int i = 0, err; |
534 | int first_driver; | 721 | int first_driver; |
535 | u32 val; | 722 | u32 val; |
536 | int pci_func_id = PCI_FUNC(pdev->devfn); | 723 | int pci_func_id = PCI_FUNC(pdev->devfn); |
537 | struct netxen_legacy_intr_set *legacy_intrp; | ||
538 | uint8_t revision_id; | 724 | uint8_t revision_id; |
539 | 725 | ||
540 | if (pci_func_id == 0) | 726 | if (pci_func_id == 0) |
@@ -589,128 +775,14 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
589 | goto err_out_free_netdev; | 775 | goto err_out_free_netdev; |
590 | 776 | ||
591 | rwlock_init(&adapter->adapter_lock); | 777 | rwlock_init(&adapter->adapter_lock); |
592 | adapter->ahw.qdr_sn_window = -1; | ||
593 | adapter->ahw.ddr_mn_window = -1; | ||
594 | |||
595 | /* remap phys address */ | ||
596 | mem_base = pci_resource_start(pdev, 0); /* 0 is for BAR 0 */ | ||
597 | mem_len = pci_resource_len(pdev, 0); | ||
598 | pci_len0 = 0; | ||
599 | |||
600 | adapter->hw_write_wx = netxen_nic_hw_write_wx_128M; | ||
601 | adapter->hw_read_wx = netxen_nic_hw_read_wx_128M; | ||
602 | adapter->pci_read_immediate = netxen_nic_pci_read_immediate_128M; | ||
603 | adapter->pci_write_immediate = netxen_nic_pci_write_immediate_128M; | ||
604 | adapter->pci_read_normalize = netxen_nic_pci_read_normalize_128M; | ||
605 | adapter->pci_write_normalize = netxen_nic_pci_write_normalize_128M; | ||
606 | adapter->pci_set_window = netxen_nic_pci_set_window_128M; | ||
607 | adapter->pci_mem_read = netxen_nic_pci_mem_read_128M; | ||
608 | adapter->pci_mem_write = netxen_nic_pci_mem_write_128M; | ||
609 | |||
610 | /* 128 Meg of memory */ | ||
611 | if (mem_len == NETXEN_PCI_128MB_SIZE) { | ||
612 | mem_ptr0 = ioremap(mem_base, FIRST_PAGE_GROUP_SIZE); | ||
613 | mem_ptr1 = ioremap(mem_base + SECOND_PAGE_GROUP_START, | ||
614 | SECOND_PAGE_GROUP_SIZE); | ||
615 | mem_ptr2 = ioremap(mem_base + THIRD_PAGE_GROUP_START, | ||
616 | THIRD_PAGE_GROUP_SIZE); | ||
617 | first_page_group_start = FIRST_PAGE_GROUP_START; | ||
618 | first_page_group_end = FIRST_PAGE_GROUP_END; | ||
619 | } else if (mem_len == NETXEN_PCI_32MB_SIZE) { | ||
620 | mem_ptr1 = ioremap(mem_base, SECOND_PAGE_GROUP_SIZE); | ||
621 | mem_ptr2 = ioremap(mem_base + THIRD_PAGE_GROUP_START - | ||
622 | SECOND_PAGE_GROUP_START, THIRD_PAGE_GROUP_SIZE); | ||
623 | first_page_group_start = 0; | ||
624 | first_page_group_end = 0; | ||
625 | } else if (mem_len == NETXEN_PCI_2MB_SIZE) { | ||
626 | adapter->hw_write_wx = netxen_nic_hw_write_wx_2M; | ||
627 | adapter->hw_read_wx = netxen_nic_hw_read_wx_2M; | ||
628 | adapter->pci_read_immediate = netxen_nic_pci_read_immediate_2M; | ||
629 | adapter->pci_write_immediate = | ||
630 | netxen_nic_pci_write_immediate_2M; | ||
631 | adapter->pci_read_normalize = netxen_nic_pci_read_normalize_2M; | ||
632 | adapter->pci_write_normalize = | ||
633 | netxen_nic_pci_write_normalize_2M; | ||
634 | adapter->pci_set_window = netxen_nic_pci_set_window_2M; | ||
635 | adapter->pci_mem_read = netxen_nic_pci_mem_read_2M; | ||
636 | adapter->pci_mem_write = netxen_nic_pci_mem_write_2M; | ||
637 | 778 | ||
638 | mem_ptr0 = pci_ioremap_bar(pdev, 0); | 779 | err = netxen_setup_pci_map(adapter); |
639 | if (mem_ptr0 == NULL) { | 780 | if (err) |
640 | dev_err(&pdev->dev, "failed to map PCI bar 0\n"); | ||
641 | return -EIO; | ||
642 | } | ||
643 | |||
644 | pci_len0 = mem_len; | ||
645 | first_page_group_start = 0; | ||
646 | first_page_group_end = 0; | ||
647 | |||
648 | adapter->ahw.ddr_mn_window = 0; | ||
649 | adapter->ahw.qdr_sn_window = 0; | ||
650 | |||
651 | adapter->ahw.mn_win_crb = 0x100000 + PCIX_MN_WINDOW + | ||
652 | (pci_func_id * 0x20); | ||
653 | adapter->ahw.ms_win_crb = 0x100000 + PCIX_SN_WINDOW; | ||
654 | if (pci_func_id < 4) | ||
655 | adapter->ahw.ms_win_crb += (pci_func_id * 0x20); | ||
656 | else | ||
657 | adapter->ahw.ms_win_crb += | ||
658 | 0xA0 + ((pci_func_id - 4) * 0x10); | ||
659 | } else { | ||
660 | err = -EIO; | ||
661 | goto err_out_free_netdev; | 781 | goto err_out_free_netdev; |
662 | } | ||
663 | |||
664 | dev_info(&pdev->dev, "%dMB memory map\n", (int)(mem_len>>20)); | ||
665 | |||
666 | if (NX_IS_REVISION_P3(revision_id)) | ||
667 | goto skip_doorbell; | ||
668 | |||
669 | db_base = pci_resource_start(pdev, 4); /* doorbell is on bar 4 */ | ||
670 | db_len = pci_resource_len(pdev, 4); | ||
671 | |||
672 | if (db_len == 0) { | ||
673 | printk(KERN_ERR "%s: doorbell is disabled\n", | ||
674 | netxen_nic_driver_name); | ||
675 | err = -EIO; | ||
676 | goto err_out_iounmap; | ||
677 | } | ||
678 | |||
679 | db_ptr = ioremap(db_base, NETXEN_DB_MAPSIZE_BYTES); | ||
680 | if (!db_ptr) { | ||
681 | printk(KERN_ERR "%s: Failed to allocate doorbell map.", | ||
682 | netxen_nic_driver_name); | ||
683 | err = -EIO; | ||
684 | goto err_out_iounmap; | ||
685 | } | ||
686 | |||
687 | skip_doorbell: | ||
688 | adapter->ahw.pci_base0 = mem_ptr0; | ||
689 | adapter->ahw.pci_len0 = pci_len0; | ||
690 | adapter->ahw.first_page_group_start = first_page_group_start; | ||
691 | adapter->ahw.first_page_group_end = first_page_group_end; | ||
692 | adapter->ahw.pci_base1 = mem_ptr1; | ||
693 | adapter->ahw.pci_base2 = mem_ptr2; | ||
694 | adapter->ahw.db_base = db_ptr; | ||
695 | adapter->ahw.db_len = db_len; | ||
696 | 782 | ||
697 | netif_napi_add(netdev, &adapter->napi, | 783 | netif_napi_add(netdev, &adapter->napi, |
698 | netxen_nic_poll, NETXEN_NETDEV_WEIGHT); | 784 | netxen_nic_poll, NETXEN_NETDEV_WEIGHT); |
699 | 785 | ||
700 | if (revision_id >= NX_P3_B0) | ||
701 | legacy_intrp = &legacy_intr[pci_func_id]; | ||
702 | else | ||
703 | legacy_intrp = &legacy_intr[0]; | ||
704 | |||
705 | adapter->legacy_intr.int_vec_bit = legacy_intrp->int_vec_bit; | ||
706 | adapter->legacy_intr.tgt_status_reg = legacy_intrp->tgt_status_reg; | ||
707 | adapter->legacy_intr.tgt_mask_reg = legacy_intrp->tgt_mask_reg; | ||
708 | adapter->legacy_intr.pci_int_reg = legacy_intrp->pci_int_reg; | ||
709 | |||
710 | /* this will be read from FW later */ | ||
711 | adapter->intr_scheme = -1; | ||
712 | adapter->msi_mode = -1; | ||
713 | |||
714 | /* This will be reset for mezz cards */ | 786 | /* This will be reset for mezz cards */ |
715 | adapter->portnum = pci_func_id; | 787 | adapter->portnum = pci_func_id; |
716 | adapter->status &= ~NETXEN_NETDEV_STATUS; | 788 | adapter->status &= ~NETXEN_NETDEV_STATUS; |
@@ -741,12 +813,6 @@ skip_doorbell: | |||
741 | netdev->vlan_features |= NETIF_F_HIGHDMA; | 813 | netdev->vlan_features |= NETIF_F_HIGHDMA; |
742 | } | 814 | } |
743 | 815 | ||
744 | /* | ||
745 | * Set the CRB window to invalid. If any register in window 0 is | ||
746 | * accessed it should set the window to 0 and then reset it to 1. | ||
747 | */ | ||
748 | adapter->curr_window = 255; | ||
749 | |||
750 | if (netxen_nic_get_board_info(adapter) != 0) { | 816 | if (netxen_nic_get_board_info(adapter) != 0) { |
751 | printk("%s: Error getting board config info.\n", | 817 | printk("%s: Error getting board config info.\n", |
752 | netxen_nic_driver_name); | 818 | netxen_nic_driver_name); |
@@ -813,32 +879,7 @@ skip_doorbell: | |||
813 | 879 | ||
814 | netxen_set_msix_bit(pdev, 0); | 880 | netxen_set_msix_bit(pdev, 0); |
815 | 881 | ||
816 | if (NX_IS_REVISION_P3(revision_id)) { | 882 | netxen_setup_intr(adapter); |
817 | if ((mem_len != NETXEN_PCI_128MB_SIZE) && | ||
818 | mem_len != NETXEN_PCI_2MB_SIZE) | ||
819 | adapter->msix_supported = 0; | ||
820 | } | ||
821 | |||
822 | if (adapter->msix_supported) { | ||
823 | |||
824 | netxen_init_msix_entries(adapter); | ||
825 | |||
826 | if (pci_enable_msix(pdev, adapter->msix_entries, | ||
827 | MSIX_ENTRIES_PER_ADAPTER)) | ||
828 | goto request_msi; | ||
829 | |||
830 | adapter->flags |= NETXEN_NIC_MSIX_ENABLED; | ||
831 | netxen_set_msix_bit(pdev, 1); | ||
832 | dev_info(&pdev->dev, "using msi-x interrupts\n"); | ||
833 | |||
834 | } else { | ||
835 | request_msi: | ||
836 | if (use_msi && !pci_enable_msi(pdev)) { | ||
837 | adapter->flags |= NETXEN_NIC_MSI_ENABLED; | ||
838 | dev_info(&pdev->dev, "using msi interrupts\n"); | ||
839 | } else | ||
840 | dev_info(&pdev->dev, "using legacy interrupts\n"); | ||
841 | } | ||
842 | 883 | ||
843 | if (adapter->flags & NETXEN_NIC_MSIX_ENABLED) | 884 | if (adapter->flags & NETXEN_NIC_MSIX_ENABLED) |
844 | netdev->irq = adapter->msix_entries[0].vector; | 885 | netdev->irq = adapter->msix_entries[0].vector; |
@@ -886,23 +927,13 @@ request_msi: | |||
886 | return 0; | 927 | return 0; |
887 | 928 | ||
888 | err_out_disable_msi: | 929 | err_out_disable_msi: |
889 | if (adapter->flags & NETXEN_NIC_MSIX_ENABLED) | 930 | netxen_teardown_intr(adapter); |
890 | pci_disable_msix(pdev); | ||
891 | if (adapter->flags & NETXEN_NIC_MSI_ENABLED) | ||
892 | pci_disable_msi(pdev); | ||
893 | 931 | ||
894 | if (first_driver) | 932 | if (first_driver) |
895 | netxen_free_adapter_offload(adapter); | 933 | netxen_free_adapter_offload(adapter); |
896 | 934 | ||
897 | err_out_iounmap: | 935 | err_out_iounmap: |
898 | if (db_ptr) | 936 | netxen_cleanup_pci_map(adapter); |
899 | iounmap(db_ptr); | ||
900 | if (mem_ptr0) | ||
901 | iounmap(mem_ptr0); | ||
902 | if (mem_ptr1) | ||
903 | iounmap(mem_ptr1); | ||
904 | if (mem_ptr2) | ||
905 | iounmap(mem_ptr2); | ||
906 | 937 | ||
907 | err_out_free_netdev: | 938 | err_out_free_netdev: |
908 | free_netdev(netdev); | 939 | free_netdev(netdev); |
@@ -944,18 +975,9 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
944 | if (adapter->irq) | 975 | if (adapter->irq) |
945 | free_irq(adapter->irq, adapter); | 976 | free_irq(adapter->irq, adapter); |
946 | 977 | ||
947 | if (adapter->flags & NETXEN_NIC_MSIX_ENABLED) | 978 | netxen_teardown_intr(adapter); |
948 | pci_disable_msix(pdev); | ||
949 | if (adapter->flags & NETXEN_NIC_MSI_ENABLED) | ||
950 | pci_disable_msi(pdev); | ||
951 | 979 | ||
952 | iounmap(adapter->ahw.pci_base0); | 980 | netxen_cleanup_pci_map(adapter); |
953 | if (adapter->ahw.db_base != NULL) | ||
954 | iounmap(adapter->ahw.db_base); | ||
955 | if (adapter->ahw.pci_base1 != NULL) | ||
956 | iounmap(adapter->ahw.pci_base1); | ||
957 | if (adapter->ahw.pci_base2 != NULL) | ||
958 | iounmap(adapter->ahw.pci_base2); | ||
959 | 981 | ||
960 | pci_release_regions(pdev); | 982 | pci_release_regions(pdev); |
961 | pci_disable_device(pdev); | 983 | pci_disable_device(pdev); |