From patchwork Tue Jul 5 03:12:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 71375 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp91337qgy; Mon, 4 Jul 2016 20:17:18 -0700 (PDT) X-Received: by 10.107.9.78 with SMTP id j75mr10608591ioi.33.1467688634148; Mon, 04 Jul 2016 20:17:14 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id p36si1436674ioi.159.2016.07.04.20.17.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jul 2016 20:17:14 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKGon-0008Ne-5U; Tue, 05 Jul 2016 03:14:37 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKGol-0008ND-CY for xen-devel@lists.xen.org; Tue, 05 Jul 2016 03:14:35 +0000 Received: from [193.109.254.147] by server-1.bemta-14.messagelabs.com id 44/B0-14454-A162B775; Tue, 05 Jul 2016 03:14:34 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsVSPpHPUVdKrTr c4N0mboslHxezODB6HN39mymAMYo1My8pvyKBNWNu1yy2gikCFVun9LA1ML7i6WLk4hASOMUo 8af9EjuEs5tRYs2hpUAOJwebgK7Ex41TwGwRAVmJ1V1zwGxmgQ+MEqdmS4DYwgJ2Er2PzrN1M XJwsAioSHxaHw0S5hXwkPi3vp0NxJYQ0JBY2TuBBcTmFPCU+HoTwhYCquk/sJ4Vol5Q4uTMJy wQ4yUkDr54wQzRqyjRtv4k1BxJiYMrbrCA3CkBcvTpx1tYIBKmEnsOHWGdwCg4C8msWUhmLWB kWsWoXpxaVJZapGuhl1SUmZ5RkpuYmaNraGiil5taXJyYnpqTmFSsl5yfu4kRGJ4MQLCDceMk 50OMkhxMSqK8r/5VhQvxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4F2rUh0uJFiUmp5akZaZA4wUm LQEB4+SCO8zkDRvcUFibnFmOkTqFKOilDjvApCEAEgiozQPrg0WnZcYZaWEeRmBDhHiKUgtys 0sQZV/xSjOwagkzPsCZApPZl4J3PRXQIuZgBazxpaDLC5JREhJNTB2Ce+rsPW9uSFTxki5b47 iu608dvfaHNTn2TUmSr+/cu/RZ18bmcCc+uPfWN3Z/6gW/BE8OJXz+UoJjV++rEVNiz+InW2W sN1o++01862b1Su5n28/uvvH5I4Srv3O5nxneCXeN30u9H3aZFyxyon5SMC9P3PPFAY2sFdZv rd6oRHb5XFyVZwSS3FGoqEWc1FxIgC5sEhUyQIAAA== X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-13.tower-27.messagelabs.com!1467688469!51904794!1 X-Originating-IP: [119.145.14.65] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTE5LjE0NS4xNC42NSA9PiA3NzQ2Mw==\n X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 52426 invoked from network); 5 Jul 2016 03:14:33 -0000 Received: from szxga02-in.huawei.com (HELO szxga02-in.huawei.com) (119.145.14.65) by server-13.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 5 Jul 2016 03:14:33 -0000 Received: from 172.24.1.47 (EHLO SZXEML429-HUB.china.huawei.com) ([172.24.1.47]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DJT71999; Tue, 05 Jul 2016 11:14:09 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by SZXEML429-HUB.china.huawei.com (10.82.67.184) with Microsoft SMTP Server id 14.3.235.1; Tue, 5 Jul 2016 11:14:00 +0800 From: Shannon Zhao To: Date: Tue, 5 Jul 2016 11:12:38 +0800 Message-ID: <1467688367-17320-9-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1467688367-17320-1-git-send-email-zhaoshenglong@huawei.com> References: <1467688367-17320-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.0A020204.577B2601.0061, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: e3d7180c0dc891c9bce944d68fab6520 Cc: hangaohuai@huawei.com, sstabellini@kernel.org, wei.liu2@citrix.com, ian.jackson@eu.citrix.com, peter.huangpeng@huawei.com, julien.grall@arm.com, shannon.zhao@linaro.org, boris.ostrovsky@oracle.com Subject: [Xen-devel] [PATCH v3 08/17] libxl/arm: Construct ACPI XSDT table X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" From: Shannon Zhao Signed-off-by: Shannon Zhao --- tools/libxl/libxl_arm_acpi.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c index 9df1573..1989050 100644 --- a/tools/libxl/libxl_arm_acpi.c +++ b/tools/libxl/libxl_arm_acpi.c @@ -142,6 +142,35 @@ static void make_acpi_rsdp(libxl__gc *gc, struct xc_dom_image *dom, acpitables[RSDP].size); } +static void make_acpi_header(struct acpi_table_header *h, const char *sig, + int len, uint8_t rev) +{ + memcpy(h->signature, sig, 4); + h->length = len; + h->revision = rev; + memcpy(h->oem_id, ACPI_BUILD_APPNAME6, 6); + memcpy(h->oem_table_id, ACPI_BUILD_APPNAME4, 4); + memcpy(h->oem_table_id + 4, sig, 4); + h->oem_revision = 1; + memcpy(h->asl_compiler_id, ACPI_BUILD_APPNAME4, 4); + h->asl_compiler_revision = 1; + h->checksum = 0; +} + +static void make_acpi_xsdt(libxl__gc *gc, struct xc_dom_image *dom, + struct acpitable acpitables[]) +{ + uint64_t offset = acpitables[XSDT].addr - GUEST_ACPI_BASE; + struct acpi_table_xsdt *xsdt = dom->acpitable_blob + offset; + + xsdt->table_offset_entry[0] = acpitables[MADT].addr; + xsdt->table_offset_entry[1] = acpitables[GTDT].addr; + xsdt->table_offset_entry[2] = acpitables[FADT].addr; + make_acpi_header(&xsdt->header, "XSDT", acpitables[XSDT].size, 1); + calculate_checksum(xsdt, offsetof(struct acpi_table_header, checksum), + acpitables[XSDT].size); +} + int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info, libxl__domain_build_state *state, struct xc_dom_image *dom) @@ -168,6 +197,7 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info, return rc; make_acpi_rsdp(gc, dom, acpitables); + make_acpi_xsdt(gc, dom, acpitables); return 0; }