[PATCH 2/3] SBC: Add basic WRITE_SAME(16) support. (no unmap support)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Signed-off-by: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>
---
 usr/bs_rdwr.c |    1 +
 usr/sbc.c     |    4 +++-
 usr/scsi.c    |    2 ++
 usr/scsi.h    |    1 +
 4 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/usr/bs_rdwr.c b/usr/bs_rdwr.c
index e4456fc..09524a4 100644
--- a/usr/bs_rdwr.c
+++ b/usr/bs_rdwr.c
@@ -111,6 +111,7 @@ static void bs_rdwr_request(struct scsi_cmd *cmd)
 
 		break;
 	case WRITE_SAME:
+	case WRITE_SAME_16:
 		while (cmd->tl > 0) {
 			blocksize = 1 << cmd->dev->blk_shift;
 			tmpbuf = scsi_get_out_buffer(cmd);
diff --git a/usr/sbc.c b/usr/sbc.c
index cf72e65..de0a13b 100644
--- a/usr/sbc.c
+++ b/usr/sbc.c
@@ -229,6 +229,7 @@ static int sbc_rw(int host_no, struct scsi_cmd *cmd)
 		}
 		break;
 	case WRITE_SAME:
+	case WRITE_SAME_16:
 		/* We only support protection information type 0 */
 		if (cmd->scb[1] & 0xe0) {
 			key = ILLEGAL_REQUEST;
@@ -251,6 +252,7 @@ static int sbc_rw(int host_no, struct scsi_cmd *cmd)
 		case WRITE_12:
 		case WRITE_16:
 		case WRITE_SAME:
+		case WRITE_SAME_16:
 		case PRE_FETCH_10:
 		case PRE_FETCH_16:
 			key = DATA_PROTECT;
@@ -683,7 +685,7 @@ static struct device_type_template sbc_template = {
 		{sbc_rw, NULL, PR_EA_FA|PR_EA_FN}, /*PRE_FETCH_16 */
 		{sbc_sync_cache, NULL, PR_WE_FA|PR_EA_FA|PR_WE_FN|PR_EA_FN},
 		{spc_illegal_op,},
-		{spc_illegal_op,},
+		{sbc_rw,},		/* WRITE_SAME_16 */
 		{spc_illegal_op,},
 		{spc_illegal_op,},
 		{spc_illegal_op,},
diff --git a/usr/scsi.c b/usr/scsi.c
index c46753e..20382f1 100644
--- a/usr/scsi.c
+++ b/usr/scsi.c
@@ -133,6 +133,7 @@ uint64_t scsi_rw_offset(uint8_t *scb)
 	case WRITE_16:
 	case VERIFY_16:
 	case WRITE_VERIFY_16:
+	case WRITE_SAME_16:
 	case SYNCHRONIZE_CACHE_16:
 		off = (uint64_t)scb[2] << 56 | (uint64_t)scb[3] << 48 |
 			(uint64_t)scb[4] << 40 | (uint64_t)scb[5] << 32 |
@@ -179,6 +180,7 @@ uint32_t scsi_rw_count(uint8_t *scb)
 	case WRITE_16:
 	case VERIFY_16:
 	case WRITE_VERIFY_16:
+	case WRITE_SAME_16:
 	case SYNCHRONIZE_CACHE_16:
 		cnt = (uint32_t)scb[10] << 24 | (uint32_t)scb[11] << 16 |
 			(uint32_t)scb[12] << 8 | (uint32_t)scb[13];
diff --git a/usr/scsi.h b/usr/scsi.h
index 1508cc6..0a02c36 100644
--- a/usr/scsi.h
+++ b/usr/scsi.h
@@ -77,6 +77,7 @@
 #define VERIFY_16	      0x8f
 #define PRE_FETCH_16          0x90
 #define SYNCHRONIZE_CACHE_16  0x91
+#define WRITE_SAME_16         0x93
 #define SERVICE_ACTION_IN     0x9e
 #define	SAI_READ_CAPACITY_16  0x10
 #define REPORT_LUNS           0xa0
-- 
1.7.3.1

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [XFree86]     [Video Devices]

Add to Google Powered by Linux