atapi: GESN: implement 'media' subcommand
commit996faf1ad4a93342e381766d95686b16624f0dbd
authorAmit Shah <amit.shah@redhat.com>
Tue, 12 Apr 2011 16:06:07 +0000 (12 21:36 +0530)
committerKevin Wolf <kwolf@redhat.com>
Wed, 13 Apr 2011 10:20:42 +0000 (13 12:20 +0200)
treebe0c96cc36f88d59462c83fa5f6db3bf59a17148
parent0af63ba3629e6f826846a73636ca391a810b2c6e
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>
hw/ide/core.c
hw/ide/internal.h