[1/2] scsi: ufs: temperature notification
diff mbox series

Message ID 1545211745-21208-2-git-send-email-uri.yanai@wdc.com
State New
Headers show
Series
  • scsi: ufs: support new temperature atrib(UFSv3.0)
Related show

Commit Message

Uri Yanai Dec. 19, 2018, 9:29 a.m. UTC
From: Uri Yanai <uri.yanai@sandisk.com>

Support the new temperature notification
attributes introduced in UFSv3.0
Added new query requests, exception event mask, and
ufs features attributes.

Signed-off-by: Uri Yanai <uri.yanai@sandisk.com>
---
 drivers/scsi/ufs/ufs-sysfs.c | 3 +++
 drivers/scsi/ufs/ufs.h       | 8 ++++++++
 drivers/scsi/ufs/ufshcd.c    | 2 ++
 3 files changed, 13 insertions(+)

Patch
diff mbox series

diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c
index 8d9332b..eda4ddb 100644
--- a/drivers/scsi/ufs/ufs-sysfs.c
+++ b/drivers/scsi/ufs/ufs-sysfs.c
@@ -684,6 +684,9 @@  UFS_ATTRIBUTE(exception_event_status, _EE_STATUS);
 UFS_ATTRIBUTE(ffu_status, _FFU_STATUS);
 UFS_ATTRIBUTE(psa_state, _PSA_STATE);
 UFS_ATTRIBUTE(psa_data_size, _PSA_DATA_SIZE);
+UFS_ATTRIBUTE(rough_temp, _ROUGH_TEMP);
+UFS_ATTRIBUTE(too_high_temp, _TOO_HIGH_TEMP);
+UFS_ATTRIBUTE(too_low_temp, _TOO_LOW_TEMP);
 
 static struct attribute *ufs_sysfs_attributes[] = {
 	&dev_attr_boot_lun_enabled.attr,
diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
index 8e4e526..20c5b21 100644
--- a/drivers/scsi/ufs/ufs.h
+++ b/drivers/scsi/ufs/ufs.h
@@ -168,6 +168,9 @@  enum attr_idn {
 	QUERY_ATTR_IDN_FFU_STATUS		= 0x14,
 	QUERY_ATTR_IDN_PSA_STATE		= 0x15,
 	QUERY_ATTR_IDN_PSA_DATA_SIZE		= 0x16,
+	QUERY_ATTR_IDN_ROUGH_TEMP		= 0x18,
+	QUERY_ATTR_IDN_TOO_HIGH_TEMP		= 0x19,
+	QUERY_ATTR_IDN_TOO_LOW_TEMP		= 0x1A,
 };
 
 /* Descriptor idn for Query requests */
@@ -354,6 +357,8 @@  enum power_desc_param_offset {
 enum {
 	MASK_EE_STATUS		= 0xFFFF,
 	MASK_EE_URGENT_BKOPS	= (1 << 2),
+	MASK_EE_TOO_HIGH_TEMP	= (1 << 3),
+	MASK_EE_TOO_LOW_TEMP	= (1 << 4),
 };
 
 /* Background operation status */
@@ -543,6 +548,9 @@  struct ufs_dev_info {
  */
 struct ufs_dev_desc {
 	u16 wmanufacturerid;
+	u16 ufs_features;
+#define UFS_FEATURE_TOO_HIGH_TEMPERATURE (1 << 4)
+#define UFS_FEATURE_TOO_LOW_TEMPERATURE (1 << 5)
 	char model[MAX_MODEL_LEN + 1];
 };
 
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 003d489..5004c94 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6433,6 +6433,8 @@  static int ufs_get_device_desc(struct ufs_hba *hba,
 
 	model_index = desc_buf[DEVICE_DESC_PARAM_PRDCT_NAME];
 
+	dev_desc->ufs_features = desc_buf[DEVICE_DESC_PARAM_UFS_FEAT];
+
 	/* Zero-pad entire buffer for string termination. */
 	memset(desc_buf, 0, buff_len);