diff options
author | Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> | 2010-05-13 03:07:50 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-14 03:08:02 -0700 |
commit | 6df900e96c70208a931968da99f24cc982de116e (patch) | |
tree | 501341a10ff49c425eee3fabb0b9a76c27528d12 | |
parent | a5e463d0b1c123873d6f0c6cdd234041c87b7c80 (diff) | |
download | linux-3.10-6df900e96c70208a931968da99f24cc982de116e.tar.gz linux-3.10-6df900e96c70208a931968da99f24cc982de116e.tar.bz2 linux-3.10-6df900e96c70208a931968da99f24cc982de116e.zip |
qlcnic: add idc debug registers
When ever driver changes the device state, it should write
pci-func number and timestamp in debug registers.
Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/qlcnic/qlcnic.h | 2 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_main.c | 21 |
2 files changed, 23 insertions, 0 deletions
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h index 5c89f4e4635..2ed34cd43e1 100644 --- a/drivers/net/qlcnic/qlcnic.h +++ b/drivers/net/qlcnic/qlcnic.h @@ -960,6 +960,8 @@ struct qlcnic_adapter { u8 mac_addr[ETH_ALEN]; + u64 dev_rst_time; + struct qlcnic_adapter_stats stats; struct qlcnic_recv_context recv_ctx; diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index 6a7b8138835..f1949c93ab2 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c @@ -84,6 +84,7 @@ static void qlcnic_remove_sysfs_entries(struct qlcnic_adapter *adapter); static void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter); static void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter); +static void qlcnic_idc_debug_info(struct qlcnic_adapter *adapter, u8 encoding); static void qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter); static int qlcnic_can_start_firmware(struct qlcnic_adapter *adapter); @@ -620,6 +621,7 @@ wait_init: goto err_out; QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_READY); + qlcnic_idc_debug_info(adapter, 1); qlcnic_check_options(adapter); @@ -1056,6 +1058,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) adapter = netdev_priv(netdev); adapter->netdev = netdev; adapter->pdev = pdev; + adapter->dev_rst_time = jiffies; adapter->ahw.pci_func = pci_func_id; revision_id = pdev->revision; @@ -1887,6 +1890,19 @@ static void qlcnic_poll_controller(struct net_device *netdev) } #endif +static void +qlcnic_idc_debug_info(struct qlcnic_adapter *adapter, u8 encoding) +{ + u32 val; + + val = adapter->portnum & 0xf; + val |= encoding << 7; + val |= (jiffies - adapter->dev_rst_time) << 8; + + QLCWR32(adapter, QLCNIC_CRB_DRV_SCRATCH, val); + adapter->dev_rst_time = jiffies; +} + static int qlcnic_set_drv_state(struct qlcnic_adapter *adapter, u8 state) { @@ -2010,6 +2026,7 @@ qlcnic_can_start_firmware(struct qlcnic_adapter *adapter) case QLCNIC_DEV_COLD: QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_INITIALIZING); QLCWR32(adapter, QLCNIC_CRB_DRV_IDC_VER, QLCNIC_DRV_IDC_VER); + qlcnic_idc_debug_info(adapter, 0); qlcnic_api_unlock(adapter); return 1; @@ -2102,6 +2119,8 @@ skip_ack_check: qlcnic_schedule_work(adapter, qlcnic_fwinit_work, FW_POLL_DELAY * 2); QLCDB(adapter, DRV, "Quiscing the driver\n"); + qlcnic_idc_debug_info(adapter, 0); + qlcnic_api_unlock(adapter); return; } @@ -2111,6 +2130,7 @@ skip_ack_check: QLCNIC_DEV_INITIALIZING); set_bit(__QLCNIC_START_FW, &adapter->state); QLCDB(adapter, DRV, "Restarting fw\n"); + qlcnic_idc_debug_info(adapter, 0); } qlcnic_api_unlock(adapter); @@ -2206,6 +2226,7 @@ qlcnic_dev_request_reset(struct qlcnic_adapter *adapter) if (state == QLCNIC_DEV_READY) { QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_NEED_RESET); QLCDB(adapter, DRV, "NEED_RESET state set\n"); + qlcnic_idc_debug_info(adapter, 0); } qlcnic_api_unlock(adapter); |