From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 1/4] wakeup: add acpi gpe wakeup reasons
Date: Thu, 6 Sep 2012 09:42:44 +0200 [thread overview]
Message-ID: <1346917367-24691-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1346917367-24691-1-git-send-email-kraxel@redhat.com>
Allocate four acpi gpe bits (0x08 -> 0x0b) for s3 wakeup
configuration and notification.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/acpi.c | 26 ++++++++++++++++++++++++++
sysemu.h | 4 ++++
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/hw/acpi.c b/hw/acpi.c
index f7950be..4d6bc71 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -263,6 +263,22 @@ static void acpi_notify_wakeup(Notifier *notifier, void *data)
ar->pm1.evt.sts |=
(ACPI_BITMASK_WAKE_STATUS | ACPI_BITMASK_TIMER_STATUS);
break;
+ case QEMU_WAKEUP_REASON_GPE_8:
+ ar->pm1.evt.sts |= ACPI_BITMASK_WAKE_STATUS;
+ ar->gpe.sts[1] |= (1 << 0);
+ break;
+ case QEMU_WAKEUP_REASON_GPE_9:
+ ar->pm1.evt.sts |= ACPI_BITMASK_WAKE_STATUS;
+ ar->gpe.sts[1] |= (1 << 1);
+ break;
+ case QEMU_WAKEUP_REASON_GPE_a:
+ ar->pm1.evt.sts |= ACPI_BITMASK_WAKE_STATUS;
+ ar->gpe.sts[1] |= (1 << 2);
+ break;
+ case QEMU_WAKEUP_REASON_GPE_b:
+ ar->pm1.evt.sts |= ACPI_BITMASK_WAKE_STATUS;
+ ar->gpe.sts[1] |= (1 << 3);
+ break;
case QEMU_WAKEUP_REASON_OTHER:
default:
/* ACPI_BITMASK_WAKE_STATUS should be set on resume.
@@ -428,6 +444,10 @@ void acpi_gpe_reset(ACPIREGS *ar)
{
memset(ar->gpe.sts, 0, ar->gpe.len / 2);
memset(ar->gpe.en, 0, ar->gpe.len / 2);
+ qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_GPE_8, 0);
+ qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_GPE_9, 0);
+ qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_GPE_a, 0);
+ qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_GPE_b, 0);
}
static uint8_t *acpi_gpe_ioport_get_ptr(ACPIREGS *ar, uint32_t addr)
@@ -457,6 +477,12 @@ void acpi_gpe_ioport_writeb(ACPIREGS *ar, uint32_t addr, uint32_t val)
} else if (addr < ar->gpe.len) {
/* GPE_EN */
*cur = val;
+ if (addr == ar->gpe.len / 2 + 1) {
+ qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_GPE_8, val & (1 << 0));
+ qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_GPE_9, val & (1 << 1));
+ qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_GPE_a, val & (1 << 2));
+ qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_GPE_b, val & (1 << 3));
+ }
} else {
abort();
}
diff --git a/sysemu.h b/sysemu.h
index 65552ac..af04941 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -42,6 +42,10 @@ typedef enum WakeupReason {
QEMU_WAKEUP_REASON_OTHER = 0,
QEMU_WAKEUP_REASON_RTC,
QEMU_WAKEUP_REASON_PMTIMER,
+ QEMU_WAKEUP_REASON_GPE_8,
+ QEMU_WAKEUP_REASON_GPE_9,
+ QEMU_WAKEUP_REASON_GPE_a,
+ QEMU_WAKEUP_REASON_GPE_b,
} WakeupReason;
void qemu_system_reset_request(void);
--
1.7.1
next prev parent reply other threads:[~2012-09-06 7:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-06 7:42 [Qemu-devel] [PULL 0/4] wakeup: make wakeup events guest-configurable Gerd Hoffmann
2012-09-06 7:42 ` Gerd Hoffmann [this message]
2012-09-06 7:42 ` [Qemu-devel] [PATCH 2/4] wakeup: make ps/2 configurable Gerd Hoffmann
2012-09-06 7:42 ` [Qemu-devel] [PATCH 3/4] wakeup: make serial configurable Gerd Hoffmann
2012-09-06 7:48 ` Peter Maydell
2012-09-06 10:47 ` Gerd Hoffmann
2012-09-08 7:15 ` Blue Swirl
2012-09-08 10:34 ` Paolo Bonzini
2012-09-10 16:02 ` Anthony Liguori
2012-09-10 16:07 ` Paolo Bonzini
2012-09-10 16:16 ` Peter Maydell
2012-09-10 17:19 ` Anthony Liguori
2012-09-10 5:47 ` Gerd Hoffmann
2012-09-06 7:42 ` [Qemu-devel] [PATCH 4/4] wakeup: uhci support Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1346917367-24691-2-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).