scsi: megaraid_sas: Dump system registers for debugging

When controller fails to transition to READY state during driver probe,
dump the system interface register set.  This will give snapshot of the
firmware status for debugging driver load issues.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Shivasharan S 2019-05-07 10:05:41 -07:00 committed by Martin K. Petersen
parent cfb9a30e5d
commit 3d1d9eb7f2
1 changed files with 26 additions and 1 deletions

View File

@ -2861,6 +2861,24 @@ megasas_dump(void *buf, int sz, int format)
printk(KERN_CONT "\n");
}
/**
* megasas_dump_reg_set - This function will print hexdump of register set
* @buf: Buffer to be dumped
* @sz: Size in bytes
* @format: Different formats of dumping e.g. format=n will
* cause only 'n' 32 bit words to be dumped in a
* single line.
*/
inline void
megasas_dump_reg_set(void __iomem *reg_set)
{
unsigned int i, sz = 256;
u32 __iomem *reg = (u32 __iomem *)reg_set;
for (i = 0; i < (sz / sizeof(u32)); i++)
printk("%08x: %08x\n", (i * 4), readl(&reg[i]));
}
/**
* megasas_dump_fusion_io - This function will print key details
* of SCSI IO
@ -3890,8 +3908,11 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)
max_wait = MEGASAS_RESET_WAIT_TIME;
cur_state = MFI_STATE_FAULT;
break;
} else
} else {
dev_printk(KERN_DEBUG, &instance->pdev->dev, "System Register set:\n");
megasas_dump_reg_set(instance->reg_set);
return -ENODEV;
}
case MFI_STATE_WAIT_HANDSHAKE:
/*
@ -3999,6 +4020,8 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)
default:
dev_printk(KERN_DEBUG, &instance->pdev->dev, "Unknown state 0x%x\n",
fw_state);
dev_printk(KERN_DEBUG, &instance->pdev->dev, "System Register set:\n");
megasas_dump_reg_set(instance->reg_set);
return -ENODEV;
}
@ -4021,6 +4044,8 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)
if (curr_abs_state == abs_state) {
dev_printk(KERN_DEBUG, &instance->pdev->dev, "FW state [%d] hasn't changed "
"in %d secs\n", fw_state, max_wait);
dev_printk(KERN_DEBUG, &instance->pdev->dev, "System Register set:\n");
megasas_dump_reg_set(instance->reg_set);
return -ENODEV;
}