aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/chelsio
diff options
context:
space:
mode:
authorHariprasad Shenai <hariprasad@chelsio.com>2014-09-01 10:24:58 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-02 02:00:41 -0400
commit31d55c2d6672430f3ef0bfd4de72c5a4f6a8bab9 (patch)
tree4520b49b870ee9b1c25ce2d6df88ed5d5510563a /drivers/net/ethernet/chelsio
parent9bb59b96ae88ee9dc035d5cc9818b02b12208904 (diff)
cxgb4: Detect and display firmware reported errors
The adapter firmware can indicate error conditions to the host. If the firmware has indicated an error, print out the reason for the firmware error. Based on original work by Casey Leedom <leedom@chelsio.com> Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/chelsio')
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_hw.c38
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h4
2 files changed, 41 insertions, 1 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 0250a9deb292..41d04462b72e 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -168,6 +168,34 @@ void t4_hw_pci_read_cfg4(struct adapter *adap, int reg, u32 *val)
168} 168}
169 169
170/* 170/*
171 * t4_report_fw_error - report firmware error
172 * @adap: the adapter
173 *
174 * The adapter firmware can indicate error conditions to the host.
175 * If the firmware has indicated an error, print out the reason for
176 * the firmware error.
177 */
178static void t4_report_fw_error(struct adapter *adap)
179{
180 static const char *const reason[] = {
181 "Crash", /* PCIE_FW_EVAL_CRASH */
182 "During Device Preparation", /* PCIE_FW_EVAL_PREP */
183 "During Device Configuration", /* PCIE_FW_EVAL_CONF */
184 "During Device Initialization", /* PCIE_FW_EVAL_INIT */
185 "Unexpected Event", /* PCIE_FW_EVAL_UNEXPECTEDEVENT */
186 "Insufficient Airflow", /* PCIE_FW_EVAL_OVERHEAT */
187 "Device Shutdown", /* PCIE_FW_EVAL_DEVICESHUTDOWN */
188 "Reserved", /* reserved */
189 };
190 u32 pcie_fw;
191
192 pcie_fw = t4_read_reg(adap, MA_PCIE_FW);
193 if (pcie_fw & FW_PCIE_FW_ERR)
194 dev_err(adap->pdev_dev, "Firmware reports adapter error: %s\n",
195 reason[FW_PCIE_FW_EVAL_GET(pcie_fw)]);
196}
197
198/*
171 * Get the reply to a mailbox command and store it in @rpl in big-endian order. 199 * Get the reply to a mailbox command and store it in @rpl in big-endian order.
172 */ 200 */
173static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit, 201static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit,
@@ -300,6 +328,7 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size,
300 dump_mbox(adap, mbox, data_reg); 328 dump_mbox(adap, mbox, data_reg);
301 dev_err(adap->pdev_dev, "command %#x in mailbox %d timed out\n", 329 dev_err(adap->pdev_dev, "command %#x in mailbox %d timed out\n",
302 *(const u8 *)cmd, mbox); 330 *(const u8 *)cmd, mbox);
331 t4_report_fw_error(adap);
303 return -ETIMEDOUT; 332 return -ETIMEDOUT;
304} 333}
305 334
@@ -1533,6 +1562,9 @@ static void cim_intr_handler(struct adapter *adapter)
1533 1562
1534 int fat; 1563 int fat;
1535 1564
1565 if (t4_read_reg(adapter, MA_PCIE_FW) & FW_PCIE_FW_ERR)
1566 t4_report_fw_error(adapter);
1567
1536 fat = t4_handle_intr_status(adapter, CIM_HOST_INT_CAUSE, 1568 fat = t4_handle_intr_status(adapter, CIM_HOST_INT_CAUSE,
1537 cim_intr_info) + 1569 cim_intr_info) +
1538 t4_handle_intr_status(adapter, CIM_HOST_UPACC_INT_CAUSE, 1570 t4_handle_intr_status(adapter, CIM_HOST_UPACC_INT_CAUSE,
@@ -2751,12 +2783,16 @@ retry:
2751 /* 2783 /*
2752 * Issue the HELLO command to the firmware. If it's not successful 2784 * Issue the HELLO command to the firmware. If it's not successful
2753 * but indicates that we got a "busy" or "timeout" condition, retry 2785 * but indicates that we got a "busy" or "timeout" condition, retry
2754 * the HELLO until we exhaust our retry limit. 2786 * the HELLO until we exhaust our retry limit. If we do exceed our
2787 * retry limit, check to see if the firmware left us any error
2788 * information and report that if so.
2755 */ 2789 */
2756 ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); 2790 ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c);
2757 if (ret < 0) { 2791 if (ret < 0) {
2758 if ((ret == -EBUSY || ret == -ETIMEDOUT) && retries-- > 0) 2792 if ((ret == -EBUSY || ret == -ETIMEDOUT) && retries-- > 0)
2759 goto retry; 2793 goto retry;
2794 if (t4_read_reg(adap, MA_PCIE_FW) & FW_PCIE_FW_ERR)
2795 t4_report_fw_error(adap);
2760 return ret; 2796 return ret;
2761 } 2797 }
2762 2798
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h
index 5f2729ebadbe..3409756a85b9 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h
@@ -2228,6 +2228,10 @@ struct fw_debug_cmd {
2228#define FW_PCIE_FW_MASTER(x) ((x) << FW_PCIE_FW_MASTER_SHIFT) 2228#define FW_PCIE_FW_MASTER(x) ((x) << FW_PCIE_FW_MASTER_SHIFT)
2229#define FW_PCIE_FW_MASTER_GET(x) (((x) >> FW_PCIE_FW_MASTER_SHIFT) & \ 2229#define FW_PCIE_FW_MASTER_GET(x) (((x) >> FW_PCIE_FW_MASTER_SHIFT) & \
2230 FW_PCIE_FW_MASTER_MASK) 2230 FW_PCIE_FW_MASTER_MASK)
2231#define FW_PCIE_FW_EVAL_MASK 0x7
2232#define FW_PCIE_FW_EVAL_SHIFT 24
2233#define FW_PCIE_FW_EVAL_GET(x) (((x) >> FW_PCIE_FW_EVAL_SHIFT) & \
2234 FW_PCIE_FW_EVAL_MASK)
2231 2235
2232struct fw_hdr { 2236struct fw_hdr {
2233 u8 ver; 2237 u8 ver;