From patchwork Mon May 23 16:09:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 97007 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 7DCD4B6FAE for ; Tue, 24 May 2011 02:17:58 +1000 (EST) Received: from localhost ([::1]:48876 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOXpL-0006gT-Pu for incoming@patchwork.ozlabs.org; Mon, 23 May 2011 12:17:55 -0400 Received: from eggs.gnu.org ([140.186.70.92]:57726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOXiI-0002sx-VU for qemu-devel@nongnu.org; Mon, 23 May 2011 12:10:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QOXiH-0001Ue-V9 for qemu-devel@nongnu.org; Mon, 23 May 2011 12:10:38 -0400 Received: from mail-pw0-f45.google.com ([209.85.160.45]:44291) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOXiH-0001D6-Qf for qemu-devel@nongnu.org; Mon, 23 May 2011 12:10:37 -0400 Received: by mail-pw0-f45.google.com with SMTP id 6so3265252pwi.4 for ; Mon, 23 May 2011 09:10:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:cc:subject:date:message-id :x-mailer:in-reply-to:references; bh=287i9+trDvw/yNNARFtOLilgzd+BZPbfbwsGLh0skJU=; b=TF9s+96zvnOlj44VHdteOwv+HmCEyTjXfGE7SoToZwvkEZcbquWfgaUaCD4S38HNux QutNPhwQ1bkc6AIsZGyWnv6wf4Ye1iNCeLoheXEbOsfJ6Dz9Cjrwi+BfC3lcChCrbJrk hSYpVKH+wWSf6S8+t+vY27lK53VEcu9FO308I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; b=g0MConZ+4E4OqOu4lEP4CqKbwfvOuA3IKRWAamgs9RqxWQShxessJU3F556nGGPOru O/s5L0E0odrSZF6HOekMaTQ+nn/BASl94V2vPCFaGBePOUO/lbyComFlmTHMv6eHmi1O VKodiRfvzG77Xc7OA/LAiJ1afSJnXgdIZQUHo= Received: by 10.142.2.35 with SMTP id 35mr797711wfb.270.1306167037521; Mon, 23 May 2011 09:10:37 -0700 (PDT) Received: from localhost.localdomain (93-34-184-88.ip51.fastwebnet.it [93.34.184.88]) by mx.google.com with ESMTPS id x12sm5946194wfd.6.2011.05.23.09.10.34 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 May 2011 09:10:36 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 23 May 2011 18:09:09 +0200 Message-Id: <1306166949-19698-25-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1306166949-19698-1-git-send-email-pbonzini@redhat.com> References: <1306166949-19698-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.160.45 Cc: hch@lst.de Subject: [Qemu-devel] [PATCH v4 24/24] scsi: ignore LUN field in the CDB 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 The LUN field in the CDB is a historical relic. Ignore it as reserved, which is what modern SCSI specifications actually say. Signed-off-by: Paolo Bonzini Reviewed-by: Christoph Hellwig --- hw/scsi-disk.c | 6 +++--- hw/scsi-generic.c | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 77d0151..b90bc97 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -515,7 +515,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) memset(outbuf, 0, buflen); - if (req->lun || req->cmd.buf[1] >> 5) { + if (req->lun) { outbuf[0] = 0x7f; /* LUN not supported */ return buflen; } @@ -1021,9 +1021,9 @@ static int32_t scsi_send_command(SCSIRequest *req, uint8_t *buf) } #endif - if (req->lun || buf[1] >> 5) { + if (req->lun) { /* Only LUN 0 supported. */ - DPRINTF("Unimplemented LUN %d\n", req->lun ? req->lun : buf[1] >> 5); + DPRINTF("Unimplemented LUN %d\n", req->lun); if (command != REQUEST_SENSE && command != INQUIRY) { scsi_command_complete(r, CHECK_CONDITION, SENSE_CODE(LUN_NOT_SUPPORTED)); diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c index 30845c5..3e720dc 100644 --- a/hw/scsi-generic.c +++ b/hw/scsi-generic.c @@ -334,9 +334,8 @@ static int32_t scsi_send_command(SCSIRequest *req, uint8_t *cmd) SCSIGenericReq *r = DO_UPCAST(SCSIGenericReq, req, req); int ret; - if (cmd[0] != REQUEST_SENSE && - (req->lun != s->lun || (cmd[1] >> 5) != s->lun)) { - DPRINTF("Unimplemented LUN %d\n", req->lun ? req->lun : cmd[1] >> 5); + if (cmd[0] != REQUEST_SENSE && req->lun != s->lun) { + DPRINTF("Unimplemented LUN %d\n", req->lun); scsi_set_sense(s, SENSE_CODE(LUN_NOT_SUPPORTED)); r->req.status = CHECK_CONDITION; scsi_req_complete(&r->req);