From patchwork Tue Sep 6 15:39:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 113609 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2C3BFB6F70 for ; Wed, 7 Sep 2011 02:57:40 +1000 (EST) Received: from localhost ([::1]:42816 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0xjJ-00045H-DO for incoming@patchwork.ozlabs.org; Tue, 06 Sep 2011 11:38:29 -0400 Received: from eggs.gnu.org ([140.186.70.92]:55190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0xiP-0002mj-Do for qemu-devel@nongnu.org; Tue, 06 Sep 2011 11:37:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0xiI-0003rT-Bq for qemu-devel@nongnu.org; Tue, 06 Sep 2011 11:37:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3363) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0xiI-0003rL-2U for qemu-devel@nongnu.org; Tue, 06 Sep 2011 11:37:26 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p86FbOJ1002060 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 6 Sep 2011 11:37:24 -0400 Received: from dhcp-5-188.str.redhat.com (dhcp-5-175.str.redhat.com [10.32.5.175]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p86FamTf015671; Tue, 6 Sep 2011 11:37:23 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Tue, 6 Sep 2011 17:39:44 +0200 Message-Id: <1315323586-23840-30-git-send-email-kwolf@redhat.com> In-Reply-To: <1315323586-23840-1-git-send-email-kwolf@redhat.com> References: <1315323586-23840-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 29/31] scsi: refine constants for READ CAPACITY 16 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Paolo Bonzini Rename SERVICE_ACTION_IN to SERVICE_ACTION_IN_16 to distinguish from the 12-byte CDB variant, and add a constant for the subcommand. Signed-off-by: Paolo Bonzini Signed-off-by: Kevin Wolf --- hw/scsi-bus.c | 3 ++- hw/scsi-defs.h | 8 +++++++- hw/scsi-disk.c | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index 6f0d039..d6fd19a 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -977,7 +977,7 @@ static const char *scsi_command_name(uint8_t cmd) [ LOCATE_16 ] = "LOCATE_16", [ WRITE_SAME_16 ] = "WRITE_SAME_16", [ ERASE_16 ] = "ERASE_16", - [ SERVICE_ACTION_IN ] = "SERVICE_ACTION_IN", + [ SERVICE_ACTION_IN_16 ] = "SERVICE_ACTION_IN_16", [ WRITE_LONG_16 ] = "WRITE_LONG_16", [ REPORT_LUNS ] = "REPORT_LUNS", [ BLANK ] = "BLANK", @@ -987,6 +987,7 @@ static const char *scsi_command_name(uint8_t cmd) [ LOAD_UNLOAD ] = "LOAD_UNLOAD", [ READ_12 ] = "READ_12", [ WRITE_12 ] = "WRITE_12", + [ SERVICE_ACTION_IN_12 ] = "SERVICE_ACTION_IN_12", [ WRITE_VERIFY_12 ] = "WRITE_VERIFY_12", [ VERIFY_12 ] = "VERIFY_12", [ SEARCH_HIGH_12 ] = "SEARCH_HIGH_12", diff --git a/hw/scsi-defs.h b/hw/scsi-defs.h index ea288fa..bfe9392 100644 --- a/hw/scsi-defs.h +++ b/hw/scsi-defs.h @@ -102,7 +102,7 @@ #define LOCATE_16 0x92 #define WRITE_SAME_16 0x93 #define ERASE_16 0x93 -#define SERVICE_ACTION_IN 0x9e +#define SERVICE_ACTION_IN_16 0x9e #define WRITE_LONG_16 0x9f #define REPORT_LUNS 0xa0 #define BLANK 0xa1 @@ -112,6 +112,7 @@ #define LOAD_UNLOAD 0xa6 #define READ_12 0xa8 #define WRITE_12 0xaa +#define SERVICE_ACTION_IN_12 0xab #define WRITE_VERIFY_12 0xae #define VERIFY_12 0xaf #define SEARCH_HIGH_12 0xb0 @@ -123,6 +124,11 @@ #define SET_CD_SPEED 0xbb /* + * SERVICE ACTION IN subcodes + */ +#define SAI_READ_CAPACITY_16 0x10 + +/* * SAM Status codes */ diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index c23c2b8..ead4163 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -890,9 +890,9 @@ static int scsi_disk_emulate_command(SCSIDiskReq *r, uint8_t *outbuf) outbuf[7] = 8; // CD-ROM buflen = 8; break; - case SERVICE_ACTION_IN: + case SERVICE_ACTION_IN_16: /* Service Action In subcommands. */ - if ((req->cmd.buf[1] & 31) == 0x10) { + if ((req->cmd.buf[1] & 31) == SAI_READ_CAPACITY_16) { DPRINTF("SAI READ CAPACITY(16)\n"); memset(outbuf, 0, req->cmd.xfer); bdrv_get_geometry(s->bs, &nb_sectors); @@ -992,7 +992,7 @@ static int32_t scsi_send_command(SCSIRequest *req, uint8_t *buf) case READ_CAPACITY_10: case READ_TOC: case GET_CONFIGURATION: - case SERVICE_ACTION_IN: + case SERVICE_ACTION_IN_16: case VERIFY_10: rc = scsi_disk_emulate_command(r, outbuf); if (rc < 0) {