diff options
author | Linsys Contractor Mithlesh Thukral <mithlesh@netxen.com> | 2007-02-28 08:16:40 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-03-02 20:02:28 -0500 |
commit | e0e20a1a0822aa64335c05013f0966de6a8fc2c6 (patch) | |
tree | 20ea92792228cd533f586d4c64fa162048473314 /drivers/net/netxen | |
parent | 0c25cfe18afffbc88a2bef28732be9e4846153fe (diff) |
NetXen: Fix second rmmod failure observed on PowerPC machines.
Signed-off by: Mithlesh Thukral <mithlesh@netxen.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 5 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_init.c | 23 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 9 |
3 files changed, 20 insertions, 17 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index deec796f90da..a2877f33fa85 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -508,8 +508,8 @@ void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw) | |||
508 | void netxen_load_firmware(struct netxen_adapter *adapter) | 508 | void netxen_load_firmware(struct netxen_adapter *adapter) |
509 | { | 509 | { |
510 | int i; | 510 | int i; |
511 | long data, size = 0; | 511 | u32 data, size = 0; |
512 | long flashaddr = NETXEN_FLASH_BASE, memaddr = NETXEN_PHANTOM_MEM_BASE; | 512 | u32 flashaddr = NETXEN_FLASH_BASE, memaddr = NETXEN_PHANTOM_MEM_BASE; |
513 | u64 off; | 513 | u64 off; |
514 | void __iomem *addr; | 514 | void __iomem *addr; |
515 | 515 | ||
@@ -951,6 +951,7 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter) | |||
951 | netxen_nic_driver_name); | 951 | netxen_nic_driver_name); |
952 | return; | 952 | return; |
953 | } | 953 | } |
954 | *ptr32 = le32_to_cpu(*ptr32); | ||
954 | ptr32++; | 955 | ptr32++; |
955 | addr += sizeof(u32); | 956 | addr += sizeof(u32); |
956 | } | 957 | } |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 2f965701a95b..586d32b676af 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -38,13 +38,13 @@ | |||
38 | #include "netxen_nic_phan_reg.h" | 38 | #include "netxen_nic_phan_reg.h" |
39 | 39 | ||
40 | struct crb_addr_pair { | 40 | struct crb_addr_pair { |
41 | long addr; | 41 | u32 addr; |
42 | long data; | 42 | u32 data; |
43 | }; | 43 | }; |
44 | 44 | ||
45 | #define NETXEN_MAX_CRB_XFORM 60 | 45 | #define NETXEN_MAX_CRB_XFORM 60 |
46 | static unsigned int crb_addr_xform[NETXEN_MAX_CRB_XFORM]; | 46 | static unsigned int crb_addr_xform[NETXEN_MAX_CRB_XFORM]; |
47 | #define NETXEN_ADDR_ERROR ((unsigned long ) 0xffffffff ) | 47 | #define NETXEN_ADDR_ERROR (0xffffffff) |
48 | 48 | ||
49 | #define crb_addr_transform(name) \ | 49 | #define crb_addr_transform(name) \ |
50 | crb_addr_xform[NETXEN_HW_PX_MAP_CRB_##name] = \ | 50 | crb_addr_xform[NETXEN_HW_PX_MAP_CRB_##name] = \ |
@@ -252,10 +252,10 @@ void netxen_initialize_adapter_ops(struct netxen_adapter *adapter) | |||
252 | * netxen_decode_crb_addr(0 - utility to translate from internal Phantom CRB | 252 | * netxen_decode_crb_addr(0 - utility to translate from internal Phantom CRB |
253 | * address to external PCI CRB address. | 253 | * address to external PCI CRB address. |
254 | */ | 254 | */ |
255 | unsigned long netxen_decode_crb_addr(unsigned long addr) | 255 | u32 netxen_decode_crb_addr(u32 addr) |
256 | { | 256 | { |
257 | int i; | 257 | int i; |
258 | unsigned long base_addr, offset, pci_base; | 258 | u32 base_addr, offset, pci_base; |
259 | 259 | ||
260 | crb_addr_transform_setup(); | 260 | crb_addr_transform_setup(); |
261 | 261 | ||
@@ -756,7 +756,7 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
756 | int n, i; | 756 | int n, i; |
757 | int init_delay = 0; | 757 | int init_delay = 0; |
758 | struct crb_addr_pair *buf; | 758 | struct crb_addr_pair *buf; |
759 | unsigned long off; | 759 | u32 off; |
760 | 760 | ||
761 | /* resetall */ | 761 | /* resetall */ |
762 | status = netxen_nic_get_board_info(adapter); | 762 | status = netxen_nic_get_board_info(adapter); |
@@ -813,14 +813,13 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
813 | if (verbose) | 813 | if (verbose) |
814 | printk("%s: PCI: 0x%08x == 0x%08x\n", | 814 | printk("%s: PCI: 0x%08x == 0x%08x\n", |
815 | netxen_nic_driver_name, (unsigned int) | 815 | netxen_nic_driver_name, (unsigned int) |
816 | netxen_decode_crb_addr((unsigned long) | 816 | netxen_decode_crb_addr(addr), val); |
817 | addr), val); | ||
818 | } | 817 | } |
819 | for (i = 0; i < n; i++) { | 818 | for (i = 0; i < n; i++) { |
820 | 819 | ||
821 | off = netxen_decode_crb_addr((unsigned long)buf[i].addr); | 820 | off = netxen_decode_crb_addr(buf[i].addr); |
822 | if (off == NETXEN_ADDR_ERROR) { | 821 | if (off == NETXEN_ADDR_ERROR) { |
823 | printk(KERN_ERR"CRB init value out of range %lx\n", | 822 | printk(KERN_ERR"CRB init value out of range %x\n", |
824 | buf[i].addr); | 823 | buf[i].addr); |
825 | continue; | 824 | continue; |
826 | } | 825 | } |
@@ -927,6 +926,10 @@ int netxen_initialize_adapter_offload(struct netxen_adapter *adapter) | |||
927 | void netxen_free_adapter_offload(struct netxen_adapter *adapter) | 926 | void netxen_free_adapter_offload(struct netxen_adapter *adapter) |
928 | { | 927 | { |
929 | if (adapter->dummy_dma.addr) { | 928 | if (adapter->dummy_dma.addr) { |
929 | writel(0, NETXEN_CRB_NORMALIZE(adapter, | ||
930 | CRB_HOST_DUMMY_BUF_ADDR_HI)); | ||
931 | writel(0, NETXEN_CRB_NORMALIZE(adapter, | ||
932 | CRB_HOST_DUMMY_BUF_ADDR_LO)); | ||
930 | pci_free_consistent(adapter->ahw.pdev, | 933 | pci_free_consistent(adapter->ahw.pdev, |
931 | NETXEN_HOST_DUMMY_DMA_SIZE, | 934 | NETXEN_HOST_DUMMY_DMA_SIZE, |
932 | adapter->dummy_dma.addr, | 935 | adapter->dummy_dma.addr, |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 2227504ed4c0..7d2525e76abb 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -434,13 +434,11 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
434 | adapter->port_count++; | 434 | adapter->port_count++; |
435 | adapter->port[i] = port; | 435 | adapter->port[i] = port; |
436 | } | 436 | } |
437 | #ifndef CONFIG_PPC64 | ||
438 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); | 437 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); |
439 | netxen_pinit_from_rom(adapter, 0); | 438 | netxen_pinit_from_rom(adapter, 0); |
440 | udelay(500); | 439 | udelay(500); |
441 | netxen_load_firmware(adapter); | 440 | netxen_load_firmware(adapter); |
442 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); | 441 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); |
443 | #endif | ||
444 | /* | 442 | /* |
445 | * delay a while to ensure that the Pegs are up & running. | 443 | * delay a while to ensure that the Pegs are up & running. |
446 | * Otherwise, we might see some flaky behaviour. | 444 | * Otherwise, we might see some flaky behaviour. |
@@ -529,12 +527,13 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
529 | free_irq(adapter->irq, adapter); | 527 | free_irq(adapter->irq, adapter); |
530 | netxen_nic_stop_all_ports(adapter); | 528 | netxen_nic_stop_all_ports(adapter); |
531 | /* leave the hw in the same state as reboot */ | 529 | /* leave the hw in the same state as reboot */ |
532 | netxen_pinit_from_rom(adapter, 0); | ||
533 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); | 530 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); |
531 | netxen_pinit_from_rom(adapter, 0); | ||
532 | udelay(500); | ||
534 | netxen_load_firmware(adapter); | 533 | netxen_load_firmware(adapter); |
535 | netxen_free_adapter_offload(adapter); | 534 | netxen_free_adapter_offload(adapter); |
536 | 535 | ||
537 | udelay(500); /* Delay for a while to drain the DMA engines */ | 536 | mdelay(1000); /* Delay for a while to drain the DMA engines */ |
538 | for (i = 0; i < adapter->port_count; i++) { | 537 | for (i = 0; i < adapter->port_count; i++) { |
539 | port = adapter->port[i]; | 538 | port = adapter->port[i]; |
540 | if ((port) && (port->netdev)) { | 539 | if ((port) && (port->netdev)) { |
@@ -545,7 +544,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
545 | 544 | ||
546 | if ((adapter->flags & NETXEN_NIC_MSI_ENABLED)) | 545 | if ((adapter->flags & NETXEN_NIC_MSI_ENABLED)) |
547 | pci_disable_msi(pdev); | 546 | pci_disable_msi(pdev); |
548 | pci_set_drvdata(pdev, NULL); | ||
549 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) | 547 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) |
550 | netxen_free_hw_resources(adapter); | 548 | netxen_free_hw_resources(adapter); |
551 | 549 | ||
@@ -556,6 +554,7 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
556 | 554 | ||
557 | pci_release_regions(pdev); | 555 | pci_release_regions(pdev); |
558 | pci_disable_device(pdev); | 556 | pci_disable_device(pdev); |
557 | pci_set_drvdata(pdev, NULL); | ||
559 | 558 | ||
560 | for (ctxid = 0; ctxid < MAX_RCV_CTX; ++ctxid) { | 559 | for (ctxid = 0; ctxid < MAX_RCV_CTX; ++ctxid) { |
561 | recv_ctx = &adapter->recv_ctx[ctxid]; | 560 | recv_ctx = &adapter->recv_ctx[ctxid]; |