aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen
diff options
context:
space:
mode:
authordhananjay@netxen.com <dhananjay@netxen.com>2007-08-28 07:53:26 -0400
committerJeff Garzik <jeff@garzik.org>2007-08-31 06:52:57 -0400
commit3052246c815fe17ff3a9fcb5601c6688b523e5f5 (patch)
treeda12e588f1895009e3baabe330b9e907dffb5880 /drivers/net/netxen
parentb3e2d8874e8ba92bfefede645b8be2ec6c956933 (diff)
netxen: fix crashes during module unload
This patch fixes two problems during driver unload. The pci_disable_device() call is before firmware reload, causing reads and writes across PCI bus after disabling device. Second problem is the register window was wrong during firmware reload Signed-off by: Dhananjay Phadke <dhananjay@netxen.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r--drivers/net/netxen/netxen_nic_hdr.h6
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c8
-rw-r--r--drivers/net/netxen/netxen_nic_main.c15
3 files changed, 15 insertions, 14 deletions
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h
index 3276866b17e2..d72f8f8fcb50 100644
--- a/drivers/net/netxen/netxen_nic_hdr.h
+++ b/drivers/net/netxen/netxen_nic_hdr.h
@@ -649,9 +649,11 @@ enum {
649#define PCIX_INT_VECTOR (0x10100) 649#define PCIX_INT_VECTOR (0x10100)
650#define PCIX_INT_MASK (0x10104) 650#define PCIX_INT_MASK (0x10104)
651 651
652#define PCIX_MN_WINDOW (0x10200) 652#define PCIX_MN_WINDOW_F0 (0x10200)
653#define PCIX_MN_WINDOW(_f) (PCIX_MN_WINDOW_F0 + (0x20 * (_f)))
653#define PCIX_MS_WINDOW (0x10204) 654#define PCIX_MS_WINDOW (0x10204)
654#define PCIX_SN_WINDOW (0x10208) 655#define PCIX_SN_WINDOW_F0 (0x10208)
656#define PCIX_SN_WINDOW(_f) (PCIX_SN_WINDOW_F0 + (0x20 * (_f)))
655#define PCIX_CRB_WINDOW (0x10210) 657#define PCIX_CRB_WINDOW (0x10210)
656#define PCIX_CRB_WINDOW_F0 (0x10210) 658#define PCIX_CRB_WINDOW_F0 (0x10210)
657#define PCIX_CRB_WINDOW_F1 (0x10230) 659#define PCIX_CRB_WINDOW_F1 (0x10230)
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index aac15421bd1e..a7b8d7f23259 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -904,11 +904,11 @@ netxen_nic_pci_set_window(struct netxen_adapter *adapter,
904 ddr_mn_window = window; 904 ddr_mn_window = window;
905 writel(window, PCI_OFFSET_SECOND_RANGE(adapter, 905 writel(window, PCI_OFFSET_SECOND_RANGE(adapter,
906 NETXEN_PCIX_PH_REG 906 NETXEN_PCIX_PH_REG
907 (PCIX_MN_WINDOW))); 907 (PCIX_MN_WINDOW(adapter->ahw.pci_func))));
908 /* MUST make sure window is set before we forge on... */ 908 /* MUST make sure window is set before we forge on... */
909 readl(PCI_OFFSET_SECOND_RANGE(adapter, 909 readl(PCI_OFFSET_SECOND_RANGE(adapter,
910 NETXEN_PCIX_PH_REG 910 NETXEN_PCIX_PH_REG
911 (PCIX_MN_WINDOW))); 911 (PCIX_MN_WINDOW(adapter->ahw.pci_func))));
912 } 912 }
913 addr -= (window * NETXEN_WINDOW_ONE); 913 addr -= (window * NETXEN_WINDOW_ONE);
914 addr += NETXEN_PCI_DDR_NET; 914 addr += NETXEN_PCI_DDR_NET;
@@ -929,11 +929,11 @@ netxen_nic_pci_set_window(struct netxen_adapter *adapter,
929 writel((window << 22), 929 writel((window << 22),
930 PCI_OFFSET_SECOND_RANGE(adapter, 930 PCI_OFFSET_SECOND_RANGE(adapter,
931 NETXEN_PCIX_PH_REG 931 NETXEN_PCIX_PH_REG
932 (PCIX_SN_WINDOW))); 932 (PCIX_SN_WINDOW(adapter->ahw.pci_func))));
933 /* MUST make sure window is set before we forge on... */ 933 /* MUST make sure window is set before we forge on... */
934 readl(PCI_OFFSET_SECOND_RANGE(adapter, 934 readl(PCI_OFFSET_SECOND_RANGE(adapter,
935 NETXEN_PCIX_PH_REG 935 NETXEN_PCIX_PH_REG
936 (PCIX_SN_WINDOW))); 936 (PCIX_SN_WINDOW(adapter->ahw.pci_func))));
937 } 937 }
938 addr -= (window * 0x400000); 938 addr -= (window * 0x400000);
939 addr += NETXEN_PCI_QDR_NET; 939 addr += NETXEN_PCI_QDR_NET;
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index ab85fb709cc9..3122d0101638 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -746,9 +746,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
746 746
747 netxen_nic_disable_int(adapter); 747 netxen_nic_disable_int(adapter);
748 748
749 if (adapter->irq)
750 free_irq(adapter->irq, adapter);
751
752 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { 749 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) {
753 init_firmware_done++; 750 init_firmware_done++;
754 netxen_free_hw_resources(adapter); 751 netxen_free_hw_resources(adapter);
@@ -772,13 +769,8 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
772 } 769 }
773 } 770 }
774 771
775 if (adapter->flags & NETXEN_NIC_MSI_ENABLED)
776 pci_disable_msi(pdev);
777
778 vfree(adapter->cmd_buf_arr); 772 vfree(adapter->cmd_buf_arr);
779 773
780 pci_disable_device(pdev);
781
782 if (adapter->portnum == 0) { 774 if (adapter->portnum == 0) {
783 if (init_firmware_done) { 775 if (init_firmware_done) {
784 i = 100; 776 i = 100;
@@ -829,12 +821,19 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
829 } 821 }
830 } 822 }
831 823
824 if (adapter->irq)
825 free_irq(adapter->irq, adapter);
826
827 if (adapter->flags & NETXEN_NIC_MSI_ENABLED)
828 pci_disable_msi(pdev);
829
832 iounmap(adapter->ahw.db_base); 830 iounmap(adapter->ahw.db_base);
833 iounmap(adapter->ahw.pci_base0); 831 iounmap(adapter->ahw.pci_base0);
834 iounmap(adapter->ahw.pci_base1); 832 iounmap(adapter->ahw.pci_base1);
835 iounmap(adapter->ahw.pci_base2); 833 iounmap(adapter->ahw.pci_base2);
836 834
837 pci_release_regions(pdev); 835 pci_release_regions(pdev);
836 pci_disable_device(pdev);
838 pci_set_drvdata(pdev, NULL); 837 pci_set_drvdata(pdev, NULL);
839 838
840 free_netdev(netdev); 839 free_netdev(netdev);