diff options
author | Pavel Hrdina <phrdina@redhat.com> | 2012-11-26 16:37:39 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-11-30 11:33:24 +0100 |
commit | 0c6f08b0b0d0c758789cdb7257a48e873598bdbb (patch) | |
tree | 25b8c64f381de7b1215530dfe951783c2f894868 /hw/ide/atapi.c | |
parent | d3067b020bdeb572f381c5be4420eedfd6af5884 (diff) | |
download | qemu-0c6f08b0b0d0c758789cdb7257a48e873598bdbb.zip qemu-0c6f08b0b0d0c758789cdb7257a48e873598bdbb.tar.gz qemu-0c6f08b0b0d0c758789cdb7257a48e873598bdbb.tar.bz2 |
atapi: make change media detection for guests easier
If you have a guest with a media in the optical drive and you change
it, the windows guest cannot properly recognize this media change.
Windows needs to detect sense "NOT_READY with ASC_MEDIUM_NOT_PRESENT"
before we send sense "UNIT_ATTENTION with ASC_MEDIUM_MAY_HAVE_CHANGED".
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/atapi.c')
-rw-r--r-- | hw/ide/atapi.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c index 685cbaa..861fd2b 100644 --- a/hw/ide/atapi.c +++ b/hw/ide/atapi.c @@ -1124,12 +1124,17 @@ void ide_atapi_cmd(IDEState *s) * GET_EVENT_STATUS_NOTIFICATION to detect such tray open/close * states rely on this behavior. */ - if (!s->tray_open && bdrv_is_inserted(s->bs) && s->cdrom_changed) { - ide_atapi_cmd_error(s, NOT_READY, ASC_MEDIUM_NOT_PRESENT); + if (!(atapi_cmd_table[s->io_buffer[0]].flags & ALLOW_UA) && + !s->tray_open && bdrv_is_inserted(s->bs) && s->cdrom_changed) { + + if (s->cdrom_changed == 1) { + ide_atapi_cmd_error(s, NOT_READY, ASC_MEDIUM_NOT_PRESENT); + s->cdrom_changed = 2; + } else { + ide_atapi_cmd_error(s, UNIT_ATTENTION, ASC_MEDIUM_MAY_HAVE_CHANGED); + s->cdrom_changed = 0; + } - s->cdrom_changed = 0; - s->sense_key = UNIT_ATTENTION; - s->asc = ASC_MEDIUM_MAY_HAVE_CHANGED; return; } |