All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pat Campbell <plc@novell.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel][PATCH] Send unit_attention on cd-rom not_ready to ready transition
Date: Wed, 14 May 2008 08:01:55 -0600	[thread overview]
Message-ID: <482AF0D3.4010508@novell.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 433 bytes --]

Patch sends a UNIT_ATTENTION(6), MEDIUM_MAY_HAVE_CHANGED(0x28) sense
when cdrom transitions from not ready to ready. 

I used the following documentation:
 ATA Packet interface for CD-ROMS, SFF8020i.pdf. See state diagram Figure
 12, page 82 and Table 44 -recommended Sense Key, ASC

With patch in place HVM win2008 server guest sees the CD/DVD contents
have changed when the media is switched.

Patch applies to SVN revision 4456.


[-- Attachment #2: qemu-unit-attention.patch --]
[-- Type: text/plain, Size: 936 bytes --]

Index: hw/ide.c
===================================================================
--- hw/ide.c	(revision 4456)
+++ hw/ide.c	(working copy)
@@ -351,6 +351,7 @@
 #define ASC_ILLEGAL_OPCODE                   0x20
 #define ASC_LOGICAL_BLOCK_OOR                0x21
 #define ASC_INV_FIELD_IN_CMD_PACKET          0x24
+#define ASC_MEDIUM_MAY_HAVE_CHANGED          0x28
 #define ASC_MEDIUM_NOT_PRESENT               0x3a
 #define ASC_SAVING_PARAMETERS_NOT_SUPPORTED  0x39
 
@@ -1385,6 +1386,11 @@
     switch(s->io_buffer[0]) {
     case GPCMD_TEST_UNIT_READY:
         if (bdrv_is_inserted(s->bs)) {
+            if (s->is_cdrom && s->sense_key == SENSE_NOT_READY) {
+                ide_atapi_cmd_error(s, SENSE_UNIT_ATTENTION,
+                                    ASC_MEDIUM_MAY_HAVE_CHANGED);
+                break;
+            }
             ide_atapi_cmd_ok(s);
         } else {
             ide_atapi_cmd_error(s, SENSE_NOT_READY,

             reply	other threads:[~2008-05-14 14:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-14 14:01 Pat Campbell [this message]
2008-05-20 14:09 ` [Qemu-devel][PATCH] Send unit_attention on cd-rom not_ready to ready transition Ian Jackson
2008-06-16 17:03 ` Ian Jackson
2008-06-16 22:34   ` Jamie Lokier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=482AF0D3.4010508@novell.com \
    --to=plc@novell.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.