From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org, seabios@seabios.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [rfc patch qemu 1/4] wakeup: add acpi gpe wakeup reasons
Date: Tue, 17 Jul 2012 14:30:49 +0200 [thread overview]
Message-ID: <1342528252-11470-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1342528252-11470-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 effc7ec..208c4af 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -262,6 +262,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.
@@ -426,6 +442,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)
@@ -455,6 +475,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 6540c79..8cd3443 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-07-17 12:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-17 12:30 [Qemu-devel] [rfc patch qemu 0/4] s3 improvements Gerd Hoffmann
2012-07-17 12:30 ` Gerd Hoffmann [this message]
2012-07-17 12:30 ` [Qemu-devel] [rfc patch qemu 2/4] wakeup: make ps/2 configurable Gerd Hoffmann
2012-07-17 12:30 ` [Qemu-devel] [rfc patch qemu 3/4] wakeup: make serial configurable Gerd Hoffmann
2012-07-17 12:30 ` [Qemu-devel] [rfc patch qemu 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=1342528252-11470-2-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=seabios@seabios.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).