From patchwork Fri Mar 25 13:48:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 64467 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp183241lbc; Fri, 25 Mar 2016 06:50:48 -0700 (PDT) X-Received: by 10.140.92.180 with SMTP id b49mr17388950qge.81.1458913847600; Fri, 25 Mar 2016 06:50:47 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id h33si10791666qgh.81.2016.03.25.06.50.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Mar 2016 06:50:47 -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; dkim=neutral (body hash did not verify) header.i=@linaro.org; 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 1ajS7B-0000yg-EE; Fri, 25 Mar 2016 13:49:25 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ajS7A-0000yX-OZ for xen-devel@lists.xen.org; Fri, 25 Mar 2016 13:49:24 +0000 Received: from [85.158.139.211] by server-7.bemta-5.messagelabs.com id 34/8C-22167-3E145F65; Fri, 25 Mar 2016 13:49:23 +0000 X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-7.tower-206.messagelabs.com!1458913761!31155127!1 X-Originating-IP: [209.85.192.172] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 36868 invoked from network); 25 Mar 2016 13:49:23 -0000 Received: from mail-pf0-f172.google.com (HELO mail-pf0-f172.google.com) (209.85.192.172) by server-7.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 25 Mar 2016 13:49:23 -0000 Received: by mail-pf0-f172.google.com with SMTP id x3so83269367pfb.1 for ; Fri, 25 Mar 2016 06:49:22 -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=seudsau+VV1FdZDgfGDLC/iJ9PXYrWXsOxBgrjYCpGM=; b=D6ituIegjYeBQps+qQz473f7QfRMiwPc5ullkaWUBIB/7p1gp4A+u+Oi2oy4DmU0SW jWqfdbv1R7yl5s8foOv1u29sXX2AnIxkUU9amVSlNI7AYYcufzRYx/04mmcKR/ovxIlF hDnxiz0XdGT7cYdSEGFnGIHBuHgmOBYp/M9n4= 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=seudsau+VV1FdZDgfGDLC/iJ9PXYrWXsOxBgrjYCpGM=; b=TKylFABAHsC52rDEE6EcVFZ67QtJdBcIT9gHYu62uev1eJsgxktEhpgmmSKpuUAMNp 9Nr26nIjz+H63zY6oIws4JEcuyg5nNR2fp+O6Vakw9dAV7KLpUDrWFSNmESDiT36dkv9 FPec+C2gO5fPqzvUYwzkGcZQbrlLyyu7oE/TJjdxM0bszFCxYmmVz+JLfmCg3NjiAWb/ OUL5P5eAfhjqIrWmdsF0AEZFURHve2YyBltS9T/qdddLIhK5efZ7wLwoyyc8ibgShoPE 3IFgNDBLJ67whHp5SQDu5nwWQdRgssHv5Oh0eZjdk+LNLRmtEGMP3nLhbIynFfk+Rsmb ABuw== X-Gm-Message-State: AD7BkJKvvSuGgRmcAeYIgLKG9t5JoTuB8vsZKt6zijJhgZJyGkb/2zR/qrdhdwbdrk6h0zmf X-Received: by 10.98.13.130 with SMTP id 2mr21235682pfn.97.1458913761464; Fri, 25 Mar 2016 06:49:21 -0700 (PDT) Received: from localhost.localdomain ([45.56.152.2]) by smtp.gmail.com with ESMTPSA id w20sm16744178pfi.31.2016.03.25.06.49.16 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 Mar 2016 06:49:20 -0700 (PDT) From: Shannon Zhao To: xen-devel@lists.xen.org Date: Fri, 25 Mar 2016 21:48:35 +0800 Message-Id: <1458913735-2678-3-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 02/22] arm/acpi: Add a helper function to get the acpi table offset 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" These tables are aligned with 64bit. Signed-off-by: Shannon Zhao Reviewed-by: Stefano Stabellini --- v7: add commnets to explain what thsi function does --- xen/arch/arm/acpi/lib.c | 20 ++++++++++++++++++++ xen/include/asm-arm/acpi.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/xen/arch/arm/acpi/lib.c b/xen/arch/arm/acpi/lib.c index db5c4d8..cee2454 100644 --- a/xen/arch/arm/acpi/lib.c +++ b/xen/arch/arm/acpi/lib.c @@ -60,3 +60,23 @@ bool_t __init acpi_psci_hvc_present(void) { return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_USE_HVC; } + +/* + * This function is used to get the offset of some new created ACPI or EFI table + * in the allocated memory region. Currently the tables should be created in the + * order of enum EFI_MEM_RES. + */ +paddr_t __init acpi_get_table_offset(struct membank tbl_add[], + EFI_MEM_RES index) +{ + int i; + paddr_t offset = 0; + + for ( i = 0; i < index; i++ ) + { + /* Aligned with 64bit (8 bytes) */ + offset += ROUNDUP(tbl_add[i].size, 8); + } + + return offset; +} diff --git a/xen/include/asm-arm/acpi.h b/xen/include/asm-arm/acpi.h index 7f59761..569fc31 100644 --- a/xen/include/asm-arm/acpi.h +++ b/xen/include/asm-arm/acpi.h @@ -25,6 +25,7 @@ #include #include +#include #define COMPILER_DEPENDENT_INT64 long long #define COMPILER_DEPENDENT_UINT64 unsigned long long @@ -45,6 +46,7 @@ typedef enum { bool_t __init acpi_psci_present(void); bool_t __init acpi_psci_hvc_present(void); void __init acpi_smp_init_cpus(void); +paddr_t acpi_get_table_offset(struct membank tbl_add[], EFI_MEM_RES index); #ifdef CONFIG_ACPI extern bool_t acpi_disabled;