aboutsummaryrefslogtreecommitdiff
path: root/hw/ide
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2012-02-24 09:45:22 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2012-02-24 09:45:22 -0600
commit7c1daf341f3374a490a03dfcde17021d3369aa48 (patch)
treef45381088a6d7fad7778ffd5cef6602f0aa3d640 /hw/ide
parent5105b6d88d1958de8c12672fba7e30a0b0f38653 (diff)
parent6f382ed226f3a408825d882e6c4b47499baaa15b (diff)
Merge remote-tracking branch 'qmp/queue/qmp' into staging
* qmp/queue/qmp: qmp: add DEVICE_TRAY_MOVED event ide: drop ide_tray_state_post_load() block: Don't call bdrv_eject() if the tray state didn't change block: bdrv_eject(): Make eject_flag a real bool block: Rename bdrv_mon_event() & BlockMonEventAction
Diffstat (limited to 'hw/ide')
-rw-r--r--hw/ide/atapi.c7
-rw-r--r--hw/ide/core.c16
2 files changed, 8 insertions, 15 deletions
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 0adb27b799..5919cf52d8 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -883,8 +883,11 @@ static void cmd_start_stop_unit(IDEState *s, uint8_t* buf)
ide_atapi_cmd_error(s, sense, ASC_MEDIA_REMOVAL_PREVENTED);
return;
}
- bdrv_eject(s->bs, !start);
- s->tray_open = !start;
+
+ if (s->tray_open != !start) {
+ bdrv_eject(s->bs, !start);
+ s->tray_open = !start;
+ }
}
ide_atapi_cmd_ok(s);
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 56b219b504..ce570a7ce5 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -519,7 +519,7 @@ static int ide_handle_rw_error(IDEState *s, int error, int op)
BlockErrorAction action = bdrv_get_on_error(s->bs, is_read);
if (action == BLOCK_ERR_IGNORE) {
- bdrv_mon_event(s->bs, BDRV_ACTION_IGNORE, is_read);
+ bdrv_emit_qmp_error_event(s->bs, BDRV_ACTION_IGNORE, is_read);
return 0;
}
@@ -527,7 +527,7 @@ static int ide_handle_rw_error(IDEState *s, int error, int op)
|| action == BLOCK_ERR_STOP_ANY) {
s->bus->dma->ops->set_unit(s->bus->dma, s->unit);
s->bus->error_status = op;
- bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read);
+ bdrv_emit_qmp_error_event(s->bs, BDRV_ACTION_STOP, is_read);
vm_stop(RUN_STATE_IO_ERROR);
bdrv_iostatus_set_err(s->bs, error);
} else {
@@ -537,7 +537,7 @@ static int ide_handle_rw_error(IDEState *s, int error, int op)
} else {
ide_rw_error(s);
}
- bdrv_mon_event(s->bs, BDRV_ACTION_REPORT, is_read);
+ bdrv_emit_qmp_error_event(s->bs, BDRV_ACTION_REPORT, is_read);
}
return 1;
@@ -2077,15 +2077,6 @@ static bool ide_drive_pio_state_needed(void *opaque)
|| (s->bus->error_status & BM_STATUS_PIO_RETRY);
}
-static int ide_tray_state_post_load(void *opaque, int version_id)
-{
- IDEState *s = opaque;
-
- bdrv_eject(s->bs, s->tray_open);
- bdrv_lock_medium(s->bs, s->tray_locked);
- return 0;
-}
-
static bool ide_tray_state_needed(void *opaque)
{
IDEState *s = opaque;
@@ -2125,7 +2116,6 @@ static const VMStateDescription vmstate_ide_tray_state = {
.version_id = 1,
.minimum_version_id = 1,
.minimum_version_id_old = 1,
- .post_load = ide_tray_state_post_load,
.fields = (VMStateField[]) {
VMSTATE_BOOL(tray_open, IDEState),
VMSTATE_BOOL(tray_locked, IDEState),