From patchwork Mon Feb 16 09:54:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 440002 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 9381314014D for ; Mon, 16 Feb 2015 21:00:27 +1100 (AEDT) Received: from localhost ([::1]:38497 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNITZ-0004br-RF for incoming@patchwork.ozlabs.org; Mon, 16 Feb 2015 05:00:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNISx-0003IH-CE for qemu-devel@nongnu.org; Mon, 16 Feb 2015 04:59:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNISr-0004Mw-GA for qemu-devel@nongnu.org; Mon, 16 Feb 2015 04:59:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53215) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNISr-0004Mn-8C; Mon, 16 Feb 2015 04:59:41 -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 t1G9sfAe004650 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 16 Feb 2015 04:54:41 -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 t1G9sI0l006518; Mon, 16 Feb 2015 04:54:35 -0500 From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Mon, 16 Feb 2015 11:54:03 +0200 Message-Id: <1424080457-13752-4-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 03/17] hw/apci: add _PRT method for extra 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 Signed-off-by: Marcel Apfelbaum --- hw/i386/acpi-build.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index fedcb2e..ee1a50a 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -643,6 +643,82 @@ static void build_append_pci_bus_devices(AcpiAml *parent_scope, PCIBus *bus, aml_append(parent_scope, method); } +static AcpiAml build_prt(void) +{ + AcpiAml method, pkg, if_ctx, while_ctx; + + method = acpi_method("_PRT", 0); + + aml_append(&method, acpi_store(acpi_package(128), acpi_local0())); + aml_append(&method, acpi_store(acpi_int(0), acpi_local1())); + while_ctx = acpi_while(acpi_lless(acpi_local1(), acpi_int(128))); + { + aml_append(&while_ctx, + acpi_store(acpi_shiftright(acpi_local1(), 2), + acpi_local2())); + aml_append(&while_ctx, acpi_store( + acpi_and(acpi_add(acpi_local1(), acpi_local2()), acpi_int(3)), acpi_local3())); + + if_ctx = acpi_if(acpi_equal(acpi_local3(), acpi_int(0))); + { + pkg = acpi_package(4); + aml_append(&pkg, acpi_int(0)); + aml_append(&pkg, acpi_int(0)); + aml_append(&pkg, acpi_name("LNKD")); + aml_append(&pkg, acpi_int(0)); + aml_append(&if_ctx, acpi_store(pkg, acpi_local4())); + } + aml_append(&while_ctx, if_ctx); + + if_ctx = acpi_if(acpi_equal(acpi_local3(), acpi_int(1))); + { + pkg = acpi_package(4); + aml_append(&pkg, acpi_int(0)); + aml_append(&pkg, acpi_int(0)); + aml_append(&pkg, acpi_name("LNKA")); + aml_append(&pkg, acpi_int(0)); + aml_append(&if_ctx, acpi_store(pkg, acpi_local4())); + } + aml_append(&while_ctx, if_ctx); + + if_ctx = acpi_if(acpi_equal(acpi_local3(), acpi_int(2))); + { + pkg = acpi_package(4); + aml_append(&pkg, acpi_int(0)); + aml_append(&pkg, acpi_int(0)); + aml_append(&pkg, acpi_name("LNKB")); + aml_append(&pkg, acpi_int(0)); + aml_append(&if_ctx, acpi_store(pkg, acpi_local4())); + } + aml_append(&while_ctx, if_ctx); + + if_ctx = acpi_if(acpi_equal(acpi_local3(), acpi_int(3))); + { + pkg = acpi_package(4); + aml_append(&pkg, acpi_int(0)); + aml_append(&pkg, acpi_int(0)); + aml_append(&pkg, acpi_name("LNKC")); + aml_append(&pkg, acpi_int(0)); + aml_append(&if_ctx, acpi_store(pkg, acpi_local4())); + } + aml_append(&while_ctx, if_ctx); + + aml_append(&while_ctx, acpi_store( + acpi_or(acpi_shiftleft(acpi_local2(), 16), acpi_int(0xFFFF)), + acpi_index(acpi_local4(), acpi_int(0)))); + aml_append(&while_ctx, acpi_store( + acpi_and(acpi_local1(), acpi_int(3)), + acpi_index(acpi_local4(), acpi_int(1)))); + aml_append(&while_ctx, acpi_store( + acpi_local4(), acpi_index(acpi_local0(), acpi_local1()))); + aml_append(&while_ctx, acpi_increment(acpi_local1())); + } + aml_append(&method, while_ctx); + aml_append(&method, acpi_return(acpi_local0())); + + return method; + } + static void build_ssdt(AcpiAml *table_aml, GArray *linker, AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc, @@ -687,6 +763,7 @@ build_ssdt(AcpiAml *table_aml, GArray *linker, 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(&dev, build_prt()); aml_append(&scope, dev); aml_append(&ssdt, scope); }