From patchwork Thu Sep 13 20:12:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Baron X-Patchwork-Id: 183713 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 570722C008D for ; Fri, 14 Sep 2012 06:27:28 +1000 (EST) Received: from localhost ([::1]:39966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCG0U-0006o0-Cr for incoming@patchwork.ozlabs.org; Thu, 13 Sep 2012 16:27:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCFmT-0001Sm-NU for qemu-devel@nongnu.org; Thu, 13 Sep 2012 16:13:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TCFmQ-00030s-Gd for qemu-devel@nongnu.org; Thu, 13 Sep 2012 16:12:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21178) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCFmQ-00030k-6n for qemu-devel@nongnu.org; Thu, 13 Sep 2012 16:12:54 -0400 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 q8DKCqd6021668 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 13 Sep 2012 16:12:52 -0400 Received: from redhat.com (dhcp-185-114.bos.redhat.com [10.16.185.114]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8DKCpJA026911; Thu, 13 Sep 2012 16:12:52 -0400 Date: Thu, 13 Sep 2012 16:12:51 -0400 From: Jason Baron To: qemu-devel@nongnu.org Message-Id: <98c6427441763d8673fcb33918945943e8396b05.1347561356.git.jbaron@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com, alex.williamson@redhat.com, mst@redhat.com, jan.kiszka@siemens.com, agraf@suse.de, armbru@redhat.com, yamahata@valinux.co.jp, juzhang@redhat.com, kevin@koconnor.net, avi@redhat.com, mkletzan@redhat.com, lcapitulino@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH 25/25] q35: automatically load the q35 dsdt table 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 Automatically, locate the required q35 dsdt table on load. Otherwise we error out. This could be done in the bios, but its harder to produce a good error message. Signed-off-by: Jason Baron --- hw/pc_q35.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/hw/pc_q35.c b/hw/pc_q35.c index b8c1196..08ae62b 100644 --- a/hw/pc_q35.c +++ b/hw/pc_q35.c @@ -329,6 +329,25 @@ static void pc_q35_init_late(BusState **idebus, ISADevice *rtc_state, 8, NULL, 0); } +static int find_and_load_dsdt(const char *dsdt_name) +{ + char *filename; + char buf[256]; + + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dsdt_name); + if (!filename) { + return -1; + } + + snprintf(buf, 256, "file=%s", filename); + if (acpi_table_add(buf) < 0) { + fprintf(stderr, "Wrong acpi table provided\n"); + return -1; + } + + return 0; +} + /* PC hardware initialisation */ static void pc_q35_init(ram_addr_t ram_size, const char *boot_device, @@ -356,6 +375,13 @@ static void pc_q35_init(ram_addr_t ram_size, qemu_irq *i8259; int i; + /* let's first see if we can find the proper dsdt */ + if (find_and_load_dsdt("q35-acpi-dsdt.aml")) { + fprintf(stderr, "Couldn't find q35 dsdt table!\n" + "Try updating your bios.\n"); + exit(1); + } + pc_cpus_init(cpu_model); kvmclock_create();