From 60916a7ea4d4d396c92a27e7c702a30bbdb85d0c Mon Sep 17 00:00:00 2001 From: hgchu Date: Fri, 12 Jan 2018 10:01:12 +0900 Subject: [PATCH] scsi: ufs: Add sysfs node for argos Change-Id: I89c56c18c57923ab80328ea2f2c987c50e9d12c4 Signed-off-by: hgchu --- drivers/scsi/scsi_sysfs.c | 12 ++++++++++++ drivers/scsi/ufs/ufshcd.c | 2 ++ drivers/scsi/ufs/ufshcd.h | 1 + 3 files changed, 15 insertions(+) diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 40406c162d0d..528ac9070efe 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -23,6 +23,7 @@ #include "scsi_priv.h" #include "scsi_logging.h" +#include "ufs/ufshcd.h" static struct device_type scsi_dev_type; @@ -264,6 +265,16 @@ show_shost_supported_mode(struct device *dev, struct device_attribute *attr, static DEVICE_ATTR(supported_mode, S_IRUGO | S_IWUSR, show_shost_supported_mode, NULL); +/* for Argos */ +static ssize_t show_shost_transferred_cnt(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct Scsi_Host *shost = class_to_shost(dev); + struct ufs_hba *hba = shost_priv(shost); + + return sprintf(buf, "%u\n", hba->transferred_sector); +} +static DEVICE_ATTR(transferred_cnt, 0444, show_shost_transferred_cnt, NULL); + static ssize_t show_shost_active_mode(struct device *dev, struct device_attribute *attr, char *buf) @@ -403,6 +414,7 @@ static struct attribute *scsi_sysfs_shost_attrs[] = { &dev_attr_prot_guard_type.attr, &dev_attr_host_reset.attr, &dev_attr_eh_deadline.attr, + &dev_attr_transferred_cnt.attr, NULL }; diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 14fba0757c98..4a4a36e1fcee 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2024,6 +2024,8 @@ static int ufshcd_map_sg(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) prd_table[i].upper_addr = cpu_to_le32(upper_32_bits(sg->dma_address)); prd_table[i].reserved = 0; + hba->transferred_sector += prd_table[i].size; + } } else { lrbp->utr_descriptor_ptr->prd_table_length = 0; diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 08ddfe39ad12..9f1a466d6122 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -616,6 +616,7 @@ struct ufs_hba { u32 ufshcd_state; u32 eh_flags; u32 intr_mask; + u32 transferred_sector; u16 ee_ctrl_mask; bool is_powered; bool is_init_prefetch; -- 2.20.1