p[checksum_offset] = -sum;
}
-static uint8_t battery_port_exists(void)
-{
- return (inb(0x88) == 0x1F);
-}
-
static struct acpi_20_madt *construct_madt(struct acpi_info *info)
{
struct acpi_20_madt *madt;
}
static int construct_secondary_tables(unsigned long *table_ptrs,
+ struct acpi_config *config,
struct acpi_info *info)
{
int nr_tables = 0;
if (!waet) return -1;
table_ptrs[nr_tables++] = (unsigned long)waet;
- if ( battery_port_exists() )
+ if ( config->table_flags & ACPI_HAS_SSDT_PM )
{
ssdt = mem_alloc(sizeof(ssdt_pm), 16);
if (!ssdt) return -1;
table_ptrs[nr_tables++] = (unsigned long)ssdt;
}
- if ( !strncmp(xenstore_read("platform/acpi_s3", "1"), "1", 1) )
+ if ( config->table_flags & ACPI_HAS_SSDT_S3 )
{
ssdt = mem_alloc(sizeof(ssdt_s3), 16);
if (!ssdt) return -1;
printf("S3 disabled\n");
}
- if ( !strncmp(xenstore_read("platform/acpi_s4", "1"), "1", 1) )
+ if ( config->table_flags & ACPI_HAS_SSDT_S4 )
{
ssdt = mem_alloc(sizeof(ssdt_s4), 16);
if (!ssdt) return -1;
offsetof(struct acpi_header, checksum),
sizeof(struct acpi_20_fadt));
- nr_secondaries = construct_secondary_tables(secondary_tables, acpi_info);
+ nr_secondaries = construct_secondary_tables(secondary_tables,
+ config, acpi_info);
if ( nr_secondaries < 0 )
goto oom;
#define ACPI_HAS_COM2 (1<<1)
#define ACPI_HAS_LPT1 (1<<2)
#define ACPI_HAS_HPET (1<<3)
+#define ACPI_HAS_SSDT_PM (1<<4)
+#define ACPI_HAS_SSDT_S3 (1<<5)
+#define ACPI_HAS_SSDT_S4 (1<<6)
+
struct acpi_config {
const unsigned char *dsdt_anycpu;
return ((hpet_id >> 16) == 0x8086);
}
+static uint8_t battery_port_exists(void)
+{
+ return (inb(0x88) == 0x1F);
+}
+
void hvmloader_acpi_build_tables(struct acpi_config *config,
unsigned int physical)
{
config->vm_gid[1] = strtoll(end+1, NULL, 0);
}
+ if ( battery_port_exists() )
+ config->table_flags |= ACPI_HAS_SSDT_PM;
+ if ( !strncmp(xenstore_read("platform/acpi_s3", "1"), "1", 1) )
+ config->table_flags |= ACPI_HAS_SSDT_S3;
+ if ( !strncmp(xenstore_read("platform/acpi_s4", "1"), "1", 1) )
+ config->table_flags |= ACPI_HAS_SSDT_S4;
+
config->rsdp = physical;
config->infop = ACPI_INFO_PHYSICAL_ADDRESS;