diff options
author | Deepak Ukey <deepak.ukey@microchip.com> | 2019-06-24 04:22:28 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-06-27 00:03:21 -0400 |
commit | 5f0bd875c6dbc6245b4012b13bf6b81cc629cb4c (patch) | |
tree | 0cecfb4c1e2295cd394dc634a26cd874e5c5f863 | |
parent | 2040a857e436e5e942d3d2d893891d088dba87f1 (diff) |
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: Deepak Ukey <deepak.ukey@microchip.com>
Signed-off-by: Viswas G <Viswas.G@microchip.com>
Reviewed-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/pm8001/pm8001_ctl.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c index c7e0a42c3d0d..6b85016b4db3 100644 --- a/drivers/scsi/pm8001/pm8001_ctl.c +++ b/drivers/scsi/pm8001/pm8001_ctl.c | |||
@@ -492,25 +492,26 @@ static ssize_t pm8001_ctl_iop_log_show(struct device *cdev, | |||
492 | struct Scsi_Host *shost = class_to_shost(cdev); | 492 | struct Scsi_Host *shost = class_to_shost(cdev); |
493 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); | 493 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); |
494 | struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; | 494 | struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; |
495 | #define IOP_MEMMAP(r, c) \ | ||
496 | (*(u32 *)((u8*)pm8001_ha->memoryMap.region[IOP].virt_ptr + (r) * 32 \ | ||
497 | + (c))) | ||
498 | int i; | ||
499 | char *str = buf; | 495 | char *str = buf; |
500 | int max = 2; | 496 | u32 read_size = |
501 | for (i = 0; i < max; i++) { | 497 | pm8001_ha->main_cfg_tbl.pm80xx_tbl.event_log_size / 1024; |
502 | str += sprintf(str, "0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x" | 498 | static u32 start, end, count; |
503 | "0x%08x 0x%08x\n", | 499 | u32 max_read_times = 32; |
504 | IOP_MEMMAP(i, 0), | 500 | u32 max_count = (read_size * 1024) / (max_read_times * 4); |
505 | IOP_MEMMAP(i, 4), | 501 | u32 *temp = (u32 *)pm8001_ha->memoryMap.region[IOP].virt_ptr; |
506 | IOP_MEMMAP(i, 8), | 502 | |
507 | IOP_MEMMAP(i, 12), | 503 | if ((count % max_count) == 0) { |
508 | IOP_MEMMAP(i, 16), | 504 | start = 0; |
509 | IOP_MEMMAP(i, 20), | 505 | end = max_read_times; |
510 | IOP_MEMMAP(i, 24), | 506 | count = 0; |
511 | IOP_MEMMAP(i, 28)); | 507 | } else { |
508 | start = end; | ||
509 | end = end + max_read_times; | ||
512 | } | 510 | } |
513 | 511 | ||
512 | for (; start < end; start++) | ||
513 | str += sprintf(str, "%08x ", *(temp+start)); | ||
514 | count++; | ||
514 | return str - buf; | 515 | return str - buf; |
515 | } | 516 | } |
516 | static DEVICE_ATTR(iop_log, S_IRUGO, pm8001_ctl_iop_log_show, NULL); | 517 | static DEVICE_ATTR(iop_log, S_IRUGO, pm8001_ctl_iop_log_show, NULL); |