From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Kevin Wolf <kwolf@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>
Cc: kvm-devel <kvm@vger.kernel.org>,
qemu-devel <qemu-devel@nongnu.org>,
Nicholas Bellinger <nab@linux-iscsi.org>,
Paul Brook <paul@codesourcery.com>,
Christoph Hellwig <hch@lst.de>, Hannes Reinecke <hare@suse.de>
Subject: [Qemu-devel] [PATCH 2/2] [scsi-bus]: Add MAINTENANCE_IN and MAINTENANCE_OUT case for SCSIRequest xfer and xfer_mode setup
Date: Sun, 30 May 2010 18:43:08 -0700 [thread overview]
Message-ID: <1275270188-11011-1-git-send-email-nab@linux-iscsi.org> (raw)
From: Nicholas Bellinger <nab@linux-iscsi.org>
This patch updates hw/scsi-bus.c to add MAINTENANCE_IN and MAINTENANCE_OUT case in
scsi_req_length() to extra the incoming buffer length into SCSIRequest->cmd.xfer,
and adds a second MAINTENANCE_OUT case in scsi_req_xfer_mode() in order to properly
set SCSI_XFER_TO_DEV for WRITE data.
Tested with Linux KVM guests and Megasas 8708EM2 HBA emulation and TCM_Loop target ports.
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
---
hw/scsi-bus.c | 14 ++++++++++++++
hw/scsi-defs.h | 2 ++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index 75ec74e..7d80405 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -329,6 +329,17 @@ static int scsi_req_length(SCSIRequest *req, uint8_t *cmd)
case PERSISTENT_RESERVE_IN:
req->cmd.xfer = cmd[8] | (cmd[7] << 8);
break;
+ case MAINTENANCE_OUT:
+ case MAINTENANCE_IN:
+ if (req->dev->type != TYPE_ROM) {
+ /* Used for MI_REPORT_TARGET_PGS, MO_SET_TARGET_PGS et al. */
+ req->cmd.xfer = cmd[9] | (cmd[8] << 8) |
+ (cmd[7] << 16) | (cmd[6] << 24);
+ } else {
+ /* GPCMD_REPORT_KEY and GPCMD_SEND_KEY from multi media commands */
+ req->cmd.xfer = cmd[9] | (cmd[8] << 8);
+ }
+ break;
}
return 0;
}
@@ -394,6 +405,7 @@ static void scsi_req_xfer_mode(SCSIRequest *req)
case SEND_VOLUME_TAG:
case WRITE_LONG_2:
case PERSISTENT_RESERVE_OUT:
+ case MAINTENANCE_OUT:
req->cmd.mode = SCSI_XFER_TO_DEV;
break;
default:
@@ -539,6 +551,8 @@ const char *scsi_command_name(uint8_t cmd)
[ SPACE ] = "SPACE",
[ INQUIRY ] = "INQUIRY",
[ RECOVER_BUFFERED_DATA ] = "RECOVER_BUFFERED_DATA",
+ [ MAINTENANCE_IN ] = "MAINTENANCE_IN",
+ [ MAINTENANCE_OUT ] = "MAINTENANCE_OUT",
[ MODE_SELECT ] = "MODE_SELECT",
[ RESERVE ] = "RESERVE",
[ RELEASE ] = "RELEASE",
diff --git a/hw/scsi-defs.h b/hw/scsi-defs.h
index 5890094..a4a3518 100644
--- a/hw/scsi-defs.h
+++ b/hw/scsi-defs.h
@@ -84,6 +84,8 @@
#define MODE_SENSE_10 0x5a
#define PERSISTENT_RESERVE_IN 0x5e
#define PERSISTENT_RESERVE_OUT 0x5f
+#define MAINTENANCE_IN 0xa3
+#define MAINTENANCE_OUT 0xa4
#define MOVE_MEDIUM 0xa5
#define READ_12 0xa8
#define WRITE_12 0xaa
--
1.5.6.5
reply other threads:[~2010-05-31 1:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1275270188-11011-1-git-send-email-nab@linux-iscsi.org \
--to=nab@linux-iscsi.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kwolf@redhat.com \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).