Patchwork [30/30] scsi: add read/write 16 commands.

login
register
mail settings
Submitter Gerd Hoffmann
Date Nov. 26, 2009, 2:34 p.m.
Message ID <1259246056-5389-31-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/39549/
State New
Headers show

Comments

Gerd Hoffmann - Nov. 26, 2009, 2:34 p.m.
Add READ_16 + friends to scsi-defs.h, scsi_command_name() and the
request parsing helper functions.

Use them in scsi-disk.c too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/scsi-bus.c  |    8 ++++++++
 hw/scsi-defs.h |    3 +++
 hw/scsi-disk.c |    6 ++++--
 3 files changed, 15 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index b6de5c6..736e91e 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -228,6 +228,8 @@  static int scsi_req_length(SCSIRequest *req, uint8_t *cmd)
     case WRITE_6:
     case WRITE_12:
     case WRITE_VERIFY_12:
+    case WRITE_16:
+    case WRITE_VERIFY_16:
         req->cmd.xfer *= req->dev->blocksize;
         break;
     case READ_10:
@@ -235,6 +237,7 @@  static int scsi_req_length(SCSIRequest *req, uint8_t *cmd)
     case READ_REVERSE:
     case RECOVER_BUFFERED_DATA:
     case READ_12:
+    case READ_16:
         req->cmd.xfer *= req->dev->blocksize;
         break;
     case INQUIRY:
@@ -277,6 +280,8 @@  static void scsi_req_xfer_mode(SCSIRequest *req)
     case WRITE_VERIFY:
     case WRITE_12:
     case WRITE_VERIFY_12:
+    case WRITE_16:
+    case WRITE_VERIFY_16:
     case COPY:
     case COPY_VERIFY:
     case COMPARE:
@@ -441,6 +446,9 @@  static const char *scsi_command_name(uint8_t cmd)
         [ REWIND                   ] = "REWIND",
         [ REPORT_DENSITY_SUPPORT   ] = "REPORT_DENSITY_SUPPORT",
         [ GET_CONFIGURATION        ] = "GET_CONFIGURATION",
+        [ READ_16                  ] = "READ_16",
+        [ WRITE_16                 ] = "WRITE_16",
+        [ WRITE_VERIFY_16          ] = "WRITE_VERIFY_16",
         [ SERVICE_ACTION_IN        ] = "SERVICE_ACTION_IN",
         [ REPORT_LUNS              ] = "REPORT_LUNS",
         [ LOAD_UNLOAD              ] = "LOAD_UNLOAD",
diff --git a/hw/scsi-defs.h b/hw/scsi-defs.h
index cc7f35e..4759d80 100644
--- a/hw/scsi-defs.h
+++ b/hw/scsi-defs.h
@@ -100,6 +100,9 @@ 
 #define REWIND 0x01
 #define REPORT_DENSITY_SUPPORT 0x44
 #define GET_CONFIGURATION 0x46
+#define READ_16 0x88
+#define WRITE_16 0x8a
+#define WRITE_VERIFY_16 0x8e
 #define SERVICE_ACTION_IN 0x9e
 #define REPORT_LUNS 0xa0
 #define LOAD_UNLOAD 0xa6
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 2910782..c802ccd 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -926,7 +926,8 @@  static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
         break;
     case READ_6:
     case READ_10:
-    case 0x88:
+    case READ_12:
+    case READ_16:
         DPRINTF("Read (sector %" PRId64 ", count %d)\n", lba, len);
         if (lba > s->max_lba)
             goto illegal_lba;
@@ -935,7 +936,8 @@  static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
         break;
     case WRITE_6:
     case WRITE_10:
-    case 0x8a:
+    case WRITE_12:
+    case WRITE_16:
         DPRINTF("Write (sector %" PRId64 ", count %d)\n", lba, len);
         if (lba > s->max_lba)
             goto illegal_lba;