Commit b6661342 authored by Shivasharan S's avatar Shivasharan S Committed by Martin K. Petersen

scsi: megaraid_sas: Print FW fault information

When driver detects a firmware fault during load, dump additional
information on fault code and subcode that will help in debugging.
Signed-off-by: default avatarSumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: default avatarShivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a6024a9e
...@@ -135,6 +135,8 @@ ...@@ -135,6 +135,8 @@
#define MFI_RESET_ADAPTER 0x00000002 #define MFI_RESET_ADAPTER 0x00000002
#define MEGAMFI_FRAME_SIZE 64 #define MEGAMFI_FRAME_SIZE 64
#define MFI_STATE_FAULT_CODE 0x0FFF0000
#define MFI_STATE_FAULT_SUBCODE 0x0000FF00
/* /*
* During FW init, clear pending cmds & reset state using inbound_msg_0 * During FW init, clear pending cmds & reset state using inbound_msg_0
* *
......
...@@ -3918,7 +3918,10 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) ...@@ -3918,7 +3918,10 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)
switch (fw_state) { switch (fw_state) {
case MFI_STATE_FAULT: case MFI_STATE_FAULT:
dev_printk(KERN_DEBUG, &instance->pdev->dev, "FW in FAULT state!!\n"); dev_printk(KERN_ERR, &instance->pdev->dev,
"FW in FAULT state, Fault code:0x%x subcode:0x%x func:%s\n",
abs_state & MFI_STATE_FAULT_CODE,
abs_state & MFI_STATE_FAULT_SUBCODE, __func__);
if (ocr) { if (ocr) {
max_wait = MEGASAS_RESET_WAIT_TIME; max_wait = MEGASAS_RESET_WAIT_TIME;
cur_state = MFI_STATE_FAULT; cur_state = MFI_STATE_FAULT;
......
...@@ -3983,7 +3983,7 @@ megasas_check_reset_fusion(struct megasas_instance *instance, ...@@ -3983,7 +3983,7 @@ megasas_check_reset_fusion(struct megasas_instance *instance,
static inline void megasas_trigger_snap_dump(struct megasas_instance *instance) static inline void megasas_trigger_snap_dump(struct megasas_instance *instance)
{ {
int j; int j;
u32 fw_state; u32 fw_state, abs_state;
if (!instance->disableOnlineCtrlReset) { if (!instance->disableOnlineCtrlReset) {
dev_info(&instance->pdev->dev, "Trigger snap dump\n"); dev_info(&instance->pdev->dev, "Trigger snap dump\n");
...@@ -3993,11 +3993,13 @@ static inline void megasas_trigger_snap_dump(struct megasas_instance *instance) ...@@ -3993,11 +3993,13 @@ static inline void megasas_trigger_snap_dump(struct megasas_instance *instance)
} }
for (j = 0; j < instance->snapdump_wait_time; j++) { for (j = 0; j < instance->snapdump_wait_time; j++) {
fw_state = instance->instancet->read_fw_status_reg(instance) & abs_state = instance->instancet->read_fw_status_reg(instance);
MFI_STATE_MASK; fw_state = abs_state & MFI_STATE_MASK;
if (fw_state == MFI_STATE_FAULT) { if (fw_state == MFI_STATE_FAULT) {
dev_err(&instance->pdev->dev, dev_printk(KERN_ERR, &instance->pdev->dev,
"Found FW in FAULT state, after snap dump trigger\n"); "FW in FAULT state Fault code:0x%x subcode:0x%x func:%s\n",
abs_state & MFI_STATE_FAULT_CODE,
abs_state & MFI_STATE_FAULT_SUBCODE, __func__);
return; return;
} }
msleep(1000); msleep(1000);
...@@ -4009,7 +4011,7 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance, ...@@ -4009,7 +4011,7 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
int reason, int *convert) int reason, int *convert)
{ {
int i, outstanding, retval = 0, hb_seconds_missed = 0; int i, outstanding, retval = 0, hb_seconds_missed = 0;
u32 fw_state; u32 fw_state, abs_state;
u32 waittime_for_io_completion; u32 waittime_for_io_completion;
waittime_for_io_completion = waittime_for_io_completion =
...@@ -4028,12 +4030,13 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance, ...@@ -4028,12 +4030,13 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
for (i = 0; i < waittime_for_io_completion; i++) { for (i = 0; i < waittime_for_io_completion; i++) {
/* Check if firmware is in fault state */ /* Check if firmware is in fault state */
fw_state = instance->instancet->read_fw_status_reg(instance) & abs_state = instance->instancet->read_fw_status_reg(instance);
MFI_STATE_MASK; fw_state = abs_state & MFI_STATE_MASK;
if (fw_state == MFI_STATE_FAULT) { if (fw_state == MFI_STATE_FAULT) {
dev_warn(&instance->pdev->dev, "Found FW in FAULT state," dev_printk(KERN_ERR, &instance->pdev->dev,
" will reset adapter scsi%d.\n", "FW in FAULT state Fault code:0x%x subcode:0x%x func:%s\n",
instance->host->host_no); abs_state & MFI_STATE_FAULT_CODE,
abs_state & MFI_STATE_FAULT_SUBCODE, __func__);
megasas_complete_cmd_dpc_fusion((unsigned long)instance); megasas_complete_cmd_dpc_fusion((unsigned long)instance);
if (instance->requestorId && reason) { if (instance->requestorId && reason) {
dev_warn(&instance->pdev->dev, "SR-IOV Found FW in FAULT" dev_warn(&instance->pdev->dev, "SR-IOV Found FW in FAULT"
......
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