diff options
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2.c | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index b3791b394715..1f7034d739b0 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/firmware.h> | 49 | #include <linux/firmware.h> |
50 | #include <linux/log2.h> | 50 | #include <linux/log2.h> |
51 | #include <linux/aer.h> | 51 | #include <linux/aer.h> |
52 | #include <linux/crash_dump.h> | ||
52 | 53 | ||
53 | #if IS_ENABLED(CONFIG_CNIC) | 54 | #if IS_ENABLED(CONFIG_CNIC) |
54 | #define BCM_CNIC 1 | 55 | #define BCM_CNIC 1 |
@@ -4764,15 +4765,16 @@ bnx2_setup_msix_tbl(struct bnx2 *bp) | |||
4764 | BNX2_WR(bp, BNX2_PCI_GRC_WINDOW3_ADDR, BNX2_MSIX_PBA_ADDR); | 4765 | BNX2_WR(bp, BNX2_PCI_GRC_WINDOW3_ADDR, BNX2_MSIX_PBA_ADDR); |
4765 | } | 4766 | } |
4766 | 4767 | ||
4767 | static int | 4768 | static void |
4768 | bnx2_reset_chip(struct bnx2 *bp, u32 reset_code) | 4769 | bnx2_wait_dma_complete(struct bnx2 *bp) |
4769 | { | 4770 | { |
4770 | u32 val; | 4771 | u32 val; |
4771 | int i, rc = 0; | 4772 | int i; |
4772 | u8 old_port; | ||
4773 | 4773 | ||
4774 | /* Wait for the current PCI transaction to complete before | 4774 | /* |
4775 | * issuing a reset. */ | 4775 | * Wait for the current PCI transaction to complete before |
4776 | * issuing a reset. | ||
4777 | */ | ||
4776 | if ((BNX2_CHIP(bp) == BNX2_CHIP_5706) || | 4778 | if ((BNX2_CHIP(bp) == BNX2_CHIP_5706) || |
4777 | (BNX2_CHIP(bp) == BNX2_CHIP_5708)) { | 4779 | (BNX2_CHIP(bp) == BNX2_CHIP_5708)) { |
4778 | BNX2_WR(bp, BNX2_MISC_ENABLE_CLR_BITS, | 4780 | BNX2_WR(bp, BNX2_MISC_ENABLE_CLR_BITS, |
@@ -4796,6 +4798,21 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code) | |||
4796 | } | 4798 | } |
4797 | } | 4799 | } |
4798 | 4800 | ||
4801 | return; | ||
4802 | } | ||
4803 | |||
4804 | |||
4805 | static int | ||
4806 | bnx2_reset_chip(struct bnx2 *bp, u32 reset_code) | ||
4807 | { | ||
4808 | u32 val; | ||
4809 | int i, rc = 0; | ||
4810 | u8 old_port; | ||
4811 | |||
4812 | /* Wait for the current PCI transaction to complete before | ||
4813 | * issuing a reset. */ | ||
4814 | bnx2_wait_dma_complete(bp); | ||
4815 | |||
4799 | /* Wait for the firmware to tell us it is ok to issue a reset. */ | 4816 | /* Wait for the firmware to tell us it is ok to issue a reset. */ |
4800 | bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT0 | reset_code, 1, 1); | 4817 | bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT0 | reset_code, 1, 1); |
4801 | 4818 | ||
@@ -6361,6 +6378,10 @@ bnx2_open(struct net_device *dev) | |||
6361 | struct bnx2 *bp = netdev_priv(dev); | 6378 | struct bnx2 *bp = netdev_priv(dev); |
6362 | int rc; | 6379 | int rc; |
6363 | 6380 | ||
6381 | rc = bnx2_request_firmware(bp); | ||
6382 | if (rc < 0) | ||
6383 | goto out; | ||
6384 | |||
6364 | netif_carrier_off(dev); | 6385 | netif_carrier_off(dev); |
6365 | 6386 | ||
6366 | bnx2_disable_int(bp); | 6387 | bnx2_disable_int(bp); |
@@ -6429,6 +6450,7 @@ open_err: | |||
6429 | bnx2_free_irq(bp); | 6450 | bnx2_free_irq(bp); |
6430 | bnx2_free_mem(bp); | 6451 | bnx2_free_mem(bp); |
6431 | bnx2_del_napi(bp); | 6452 | bnx2_del_napi(bp); |
6453 | bnx2_release_firmware(bp); | ||
6432 | goto out; | 6454 | goto out; |
6433 | } | 6455 | } |
6434 | 6456 | ||
@@ -8575,12 +8597,15 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
8575 | 8597 | ||
8576 | pci_set_drvdata(pdev, dev); | 8598 | pci_set_drvdata(pdev, dev); |
8577 | 8599 | ||
8578 | rc = bnx2_request_firmware(bp); | 8600 | /* |
8579 | if (rc < 0) | 8601 | * In-flight DMA from 1st kernel could continue going in kdump kernel. |
8580 | goto error; | 8602 | * New io-page table has been created before bnx2 does reset at open stage. |
8581 | 8603 | * We have to wait for the in-flight DMA to complete to avoid it look up | |
8604 | * into the newly created io-page table. | ||
8605 | */ | ||
8606 | if (is_kdump_kernel()) | ||
8607 | bnx2_wait_dma_complete(bp); | ||
8582 | 8608 | ||
8583 | bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_RESET); | ||
8584 | memcpy(dev->dev_addr, bp->mac_addr, ETH_ALEN); | 8609 | memcpy(dev->dev_addr, bp->mac_addr, ETH_ALEN); |
8585 | 8610 | ||
8586 | dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | | 8611 | dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | |
@@ -8613,7 +8638,6 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
8613 | return 0; | 8638 | return 0; |
8614 | 8639 | ||
8615 | error: | 8640 | error: |
8616 | bnx2_release_firmware(bp); | ||
8617 | pci_iounmap(pdev, bp->regview); | 8641 | pci_iounmap(pdev, bp->regview); |
8618 | pci_release_regions(pdev); | 8642 | pci_release_regions(pdev); |
8619 | pci_disable_device(pdev); | 8643 | pci_disable_device(pdev); |