summary refs log tree commit diff stats
path: root/hw/ide/internal.h
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2011-04-12 21:36:07 +0530
committerKevin Wolf <kwolf@redhat.com>2011-04-13 12:20:42 +0200
commit996faf1ad4a93342e381766d95686b16624f0dbd (patch)
treebe0c96cc36f88d59462c83fa5f6db3bf59a17148 /hw/ide/internal.h
parent0af63ba3629e6f826846a73636ca391a810b2c6e (diff)
downloadfocaccia-qemu-996faf1ad4a93342e381766d95686b16624f0dbd.tar.gz
focaccia-qemu-996faf1ad4a93342e381766d95686b16624f0dbd.zip
atapi: GESN: implement 'media' subcommand
Implement the 'media' sub-command of the GET_EVENT_STATUS_NOTIFICATION
command.  This helps us report tray open, tray closed, no media, media
present states to the guest.

Newer Linux kernels (2.6.38+) rely on this command to revalidate discs
after media change.

This patch also sends out tray open/closed status to the guest driver
when requested e.g. via the CDROM_DRIVE_STATUS ioctl (thanks Markus).
Without such notification, the guest and qemu's tray open/close status
was frequently out of sync, causing installers like Anaconda detecting
no disc instead of tray open, confusing them terribly.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/internal.h')
-rw-r--r--hw/ide/internal.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index d533fb63b3..ba7e9a8ee2 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -373,6 +373,11 @@ typedef int DMAFunc(IDEDMA *);
 typedef int DMAIntFunc(IDEDMA *, int);
 typedef void DMARestartFunc(void *, int, int);
 
+struct unreported_events {
+    bool eject_request;
+    bool new_media;
+};
+
 /* NOTE: IDEState represents in fact one drive */
 struct IDEState {
     IDEBus *bus;
@@ -408,6 +413,7 @@ struct IDEState {
     BlockDriverState *bs;
     char version[9];
     /* ATAPI specific */
+    struct unreported_events events;
     uint8_t sense_key;
     uint8_t asc;
     uint8_t cdrom_changed;