diff mbox

[v5,02/22] arm/acpi: Add a helper function to get the acpi table offset

Message ID 1457072152-16128-3-git-send-email-zhaoshenglong@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shannon Zhao March 4, 2016, 6:15 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>
---
v5: make the return value type and variable type consistent
---
 xen/arch/arm/acpi/lib.c    | 15 +++++++++++++++
 xen/include/asm-arm/acpi.h |  6 ++++++
 2 files changed, 21 insertions(+)

Comments

Stefano Stabellini March 4, 2016, 10:59 a.m. UTC | #1
On Fri, 4 Mar 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>
> ---
> v5: make the return value type and variable type consistent
> ---
>  xen/arch/arm/acpi/lib.c    | 15 +++++++++++++++
>  xen/include/asm-arm/acpi.h |  6 ++++++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/xen/arch/arm/acpi/lib.c b/xen/arch/arm/acpi/lib.c
> index db5c4d8..79f7edd 100644
> --- a/xen/arch/arm/acpi/lib.c
> +++ b/xen/arch/arm/acpi/lib.c
> @@ -60,3 +60,18 @@ bool_t __init acpi_psci_hvc_present(void)
>  {
>      return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_USE_HVC;
>  }
> +
> +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..6db3711 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
> @@ -58,10 +59,15 @@ static inline void enable_acpi(void)
>  {
>      acpi_disabled = 0;
>  }
> +
> +paddr_t acpi_get_table_offset(struct membank tbl_add[], EFI_MEM_RES index);
>  #else
>  #define acpi_disabled (1)
>  #define disable_acpi()
>  #define enable_acpi()
> +paddr_t inline acpi_get_table_offset(struct membank tbl_add[],
> +                                     EFI_MEM_RES index)
> +{ return 0; }

Why did you move the declaration of acpi_get_table_offset to within the
ifdef?  It was just above the ifdef in the previous version of the
patch.


>  #endif
>  
>  #endif /*_ASM_ARM_ACPI_H*/
> -- 
> 2.0.4
> 
>
Shannon Zhao March 4, 2016, 3:12 p.m. UTC | #2
On 2016?03?04? 18:59, Stefano Stabellini wrote:
>> diff --git a/xen/include/asm-arm/acpi.h b/xen/include/asm-arm/acpi.h
>> > index 7f59761..6db3711 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
>> > @@ -58,10 +59,15 @@ static inline void enable_acpi(void)
>> >  {
>> >      acpi_disabled = 0;
>> >  }
>> > +
>> > +paddr_t acpi_get_table_offset(struct membank tbl_add[], EFI_MEM_RES index);
>> >  #else
>> >  #define acpi_disabled (1)
>> >  #define disable_acpi()
>> >  #define enable_acpi()
>> > +paddr_t inline acpi_get_table_offset(struct membank tbl_add[],
>> > +                                     EFI_MEM_RES index)
>> > +{ return 0; }
> Why did you move the declaration of acpi_get_table_offset to within the
> ifdef?  It was just above the ifdef in the previous version of the
> patch.
> 
If we don't do this, when we compile Xen just only apply the first 11
patches of this series and since the acpi_create_efi_system_table is not
covered by #ifdef CONFIG_ACPI, it will throw out an error says something
like "acpi_get_table_offset not defined".

Thanks,
diff mbox

Patch

diff --git a/xen/arch/arm/acpi/lib.c b/xen/arch/arm/acpi/lib.c
index db5c4d8..79f7edd 100644
--- a/xen/arch/arm/acpi/lib.c
+++ b/xen/arch/arm/acpi/lib.c
@@ -60,3 +60,18 @@  bool_t __init acpi_psci_hvc_present(void)
 {
     return acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_USE_HVC;
 }
+
+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..6db3711 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
@@ -58,10 +59,15 @@  static inline void enable_acpi(void)
 {
     acpi_disabled = 0;
 }
+
+paddr_t acpi_get_table_offset(struct membank tbl_add[], EFI_MEM_RES index);
 #else
 #define acpi_disabled (1)
 #define disable_acpi()
 #define enable_acpi()
+paddr_t inline acpi_get_table_offset(struct membank tbl_add[],
+                                     EFI_MEM_RES index)
+{ return 0; }
 #endif
 
 #endif /*_ASM_ARM_ACPI_H*/