From patchwork Fri Jul 27 15:02:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 173712 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AC6E42C0095 for ; Sat, 28 Jul 2012 01:58:26 +1000 (EST) Received: from localhost ([::1]:54374 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sumvo-0002ii-TC for incoming@patchwork.ozlabs.org; Fri, 27 Jul 2012 11:58:24 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sum5O-0007ln-Gg for qemu-devel@nongnu.org; Fri, 27 Jul 2012 11:04:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sum5N-0007TV-By for qemu-devel@nongnu.org; Fri, 27 Jul 2012 11:04:14 -0400 Received: from mail-gg0-f173.google.com ([209.85.161.173]:38232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sum5N-0007TO-5v for qemu-devel@nongnu.org; Fri, 27 Jul 2012 11:04:13 -0400 Received: by ggnp1 with SMTP id p1so3211128ggn.4 for ; Fri, 27 Jul 2012 08:04:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=9qH8C9IcKHT17A4JW5/adWSpT+9cS7wsuUDlmfYqj0o=; b=JVu7lR1jA17BFVMiAAZXZwYKoM8ueY0Z8SN9H8e0PYKrOE9Tch2svEcA2F3t09Czc2 W2fuUXUnV7YszDeZOEH2yCH5Inis6YP19vAFOYGJsYJFJt5dg7eDP+T9BHNudOwRQ1F7 tUnmi0qtk8e52DNBU+TrBgfOOYpUQYGO//Bug6yI5Y99TC6P/Sw9zPXf0UI4nJ94CAhf kUtDsSU7903kFHODFYvR1mADncQaepDrYRgyYpa59ZdeUXBX9Ng44fOkdVgFugMCorTM noHEAKEDcz840J9V6GHOsDdJkRw4DFAbrS6VrabMPFtpp/GNIgD4p4vTbmT77PFxqgV4 e0PA== Received: by 10.66.86.199 with SMTP id r7mr6343798paz.1.1343401452665; Fri, 27 Jul 2012 08:04:12 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-189-113.ip51.fastwebnet.it. [93.34.189.113]) by mx.google.com with ESMTPS id nk3sm2062530pbc.27.2012.07.27.08.04.10 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 27 Jul 2012 08:04:11 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 27 Jul 2012 17:02:48 +0200 Message-Id: <1343401379-19495-22-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1343401379-19495-1-git-send-email-pbonzini@redhat.com> References: <1343401379-19495-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.161.173 Subject: [Qemu-devel] [PATCH 21/32] scsi-disk: removable hard disks support load/eject 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 Support for the LOEJ bit of the START/STOP UNIT command right now is limited to CD-ROMs. This is wrong, since removable hard disks (in the real world: SD card readers) also support it in pretty much the same way. Without the LOEJ bit, START/STOP UNIT does nothing for all devices. Signed-off-by: Paolo Bonzini --- hw/scsi-disk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index fb0540a..b52e304 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -1248,7 +1248,7 @@ static int scsi_disk_emulate_start_stop(SCSIDiskReq *r) bool start = req->cmd.buf[4] & 1; bool loej = req->cmd.buf[4] & 2; /* load on start, eject on !start */ - if (s->qdev.type == TYPE_ROM && loej) { + if ((s->features & (1 << SCSI_DISK_F_REMOVABLE)) && loej) { if (!start && !s->tray_open && s->tray_locked) { scsi_check_condition(r, bdrv_is_inserted(s->qdev.conf.bs)