Patchwork [v2,1/6] atapi: Allow GESN after media change

login
register
mail settings
Submitter Amit Shah
Date April 12, 2011, 9:27 a.m.
Message ID <5117cc4f49fb4fd756f3d56739b171f54aebdda8.1302600061.git.amit.shah@redhat.com>
Download mbox | patch
Permalink /patch/90750/
State New
Headers show

Comments

Amit Shah - April 12, 2011, 9:27 a.m.
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>
---
 hw/ide/core.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
Kevin Wolf - April 12, 2011, 9:54 a.m.
Am 12.04.2011 11:27, schrieb 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 <amit.shah@redhat.com>
> ---
>  hw/ide/core.c |   19 +++++++++++++------
>  1 files changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/ide/core.c b/hw/ide/core.c
> index c11d457..f839ef3 100644
> --- a/hw/ide/core.c
> +++ b/hw/ide/core.c
> @@ -1102,13 +1102,20 @@ 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 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.
> +     */

GET CONFIGURATION is allowed as well. That would be an unrelated fix,
though, so we can do it on top.

Kevin

Patch

diff --git a/hw/ide/core.c b/hw/ide/core.c
index c11d457..f839ef3 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1102,13 +1102,20 @@  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 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: