From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tr2jm-000661-FJ for qemu-devel@nongnu.org; Fri, 04 Jan 2013 03:34:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tr2jl-0002Dk-5U for qemu-devel@nongnu.org; Fri, 04 Jan 2013 03:34:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tr2MR-0003Oh-MG for qemu-devel@nongnu.org; Fri, 04 Jan 2013 03:10:39 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r048Abeb003715 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 4 Jan 2013 03:10:38 -0500 From: Gerd Hoffmann Date: Fri, 4 Jan 2013 09:10:07 +0100 Message-Id: <1357287009-22604-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1357287009-22604-1-git-send-email-kraxel@redhat.com> References: <1357287009-22604-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 2/4] acpi: autoload dsdt List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Signed-off-by: Gerd Hoffmann --- hw/pc.c | 23 +++++++++++++++++++++++ hw/pc.h | 1 + hw/pc_piix.c | 1 + hw/pc_q35.c | 1 + 4 files changed, 26 insertions(+), 0 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 71902e2..5ec3bd5 100644 --- 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 a73e3e7..4134aa9 100644 --- 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, diff --git a/hw/pc_piix.c b/hw/pc_piix.c index 99747a7..2b3d58b 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -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(); diff --git a/hw/pc_q35.c b/hw/pc_q35.c index c7262d6..ef540b6 100644 --- a/hw/pc_q35.c +++ b/hw/pc_q35.c @@ -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(); -- 1.7.1