Commit d5c1da56 authored by Ron Mercer's avatar Ron Mercer Committed by David S. Miller

qlge: Add module param to force firmware core dump.

Default setting is 'off', don't allow force firmware dump.
Signed-off-by: default avatarRon Mercer <ron.mercer@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a2f98232
...@@ -2004,6 +2004,7 @@ enum { ...@@ -2004,6 +2004,7 @@ enum {
QL_CAM_RT_SET = 8, QL_CAM_RT_SET = 8,
QL_SELFTEST = 9, QL_SELFTEST = 9,
QL_LB_LINK_UP = 10, QL_LB_LINK_UP = 10,
QL_FRC_COREDUMP = 11,
}; };
/* link_status bit definitions */ /* link_status bit definitions */
...@@ -2230,6 +2231,7 @@ int ql_dump_risc_ram_area(struct ql_adapter *qdev, void *buf, ...@@ -2230,6 +2231,7 @@ int ql_dump_risc_ram_area(struct ql_adapter *qdev, void *buf,
u32 ram_addr, int word_count); u32 ram_addr, int word_count);
int ql_core_dump(struct ql_adapter *qdev, int ql_core_dump(struct ql_adapter *qdev,
struct ql_mpi_coredump *mpi_coredump); struct ql_mpi_coredump *mpi_coredump);
int ql_mb_sys_err(struct ql_adapter *qdev);
int ql_mb_about_fw(struct ql_adapter *qdev); int ql_mb_about_fw(struct ql_adapter *qdev);
int ql_wol(struct ql_adapter *qdev); int ql_wol(struct ql_adapter *qdev);
int ql_mb_wol_set_magic(struct ql_adapter *qdev, u32 enable_wol); int ql_mb_wol_set_magic(struct ql_adapter *qdev, u32 enable_wol);
...@@ -2246,6 +2248,7 @@ void ql_gen_reg_dump(struct ql_adapter *qdev, ...@@ -2246,6 +2248,7 @@ void ql_gen_reg_dump(struct ql_adapter *qdev,
struct ql_reg_dump *mpi_coredump); struct ql_reg_dump *mpi_coredump);
netdev_tx_t ql_lb_send(struct sk_buff *skb, struct net_device *ndev); netdev_tx_t ql_lb_send(struct sk_buff *skb, struct net_device *ndev);
void ql_check_lb_frame(struct ql_adapter *, struct sk_buff *); void ql_check_lb_frame(struct ql_adapter *, struct sk_buff *);
int ql_own_firmware(struct ql_adapter *qdev);
int ql_clean_lb_rx_ring(struct rx_ring *rx_ring, int budget); int ql_clean_lb_rx_ring(struct rx_ring *rx_ring, int budget);
#if 1 #if 1
......
...@@ -1222,6 +1222,28 @@ int ql_core_dump(struct ql_adapter *qdev, struct ql_mpi_coredump *mpi_coredump) ...@@ -1222,6 +1222,28 @@ int ql_core_dump(struct ql_adapter *qdev, struct ql_mpi_coredump *mpi_coredump)
} }
static void ql_get_core_dump(struct ql_adapter *qdev)
{
if (!ql_own_firmware(qdev)) {
QPRINTK(qdev, DRV, ERR, "%s: Don't own firmware!\n",
qdev->ndev->name);
return;
}
if (!netif_running(qdev->ndev)) {
QPRINTK(qdev, IFUP, ERR,
"Force Coredump can only be done from interface "
"that is up.\n");
return;
}
if (ql_mb_sys_err(qdev)) {
QPRINTK(qdev, IFUP, ERR,
"Fail force coredump with ql_mb_sys_err().\n");
return;
}
}
void ql_gen_reg_dump(struct ql_adapter *qdev, void ql_gen_reg_dump(struct ql_adapter *qdev,
struct ql_reg_dump *mpi_coredump) struct ql_reg_dump *mpi_coredump)
{ {
...@@ -1297,6 +1319,9 @@ void ql_gen_reg_dump(struct ql_adapter *qdev, ...@@ -1297,6 +1319,9 @@ void ql_gen_reg_dump(struct ql_adapter *qdev,
status = ql_get_ets_regs(qdev, &mpi_coredump->ets[0]); status = ql_get_ets_regs(qdev, &mpi_coredump->ets[0]);
if (status) if (status)
return; return;
if (test_bit(QL_FRC_COREDUMP, &qdev->flags))
ql_get_core_dump(qdev);
} }
/* Coredump to messages log file using separate worker thread */ /* Coredump to messages log file using separate worker thread */
......
...@@ -77,8 +77,13 @@ static int qlge_mpi_coredump; ...@@ -77,8 +77,13 @@ static int qlge_mpi_coredump;
module_param(qlge_mpi_coredump, int, 0); module_param(qlge_mpi_coredump, int, 0);
MODULE_PARM_DESC(qlge_mpi_coredump, MODULE_PARM_DESC(qlge_mpi_coredump,
"Option to enable MPI firmware dump. " "Option to enable MPI firmware dump. "
"Default is OFF - Do Not allocate memory. " "Default is OFF - Do Not allocate memory. ");
"Do not perform firmware coredump.");
static int qlge_force_coredump;
module_param(qlge_force_coredump, int, 0);
MODULE_PARM_DESC(qlge_force_coredump,
"Option to allow force of firmware core dump. "
"Default is OFF - Do not allow.");
static DEFINE_PCI_DEVICE_TABLE(qlge_pci_tbl) = { static DEFINE_PCI_DEVICE_TABLE(qlge_pci_tbl) = {
{PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, QLGE_DEVICE_ID_8012)}, {PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, QLGE_DEVICE_ID_8012)},
...@@ -4496,6 +4501,8 @@ static int __devinit ql_init_device(struct pci_dev *pdev, ...@@ -4496,6 +4501,8 @@ static int __devinit ql_init_device(struct pci_dev *pdev,
err = -ENOMEM; err = -ENOMEM;
goto err_out; goto err_out;
} }
if (qlge_force_coredump)
set_bit(QL_FRC_COREDUMP, &qdev->flags);
} }
/* make sure the EEPROM is good */ /* make sure the EEPROM is good */
err = qdev->nic_ops->get_flash(qdev); err = qdev->nic_ops->get_flash(qdev);
......
...@@ -607,6 +607,22 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) ...@@ -607,6 +607,22 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp)
return status; return status;
} }
int ql_mb_sys_err(struct ql_adapter *qdev)
{
struct mbox_params mbc;
struct mbox_params *mbcp = &mbc;
int status;
memset(mbcp, 0, sizeof(struct mbox_params));
mbcp->in_count = 1;
mbcp->out_count = 0;
mbcp->mbox_in[0] = MB_CMD_MAKE_SYS_ERR;
status = ql_mailbox_command(qdev, mbcp);
return status;
}
/* Get MPI firmware version. This will be used for /* Get MPI firmware version. This will be used for
* driver banner and for ethtool info. * driver banner and for ethtool info.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment