From patchwork Wed Oct 7 13:21:44 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 35291 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 EAD91B7B94 for ; Thu, 8 Oct 2009 01:07:33 +1100 (EST) Received: from localhost ([127.0.0.1]:46759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvXAx-0002TN-1k for incoming@patchwork.ozlabs.org; Wed, 07 Oct 2009 10:07:31 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MvWSw-0003Z8-4f for qemu-devel@nongnu.org; Wed, 07 Oct 2009 09:22:02 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MvWSo-0003S6-IU for qemu-devel@nongnu.org; Wed, 07 Oct 2009 09:21:59 -0400 Received: from [199.232.76.173] (port=40295 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvWSm-0003Rl-6Z for qemu-devel@nongnu.org; Wed, 07 Oct 2009 09:21:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21913) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MvWSl-00034R-P3 for qemu-devel@nongnu.org; Wed, 07 Oct 2009 09:21:52 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n97DLkFP013552; Wed, 7 Oct 2009 09:21:46 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n97DLjfI021493; Wed, 7 Oct 2009 09:21:46 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id DADC61336CC; Wed, 7 Oct 2009 15:21:44 +0200 (IST) From: Gleb Natapov To: kevin@koconnor.net Date: Wed, 7 Oct 2009 15:21:44 +0200 Message-Id: <1254921704-18810-2-git-send-email-gleb@redhat.com> In-Reply-To: <1254921704-18810-1-git-send-email-gleb@redhat.com> References: <1254921704-18810-1-git-send-email-gleb@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 2/2] Add support for passing additional acpi tables from qemu. 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 Signed-off-by: Gleb Natapov --- src/acpi.c | 18 +++++++++++++++++- src/config.h | 2 +- src/paravirt.c | 27 +++++++++++++++++++++++++++ src/paravirt.h | 3 +++ 4 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/acpi.c b/src/acpi.c index b9d449f..dafd8c8 100644 --- a/src/acpi.c +++ b/src/acpi.c @@ -11,7 +11,7 @@ #include "biosvar.h" // GET_EBDA #include "pci_ids.h" // PCI_VENDOR_ID_INTEL #include "pci_regs.h" // PCI_INTERRUPT_LINE - +#include "paravirt.h" /****************************************************/ /* ACPI tables init */ @@ -444,6 +444,22 @@ acpi_bios_init(void) ACPI_INIT_TABLE(build_ssdt()); ACPI_INIT_TABLE(build_madt()); + u16 i, external_tables = qemu_cfg_acpi_additional_tables(); + + for(i = 0; i < external_tables; i++) { + u16 len = qemu_cfg_next_acpi_table_len(); + void *addr = malloc_high(len); + if (!addr) { + dprintf(1, "Not enogh memory of ext acpi table of size %d!\n", len); + continue; + } + ACPI_INIT_TABLE(qemu_cfg_next_acpi_table_load(addr, len)); + if (tbl_idx == MAX_ACPI_TABLES) { + dprintf(1, "To many external table!\n"); + break; + } + } + struct rsdt_descriptor_rev1 *rsdt; size_t rsdt_len = sizeof(*rsdt) + sizeof(u32) * tbl_idx; rsdt = malloc_high(rsdt_len); diff --git a/src/config.h b/src/config.h index e93b080..10b2232 100644 --- a/src/config.h +++ b/src/config.h @@ -13,7 +13,7 @@ #define CONFIG_APPNAME4 "BXPC" // Configure for use with KVM. -#define CONFIG_KVM 0 +#define CONFIG_KVM 1 // Configure as a coreboot payload. #define CONFIG_COREBOOT 0 diff --git a/src/paravirt.c b/src/paravirt.c index 56d8421..cd1f263 100644 --- a/src/paravirt.c +++ b/src/paravirt.c @@ -72,3 +72,30 @@ int qemu_cfg_show_boot_menu(void) return v; } +u16 qemu_cfg_acpi_additional_tables(void) +{ + u16 cnt; + + if (!qemu_cfg_present) + return 0; + + qemu_cfg_read_entry(&cnt, QEMU_CFG_ACPI_TABLES, sizeof(cnt)); + + return cnt; +} + +u16 qemu_cfg_next_acpi_table_len(void) +{ + u16 len; + + qemu_cfg_read((u8*)&len, sizeof(len)); + + return len; +} + +void* qemu_cfg_next_acpi_table_load(void *addr, u16 len) +{ + qemu_cfg_read(addr, len); + return addr; +} + diff --git a/src/paravirt.h b/src/paravirt.h index 6997cff..c2bab71 100644 --- a/src/paravirt.h +++ b/src/paravirt.h @@ -40,5 +40,8 @@ extern int qemu_cfg_present; void qemu_cfg_port_probe(void); int qemu_cfg_show_boot_menu(void); void qemu_cfg_get_uuid(u8 *uuid); +u16 qemu_cfg_acpi_additional_tables(void); +u16 qemu_cfg_next_acpi_table_len(void); +void *qemu_cfg_next_acpi_table_load(void *addr, u16 len); #endif