[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] hvm: Fix ACPI shutdown, broken by my previous changeset.
# HG changeset patch # User Keir Fraser <keir@xxxxxxxxxxxxx> # Date 1178983490 -3600 # Node ID 05c128b0188a7013de3806990916ff7425d78cfb # Parent 174995130550a7c8d69bb22cf8036cb4f9f13f71 hvm: Fix ACPI shutdown, broken by my previous changeset. It turns out that although PIIX4 hardware defines the S5 type code to be 000, all OSes will discover the correct code by evlauating an \_Sx object in the ACPI DSDT. And we set the type code in that object to be 111. So this patch keeps the other cleanups made to the piix4acpi.c file, but switches back to checking for code 111. It also makes it clearer in both the ioemu code and in the dsdt source code where these magic numbers come from. Let's hope noone actually has the true PIIX4 type codes hardcoded (it's highly doubtful that anyone would). Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- tools/firmware/hvmloader/acpi/dsdt.asl | 10 +++++----- tools/firmware/hvmloader/acpi/dsdt.c | 4 ++-- tools/ioemu/hw/piix4acpi.c | 24 ++++++++++++++---------- 3 files changed, 21 insertions(+), 17 deletions(-) diff -r 174995130550 -r 05c128b0188a tools/firmware/hvmloader/acpi/dsdt.asl --- a/tools/firmware/hvmloader/acpi/dsdt.asl Sat May 12 12:46:26 2007 +0100 +++ b/tools/firmware/hvmloader/acpi/dsdt.asl Sat May 12 16:24:50 2007 +0100 @@ -27,13 +27,13 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, Name (\APCL, 0x00010000) Name (\PUID, 0x00) - /* Poweroff support - ties in with qemu emulation */ + /* S5 (power-off) type codes: must match with piix4 emulation! */ Name (\_S5, Package (0x04) { - 0x07, - 0x07, - 0x00, - 0x00 + 0x07, /* PM1a_CNT.SLP_TYP */ + 0x07, /* PM1b_CNT.SLP_TYP */ + 0x00, /* reserved */ + 0x00 /* reserved */ }) Name(PICD, 0) diff -r 174995130550 -r 05c128b0188a tools/firmware/hvmloader/acpi/dsdt.c --- a/tools/firmware/hvmloader/acpi/dsdt.c Sat May 12 12:46:26 2007 +0100 +++ b/tools/firmware/hvmloader/acpi/dsdt.c Sat May 12 16:24:50 2007 +0100 @@ -1,11 +1,11 @@ /* * * Intel ACPI Component Architecture - * ASL Optimizing Compiler version 20060707 [Feb 16 2007] + * ASL Optimizing Compiler version 20060707 [Dec 30 2006] * Copyright (C) 2000 - 2006 Intel Corporation * Supports ACPI Specification Revision 3.0a * - * Compilation of "dsdt.asl" - Mon Feb 26 11:09:49 2007 + * Compilation of "dsdt.asl" - Sat May 12 16:13:55 2007 * * C source code output * diff -r 174995130550 -r 05c128b0188a tools/ioemu/hw/piix4acpi.c --- a/tools/ioemu/hw/piix4acpi.c Sat May 12 12:46:26 2007 +0100 +++ b/tools/ioemu/hw/piix4acpi.c Sat May 12 16:24:50 2007 +0100 @@ -25,11 +25,15 @@ #include "vl.h" -/* PMCNTRL */ +/* PM1a_CNT bits, as defined in the ACPI specification. */ #define SCI_EN (1 << 0) #define GBL_RLS (1 << 2) -#define SUS_TYP (7 << 10) -#define SUS_EN (1 << 13) +#define SLP_TYP_Sx (7 << 10) +#define SLP_EN (1 << 13) + +/* Sleep state type codes as defined by the \_Sx objects in the DSDT. */ +/* These must be kept in sync with the DSDT (hvmloader/acpi/dsdt.asl) */ +#define SLP_TYP_S5 (7 << 10) typedef struct AcpiDeviceState AcpiDeviceState; AcpiDeviceState *acpi_device_table; @@ -69,7 +73,7 @@ static uint32_t acpiPm1Control_readb(voi { PCIAcpiState *s = opaque; /* Mask out the write-only bits */ - return (uint8_t)(s->pm1_control & ~(GBL_RLS|SUS_EN)); + return (uint8_t)(s->pm1_control & ~(GBL_RLS|SLP_EN)); } static void acpiPm1ControlP1_writeb(void *opaque, uint32_t addr, uint32_t val) @@ -77,10 +81,10 @@ static void acpiPm1ControlP1_writeb(void PCIAcpiState *s = opaque; val <<= 8; - s->pm1_control = ((s->pm1_control & 0xff) | val) & ~SUS_EN; + s->pm1_control = ((s->pm1_control & 0xff) | val) & ~SLP_EN; /* Check for power off request. */ - if ((val & (SUS_EN|SUS_TYP)) == SUS_EN) + if ((val & (SLP_EN|SLP_TYP_Sx)) == (SLP_EN|SLP_TYP_S5)) qemu_system_shutdown_request(); } @@ -88,17 +92,17 @@ static uint32_t acpiPm1ControlP1_readb(v { PCIAcpiState *s = opaque; /* Mask out the write-only bits */ - return (uint8_t)((s->pm1_control & ~(GBL_RLS|SUS_EN)) >> 8); + return (uint8_t)((s->pm1_control & ~(GBL_RLS|SLP_EN)) >> 8); } static void acpiPm1Control_writew(void *opaque, uint32_t addr, uint32_t val) { PCIAcpiState *s = opaque; - s->pm1_control = val & ~SUS_EN; + s->pm1_control = val & ~SLP_EN; /* Check for power off request. */ - if ((val & (SUS_EN|SUS_TYP)) == SUS_EN) + if ((val & (SLP_EN|SLP_TYP_Sx)) == (SLP_EN|SLP_TYP_S5)) qemu_system_shutdown_request(); } @@ -106,7 +110,7 @@ static uint32_t acpiPm1Control_readw(voi { PCIAcpiState *s = opaque; /* Mask out the write-only bits */ - return (s->pm1_control & ~(GBL_RLS|SUS_EN)); + return (s->pm1_control & ~(GBL_RLS|SLP_EN)); } static void acpi_map(PCIDevice *pci_dev, int region_num, _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |