From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=58561 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOstH-00085h-Ph for qemu-devel@nongnu.org; Wed, 16 Jun 2010 09:42:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OOstF-0000Re-Q7 for qemu-devel@nongnu.org; Wed, 16 Jun 2010 09:42:51 -0400 Received: from smtp127.sbc.mail.sp1.yahoo.com ([69.147.65.186]:34357) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OOstF-0000RS-GY for qemu-devel@nongnu.org; Wed, 16 Jun 2010 09:42:49 -0400 From: "Nicholas A. Bellinger" Date: Wed, 16 Jun 2010 06:43:06 -0700 Message-Id: <1276695786-16626-1-git-send-email-nab@linux-iscsi.org> Subject: [Qemu-devel] [PATCH 2/2] [scsi-bus]: Add MAINTENANCE_IN and MAINTENANCE_OUT SCSIRequest xfer and mode assignments List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: kvm-devel , Hannes Reinecke , qemu-devel , Nicholas Bellinger , FUJITA Tomonori , Paul Brook , Christoph Hellwig , Gerd Hoffmann From: Nicholas Bellinger This patch updates hw/scsi-bus.c to add MAINTENANCE_IN and MAINTENANCE_OUT case in scsi_req_length() for TYPE_ROM with MMC commands. It also adds the MAINTENANCE_OUT case in scsi_req_xfer_mode() to set SCSI_XFER_TO_DEV for outgoing write data. Signed-off-by: Nicholas A. Bellinger --- hw/scsi-bus.c | 10 ++++++++++ hw/scsi-defs.h | 2 ++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index 7a5fa48..ed3554c 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -325,6 +325,13 @@ static int scsi_req_length(SCSIRequest *req, uint8_t *cmd) case INQUIRY: req->cmd.xfer = cmd[4] | (cmd[3] << 8); break; + case MAINTENANCE_OUT: + case MAINTENANCE_IN: + if (req->dev->type == TYPE_ROM) { + /* GPCMD_REPORT_KEY and GPCMD_SEND_KEY from multi media commands */ + req->cmd.xfer = cmd[9] | (cmd[8] << 8); + } + break; } return 0; } @@ -390,6 +397,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: @@ -535,6 +543,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