[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [HVM] ACPI support patch 4 of 4: shutdown.
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 58b374f76a7165319a07c353a5a74ee8b9638d10 # Parent e1c8212d78c3f57ef5b76cc84639a8d08a11659d [HVM] ACPI support patch 4 of 4: shutdown. The patch is incorporated from Ben's Virtual Iron's ACPI shutdown patch in changeset 9989:f8d20c3e4225 The patch support guest ACPI Windows shutdown, as well as ACPI guest Linux "halt -p" and "shutdown -h now". Signed-off-by: Ben Thomas <ben@xxxxxxxxxxxxxxx> Signed-off-by: Winston Wang <winston.l.wang@xxxxxxxxx> --- tools/ioemu/hw/piix4acpi.c | 29 +++++++++++++++++++++++------ 1 files changed, 23 insertions(+), 6 deletions(-) diff -r e1c8212d78c3 -r 58b374f76a71 tools/ioemu/hw/piix4acpi.c --- a/tools/ioemu/hw/piix4acpi.c Sat Jun 17 09:06:46 2006 +0100 +++ b/tools/ioemu/hw/piix4acpi.c Sat Jun 17 09:08:14 2006 +0100 @@ -44,6 +44,10 @@ #define GBL_RLS (1 << 2) #define SLP_EN (1 << 13) +/* Bits of PM1a register define here */ +#define SLP_TYP_MASK 0x1C00 +#define SLP_VAL 0x1C00 + typedef struct AcpiDeviceState AcpiDeviceState; AcpiDeviceState *acpi_device_table; @@ -94,7 +98,7 @@ static int pmtimer_load(QEMUFile *f, voi qemu_get_be64s(f, &s->next_pm_time); qemu_get_timer(f, s->pm_timer); return 0; - + } static inline void acpi_set_irq(PCIAcpiState *s) @@ -277,6 +281,13 @@ static void acpiPm1ControlP1_writeb(void s->pm1_control = (val<<8)||(s->pm1_control); /* printf("acpiPm1ControlP1_writeb \n addr %x val:%x\n", addr, val); */ + // Check for power off request + + if ( ( (val & SLP_EN) != 0) && + ( (val & SLP_TYP_MASK) == SLP_VAL) ) { + s->pm1_timer=0x0; //clear ACPI timer + qemu_system_shutdown_request(); + } } static uint32_t acpiPm1ControlP1_readb(void *opaque, uint32_t addr) @@ -304,7 +315,6 @@ static void acpiPm1Status_writew(void *o /* printf("acpiPm1Status_writew \n addr %x val:%x pm1_status:%x \n", addr, val,s->pm1_status); */ - } static uint32_t acpiPm1Status_readw(void *opaque, uint32_t addr) @@ -344,6 +354,13 @@ static void acpiPm1Control_writew(void * s->pm1_control = val; /* printf("acpiPm1Control_writew \n addr %x val:%x\n", addr, val); */ + + // Check for power off request + + if ( ( (val & SLP_EN) != 0) && + ( (val & SLP_TYP_MASK) == SLP_VAL) ) { + qemu_system_shutdown_request(); + } } @@ -403,9 +420,9 @@ static void acpi_map(PCIDevice *pci_dev, static void acpi_map(PCIDevice *pci_dev, int region_num, uint32_t addr, uint32_t size, int type) { - PCIAcpiState *d = (PCIAcpiState *)pci_dev; - printf("register acpi io \n "); - /*Byte access */ + PCIAcpiState *d = (PCIAcpiState *)pci_dev; + printf("register acpi io \n "); + /*Byte access */ register_ioport_write(addr, 1, 1, acpiPm1Status_writeb, d); register_ioport_read(addr, 1, 1, acpiPm1Status_readb, d); register_ioport_write(addr+1, 1, 1, acpiPm1StatusP1_writeb, d); @@ -431,7 +448,7 @@ static void acpi_map(PCIDevice *pci_dev, register_ioport_write(addr + 4, 2, 2, acpiPm1Control_writew, d); register_ioport_read(addr + 4, 2, 2, acpiPm1Control_readw, d); - /* dword access */ + /* dword access */ register_ioport_write(addr, 4, 4, acpiPm1Event_writel, d); register_ioport_read(addr, 4, 4, acpiPm1Event_readl, d); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |