commit ef93688e70bf11313ec89c7e609fc142259dfd74 Author: Gerd Hoffmann Date: Thu Feb 9 13:44:37 2012 +0100 enable/disable reasons diff --git a/sysemu.h b/sysemu.h index e7060aa..781bdaf 100644 --- a/sysemu.h +++ b/sysemu.h @@ -47,6 +47,7 @@ void qemu_system_reset_request(void); void qemu_system_suspend_request(void); void qemu_register_suspend_notifier(Notifier *notifier); void qemu_system_wakeup_request(WakeupReason reason); +void qemu_system_wakeup_enable(WakeupReason reason, bool enabled); void qemu_register_wakeup_notifier(Notifier *notifier); void qemu_system_shutdown_request(void); void qemu_system_powerdown_request(void); diff --git a/vl.c b/vl.c index 17d4b72..1feac41 100644 --- a/vl.c +++ b/vl.c @@ -1288,6 +1288,7 @@ static NotifierList suspend_notifiers = NOTIFIER_LIST_INITIALIZER(suspend_notifiers); static NotifierList wakeup_notifiers = NOTIFIER_LIST_INITIALIZER(wakeup_notifiers); +static uint32_t wakeup_reason_mask; static RunState vmstop_requested = RUN_STATE_MAX; int qemu_shutdown_requested_get(void) @@ -1423,12 +1424,24 @@ void qemu_system_wakeup_request(WakeupReason reason) if (!is_suspended) { return; } + if (!(wakeup_reason_mask & (1 << reason))) { + return; + } notifier_list_notify(&wakeup_notifiers, &reason); reset_requested = 1; qemu_notify_event(); is_suspended = false; } +void qemu_system_wakeup_enable(WakeupReason reason, bool enabled) +{ + if (enabled) { + wakeup_reason_mask |= (1 << reason); + } else { + wakeup_reason_mask &= ~(1 << reason); + } +} + void qemu_register_wakeup_notifier(Notifier *notifier) { notifier_list_add(&wakeup_notifiers, notifier);