]> git.proxmox.com Git - mirror_qemu.git/commitdiff
acpi: autoload dsdt
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 3 Dec 2012 09:47:27 +0000 (10:47 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 4 Jan 2013 07:51:56 +0000 (08:51 +0100)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/pc.c
hw/pc.h
hw/pc_piix.c
hw/pc_q35.c

diff --git a/hw/pc.c b/hw/pc.c
index 71902e210bccd92798e58a36b23a3b9394dd9686..5ec3bd5aff6b6cf5bf5c6443500286c41db3bb56 100644 (file)
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -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,
diff --git a/hw/pc.h b/hw/pc.h
index a73e3e7b5b7e34d3fa4b57cf1274a2043125bcbb..4134aa94e5a1b58115983152a77b6d6f91f21761 100644 (file)
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -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,
index 99747a774c4525c3c5363c2bf45c80e0099fbf64..2b3d58b852dec92131837f06f0f3fa443ac701a5 100644 (file)
@@ -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();
index c7262d631511a53f54edfbe7d8ed7b8cc0526aaa..ef540b6a716f0d980891c1fa0ee20bd939cdb553 100644 (file)
@@ -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();