From patchwork Thu May 21 02:28:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48832 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 53B1F2121F for ; Thu, 21 May 2015 02:38:00 +0000 (UTC) Received: by laat2 with SMTP id t2sf22690681laa.2 for ; Wed, 20 May 2015 19:37:59 -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=ofp0YVH+zAsFAVR1DwkmdtJxKghGtTMkdJ15PoET564=; b=S8kZ7vT5PfJzipJcRf05SXsem/yReM9wdylbM5/RAjy9qnhg1+GXSfBZvNGbW/ay3t m7WLKvsyZ5SVR87wQb8Yw8oA9D+hSvt+J9LLc8q/RCs7HxeAN3blu3eswg9SyXrI8XOH dP28O00KBAIkO3U++IUv6cq0COfzj8OCbP28dK3sRMlq6J5ZRlW6WOygEEo+KNC5SJj5 KsAhRhcmrID2uKSLMjipGyOEWszTaxzPpM086ae0lMssd+zQY2HXIJ3MrjCPbZpJZcSG zkzZlOQGbWR8tlHX+zoGDBfGum10I7H59IYNQpujRGRh98BrFoRyCbHaxzIp7v4Xjaaw PnOA== X-Gm-Message-State: ALoCoQmaUyRB4ibb7mlK76Icjwt1HfgV2n4vOSOLdea5JJaYb9CJuOtEiVZLbwJB3EZQSze2nuE8 X-Received: by 10.112.219.200 with SMTP id pq8mr451475lbc.7.1432175879340; Wed, 20 May 2015 19:37:59 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.135 with SMTP id e7ls305005lam.79.gmail; Wed, 20 May 2015 19:37:59 -0700 (PDT) X-Received: by 10.113.10.134 with SMTP id ea6mr310857lbd.29.1432175879228; Wed, 20 May 2015 19:37:59 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id z9si12314395laj.152.2015.05.20.19.37.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 May 2015 19:37:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbqq2 with SMTP id qq2so8015002lbb.3 for ; Wed, 20 May 2015 19:37:59 -0700 (PDT) X-Received: by 10.113.10.134 with SMTP id ea6mr310850lbd.29.1432175878963; Wed, 20 May 2015 19:37:58 -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.108.230 with SMTP id hn6csp230679lbb; Wed, 20 May 2015 19:37:57 -0700 (PDT) X-Received: by 10.140.233.82 with SMTP id e79mr548268qhc.83.1432175877355; Wed, 20 May 2015 19:37:57 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id n5si2076361qgf.100.2015.05.20.19.37.56 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 20 May 2015 19:37:57 -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]:54624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvGMu-00052G-8q for patch@linaro.org; Wed, 20 May 2015 22:37:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48024) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvGLv-0003Yf-Rd for qemu-devel@nongnu.org; Wed, 20 May 2015 22:36:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YvGLu-0008Qg-O5 for qemu-devel@nongnu.org; Wed, 20 May 2015 22:36:55 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:1717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvGLu-0008QA-5Q for qemu-devel@nongnu.org; Wed, 20 May 2015 22:36:54 -0400 Received: from 172.24.2.119 (EHLO szxeml434-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BGI56264; Thu, 21 May 2015 10:30:23 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml434-hub.china.huawei.com (10.82.67.225) with Microsoft SMTP Server id 14.3.158.1; Thu, 21 May 2015 10:30:11 +0800 From: Shannon Zhao To: , , , , , , , , , , Date: Thu, 21 May 2015 10:28:38 +0800 Message-ID: <1432175331-12548-12-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1432175331-12548-1-git-send-email-zhaoshenglong@huawei.com> References: <1432175331-12548-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.555D4340.008C, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: b650516c920c6d4da09104a553f6777a X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.66 Cc: hangaohuai@huawei.com, zhaoshenglong@huawei.com, peter.huangpeng@huawei.com, shannon.zhao@linaro.org Subject: [Qemu-devel] [PATCH v8 11/24] 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.217.176 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. This code is shared with x86. Here we still use RSDT as UEFI puts ACPI tables below 4G address space, and UEFI ignore the RSDT or XSDT. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/acpi/aml-build.c | 24 ++++++++++++++++++++++++ hw/arm/virt-acpi-build.c | 3 +++ hw/i386/acpi-build.c | 24 ------------------------ include/hw/acpi/aml-build.h | 2 ++ 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 0d99941..de19c63 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1006,3 +1006,27 @@ void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre) g_array_free(tables->table_data, true); g_array_free(tables->tcpalog, mfre); } + +/* Build rsdt table */ +void +build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets) +{ + AcpiRsdtDescriptorRev1 *rsdt; + size_t rsdt_len; + int i; + const int table_data_len = (sizeof(uint32_t) * table_offsets->len); + + rsdt_len = sizeof(*rsdt) + table_data_len; + rsdt = acpi_data_push(table_data, rsdt_len); + memcpy(rsdt->table_offset_entry, table_offsets->data, table_data_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); +} diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index a28b5fe..f46820a 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -319,6 +319,9 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) acpi_add_table(table_offsets, tables_blob); build_gtdt(tables_blob, tables->linker); + /* 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); } diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index c7c6b61..3d19de6 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1208,30 +1208,6 @@ build_dsdt(GArray *table_data, GArray *linker, AcpiMiscInfo *misc) misc->dsdt_size, 1); } -/* Build final rsdt table */ -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); -} - static GArray * build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) { diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index df23479..f4e678f 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -266,5 +266,7 @@ unsigned acpi_data_len(GArray *table); void acpi_add_table(GArray *table_offsets, GArray *table_data); void acpi_build_tables_init(AcpiBuildTables *tables); void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre); +void +build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets); #endif