From patchwork Thu Sep 29 01:18:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 9355515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 81B0D6077A for ; Thu, 29 Sep 2016 01:22:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65B4D28E6B for ; Thu, 29 Sep 2016 01:22:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57267296CB; Thu, 29 Sep 2016 01:22:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E84BC28E6B for ; Thu, 29 Sep 2016 01:22:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpQ0n-0001P8-LY; Thu, 29 Sep 2016 01:19:45 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpQ0l-0001MJ-SU for xen-devel@lists.xen.org; Thu, 29 Sep 2016 01:19:43 +0000 Received: from [85.158.139.211] by server-15.bemta-5.messagelabs.com id 2E/13-01343-F2C6CE75; Thu, 29 Sep 2016 01:19:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRWlGSWpSXmKPExsVyMfSOoa5ezpt wg5mLmC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1owb1+6zFewSqJjybxVrA+MS3i5GLg4hgUmM ErsXT2YCcVgE5jFLfDuzCMyREOhnlfg08TWQwwnkxEjcfL+EDcKulrjUMRksLiSgJrHs8EJmC LuJSWLSBicQm01AR+LFpJ1g9SIC0hLXPl9mBBnKLHCEUeLW/JNADRwcwgJ2Ett+1ILUsAioSk z71csIEuYVsJb41ioEsUpTYvqs12DjOQVsJD60/IJaZS2x7NtmlgmMAgsYGVYxahSnFpWlFuk aGuslFWWmZ5TkJmbm6BoamOrlphYXJ6an5iQmFesl5+duYgQGFgMQ7GD8t83zEKMkB5OSKC+n z5twIb6k/JTKjMTijPii0pzU4kOMMhwcShK8V7KAcoJFqempFWmZOcAQh0lLcPAoifC+AknzF hck5hZnpkOkTjEac2z5fW0tE8e2qffWMgmx5OXnpUqJ8yaAlAqAlGaU5sENgsXeJUZZKWFeRq DThHgKUotyM0tQ5V8xinMwKgnzvgaZwpOZVwK37xXQKUxApyw98QLklJJEhJRUA2Nn2Iyiz3s 4j+6ant9rpjkx8KpuGf+rQ+/DP+z1sXl3ddL0e097js+YolakZZKjppzK6HRrzgTVOA0myYX6 xg83t9v/XahgeMak7I6HY09MerKmsMCx2vqFDkFB9ZpsNTODpgseS1nfErzTManFvzbGXoRnS 2zyLsErnT/NA66Ennx56sDpTCWW4oxEQy3mouJEAE+2sy64AgAA X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-5.tower-206.messagelabs.com!1475111979!60438374!1 X-Originating-IP: [209.85.220.49] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 39394 invoked from network); 29 Sep 2016 01:19:40 -0000 Received: from mail-pa0-f49.google.com (HELO mail-pa0-f49.google.com) (209.85.220.49) by server-5.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 29 Sep 2016 01:19:40 -0000 Received: by mail-pa0-f49.google.com with SMTP id cd13so18647325pac.0 for ; Wed, 28 Sep 2016 18:19:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/5dGSOWqGu8i1XjBTXj7s7p9ZivZwHsq0XDLlmAlxD4=; b=UNb/codIYmCugNWBbWfG010dzJnRIVDN2u9llGgaFocL7PspPtxPPM7LSPdDAQELNP 56dckefqNTLiks2Xhh5Fa0TYtY1eeNIOkjGb3+aUg43QHOeZ7fxA6s/IR3AT6ucDbo22 ScKfSYGxcCD/dOECgECh6IMmoq5vnfOgqlEc8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/5dGSOWqGu8i1XjBTXj7s7p9ZivZwHsq0XDLlmAlxD4=; b=ZX4KgGP1Z8f5N0OR5w9JJfWi6uJpLH9QZ++ofKbr4050+FUgn2uJ6i8DiGwLovwpQP eSBmj8GhNdgrXhxikCQHh0uUa6TQ/hWiJdoDHP+dT2UPDaYwtSRQL4K52SLlqPbA+O8J RICidocW09AUIASIGNG9GbOMKhgjDNbXNaVfVIsu+UnnqFRv3COTxmN4yKxYPjrC8Wdp nEqqEujim9TcYrBQ86lgmFETZAkg+N+eJjoM9nqz7COVcGF4yxlH/X7SJCLaK8lVDviJ lF2NXoviUJZ72nbMHwczr/wqfrzip5i/5PKkGOJFGUFBidK4fDh4EjC6m00hyEdDcGBA VeXg== X-Gm-Message-State: AE9vXwPuDTaQPV6MuKf43fEDbRp8aTo0v887P4n0+W1WN4/QrxrC6PdhKIHHyRps5veIowNB X-Received: by 10.66.217.170 with SMTP id oz10mr62396098pac.61.1475111979345; Wed, 28 Sep 2016 18:19:39 -0700 (PDT) Received: from HZA160860128-A.china.huawei.com ([67.238.99.186]) by smtp.gmail.com with ESMTPSA id wd7sm15228744pab.2.2016.09.28.18.19.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Sep 2016 18:19:38 -0700 (PDT) From: Shannon Zhao To: xen-devel@lists.xen.org Date: Wed, 28 Sep 2016 18:18:52 -0700 Message-Id: <20160929011902.7784-7-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.10.0.windows.1 In-Reply-To: <20160929011902.7784-1-shannon.zhao@linaro.org> References: <20160929011902.7784-1-shannon.zhao@linaro.org> Cc: sstabellini@kernel.org, wei.liu2@citrix.com, ian.jackson@eu.citrix.com, julien.grall@arm.com, Shannon Zhao , zhaoshenglong@huawei.com, boris.ostrovsky@oracle.com Subject: [Xen-devel] [PATCH v8 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Shannon Zhao Acked-by: Julien Grall Acked-by: Wei Liu --- 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 0512630..ab68bf8 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, struct xc_dom_image *dom) { @@ -186,6 +215,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;