From 0aab3881ced1919428711bd60fe070b569fd4f08 Mon Sep 17 00:00:00 2001 From: Maya Erez Date: Thu, 13 Nov 2014 12:55:04 +0200 Subject: [PATCH] ANDROID: GKI: scsi: Adjust DBD setting in mode sense for caching mode page per LLD Host sends MODE_SENSE_10 with caching mode page, to check if the device supports the cache feature. Some LLD standards requires DBD field to be set to 1. This patch allows LLD to define the setting of DBD if required. Change-Id: I7f6c0ff6613516c3ef49aacc0679b96b8bd9ccc8 Signed-off-by: Maya Erez [mattw@codeaurora.org: resolved a trivial context conflict in Scsi_Host struct definition] Signed-off-by: Matt Wagantall [subhashj@codeaurora.org: resolved trivial merge conflicts] Signed-off-by: Subhash Jadavani Bug: 153569404 (cherry picked from commit 36c183b7430f9170497c4467e60a70d07fce239c) Signed-off-by: Saravana Kannan --- drivers/scsi/sd.c | 6 +++++- include/scsi/scsi_host.h | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 90f9ffa917a3..1aec735ecd39 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2680,6 +2680,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) { int len = 0, res; struct scsi_device *sdp = sdkp->device; + struct Scsi_Host *host = sdp->host; int dbd; int modepage; @@ -2711,7 +2712,10 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) dbd = 8; } else { modepage = 8; - dbd = 0; + if (host->set_dbd_for_caching) + dbd = 8; + else + dbd = 0; } /* cautiously ask */ diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 1462a3c1065b..14175266289c 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -657,6 +657,12 @@ struct Scsi_Host { /* Host responded with short (<36 bytes) INQUIRY result */ unsigned short_inquiry:1; + /* + * Set "DBD" field in mode_sense caching mode page in case it is + * mandatory by LLD standard. + */ + unsigned set_dbd_for_caching:1; + /* * Optional work queue to be utilized by the transport */