From patchwork Tue Apr 12 16:06:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 90822 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 84777B6F1E for ; Wed, 13 Apr 2011 02:06:55 +1000 (EST) Received: from localhost ([::1]:54532 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9g79-0003ws-Bn for incoming@patchwork.ozlabs.org; Tue, 12 Apr 2011 12:06:51 -0400 Received: from eggs.gnu.org ([140.186.70.92]:34004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9g6k-0003sA-A3 for qemu-devel@nongnu.org; Tue, 12 Apr 2011 12:06:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9g6j-0003FI-5g for qemu-devel@nongnu.org; Tue, 12 Apr 2011 12:06:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9979) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9g6i-0003F0-SM for qemu-devel@nongnu.org; Tue, 12 Apr 2011 12:06:25 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3CG6M9n018191 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 12 Apr 2011 12:06:22 -0400 Received: from localhost (ovpn-113-139.phx2.redhat.com [10.3.113.139]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p3CG6JMS029746; Tue, 12 Apr 2011 12:06:21 -0400 From: Amit Shah To: qemu list Date: Tue, 12 Apr 2011 21:36:03 +0530 Message-Id: <543f9b872c9a19fb6a34129071d7b6d4e4e5631d.1302624272.git.amit.shah@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Juan Quintela , Stefan Hajnoczi , Markus Armbruster , Jes Sorensen , Amit Shah , Paolo Bonzini Subject: [Qemu-devel] [PATCH v5 1/5] atapi: Allow GET_EVENT_STATUS_NOTIFICATION after media change 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 After a media change, the only commands allowed from the guest were REQUEST_SENSE and INQUIRY. The guest may also issue GET_EVENT_STATUS_NOTIFICATION commands to get media changed notification. Signed-off-by: Amit Shah --- hw/ide/core.c | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index c11d457..60137c6 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -1102,13 +1102,21 @@ static void ide_atapi_cmd(IDEState *s) printf("\n"); } #endif - /* If there's a UNIT_ATTENTION condition pending, only - REQUEST_SENSE and INQUIRY commands are allowed to complete. */ + /* + * If there's a UNIT_ATTENTION condition pending, only + * REQUEST_SENSE, INQUIRY, GET_CONFIGURATION and + * GET_EVENT_STATUS_NOTIFICATION commands are allowed to complete. + * MMC-5, section 4.1.6.1 lists only these commands being allowed + * to complete, with other commands getting a CHECK condition + * response unless a higher priority status, defined by the drive + * here, is pending. + */ if (s->sense_key == SENSE_UNIT_ATTENTION && - s->io_buffer[0] != GPCMD_REQUEST_SENSE && - s->io_buffer[0] != GPCMD_INQUIRY) { - ide_atapi_cmd_check_status(s); - return; + s->io_buffer[0] != GPCMD_REQUEST_SENSE && + s->io_buffer[0] != GPCMD_INQUIRY && + s->io_buffer[0] != GPCMD_GET_EVENT_STATUS_NOTIFICATION) { + ide_atapi_cmd_check_status(s); + return; } switch(s->io_buffer[0]) { case GPCMD_TEST_UNIT_READY: