From patchwork Tue Jun 22 14:09:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 56506 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DED0AB6F05 for ; Wed, 23 Jun 2010 00:14:11 +1000 (EST) Received: from localhost ([127.0.0.1]:34801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OR4Eq-0007Q1-EP for incoming@patchwork.ozlabs.org; Tue, 22 Jun 2010 10:14:08 -0400 Received: from [140.186.70.92] (port=43236 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OR4Ag-0005dg-Ce for qemu-devel@nongnu.org; Tue, 22 Jun 2010 10:09:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OR4Ae-0007aB-Rc for qemu-devel@nongnu.org; Tue, 22 Jun 2010 10:09:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45896) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OR4Ae-0007Zy-Hk for qemu-devel@nongnu.org; Tue, 22 Jun 2010 10:09:48 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5ME9jZJ011634 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 22 Jun 2010 10:09:45 -0400 Received: from localhost.localdomain (dhcp-5-217.str.redhat.com [10.32.5.217]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5ME9fjm024621; Tue, 22 Jun 2010 10:09:44 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Tue, 22 Jun 2010 16:09:21 +0200 Message-Id: <1277215773-27357-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1277215773-27357-1-git-send-email-kwolf@redhat.com> References: <1277215773-27357-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 02/14] scsi-bus: Add MAINTENANCE_IN and MAINTENANCE_OUT SCSIRequest xfer and mode assignments X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Acked-by: Gerd Hoffmann Signed-off-by: Kevin Wolf --- 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 3575ba3..24bd060 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -242,6 +242,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; } @@ -307,6 +314,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: @@ -387,6 +395,8 @@ static 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