Skip to content

Commit

Permalink
acpi: autoload dsdt
Browse files Browse the repository at this point in the history
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
kraxel committed Jan 4, 2013
1 parent 5acc2ec commit f7e4dd6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
23 changes: 23 additions & 0 deletions hw/pc.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,29 @@ void pc_cpus_init(const char *cpu_model)
}
}

void pc_acpi_init(const char *default_dsdt)
{
char *filename = NULL, *arg = NULL;

if (acpi_tables != NULL) {
/* manually set via -acpitable, leave it alone */
return;
}

filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, default_dsdt);
if (filename == NULL) {
fprintf(stderr, "WARNING: failed to find %s\n", default_dsdt);
return;
}

arg = g_strdup_printf("file=%s", filename);
if (acpi_table_add(arg) != 0) {
fprintf(stderr, "WARNING: failed to load %s\n", filename);
}
g_free(arg);
g_free(filename);
}

void *pc_memory_init(MemoryRegion *system_memory,
const char *kernel_filename,
const char *kernel_cmdline,
Expand Down
1 change: 1 addition & 0 deletions hw/pc.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ void pc_register_ferr_irq(qemu_irq irq);
void pc_acpi_smi_interrupt(void *opaque, int irq, int level);

void pc_cpus_init(const char *cpu_model);
void pc_acpi_init(const char *default_dsdt);
void *pc_memory_init(MemoryRegion *system_memory,
const char *kernel_filename,
const char *kernel_cmdline,
Expand Down
1 change: 1 addition & 0 deletions hw/pc_piix.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ static void pc_init1(MemoryRegion *system_memory,
void *fw_cfg = NULL;

pc_cpus_init(cpu_model);
pc_acpi_init("acpi-dsdt.aml");

if (kvmclock_enabled) {
kvmclock_create();
Expand Down
1 change: 1 addition & 0 deletions hw/pc_q35.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
qemu_irq *cmos_s3;

pc_cpus_init(cpu_model);
pc_acpi_init("q35-acpi-dsdt.aml");

kvmclock_create();

Expand Down

0 comments on commit f7e4dd6

Please sign in to comment.