diff mbox

[v4,05/24] arm/acpi: Add a helper function to get the acpi table offset

Message ID 1456658360-16080-6-git-send-email-zhaoshenglong@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shannon Zhao Feb. 28, 2016, 11:19 a.m. UTC
From: Shannon Zhao <shannon.zhao@linaro.org>

These tables are aligned with 64bit.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
v4: aligned with 64bit
---
 xen/arch/arm/acpi/lib.c    | 14 ++++++++++++++
 xen/include/asm-arm/acpi.h |  2 ++
 2 files changed, 16 insertions(+)

Comments

Stefano Stabellini Feb. 29, 2016, 12:17 p.m. UTC | #1
On Sun, 28 Feb 2016, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
> 
> These tables are aligned with 64bit.
> 
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> ---
> v4: aligned with 64bit
> ---
>  xen/arch/arm/acpi/lib.c    | 14 ++++++++++++++
>  xen/include/asm-arm/acpi.h |  2 ++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/xen/arch/arm/acpi/lib.c b/xen/arch/arm/acpi/lib.c
> index 5698245..d5ac590 100644
> --- a/xen/arch/arm/acpi/lib.c
> +++ b/xen/arch/arm/acpi/lib.c
> @@ -62,3 +62,17 @@ bool_t __init acpi_psci_hvc_present(void)
>  {
>      return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_USE_HVC;
>  }
> +
> +unsigned int acpi_get_table_offset(struct membank tbl_add[], EFI_MEM_RES index)
> +{
> +    int i;
> +    unsigned int offset = 0;
> +
> +    for ( i = 0; i < index; i++ )
> +    {
> +        /* Aligned with 64bit (8 bytes) */
> +        offset += ROUNDUP(tbl_add[i].size, 8);
> +    }
> +
> +    return offset;

offset and the return type of this function need to be of the same type
of tbl_add[i].size, which is paddr_t (u64).


> +}
> diff --git a/xen/include/asm-arm/acpi.h b/xen/include/asm-arm/acpi.h
> index 7f59761..b507dca 100644
> --- a/xen/include/asm-arm/acpi.h
> +++ b/xen/include/asm-arm/acpi.h
> @@ -25,6 +25,7 @@
>  
>  #include <xen/init.h>
>  #include <asm/page.h>
> +#include <asm/setup.h>
>  
>  #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);
> +unsigned int acpi_get_table_offset(struct membank tbl_add[], EFI_MEM_RES index);
>  
>  #ifdef CONFIG_ACPI
>  extern bool_t acpi_disabled;
> -- 
> 2.0.4
> 
>
diff mbox

Patch

diff --git a/xen/arch/arm/acpi/lib.c b/xen/arch/arm/acpi/lib.c
index 5698245..d5ac590 100644
--- a/xen/arch/arm/acpi/lib.c
+++ b/xen/arch/arm/acpi/lib.c
@@ -62,3 +62,17 @@  bool_t __init acpi_psci_hvc_present(void)
 {
     return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_USE_HVC;
 }
+
+unsigned int acpi_get_table_offset(struct membank tbl_add[], EFI_MEM_RES index)
+{
+    int i;
+    unsigned int 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..b507dca 100644
--- a/xen/include/asm-arm/acpi.h
+++ b/xen/include/asm-arm/acpi.h
@@ -25,6 +25,7 @@ 
 
 #include <xen/init.h>
 #include <asm/page.h>
+#include <asm/setup.h>
 
 #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);
+unsigned int acpi_get_table_offset(struct membank tbl_add[], EFI_MEM_RES index);
 
 #ifdef CONFIG_ACPI
 extern bool_t acpi_disabled;