On 10/28/19 8:10 PM, Can Guo wrote:
Host sends MODE_SENSE_10 with caching mode page, to check if the devicevariable locality
supports the cache feature.
UFS JEDEC standards require DBD field to be set to 1.
This patch allows LLD to define the setting of DBD if required.
Signed-off-by: Can Guo <cang@xxxxxxxxxxxxxx>
---
 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 aab4ed8..6d8194f 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2629,6 +2629,7 @@ static int sd_try_rc16_first(struct scsi_device *sdp)
 {
ÂÂÂÂÂ int len = 0, res;
ÂÂÂÂÂ struct scsi_device *sdp = sdkp->device;
+ÂÂÂ struct Scsi_Host *host = sdp->host;
ÂÂÂÂÂ int dbd;
ÂÂÂÂÂ int modepage;
@@ -2660,7 +2661,10 @@ static int sd_try_rc16_first(struct scsi_device *sdp)
ÂÂÂÂÂÂÂÂÂ dbd = 8;
ÂÂÂÂÂ } else {
ÂÂÂÂÂÂÂÂÂ modepage = 8;
-ÂÂÂÂÂÂÂ dbd = 0;
+ÂÂÂÂÂÂÂ if (host->set_dbd_for_caching)
+ÂÂÂÂÂÂÂÂÂÂÂ dbd = 8;
+ÂÂÂÂÂÂÂ else
+ÂÂÂÂÂÂÂÂÂÂÂ dbd = 0;
ÂÂÂÂÂ }
This simplifies to:
-ÂÂ } else if (sdp->type == TYPE_RBC) {
+ÂÂÂ } else if (sdp->type == TYPE_RBC || sdp->host->set_dbd_for_caching) {