From patchwork Fri Nov 26 12:39:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 73170 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id F37EFB70DE for ; Fri, 26 Nov 2010 23:42:29 +1100 (EST) Received: from localhost ([127.0.0.1]:45255 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLxdD-0006mP-4O for incoming@patchwork.ozlabs.org; Fri, 26 Nov 2010 07:42:27 -0500 Received: from [140.186.70.92] (port=40316 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLxaY-0006AS-1P for qemu-devel@nongnu.org; Fri, 26 Nov 2010 07:39:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PLxaU-0001lC-P3 for qemu-devel@nongnu.org; Fri, 26 Nov 2010 07:39:41 -0500 Received: from mail.valinux.co.jp ([210.128.90.3]:38248) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PLxaU-0001jn-3m for qemu-devel@nongnu.org; Fri, 26 Nov 2010 07:39:38 -0500 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id 0898A188B5; Fri, 26 Nov 2010 21:39:35 +0900 (JST) Received: (nullmailer pid 8526 invoked by uid 1000); Fri, 26 Nov 2010 12:39:34 -0000 Date: Fri, 26 Nov 2010 21:39:34 +0900 From: Isaku Yamahata To: adq Subject: Re: [Qemu-devel] [Patch] Small fix for qemu APIC for Mac OS X support Message-ID: <20101126123934.GE14105@valinux.co.jp> References: <9E1995D5-0971-4B80-93AF-85315045C6D2@suse.de> <6F3766C8-F8D4-4468-8F6E-7168E3578805@suse.de> <20101125112804.GB14105@valinux.co.jp> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-01-05) X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: seabios , Alexander Graf , qemu-devel@nongnu.org X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Thu, Nov 25, 2010 at 08:18:45PM +0000, adq wrote: > On 25 November 2010 11:28, Isaku Yamahata wrote: > > On Wed, Nov 24, 2010 at 02:08:16PM +0000, adq wrote: > >> > Interesting. I was also thinking that maybe we can leverage overriding mechanisms that are already available. Maybe it's possible to squeeze the HPET node into an SSDT. Maybe we need to override the whole DSDT from the command line. > >> > >> We'll definitely need to override the DSDT for the applesmc device. I > >> was thinking something along the lines of an additional DSDT binary > >> supplied with QEMU for use when emulating apple hardware as you > >> suggest. > > > > The patches for qemu and seabios have been floating around. > > I wrote them for Q35 chipset support, but no one has gotten interested in it. > > But now, you are there. I'm willing to rebase/resend them. > > I'd definitely be interested to see those! Here is qemu part. I rebased and just compiled it. From df45b74ca7217d40981cd8895fb1b270fb8039ec Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Isaku Yamahata Date: Fri, 26 Nov 2010 21:25:26 +0900 Subject: [PATCH 1/1] acpi: add option, load_header, for -acpitable to load acpi header This patch adds load_header option to -acpitable to load acpi table which includes acpi header. With this option and with seabios patches, alternative dsdt table can be passed to BIOS. Signed-off-by: Isaku Yamahata --- hw/acpi.c | 26 +++++++++++++++++++++++--- qemu-options.hx | 2 ++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/hw/acpi.c b/hw/acpi.c index 8071e7b..fe9bede 100644 --- a/hw/acpi.c +++ b/hw/acpi.c @@ -47,6 +47,7 @@ static int acpi_checksum(const uint8_t *data, int len) int acpi_table_add(const char *t) { static const char *dfl_id = "QEMUQEMU"; + bool load_header = false; char buf[1024], *p, *f; struct acpi_table_header acpi_hdr; unsigned long val; @@ -54,6 +55,17 @@ int acpi_table_add(const char *t) struct acpi_table_header *acpi_hdr_p; size_t off; + if (strncmp(t, "load_header", strlen("load_header")) == 0) { + /* the files includes acpi header to load. + * the acpi header options, sig, rev, ... will be ignored. + */ + load_header = true; + t += strlen("load_header"); + if (*t == ',') { + t++; + } + } + memset(&acpi_hdr, 0, sizeof(acpi_hdr)); if (get_param_value(buf, sizeof(buf), "sig", t)) { @@ -110,7 +122,11 @@ int acpi_table_add(const char *t) buf[0] = '\0'; } - length = sizeof(acpi_hdr); + if (load_header) { + length = 0; + } else { + length = sizeof(acpi_hdr); + } f = buf; while (buf[0]) { @@ -140,8 +156,12 @@ int acpi_table_add(const char *t) *(uint16_t*)p = cpu_to_le32(length); p += sizeof(uint16_t); - memcpy(p, &acpi_hdr, sizeof(acpi_hdr)); - off = sizeof(acpi_hdr); + if (load_header) { + off = 0; + } else { + off = sizeof(acpi_hdr); + memcpy(p, &acpi_hdr, sizeof(acpi_hdr)); + } f = buf; while (buf[0]) { diff --git a/qemu-options.hx b/qemu-options.hx index 4d99a58..c30eb2a 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -981,9 +981,11 @@ ETEXI DEF("acpitable", HAS_ARG, QEMU_OPTION_acpitable, "-acpitable [sig=str][,rev=n][,oem_id=str][,oem_table_id=str][,oem_rev=n][,asl_compiler_id=str][,asl_compiler_rev=n][,data=file1[:file2]...]\n" + "-acpitable [load_header][,data=file1[:file2]...]\n" " ACPI table description\n", QEMU_ARCH_I386) STEXI @item -acpitable [sig=@var{str}][,rev=@var{n}][,oem_id=@var{str}][,oem_table_id=@var{str}][,oem_rev=@var{n}] [,asl_compiler_id=@var{str}][,asl_compiler_rev=@var{n}][,data=@var{file1}[:@var{file2}]...] +@item -acpitable [load_header][,data=@var{file1}[:@var{file2}]...] @findex -acpitable Add ACPI table with specified header fields and context from specified files. ETEXI