From patchwork Wed Dec 19 08:46:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 207263 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1EE622C009F for ; Wed, 19 Dec 2012 19:56:37 +1100 (EST) Received: from localhost ([::1]:45705 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlFIj-000455-MY for incoming@patchwork.ozlabs.org; Wed, 19 Dec 2012 03:46:53 -0500 Received: from eggs.gnu.org ([208.118.235.92]:54594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlFI8-0002m3-N8 for qemu-devel@nongnu.org; Wed, 19 Dec 2012 03:46:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TlFI5-0007q9-9c for qemu-devel@nongnu.org; Wed, 19 Dec 2012 03:46:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:1427) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlFI5-0007pR-0T for qemu-devel@nongnu.org; Wed, 19 Dec 2012 03:46:13 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBJ8kCka010219 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 19 Dec 2012 03:46:12 -0500 Received: from rincewind.home.kraxel.org (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qBJ8kAsc032607; Wed, 19 Dec 2012 03:46:11 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 5B0AB4173A; Wed, 19 Dec 2012 09:46:10 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 19 Dec 2012 09:46:04 +0100 Message-Id: <1355906770-17199-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1355906770-17199-1-git-send-email-kraxel@redhat.com> References: <1355906770-17199-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 2/8] acpi: autoload dsdt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 b11e7c4..cc4b260 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 2237e86..9ecccbb 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 19e342a..e032474 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 3429a9a..7a8d6fe 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();