From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53173) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9ymm-0002rp-VV for qemu-devel@nongnu.org; Wed, 13 Apr 2011 08:03:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9ymh-0003iF-2V for qemu-devel@nongnu.org; Wed, 13 Apr 2011 08:03:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18241) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9ymg-0003hp-OQ for qemu-devel@nongnu.org; Wed, 13 Apr 2011 08:02:59 -0400 From: Kevin Wolf Date: Wed, 13 Apr 2011 14:05:11 +0200 Message-Id: <1302696316-26190-6-git-send-email-kwolf@redhat.com> In-Reply-To: <1302696316-26190-1-git-send-email-kwolf@redhat.com> References: <1302696316-26190-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 05/10] atapi: Allow GET_EVENT_STATUS_NOTIFICATION after media change List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Amit Shah 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 Acked-by: Jes Sorensen Acked-by: Paolo Bonzini Signed-off-by: Kevin Wolf --- 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 b5de22e..f0da95d 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: -- 1.7.2.3