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

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: 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 cfb9a30e
...@@ -2861,6 +2861,24 @@ megasas_dump(void *buf, int sz, int format) ...@@ -2861,6 +2861,24 @@ megasas_dump(void *buf, int sz, int format)
printk(KERN_CONT "\n"); 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 * megasas_dump_fusion_io - This function will print key details
* of SCSI IO * of SCSI IO
...@@ -3890,8 +3908,11 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) ...@@ -3890,8 +3908,11 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)
max_wait = MEGASAS_RESET_WAIT_TIME; max_wait = MEGASAS_RESET_WAIT_TIME;
cur_state = MFI_STATE_FAULT; cur_state = MFI_STATE_FAULT;
break; break;
} else } else {
dev_printk(KERN_DEBUG, &instance->pdev->dev, "System Register set:\n");
megasas_dump_reg_set(instance->reg_set);
return -ENODEV; return -ENODEV;
}
case MFI_STATE_WAIT_HANDSHAKE: case MFI_STATE_WAIT_HANDSHAKE:
/* /*
...@@ -3999,6 +4020,8 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) ...@@ -3999,6 +4020,8 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)
default: default:
dev_printk(KERN_DEBUG, &instance->pdev->dev, "Unknown state 0x%x\n", dev_printk(KERN_DEBUG, &instance->pdev->dev, "Unknown state 0x%x\n",
fw_state); fw_state);
dev_printk(KERN_DEBUG, &instance->pdev->dev, "System Register set:\n");
megasas_dump_reg_set(instance->reg_set);
return -ENODEV; return -ENODEV;
} }
...@@ -4021,6 +4044,8 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr) ...@@ -4021,6 +4044,8 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)
if (curr_abs_state == abs_state) { if (curr_abs_state == abs_state) {
dev_printk(KERN_DEBUG, &instance->pdev->dev, "FW state [%d] hasn't changed " dev_printk(KERN_DEBUG, &instance->pdev->dev, "FW state [%d] hasn't changed "
"in %d secs\n", fw_state, max_wait); "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; return -ENODEV;
} }
......
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