From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JwHYs-0006E7-Tm for qemu-devel@nongnu.org; Wed, 14 May 2008 10:02:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JwHYq-0006Bu-6d for qemu-devel@nongnu.org; Wed, 14 May 2008 10:02:30 -0400 Received: from [199.232.76.173] (port=37114 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JwHYq-0006Bq-33 for qemu-devel@nongnu.org; Wed, 14 May 2008 10:02:28 -0400 Received: from victor.provo.novell.com ([137.65.250.26]:44918) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JwHYp-0003xV-Fy for qemu-devel@nongnu.org; Wed, 14 May 2008 10:02:27 -0400 Message-ID: <482AF0D3.4010508@novell.com> Date: Wed, 14 May 2008 08:01:55 -0600 From: Pat Campbell MIME-Version: 1.0 Subject: [Qemu-devel][PATCH] Send unit_attention on cd-rom not_ready to ready transition Content-Type: multipart/mixed; boundary="------------020108050107030101020605" Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------020108050107030101020605 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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. --------------020108050107030101020605 Content-Type: text/plain; name="qemu-unit-attention.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="qemu-unit-attention.patch" 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, --------------020108050107030101020605--