From patchwork Fri Aug 3 08:06:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 174947 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 02A262C007A for ; Fri, 3 Aug 2012 18:13:16 +1000 (EST) Received: from localhost ([::1]:60827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxCuy-0002DS-D3 for incoming@patchwork.ozlabs.org; Fri, 03 Aug 2012 04:07:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47459) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxCuE-0000TQ-8Y for qemu-devel@nongnu.org; Fri, 03 Aug 2012 04:06:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SxCu5-0006kZ-Rv for qemu-devel@nongnu.org; Fri, 03 Aug 2012 04:06:46 -0400 Received: from mail-gh0-f173.google.com ([209.85.160.173]:61078) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxCu5-0006kT-GT for qemu-devel@nongnu.org; Fri, 03 Aug 2012 04:06:37 -0400 Received: by ghrr14 with SMTP id r14so497947ghr.4 for ; Fri, 03 Aug 2012 01:06:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=XE1S5nOWhndM1cSBYOo8UEPa9AWAO7+2DyYDnyrtA0A=; b=0esGFy+EaSB/4mDSTcEB7UtwNdzr2rhnJQL5CKZ7blzTN1UF5ajTU8ywnenyem8f9K v5PWDpv9aoQI3j+qZvQJGmVxDdf39W5Pvpnc+aLom26xkLDW783orJFXw1UUwl6bFZY+ wM8cceioy1QQqamwPG6V/wQ8sM+UF/g9HbMBWL/OClEGF75OTHgz+PnykZkj1uRNghyd t2U6TK44A37RhfinXQErn84+AFHTZ7teXlAtHPxD/dTsV+BRDi2QQZnlr98f8qP6yR6M M+xaU44ACPgTocEhNe0o57XS+NC789jLtYQ1bidHQBYWkiKXQD+vzCrjYAc6aGheDVd3 S/Kg== Received: by 10.50.207.36 with SMTP id lt4mr1907394igc.5.1343981196513; Fri, 03 Aug 2012 01:06:36 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-169-1.ip50.fastwebnet.it. [93.34.169.1]) by mx.google.com with ESMTPS id rd8sm19683913igb.3.2012.08.03.01.06.32 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 03 Aug 2012 01:06:35 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 3 Aug 2012 10:06:12 +0200 Message-Id: <1343981180-23817-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1343981180-23817-1-git-send-email-pbonzini@redhat.com> References: <1343981180-23817-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.160.173 Cc: Ronnie Sahlberg Subject: [Qemu-devel] [PATCH 02/10] SCSI: STARTSTOPUNIT only eject/load media if powercondition is 0 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: Ronnie Sahlberg The START STOP UNIT command will only eject/load media if power condition is zero. If power condition is !0 then LOEJ and START will be ignored. From MMC (sbc contains similar wordings too) The Power Conditions field requests the block device to be placed in the power condition defined in Table 558. If this field has a value other than 0h then the Start and LoEj bits shall be ignored. Signed-off-by: Ronnie Sahlberg Signed-off-by: Paolo Bonzini --- hw/scsi-disk.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 84b63ff..e2ec177 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -1247,6 +1247,12 @@ static int scsi_disk_emulate_start_stop(SCSIDiskReq *r) SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev); bool start = req->cmd.buf[4] & 1; bool loej = req->cmd.buf[4] & 2; /* load on start, eject on !start */ + int pwrcnd = req->cmd.buf[4] & 0xf0; + + if (pwrcnd) { + /* eject/load only happens for power condition == 0 */ + return 0; + } if ((s->features & (1 << SCSI_DISK_F_REMOVABLE)) && loej) { if (!start && !s->tray_open && s->tray_locked) {