From patchwork Fri Mar 25 13:48:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 8671751 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 60DF6C0555 for ; Fri, 25 Mar 2016 13:52:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 822BC2038D for ; Fri, 25 Mar 2016 13:52:10 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 8900D20351 for ; Fri, 25 Mar 2016 13:52:09 +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 1ajS7b-0001Db-3l; Fri, 25 Mar 2016 13:49:51 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ajS7Z-0001CO-Rs for xen-devel@lists.xen.org; Fri, 25 Mar 2016 13:49:49 +0000 Received: from [193.109.254.147] by server-2.bemta-14.messagelabs.com id 6D/37-03301-DF145F65; Fri, 25 Mar 2016 13:49:49 +0000 X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-12.tower-27.messagelabs.com!1458913786!33718276!1 X-Originating-IP: [209.85.220.44] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10461 invoked from network); 25 Mar 2016 13:49:48 -0000 Received: from mail-pa0-f44.google.com (HELO mail-pa0-f44.google.com) (209.85.220.44) by server-12.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 25 Mar 2016 13:49:48 -0000 Received: by mail-pa0-f44.google.com with SMTP id fl4so46871227pad.0 for ; Fri, 25 Mar 2016 06:49:48 -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=iPfL+ld13KtTMyi0sO1Fd4JEWxRC8stnEiGM1QyKxx4=; b=FMvw8sW8tXq+ccWFCqxPxMYSXxn0WNnJehlgw+LS4lifp5WlJa1W1yVEThAsFhmCgz sFRfv1/+2xtKXbCDd9pMt9FjyKLZX8feUfgXksyvd/LsxBNwiepp+L6y0tlwGVjU7E7Z 1FbzfCDIiuXN2XTWgkCqCOvZr93GnDgEvGyhg= 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=iPfL+ld13KtTMyi0sO1Fd4JEWxRC8stnEiGM1QyKxx4=; b=KV/AxuLdcGjkyip/nnzLjoQ1a5aZVk3dRH1+rxXDNJnfliJ+ETdP2uCTON8yS5uy6L MOLAjaUCg+Lk6jXo4eB+hX4nRYU2yE1dYJ8BeZ5k86Jo+oy5ycFpW455xqYSKC1ZO/2A srSRPoF/qaXRssWTK1QAs5Rjzs8YxwtPR6nv8Ef3qaobqwD9g42OZybLDrAjn9tTXMXN Bh/5X+06HD6RMKZ61WDLO1f6VqJWpBI/E8JLV/QV05acYqL6l4FH/cOFS8Xd+reZmrA3 7Ywp3DuKsIw+qx1+07FYvm+t73nSyS+QSnFCzaeEUiZp/k+twUOQmK17BJkApHTUMNDb RFHQ== X-Gm-Message-State: AD7BkJLcS94YAZB+/5j9bUinnAbV+c6ZxnNuqwzSSrVIjfoozeU2QOGRm6diFxvd++a5LGLh X-Received: by 10.66.100.228 with SMTP id fb4mr20966849pab.84.1458913786423; Fri, 25 Mar 2016 06:49:46 -0700 (PDT) Received: from localhost.localdomain ([45.56.152.2]) by smtp.gmail.com with ESMTPSA id w20sm16744178pfi.31.2016.03.25.06.49.42 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 Mar 2016 06:49:45 -0700 (PDT) From: Shannon Zhao To: xen-devel@lists.xen.org Date: Fri, 25 Mar 2016 21:48:41 +0800 Message-Id: <1458913735-2678-9-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458913735-2678-1-git-send-email-shannon.zhao@linaro.org> References: <1458913735-2678-1-git-send-email-shannon.zhao@linaro.org> Cc: julien.grall@arm.com, shannon.zhao@linaro.org, stefano.stabellini@citrix.com, peter.huangpeng@huawei.com, zhaoshenglong@huawei.com Subject: [Xen-devel] [PATCH v7 08/22] arm/acpi: Prepare RSDP table for Dom0 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-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Copy RSDP table and replace rsdp->xsdt_physical_address with the address of XSDT table, so it can point to the right XSDT table. Signed-off-by: Shannon Zhao Acked-by: Stefano Stabellini Acked-by: Julien Grall --- xen/arch/arm/domain_build.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index cd501ff..eeb1359 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1357,6 +1357,40 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo) } #ifdef CONFIG_ACPI +static int acpi_create_rsdp(struct domain *d, struct membank tbl_add[]) +{ + + struct acpi_table_rsdp *rsdp = NULL; + u64 addr; + u64 table_size = sizeof(struct acpi_table_rsdp); + u8 *base_ptr; + u8 checksum; + + addr = acpi_os_get_root_pointer(); + if ( !addr ) + { + printk("Unable to get acpi root pointer\n"); + return -EINVAL; + } + rsdp = acpi_os_map_memory(addr, table_size); + base_ptr = d->arch.efi_acpi_table + + acpi_get_table_offset(tbl_add, TBL_RSDP); + ACPI_MEMCPY(base_ptr, rsdp, table_size); + acpi_os_unmap_memory(rsdp, table_size); + + rsdp = (struct acpi_table_rsdp *)base_ptr; + /* Replace xsdt_physical_address */ + rsdp->xsdt_physical_address = tbl_add[TBL_XSDT].start; + checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, rsdp), table_size); + rsdp->checksum = rsdp->checksum - checksum; + + tbl_add[TBL_RSDP].start = d->arch.efi_acpi_gpa + + acpi_get_table_offset(tbl_add, TBL_RSDP); + tbl_add[TBL_RSDP].size = table_size; + + return 0; +} + static void acpi_xsdt_modify_entry(u64 entry[], unsigned long entry_count, char *signature, u64 addr) { @@ -1657,6 +1691,10 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) if ( rc != 0 ) return rc; + rc = acpi_create_rsdp(d, tbl_add); + if ( rc != 0 ) + return rc; + return 0; } #else