From patchwork Fri Apr 3 10:03:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 46762 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BE494216D1 for ; Fri, 3 Apr 2015 10:18:04 +0000 (UTC) Received: by lajy8 with SMTP id y8sf23478051laj.3 for ; Fri, 03 Apr 2015 03:18:03 -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=UCpyroNk6oj29UtTn1ab2Idie7+KdjC0donnyV2H7qw=; b=ikFm7kd7e1j/GkoF2QpUN0CzFrGTdseqviDZDW26ixwE3KWkHTn+e8gEV+N87smB0f veHGhG+bF0Nx2LzUmUadL0lLjawX5HiK82Y4IYRfNkAcnm7wStJObTPc9hjuh/BUuO+0 s8O1icaDT4ZIm/rh0+xlxtadngf7KZao+jYbDN+cmFeb0AhVenZxOcVyiAIzRsyWWTbF mWDyefhD+CdD3kEDvKCglZIePuhyzPBW/wskJ834TzKN9Rs2ocFh1C/ReNlU0v5uZI1n 3KkhGjBKeqVcx/budZBBdo2qqUzOrYEEZcJ47sbb4cRNir3uXHEimECTxvxsj9fWhS+5 W+dg== X-Gm-Message-State: ALoCoQnPSP72iHrvLRlhzJyzktKEZwxxHefy3dDQYXRRG3OrKug349gEzmoFDF1fBVZzuwTAdXhC X-Received: by 10.112.235.70 with SMTP id uk6mr429287lbc.24.1428056283791; Fri, 03 Apr 2015 03:18:03 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.182.138 with SMTP id ee10ls204117lac.44.gmail; Fri, 03 Apr 2015 03:18:03 -0700 (PDT) X-Received: by 10.152.234.42 with SMTP id ub10mr1574904lac.60.1428056283496; Fri, 03 Apr 2015 03:18:03 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id t4si6349926lbp.105.2015.04.03.03.18.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Apr 2015 03:18:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by lajy8 with SMTP id y8so77172794laj.0 for ; Fri, 03 Apr 2015 03:18:03 -0700 (PDT) X-Received: by 10.152.5.72 with SMTP id q8mr1543291laq.73.1428056283363; Fri, 03 Apr 2015 03:18:03 -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.57.201 with SMTP id k9csp1863379lbq; Fri, 3 Apr 2015 03:18:02 -0700 (PDT) X-Received: by 10.140.148.129 with SMTP id 123mr1865771qhu.23.1428056281401; Fri, 03 Apr 2015 03:18:01 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g9si7719881qca.43.2015.04.03.03.18.00 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 03 Apr 2015 03:18:01 -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]:33393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ydyfo-0004Hq-EL for patch@linaro.org; Fri, 03 Apr 2015 06:18:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdyaX-0004VM-81 for qemu-devel@nongnu.org; Fri, 03 Apr 2015 06:12:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YdyaS-0006uE-TY for qemu-devel@nongnu.org; Fri, 03 Apr 2015 06:12:33 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:11109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdyaS-0006ro-B2 for qemu-devel@nongnu.org; Fri, 03 Apr 2015 06:12:28 -0400 Received: from 172.24.2.119 (EHLO szxeml425-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CJI43156; Fri, 03 Apr 2015 18:05:54 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml425-hub.china.huawei.com (10.82.67.180) with Microsoft SMTP Server id 14.3.158.1; Fri, 3 Apr 2015 18:05:46 +0800 From: Shannon Zhao To: , , , , , , , , , , Date: Fri, 3 Apr 2015 18:03:42 +0800 Message-ID: <1428055432-12120-11-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1428055432-12120-1-git-send-email-zhaoshenglong@huawei.com> References: <1428055432-12120-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: 119.145.14.65 Cc: hangaohuai@huawei.com, shannon.zhao@linaro.org, peter.huangpeng@huawei.com, zhaoshenglong@huawei.com Subject: [Qemu-devel] [PATCH v4 10/20] hw/arm/virt-acpi-build: Generate RSDT 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.47 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 RSDT points to other tables FADT, MADT, GTDT. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/arm/virt-acpi-build.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index a7aba75..85e84b1 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -176,6 +176,30 @@ static void acpi_dsdt_add_virtio(Aml *scope, const hwaddr *mmio_addrs, } } +/* RSDT */ +static void +build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets) +{ + AcpiRsdtDescriptorRev1 *rsdt; + size_t rsdt_len; + int i; + + rsdt_len = sizeof(*rsdt) + sizeof(uint32_t) * table_offsets->len; + rsdt = acpi_data_push(table_data, rsdt_len); + memcpy(rsdt->table_offset_entry, table_offsets->data, + sizeof(uint32_t) * table_offsets->len); + for (i = 0; i < table_offsets->len; ++i) { + /* rsdt->table_offset_entry to be filled by Guest linker */ + bios_linker_loader_add_pointer(linker, + ACPI_BUILD_TABLE_FILE, + ACPI_BUILD_TABLE_FILE, + table_data, &rsdt->table_offset_entry[i], + sizeof(uint32_t)); + } + build_header(linker, table_data, + (void *)rsdt, "RSDT", rsdt_len, 1); +} + /* GTDT */ static void build_gtdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) @@ -348,6 +372,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); + /* RSDT is pointed to by RSDP */ + build_rsdt(tables_blob, tables->linker, table_offsets); + /* Cleanup memory that's no longer used. */ g_array_free(table_offsets, true); }