From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDfRB-00074a-OM for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:35:16 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDfR5-0006wR-Mi for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:35:09 -0500 Received: from [199.232.76.173] (port=56180 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDfR4-0006uZ-2P for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:35:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60701) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NDfR3-0000JP-Kd for qemu-devel@nongnu.org; Thu, 26 Nov 2009 09:35:05 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAQEZ4Ii012673 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 26 Nov 2009 09:35:04 -0500 From: Gerd Hoffmann Date: Thu, 26 Nov 2009 15:34:14 +0100 Message-Id: <1259246056-5389-29-git-send-email-kraxel@redhat.com> In-Reply-To: <1259246056-5389-1-git-send-email-kraxel@redhat.com> References: <1259246056-5389-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 28/30] scsi-disk: restruct emulation: REPORT_LUNS List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Move REPORT_LUNS emulation from scsi_send_command() to scsi_disk_emulate_command(). Also add REPORT_LUNS to scsi-defs.h and scsi_command_name(). Signed-off-by: Gerd Hoffmann --- hw/scsi-bus.c | 1 + hw/scsi-defs.h | 1 + hw/scsi-disk.c | 16 ++++++++-------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index deb6b4f..b6de5c6 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -442,6 +442,7 @@ static const char *scsi_command_name(uint8_t cmd) [ REPORT_DENSITY_SUPPORT ] = "REPORT_DENSITY_SUPPORT", [ GET_CONFIGURATION ] = "GET_CONFIGURATION", [ SERVICE_ACTION_IN ] = "SERVICE_ACTION_IN", + [ REPORT_LUNS ] = "REPORT_LUNS", [ LOAD_UNLOAD ] = "LOAD_UNLOAD", [ SET_CD_SPEED ] = "SET_CD_SPEED", [ BLANK ] = "BLANK", diff --git a/hw/scsi-defs.h b/hw/scsi-defs.h index 4aeb667..cc7f35e 100644 --- a/hw/scsi-defs.h +++ b/hw/scsi-defs.h @@ -101,6 +101,7 @@ #define REPORT_DENSITY_SUPPORT 0x44 #define GET_CONFIGURATION 0x46 #define SERVICE_ACTION_IN 0x9e +#define REPORT_LUNS 0xa0 #define LOAD_UNLOAD 0xa6 #define SET_CD_SPEED 0xbb #define BLANK 0xa1 diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index b481c13..1507bcd 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -787,6 +787,13 @@ static int scsi_disk_emulate_command(SCSIRequest *req, uint8_t *outbuf) } DPRINTF("Unsupported Service Action In\n"); goto illegal_request; + case REPORT_LUNS: + if (req->cmd.xfer < 16) + goto illegal_request; + memset(outbuf, 0, 16); + outbuf[3] = 8; + buflen = 16; + break; default: goto illegal_request; } @@ -904,6 +911,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, case READ_TOC: case GET_CONFIGURATION: case SERVICE_ACTION_IN: + case REPORT_LUNS: rc = scsi_disk_emulate_command(&r->req, outbuf); if (rc > 0) { r->iov.iov_len = rc; @@ -932,14 +940,6 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, r->sector_count = len * s->cluster_size; is_write = 1; break; - case 0xa0: - DPRINTF("Report LUNs (len %d)\n", len); - if (len < 16) - goto fail; - memset(outbuf, 0, 16); - outbuf[3] = 8; - r->iov.iov_len = 16; - break; case VERIFY: DPRINTF("Verify (sector %" PRId64 ", count %d)\n", lba, len); break; -- 1.6.2.5