Andrew Cooper
2011-Oct-14 15:17 UTC
[Xen-devel] [PATCH] hvmloader: Add the WAET since Microsoft are demanding it for Windows 8
Signed-off-by: Paul Durrant <paul.durrant@citrix.com> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> diff -r 4b0907c6a08c -r 52783753dea2 tools/firmware/hvmloader/acpi/acpi2_0.h --- a/tools/firmware/hvmloader/acpi/acpi2_0.h Tue Oct 11 12:02:58 2011 +0100 +++ b/tools/firmware/hvmloader/acpi/acpi2_0.h Fri Oct 14 16:16:33 2011 +0100 @@ -297,6 +297,14 @@ struct acpi_20_hpet { #define ACPI_HPET_ADDRESS 0xFED00000UL /* + * WAET Description Table + */ +struct acpi_20_waet { + struct acpi_header header; + uint32_t flags; +}; + +/* * Multiple APIC Flags. */ #define ACPI_PCAT_COMPAT (1 << 0) @@ -366,6 +374,7 @@ struct acpi_20_madt_intsrcovr { #define ACPI_2_0_XSDT_SIGNATURE ASCII32(''X'',''S'',''D'',''T'') #define ACPI_2_0_TCPA_SIGNATURE ASCII32(''T'',''C'',''P'',''A'') #define ACPI_2_0_HPET_SIGNATURE ASCII32(''H'',''P'',''E'',''T'') +#define ACPI_2_0_WAET_SIGNATURE ASCII32(''W'',''A'',''E'',''T'') /* * Table revision numbers. @@ -377,6 +386,7 @@ struct acpi_20_madt_intsrcovr { #define ACPI_2_0_XSDT_REVISION 0x01 #define ACPI_2_0_TCPA_REVISION 0x02 #define ACPI_2_0_HPET_REVISION 0x01 +#define ACPI_2_0_WAET_REVISION 0x01 #define ACPI_1_0_FADT_REVISION 0x01 #pragma pack () diff -r 4b0907c6a08c -r 52783753dea2 tools/firmware/hvmloader/acpi/build.c --- a/tools/firmware/hvmloader/acpi/build.c Tue Oct 11 12:02:58 2011 +0100 +++ b/tools/firmware/hvmloader/acpi/build.c Fri Oct 14 16:16:33 2011 +0100 @@ -30,6 +30,7 @@ extern struct acpi_20_rsdt Rsdt; extern struct acpi_20_xsdt Xsdt; extern struct acpi_20_fadt Fadt; extern struct acpi_20_facs Facs; +extern struct acpi_20_waet Waet; /* * Located at ACPI_INFO_PHYSICAL_ADDRESS. @@ -191,12 +192,28 @@ static struct acpi_20_hpet *construct_hp return hpet; } +static struct acpi_20_waet *construct_waet(void) +{ + struct acpi_20_waet *waet; + + waet = mem_alloc(sizeof(*waet), 16); + if (!waet) return NULL; + + memcpy(waet, &Waet, sizeof(*waet)); + + waet->header.length = sizeof(*waet); + set_checksum(waet, offsetof(struct acpi_header, checksum), sizeof(*waet)); + + return waet; +} + static int construct_secondary_tables(unsigned long *table_ptrs, struct acpi_info *info) { int nr_tables = 0; struct acpi_20_madt *madt; struct acpi_20_hpet *hpet; + struct acpi_20_waet *waet; struct acpi_20_tcpa *tcpa; unsigned char *ssdt; static const uint16_t tis_signature[] = {0x0001, 0x0001, 0x0001}; @@ -217,6 +234,11 @@ static int construct_secondary_tables(un if (!hpet) return -1; table_ptrs[nr_tables++] = (unsigned long)hpet; + /* WAET. */ + waet = construct_waet(); + if (!waet) return -1; + table_ptrs[nr_tables++] = (unsigned long)waet; + if ( battery_port_exists() ) { ssdt = mem_alloc(sizeof(ssdt_pm), 16); diff -r 4b0907c6a08c -r 52783753dea2 tools/firmware/hvmloader/acpi/static_tables.c --- a/tools/firmware/hvmloader/acpi/static_tables.c Tue Oct 11 12:02:58 2011 +0100 +++ b/tools/firmware/hvmloader/acpi/static_tables.c Fri Oct 14 16:16:33 2011 +0100 @@ -136,6 +136,26 @@ struct acpi_20_rsdp Rsdp = { .length = sizeof(struct acpi_20_rsdp) }; +#define ACPI_WAET_RTC_GOOD 0x00000001 +#define ACPI_WAET_PM_TIMER_GOOD 0x00000002 + +#define ACPI_WAET_FLAGS (ACPI_WAET_RTC_GOOD | \ + ACPI_WAET_PM_TIMER_GOOD) + +struct acpi_20_waet Waet = { + .header = { + .signature = ACPI_2_0_WAET_SIGNATURE, + .length = sizeof(struct acpi_20_waet), + .revision = ACPI_2_0_WAET_REVISION, + .oem_id = ACPI_OEM_ID, + .oem_table_id = ACPI_OEM_TABLE_ID, + .oem_revision = ACPI_OEM_REVISION, + .creator_id = ACPI_CREATOR_ID, + .creator_revision = ACPI_CREATOR_REVISION + }, + .flags = ACPI_WAET_FLAGS +}; + /* * Local variables: * mode: C _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel