From patchwork Mon Feb 16 09:54:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 440008 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A04B3140187 for ; Mon, 16 Feb 2015 21:05:19 +1100 (AEDT) Received: from localhost ([::1]:38560 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNIYH-0004wE-RZ for incoming@patchwork.ozlabs.org; Mon, 16 Feb 2015 05:05:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35041) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNITj-00053a-EJ for qemu-devel@nongnu.org; Mon, 16 Feb 2015 05:00:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNITf-0004qw-HD for qemu-devel@nongnu.org; Mon, 16 Feb 2015 05:00:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49251) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNITf-0004qh-9j; Mon, 16 Feb 2015 05:00:31 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1G9sZHe023868 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 16 Feb 2015 04:54:35 -0500 Received: from work.redhat.com (vpn1-4-121.ams2.redhat.com [10.36.4.121]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1G9sI0k006518; Mon, 16 Feb 2015 04:54:30 -0500 From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Mon, 16 Feb 2015 11:54:02 +0200 Message-Id: <1424080457-13752-3-git-send-email-marcel@redhat.com> In-Reply-To: <1424080457-13752-1-git-send-email-marcel@redhat.com> References: <1424080457-13752-1-git-send-email-marcel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: seabios@seabios.org, kraxel@redhat.com, mst@redhat.com, quintela@redhat.com, agraf@suse.de, marcel@redhat.com, alex.williamson@redhat.com, kevin@koconnor.net, qemu-ppc@nongnu.org, hare@suse.de, imammedo@redhat.com, amit.shah@redhat.com, pbonzini@redhat.com, leon.alrae@imgtec.com, aurelien@aurel32.net, rth@twiddle.net Subject: [Qemu-devel] [PATCH RFC V2 02/17] hw/acpi: add support for multiple root busses 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 If the machine has several root busses, we need to add them to acpi in order to be properly detected by guests. Signed-off-by: Marcel Apfelbaum --- hw/i386/acpi-build.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index e7db85d..fedcb2e 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -60,6 +60,8 @@ #include "qom/qom-qobject.h" #include "exec/ram_addr.h" +#include "qmp-commands.h" + /* These are used to size the ACPI tables for -M pc-i440fx-1.7 and * -M pc-i440fx-2.0. Even if the actual amount of AML generated grows * a little bit, there should be plenty of free space since the DSDT @@ -661,6 +663,36 @@ build_ssdt(AcpiAml *table_aml, GArray *linker, ssdt = acpi_def_block("SSDT", 1, ACPI_BUILD_APPNAME6, ACPI_BUILD_APPNAME4, 1); + { + PciInfoList *info_list, *info; + Error *err = NULL; + + info_list = qmp_query_pci(&err); + if (err) { + error_free(err); + return; + } + + for (info = info_list; info; info = info->next) { + PciInfo *bus_info = info->value; + + if (bus_info->bus == 0) { + continue; + } + + scope = acpi_scope("\\_SB"); + dev = acpi_device("PC%.02X", (uint8_t)bus_info->bus); + aml_append(&dev, acpi_name_decl("_UID", + acpi_string("PC%.02X", (uint8_t)bus_info->bus))); + aml_append(&dev, acpi_name_decl("_HID", acpi_string("PNP0A03"))); + aml_append(&dev, + acpi_name_decl("_BBN", acpi_int((uint8_t)bus_info->bus))); + aml_append(&scope, dev); + aml_append(&ssdt, scope); + } + qapi_free_PciInfoList(info_list); + } + scope = acpi_scope("\\_SB.PCI0"); /* build PCI0._CRS */ crs = acpi_resource_template();