From patchwork Thu May 7 09:29:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48106 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1987B20553 for ; Thu, 7 May 2015 09:45:10 +0000 (UTC) Received: by wiun10 with SMTP id n10sf13859619wiu.1 for ; Thu, 07 May 2015 02:45:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:content-type:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=uEGck25dfVXj4C2NO6CtA+t7oYOvscJq0cYFx+gsCic=; b=hhvXyZB60DU8W+GYx35aSommBxO0k2xRJkRuLZuQUyblFP3KP3tPOC927HrYxWdTae cLh/eCpOzUROOmUPolG1RLjQY3V9xSIW9skafROrQaicWRizUfCyAMoZwppNAA2BpbN4 V0OUZgimdZxwQW5YAhJWsrJ2vmjwfDiFDV2moJyjqaAhcFaUtGMqpg+pb900PtL9o4W0 zv2WOrWlqLVyIG/CZF5b4aXcJHSgXaL4NW8HkB7//fBMELc44qiuDxdjlH0YG0fgQzK7 TE4gAWGVe90QLfQz6LHzucHf0YJ5SpgqGli76K4QaQpveRM5Vkg7AlLseeJf4FdTTfOH FMjw== X-Gm-Message-State: ALoCoQmpQX5E+u3l8RW5hL4jvHKq96QU0YoWGdt7wjwZoMSKhIa2h1T1YOa/ru8M2fNzDBpxnFzx X-Received: by 10.180.85.129 with SMTP id h1mr1636580wiz.6.1430991909409; Thu, 07 May 2015 02:45:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.194 with SMTP id v2ls196737lag.59.gmail; Thu, 07 May 2015 02:45:09 -0700 (PDT) X-Received: by 10.112.150.100 with SMTP id uh4mr2328313lbb.112.1430991909224; Thu, 07 May 2015 02:45:09 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id pf2si961028lbc.2.2015.05.07.02.45.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2015 02:45:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by labbd9 with SMTP id bd9so26510233lab.2 for ; Thu, 07 May 2015 02:45:08 -0700 (PDT) X-Received: by 10.112.204.72 with SMTP id kw8mr2378666lbc.88.1430991908801; Thu, 07 May 2015 02:45:08 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp3333349lbt; Thu, 7 May 2015 02:45:08 -0700 (PDT) X-Received: by 10.229.249.6 with SMTP id mi6mr3995231qcb.24.1430991907558; Thu, 07 May 2015 02:45:07 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id r9si1469055qca.13.2015.05.07.02.45.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 07 May 2015 02:45:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:49759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqIMc-0002Sx-Oe for patch@linaro.org; Thu, 07 May 2015 05:45:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqIAJ-0007pt-Ce for qemu-devel@nongnu.org; Thu, 07 May 2015 05:32:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YqIAG-0001u3-65 for qemu-devel@nongnu.org; Thu, 07 May 2015 05:32:23 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:42276) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqIAF-0001sg-DV for qemu-devel@nongnu.org; Thu, 07 May 2015 05:32:20 -0400 Received: from 172.24.2.119 (EHLO szxeml426-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CNI17457; Thu, 07 May 2015 17:32:03 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml426-hub.china.huawei.com (10.82.67.181) with Microsoft SMTP Server id 14.3.158.1; Thu, 7 May 2015 17:31:30 +0800 From: Shannon Zhao To: , , , , , , , , , , Date: Thu, 7 May 2015 17:29:14 +0800 Message-ID: <1430990964-10528-13-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1430990964-10528-1-git-send-email-zhaoshenglong@huawei.com> References: <1430990964-10528-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 58.251.152.64 Cc: hangaohuai@huawei.com, zhaoshenglong@huawei.com, peter.huangpeng@huawei.com, shannon.zhao@linaro.org Subject: [Qemu-devel] [PATCH v6 12/22] hw/arm/virt-acpi-build: Add PCIe info and generate MCFG 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Shannon Zhao Add PCIe info struct, prepare for building PCIe table. And generate MCFG table. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/arm/virt-acpi-build.c | 21 +++++++++++++++++++++ include/hw/arm/virt-acpi-build.h | 9 +++++++++ 2 files changed, 30 insertions(+) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index caa7096..ceea689 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -181,6 +181,24 @@ build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) return rsdp_table; } +static void +build_mcfg(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) +{ + AcpiTableMcfg *mcfg; + AcpiPcieInfo *info = guest_info->pcie_info; + int len = sizeof(*mcfg) + sizeof(mcfg->allocation[0]); + + mcfg = acpi_data_push(table_data, len); + mcfg->allocation[0].address = cpu_to_le64(info->pcie_ecam.addr); + + /* Only a single allocation so no need to play with segments */ + mcfg->allocation[0].pci_segment = cpu_to_le16(0); + mcfg->allocation[0].start_bus_number = 0; + mcfg->allocation[0].end_bus_number = info->nr_pcie_buses - 1; + + build_header(linker, table_data, (void *)mcfg, "MCFG", len, 1); +} + /* GTDT */ static void build_gtdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) @@ -349,6 +367,9 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) acpi_add_table(table_offsets, tables_blob); build_gtdt(tables_blob, tables->linker, guest_info); + acpi_add_table(table_offsets, tables_blob); + build_mcfg(tables_blob, tables->linker, guest_info); + /* RSDT is pointed to by RSDP */ rsdt = tables_blob->len; build_rsdt(tables_blob, tables->linker, table_offsets); diff --git a/include/hw/arm/virt-acpi-build.h b/include/hw/arm/virt-acpi-build.h index 60d6f0f..4dbc5d3 100644 --- a/include/hw/arm/virt-acpi-build.h +++ b/include/hw/arm/virt-acpi-build.h @@ -53,6 +53,14 @@ typedef struct AcpiDsdtInfo { const MemMap *flash_memmap; } AcpiDsdtInfo; +typedef struct AcpiPcieInfo { + const int *pcie_irq; + MemMap pcie_mmio; + MemMap pcie_ioport; + MemMap pcie_ecam; + int nr_pcie_buses; +} AcpiPcieInfo; + typedef struct VirtGuestInfo { int smp_cpus; int max_cpus; @@ -60,6 +68,7 @@ typedef struct VirtGuestInfo { AcpiMadtInfo *madt_info; AcpiDsdtInfo *dsdt_info; AcpiGtdtInfo *gtdt_info; + AcpiPcieInfo *pcie_info; } VirtGuestInfo;