]> git.proxmox.com Git - qemu.git/commitdiff
atapi: Allow GET_EVENT_STATUS_NOTIFICATION after media change
authorAmit Shah <amit.shah@redhat.com>
Tue, 12 Apr 2011 16:06:03 +0000 (21:36 +0530)
committerKevin Wolf <kwolf@redhat.com>
Wed, 13 Apr 2011 10:19:52 +0000 (12:19 +0200)
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 <amit.shah@redhat.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
hw/ide/core.c

index b5de22e86adf7cdd6b6a198b8cf136e1b11dfce6..f0da95d7283c4c75285558c58e31cb642a09a8e1 100644 (file)
@@ -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: