dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0104-scsi-bus-fix-transfer-length-and-direction-for-VERIF.patch

c40251
From 3b1f248f3f8ff06ed4a4269871138db66e336ec5 Mon Sep 17 00:00:00 2001
c40251
From: Paolo Bonzini <pbonzini@redhat.com>
c40251
Date: Thu, 28 Nov 2013 11:01:13 +0100
c40251
Subject: [PATCH] scsi-bus: fix transfer length and direction for VERIFY
c40251
 command
c40251
MIME-Version: 1.0
c40251
Content-Type: text/plain; charset=UTF-8
c40251
Content-Transfer-Encoding: 8bit
c40251
c40251
The amount of bytes to transfer depends on the BYTCHK field.
c40251
If any data is transferred, it is sent to the device.
c40251
c40251
Cc: qemu-stable@nongnu.org
c40251
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
c40251
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
c40251
(cherry picked from commit d12ad44cc4cc9142179e64295608611f118b8ad8)
c40251
---
c40251
 hw/scsi/scsi-bus.c | 14 +++++++++++++-
c40251
 1 file changed, 13 insertions(+), 1 deletion(-)
c40251
c40251
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
c40251
index ea916d1..2d6ce4d 100644
c40251
--- a/hw/scsi/scsi-bus.c
c40251
+++ b/hw/scsi/scsi-bus.c
c40251
@@ -886,7 +886,6 @@ static int scsi_req_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf)
c40251
     case RELEASE:
c40251
     case ERASE:
c40251
     case ALLOW_MEDIUM_REMOVAL:
c40251
-    case VERIFY_10:
c40251
     case SEEK_10:
c40251
     case SYNCHRONIZE_CACHE:
c40251
     case SYNCHRONIZE_CACHE_16:
c40251
@@ -903,6 +902,16 @@ static int scsi_req_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf)
c40251
     case ALLOW_OVERWRITE:
c40251
         cmd->xfer = 0;
c40251
         break;
c40251
+    case VERIFY_10:
c40251
+    case VERIFY_12:
c40251
+    case VERIFY_16:
c40251
+        if ((buf[1] & 2) == 0) {
c40251
+            cmd->xfer = 0;
c40251
+        } else if ((buf[1] & 4) == 1) {
c40251
+            cmd->xfer = 1;
c40251
+        }
c40251
+        cmd->xfer *= dev->blocksize;
c40251
+        break;
c40251
     case MODE_SENSE:
c40251
         break;
c40251
     case WRITE_SAME_10:
c40251
@@ -1100,6 +1109,9 @@ static void scsi_cmd_xfer_mode(SCSICommand *cmd)
c40251
     case WRITE_VERIFY_12:
c40251
     case WRITE_16:
c40251
     case WRITE_VERIFY_16:
c40251
+    case VERIFY_10:
c40251
+    case VERIFY_12:
c40251
+    case VERIFY_16:
c40251
     case COPY:
c40251
     case COPY_VERIFY:
c40251
     case COMPARE: