Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: pm80xx: Add sysfs attribute to check controller hmi error

A new sysfs variable 'ctl_hmi_error' is being introduced to give the error
details if the MPI initialization fails

Using the 'ctl_hmi_error' sysfs variable we can check the error details:

linux-2dq0:~# cat /sys/class/scsi_host/host*/ctl_hmi_error
0x00000000
0x00000000
0x00000000

Link: https://lore.kernel.org/r/20210415103352.3580-3-Viswas.G@microchip.com
Signed-off-by: Vishakha Channapattan <vishakhavc@google.com>
Signed-off-by: Viswas G <Viswas.G@microchip.com>
Signed-off-by: Ruksar Devadi <Ruksar.devadi@microchip.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Vishakha Channapattan and committed by
Martin K. Petersen
a4c55e16 4ddbea1b

+22
+22
drivers/scsi/pm8001/pm8001_ctl.c
··· 911 911 } 912 912 static DEVICE_ATTR_RO(ctl_mpi_state); 913 913 914 + /** 915 + * ctl_hmi_error_show - controller MPI initialization fails 916 + * @cdev: pointer to embedded class device 917 + * @buf: the buffer returned 918 + * 919 + * A sysfs 'read-only' shost attribute. 920 + */ 921 + 922 + static ssize_t ctl_hmi_error_show(struct device *cdev, 923 + struct device_attribute *attr, char *buf) 924 + { 925 + struct Scsi_Host *shost = class_to_shost(cdev); 926 + struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); 927 + struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; 928 + unsigned int mpidw0; 929 + 930 + mpidw0 = pm8001_mr32(pm8001_ha->general_stat_tbl_addr, 0); 931 + return sysfs_emit(buf, "0x%08x\n", (mpidw0 >> 16)); 932 + } 933 + static DEVICE_ATTR_RO(ctl_hmi_error); 934 + 914 935 struct device_attribute *pm8001_host_attrs[] = { 915 936 &dev_attr_interface_rev, 916 937 &dev_attr_controller_fatal_error, ··· 956 935 &dev_attr_ila_version, 957 936 &dev_attr_inc_fw_ver, 958 937 &dev_attr_ctl_mpi_state, 938 + &dev_attr_ctl_hmi_error, 959 939 NULL, 960 940 }; 961 941