From patchwork Thu Sep 22 12:52:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 76779 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp14728qgf; Thu, 22 Sep 2016 05:55:19 -0700 (PDT) X-Received: by 10.36.137.193 with SMTP id s184mr10960751itd.51.1474548919428; Thu, 22 Sep 2016 05:55:19 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id o19si1975217ioo.214.2016.09.22.05.55.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Sep 2016 05:55:19 -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 1bn3VR-00047L-Bt; Thu, 22 Sep 2016 12:53:37 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bn3VQ-00046B-8b for xen-devel@lists.xen.org; Thu, 22 Sep 2016 12:53:36 +0000 Received: from [85.158.139.211] by server-2.bemta-5.messagelabs.com id 6D/DE-15996-F44D3E75; Thu, 22 Sep 2016 12:53:35 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsVSPpHPSdf/yuN wg4alrBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8aWZa1sBe8EKo4/WsjcwLiXt4uRi0NI4Ayj xMaG7ywQzh5Gia0HXjF2MXJysAloSZyf/oMdxBYRkJVY3TWHHaSIWeA6o8Sd99tYQRLCAnYSn Rt+s4HYLAKqEr37ZrKA2LwCHhLPni8Aq5EQ0JBY2TsBLM4p4Ckx4ch6sLgQUM3KKwtZIeoFJU 7OfAJWwywgIXHwxQtmiF5Fibb1J9kgbEmJgytugF0qIXCKUaJ/709GiISpxPIn+5knMArOQjJ rFpJZCxiZVjGqF6cWlaUW6ZrqJRVlpmeU5CZm5ugaGpjq5aYWFyemp+YkJhXrJefnbmIEhigD EOxg/NLvfIhRkoNJSZT3Qv/jcCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvI8vAeUEi1LTUyvSM nOA0QKTluDgURLhdQZJ8xYXJOYWZ6ZDpE4xKkqJ8/4GSQiAJDJK8+DaYBF6iVFWSpiXEegQIZ 6C1KLczBJU+VeM4hyMSsK8YpeBpvBk5pXATX8FtJgJaPGWnw9AFpckIqSkGhiXNO5wD+bmM/4 oKCEgFbJM1SB4fup0h+Q+u1XRyv83H85wZi/XUg521BHb+bZvwWP2e0Z16aFWV7QKHmZ0zP18 uVrtbqdFjOjVD2pL9a7LK0QprtLKVZkd9eWJSmXEyUmadZr3lA3lk6fXCNdWzPE4Zr5DR/9wf cZanjhljccHF0VPvRw7U4mlOCPRUIu5qDgRAHNRtQLLAgAA X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-9.tower-206.messagelabs.com!1474548809!61046788!1 X-Originating-IP: [119.145.14.66] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTE5LjE0NS4xNC42NiA9PiA4NTI3\n X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 56808 invoked from network); 22 Sep 2016 12:53:34 -0000 Received: from szxga03-in.huawei.com (HELO szxga03-in.huawei.com) (119.145.14.66) by server-9.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 22 Sep 2016 12:53:34 -0000 Received: from 172.24.1.137 (EHLO szxeml431-hub.china.huawei.com) ([172.24.1.137]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id CIG48133; Thu, 22 Sep 2016 20:53:05 +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; Thu, 22 Sep 2016 20:52:53 +0800 From: z00226004 To: Date: Thu, 22 Sep 2016 20:52:23 +0800 Message-ID: <1474548753-12596-7-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1474548753-12596-1-git-send-email-zhaoshenglong@huawei.com> References: <1474548753-12596-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.0A020205.57E3D431.0262, 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: 653c13c089dd2b3fd0541c43ff10bc22 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 v6 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 421128a..eb62096 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;