aboutsummaryrefslogtreecommitdiff
path: root/hw/ide/core.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-10-25 12:53:39 +0200
committerKevin Wolf <kwolf@redhat.com>2011-11-11 14:02:57 +0100
commit2df0a3a3085adfde93505bc73c938310b0820c36 (patch)
treea177b261b39b611c0a056a180631128cf4765f64 /hw/ide/core.c
parent025ccaa7f9d2f54a79567599d3eb402100bed7a4 (diff)
atapi: implement eject requests
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/core.c')
-rw-r--r--hw/ide/core.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 9a2fd30607..93a1a689c4 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -804,6 +804,18 @@ static void ide_cd_change_cb(void *opaque, bool load)
*/
s->cdrom_changed = 1;
s->events.new_media = true;
+ s->events.eject_request = false;
+ ide_set_irq(s->bus);
+}
+
+static void ide_cd_eject_request_cb(void *opaque, bool force)
+{
+ IDEState *s = opaque;
+
+ s->events.eject_request = true;
+ if (force) {
+ s->tray_locked = false;
+ }
ide_set_irq(s->bus);
}
@@ -1811,6 +1823,7 @@ static bool ide_cd_is_medium_locked(void *opaque)
static const BlockDevOps ide_cd_block_ops = {
.change_media_cb = ide_cd_change_cb,
+ .eject_request_cb = ide_cd_eject_request_cb,
.is_tray_open = ide_cd_is_tray_open,
.is_medium_locked = ide_cd_is_medium_locked,
};