aboutsummaryrefslogtreecommitdiff
path: root/hw/ide
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2011-04-28 20:04:41 +0530
committerKevin Wolf <kwolf@redhat.com>2011-05-03 11:29:21 +0200
commit4a737d14d0788412eead23330b554eb75900af04 (patch)
treeeedc7bff3a7e8ee598e47cb0a437e859bc917379 /hw/ide
parenta7acf552e2cfb42ea1b27966b7f318eca2cc478a (diff)
atapi: Explain why we need a 'media not present' state
After the re-org of the atapi code, it might not be intuitive for a reader of the code to understand why we're inserting a 'media not present' state between cd changes. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide')
-rw-r--r--hw/ide/atapi.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 86b18d894c..58febc0285 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -1106,7 +1106,13 @@ void ide_atapi_cmd(IDEState *s)
ide_atapi_cmd_check_status(s);
return;
}
-
+ /*
+ * When a CD gets changed, we have to report an ejected state and
+ * then a loaded state to guests so that they detect tray
+ * open/close and media change events. Guests that do not use
+ * GET_EVENT_STATUS_NOTIFICATION to detect such tray open/close
+ * states rely on this behavior.
+ */
if (bdrv_is_inserted(s->bs) && s->cdrom_changed) {
ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT);