scsi: ufs: Add sysfs node for argos
authorhgchu <hg.chu@samsung.com>
Fri, 12 Jan 2018 01:01:12 +0000 (10:01 +0900)
committerJaeHun Jung <jh0801.jung@samsung.com>
Tue, 8 May 2018 08:20:11 +0000 (17:20 +0900)
Change-Id: I89c56c18c57923ab80328ea2f2c987c50e9d12c4
Signed-off-by: hgchu <hg.chu@samsung.com>
drivers/scsi/scsi_sysfs.c
drivers/scsi/ufs/ufshcd.c
drivers/scsi/ufs/ufshcd.h

index 40406c162d0d7f88bcd1d479c2666888b8eda3c4..528ac9070efed6c11b949535658f5a5428127480 100644 (file)
@@ -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
 };
 
index 14fba0757c9821cfdcbab94b162d9e2336a857a7..4a4a36e1fcee52616425d72d51f29b10ee3d9ab0 100644 (file)
@@ -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;
index 08ddfe39ad129e279ef7135448f9f6a739050f20..9f1a466d6122ba88a95d8ea485a19230abbec9b9 100644 (file)
@@ -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;