mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
hvmloader: decide which SSDTs to install in hvmloader
With that, xenstore_read() won't need to be done in ACPI code Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
3bb36fe2aa
commit
653d8fb95a
3 files changed
+22
-9
No files matched your search
@@ -72,11 +72,6 @@ static void set_checksum(
|
||||
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;
|
||||
@@ -338,6 +333,7 @@ static int construct_passthrough_tables(unsigned long *table_ptrs,
|
||||
}
|
||||
|
||||
static int construct_secondary_tables(unsigned long *table_ptrs,
|
||||
struct acpi_config *config,
|
||||
struct acpi_info *info)
|
||||
{
|
||||
int nr_tables = 0;
|
||||
@@ -371,7 +367,7 @@ static int construct_secondary_tables(unsigned long *table_ptrs,
|
||||
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;
|
||||
@@ -379,7 +375,7 @@ static int construct_secondary_tables(unsigned long *table_ptrs,
|
||||
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;
|
||||
@@ -389,7 +385,7 @@ static int construct_secondary_tables(unsigned long *table_ptrs,
|
||||
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;
|
||||
@@ -574,7 +570,8 @@ void acpi_build_tables(const struct acpi_config *config)
|
||||
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;
|
||||
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
#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;
|
||||
|
||||
@@ -859,6 +859,11 @@ int hpet_exists(unsigned long hpet_base)
|
||||
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)
|
||||
{
|
||||
@@ -895,6 +900,13 @@ void hvmloader_acpi_build_tables(struct acpi_config *config,
|
||||
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;
|
||||
|
||||
|
||||