From patchwork Fri Sep 2 02:55:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 75274 Delivered-To: patch@linaro.org Received: by 10.140.29.8 with SMTP id a8csp623868qga; Thu, 1 Sep 2016 19:59:07 -0700 (PDT) X-Received: by 10.36.129.193 with SMTP id q184mr1589078itd.35.1472785135346; Thu, 01 Sep 2016 19:58:55 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id f10si1985435itf.22.2016.09.01.19.58.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Sep 2016 19:58:55 -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 1bfeeq-0006rl-TW; Fri, 02 Sep 2016 02:56:44 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bfeeq-0006qZ-B9 for xen-devel@lists.xen.org; Fri, 02 Sep 2016 02:56:44 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id 2E/E2-12285-B6AE8C75; Fri, 02 Sep 2016 02:56:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsVi9XuGg272qxP hBs/fMVos+biYxYHR4+ju30wBjFGsmXlJ+RUJrBk/5x1jKzggULHjvn4D42TeLkYuDiGBU4wS Sw9/YIZwdjNK7Dqyh62LkZODTUBX4uPGKewgtoiArMTqrjnsIEXMAtcZJe6838YKkhAWsJPo2 zmbBcRmEVCROLbwETOIzSvgIbH9wUtGEFtCQENiZe8EsBpOAU+Jt6s+gQ0VAqp5/OoRE0S9oM TJmU/AapgFJCQOvnjBDNGrKNG2/iQbhC0pcXDFDRaQIyRAzp50ZCbUAlOJ5d8uskxgFJyFZNY sJLMWMDKtYtQoTi0qSy3SNTLWSyrKTM8oyU3MzNE1NDDVy00tLk5MT81JTCrWS87P3cQIDNF6 BgbGHYw72v0OMUpyMCmJ8uY/OREuxJeUn1KZkVicEV9UmpNafIhRhoNDSYL30AugnGBRanpqR VpmDjBaYNISHDxKIry1IGne4oLE3OLMdIjUKUZFKXHeFyAJAZBERmkeXBssQi8xykoJ8zIyMD AI8RSkFuVmlqDKv2IU52BUEublfQk0hSczrwRu+iugxUxAi0uuHQdZXJKIkJJqYFRY1qX1f8G l4FXxsoqXbe5VSyYe11r2+VKtuGuG4Ve3zSWvbaLSovZlKS1je2zMobBg97SD1+zMymZnSnn3 JEzRfH/opHT/9We99dtXVk9dqrzC/fkiE6mIY1Emxxe7LLs71/pe1o/Zq48+OaM0tWulkVP1H M5sMZarzhuYVSUrWooNj+UGFCuxFGckGmoxFxUnAgCLKkZXywIAAA== X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-2.tower-206.messagelabs.com!1472784998!41436229!1 X-Originating-IP: [58.251.152.64] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 41160 invoked from network); 2 Sep 2016 02:56:42 -0000 Received: from szxga01-in.huawei.com (HELO szxga01-in.huawei.com) (58.251.152.64) by server-2.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 2 Sep 2016 02:56:42 -0000 Received: from 172.24.1.60 (EHLO szxeml431-hub.china.huawei.com) ([172.24.1.60]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DQM36311; Fri, 02 Sep 2016 10:56:16 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml431-hub.china.huawei.com (10.82.67.208) with Microsoft SMTP Server id 14.3.235.1; Fri, 2 Sep 2016 10:56:03 +0800 From: Shannon Zhao To: Date: Fri, 2 Sep 2016 10:55:29 +0800 Message-ID: <1472784939-14404-7-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1472784939-14404-1-git-send-email-zhaoshenglong@huawei.com> References: <1472784939-14404-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.0A0B0205.57C8EA51.00A0, 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: 1673e642029f86f296263ce2d47b656a Cc: 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 v5 06/16] 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 Acked-by: Julien Grall --- 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 83ad954..93ba2d1 100644 --- a/tools/libxl/libxl_arm_acpi.c +++ b/tools/libxl/libxl_arm_acpi.c @@ -161,6 +161,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, + size_t len, uint8_t rev) +{ + memcpy(h->signature, sig, 4); + h->length = len; + h->revision = rev; + memcpy(h->oem_id, ACPI_OEM_ID, sizeof(h->oem_id)); + memcpy(h->oem_table_id, ACPI_OEM_TABLE_ID, sizeof(h->oem_table_id)); + h->oem_revision = 0; + memcpy(h->asl_compiler_id, ACPI_ASL_COMPILER_ID, + sizeof(h->asl_compiler_id)); + h->asl_compiler_revision = 0; + 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 = (void *)dom->acpi_modules[0].data + 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) @@ -190,6 +219,7 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info, goto out; make_acpi_rsdp(gc, dom, acpitables); + make_acpi_xsdt(gc, dom, acpitables); out: return rc;