Commit 5f0bd875 authored by Deepak Ukey's avatar Deepak Ukey Committed by Martin K. Petersen

scsi: pm80xx: Modified the logic to collect IOP event logs

Added the logic for collecting IOP log respective to event log size.
Signed-off-by: default avatarDeepak Ukey <deepak.ukey@microchip.com>
Signed-off-by: default avatarViswas G <Viswas.G@microchip.com>
Reviewed-by: default avatarJack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 2040a857
...@@ -492,25 +492,26 @@ static ssize_t pm8001_ctl_iop_log_show(struct device *cdev, ...@@ -492,25 +492,26 @@ static ssize_t pm8001_ctl_iop_log_show(struct device *cdev,
struct Scsi_Host *shost = class_to_shost(cdev); struct Scsi_Host *shost = class_to_shost(cdev);
struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
#define IOP_MEMMAP(r, c) \
(*(u32 *)((u8*)pm8001_ha->memoryMap.region[IOP].virt_ptr + (r) * 32 \
+ (c)))
int i;
char *str = buf; char *str = buf;
int max = 2; u32 read_size =
for (i = 0; i < max; i++) { pm8001_ha->main_cfg_tbl.pm80xx_tbl.event_log_size / 1024;
str += sprintf(str, "0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x" static u32 start, end, count;
"0x%08x 0x%08x\n", u32 max_read_times = 32;
IOP_MEMMAP(i, 0), u32 max_count = (read_size * 1024) / (max_read_times * 4);
IOP_MEMMAP(i, 4), u32 *temp = (u32 *)pm8001_ha->memoryMap.region[IOP].virt_ptr;
IOP_MEMMAP(i, 8),
IOP_MEMMAP(i, 12), if ((count % max_count) == 0) {
IOP_MEMMAP(i, 16), start = 0;
IOP_MEMMAP(i, 20), end = max_read_times;
IOP_MEMMAP(i, 24), count = 0;
IOP_MEMMAP(i, 28)); } else {
start = end;
end = end + max_read_times;
} }
for (; start < end; start++)
str += sprintf(str, "%08x ", *(temp+start));
count++;
return str - buf; return str - buf;
} }
static DEVICE_ATTR(iop_log, S_IRUGO, pm8001_ctl_iop_log_show, NULL); static DEVICE_ATTR(iop_log, S_IRUGO, pm8001_ctl_iop_log_show, NULL);
......
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