diff options
author | Isaku Yamahata <yamahata@valinux.co.jp> | 2011-03-25 19:54:40 +0900 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2011-04-09 18:39:06 +0200 |
commit | eaba51c573afbdd45273eed9d61d9effda979b47 (patch) | |
tree | 31fd6fc51e065b02461184f978d79f6d34b29607 /hw/vt82c686.c | |
parent | 04dc308f687d45dacc664251b266b6849f5a79d0 (diff) | |
download | qemu-eaba51c573afbdd45273eed9d61d9effda979b47.zip qemu-eaba51c573afbdd45273eed9d61d9effda979b47.tar.gz qemu-eaba51c573afbdd45273eed9d61d9effda979b47.tar.bz2 |
acpi, acpi_piix, vt82c686: factor out PM1_CNT logic
factor out ACPI PM1_CNT logic. This will be used by ich9 acpi.
Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Huacai Chen <zltjiangshi@gmail.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'hw/vt82c686.c')
-rw-r--r-- | hw/vt82c686.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/hw/vt82c686.c b/hw/vt82c686.c index 10cbc74..ca8f826 100644 --- a/hw/vt82c686.c +++ b/hw/vt82c686.c @@ -157,7 +157,7 @@ static void vt82c686b_write_config(PCIDevice * d, uint32_t address, typedef struct VT686PMState { PCIDevice dev; ACPIPM1EVT pm1a; - uint16_t pmcntrl; + ACPIPM1CNT pm1_cnt; APMState apm; ACPIPMTimer tmr; PMSMBus smb; @@ -209,21 +209,7 @@ static void pm_ioport_writew(void *opaque, uint32_t addr, uint32_t val) pm_update_sci(s); break; case 0x04: - { - int sus_typ; - s->pmcntrl = val & ~(SUS_EN); - if (val & SUS_EN) { - /* change suspend type */ - sus_typ = (val >> 10) & 3; - switch (sus_typ) { - case 0: /* soft power off */ - qemu_system_shutdown_request(); - break; - default: - break; - } - } - } + acpi_pm1_cnt_write(&s->pm1a, &s->pm1_cnt, val); break; default: break; @@ -245,7 +231,7 @@ static uint32_t pm_ioport_readw(void *opaque, uint32_t addr) val = s->pm1a.en; break; case 0x04: - val = s->pmcntrl; + val = s->pm1_cnt.cnt; break; default: val = 0; @@ -322,7 +308,7 @@ static const VMStateDescription vmstate_acpi = { VMSTATE_PCI_DEVICE(dev, VT686PMState), VMSTATE_UINT16(pm1a.sts, VT686PMState), VMSTATE_UINT16(pm1a.en, VT686PMState), - VMSTATE_UINT16(pmcntrl, VT686PMState), + VMSTATE_UINT16(pm1_cnt.cnt, VT686PMState), VMSTATE_STRUCT(apm, VT686PMState, 0, vmstate_apm, APMState), VMSTATE_TIMER(tmr.timer, VT686PMState), VMSTATE_INT64(tmr.overflow_time, VT686PMState), @@ -446,6 +432,7 @@ static int vt82c686b_pm_initfn(PCIDevice *dev) apm_init(&s->apm, NULL, s); acpi_pm_tmr_init(&s->tmr, pm_tmr_timer); + acpi_pm1_cnt_init(&s->pm1_cnt, NULL); pm_smbus_init(&s->dev.qdev, &s->smb); |