diff mbox series

[Xen-devel,8/8] xen/arm: acpi: Move the ACPI banks in bootinfo

Message ID 1486149538-20432-15-git-send-email-julien.grall@arm.com
State Superseded
Headers show
Series xen/arm: Fix and clean-up for ACPI and EFI | expand

Commit Message

Julien Grall Feb. 3, 2017, 7:18 p.m. UTC
Currently the acpi banks are stored in a separate variable and have an
header just for them.

This variable can be moved in the structure bootinfo removing an header
and a global variable.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/efi/efi-boot.h |  3 +--
 xen/arch/arm/efi/efi-dom0.c | 12 +++++-------
 xen/arch/arm/efi/efi-dom0.h |  8 --------
 xen/include/asm-arm/setup.h |  3 +++
 4 files changed, 9 insertions(+), 17 deletions(-)
 delete mode 100644 xen/arch/arm/efi/efi-dom0.h

Comments

Stefano Stabellini Feb. 16, 2017, 2 a.m. UTC | #1
On Fri, 3 Feb 2017, Julien Grall wrote:
> Currently the acpi banks are stored in a separate variable and have an
> header just for them.
> 
> This variable can be moved in the structure bootinfo removing an header
> and a global variable.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  xen/arch/arm/efi/efi-boot.h |  3 +--
>  xen/arch/arm/efi/efi-dom0.c | 12 +++++-------
>  xen/arch/arm/efi/efi-dom0.h |  8 --------
>  xen/include/asm-arm/setup.h |  3 +++
>  4 files changed, 9 insertions(+), 17 deletions(-)
>  delete mode 100644 xen/arch/arm/efi/efi-dom0.h
> 
> diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
> index 757d9c6..2e3e169 100644
> --- a/xen/arch/arm/efi/efi-boot.h
> +++ b/xen/arch/arm/efi/efi-boot.h
> @@ -7,7 +7,6 @@
>  #include <xen/libfdt/libfdt.h>
>  #include <asm/setup.h>
>  #include <asm/smp.h>
> -#include "efi-dom0.h"
>  
>  void noreturn efi_xen_start(void *fdt_ptr, uint32_t fdt_size);
>  void __flush_dcache_area(const void *vaddr, unsigned long size);
> @@ -164,7 +163,7 @@ static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *
>  #ifdef CONFIG_ACPI
>          else if ( desc_ptr->Type == EfiACPIReclaimMemory )
>          {
> -            if ( !meminfo_add_bank(&acpi_mem, desc_ptr) )
> +            if ( !meminfo_add_bank(&bootinfo.acpi, desc_ptr) )
>              {
>                  PrintStr(L"Error: All " __stringify(NR_MEM_BANKS)
>                            " acpi meminfo mem banks exhausted.\r\n");
> diff --git a/xen/arch/arm/efi/efi-dom0.c b/xen/arch/arm/efi/efi-dom0.c
> index f0ceaa6..1c35654 100644
> --- a/xen/arch/arm/efi/efi-dom0.c
> +++ b/xen/arch/arm/efi/efi-dom0.c
> @@ -22,7 +22,6 @@
>   */
>  
>  #include "efi.h"
> -#include "efi-dom0.h"
>  #include <xen/sched.h>
>  #include <xen/pfn.h>
>  #include <xen/libfdt/libfdt.h>
> @@ -32,7 +31,6 @@
>  #define XZ_EXTERN STATIC
>  #include "../../../common/xz/crc32.c"
>  
> -struct meminfo __initdata acpi_mem;
>  /* Constant to indicate "Xen" in unicode u16 format */
>  static const CHAR16 xen_efi_fw_vendor[] = {0x0058, 0x0065, 0x006E, 0x0000};
>  
> @@ -46,7 +44,7 @@ size_t __init estimate_efi_size(int mem_nr_banks)
>      int acpi_mem_nr_banks = 0;
>  
>      if ( !acpi_disabled )
> -        acpi_mem_nr_banks = acpi_mem.nr_banks;
> +        acpi_mem_nr_banks = bootinfo.acpi.nr_banks;
>  
>      size = ROUNDUP(est_size + ect_size + fw_vendor_size, 8);
>      /* plus 1 for new created tables */
> @@ -124,10 +122,10 @@ void __init acpi_create_efi_mmap_table(struct domain *d,
>          fill_efi_memory_descriptor(desc, EfiConventionalMemory,
>                                     mem->bank[i].start, mem->bank[i].size);
>  
> -    for ( i = 0; i < acpi_mem.nr_banks; i++, desc++ )
> +    for ( i = 0; i < bootinfo.acpi.nr_banks; i++, desc++ )
>          fill_efi_memory_descriptor(desc, EfiACPIReclaimMemory,
> -                                   acpi_mem.bank[i].start,
> -                                   acpi_mem.bank[i].size);
> +                                   bootinfo.acpi.bank[i].start,
> +                                   bootinfo.acpi.bank[i].size);
>  
>      fill_efi_memory_descriptor(desc, EfiACPIReclaimMemory,
>                                 d->arch.efi_acpi_gpa, d->arch.efi_acpi_len);
> @@ -135,7 +133,7 @@ void __init acpi_create_efi_mmap_table(struct domain *d,
>      tbl_add[TBL_MMAP].start = d->arch.efi_acpi_gpa
>                                + acpi_get_table_offset(tbl_add, TBL_MMAP);
>      tbl_add[TBL_MMAP].size = sizeof(EFI_MEMORY_DESCRIPTOR)
> -                             * (mem->nr_banks + acpi_mem.nr_banks + 1);
> +                             * (mem->nr_banks + bootinfo.acpi.nr_banks + 1);
>  }
>  
>  /* Create /hypervisor/uefi node for efi properties. */
> diff --git a/xen/arch/arm/efi/efi-dom0.h b/xen/arch/arm/efi/efi-dom0.h
> deleted file mode 100644
> index 3cd4caa..0000000
> --- a/xen/arch/arm/efi/efi-dom0.h
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -#ifndef __ARM_EFI_DOM0_H__
> -#define __ARM_EFI_DOM0_H__
> -
> -#include <asm/setup.h>
> -
> -extern struct meminfo acpi_mem;
> -
> -#endif
> diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h
> index 3da7a49..7c76185 100644
> --- a/xen/include/asm-arm/setup.h
> +++ b/xen/include/asm-arm/setup.h
> @@ -43,6 +43,9 @@ struct bootmodules {
>  struct bootinfo {
>      struct meminfo mem;
>      struct bootmodules modules;
> +#ifdef CONFIG_ACPI
> +    struct meminfo acpi;
> +#endif
>  };
>  
>  extern struct bootinfo bootinfo;
> -- 
> 1.9.1
>
diff mbox series

Patch

diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
index 757d9c6..2e3e169 100644
--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -7,7 +7,6 @@ 
 #include <xen/libfdt/libfdt.h>
 #include <asm/setup.h>
 #include <asm/smp.h>
-#include "efi-dom0.h"
 
 void noreturn efi_xen_start(void *fdt_ptr, uint32_t fdt_size);
 void __flush_dcache_area(const void *vaddr, unsigned long size);
@@ -164,7 +163,7 @@  static EFI_STATUS __init efi_process_memory_map_bootinfo(EFI_MEMORY_DESCRIPTOR *
 #ifdef CONFIG_ACPI
         else if ( desc_ptr->Type == EfiACPIReclaimMemory )
         {
-            if ( !meminfo_add_bank(&acpi_mem, desc_ptr) )
+            if ( !meminfo_add_bank(&bootinfo.acpi, desc_ptr) )
             {
                 PrintStr(L"Error: All " __stringify(NR_MEM_BANKS)
                           " acpi meminfo mem banks exhausted.\r\n");
diff --git a/xen/arch/arm/efi/efi-dom0.c b/xen/arch/arm/efi/efi-dom0.c
index f0ceaa6..1c35654 100644
--- a/xen/arch/arm/efi/efi-dom0.c
+++ b/xen/arch/arm/efi/efi-dom0.c
@@ -22,7 +22,6 @@ 
  */
 
 #include "efi.h"
-#include "efi-dom0.h"
 #include <xen/sched.h>
 #include <xen/pfn.h>
 #include <xen/libfdt/libfdt.h>
@@ -32,7 +31,6 @@ 
 #define XZ_EXTERN STATIC
 #include "../../../common/xz/crc32.c"
 
-struct meminfo __initdata acpi_mem;
 /* Constant to indicate "Xen" in unicode u16 format */
 static const CHAR16 xen_efi_fw_vendor[] = {0x0058, 0x0065, 0x006E, 0x0000};
 
@@ -46,7 +44,7 @@  size_t __init estimate_efi_size(int mem_nr_banks)
     int acpi_mem_nr_banks = 0;
 
     if ( !acpi_disabled )
-        acpi_mem_nr_banks = acpi_mem.nr_banks;
+        acpi_mem_nr_banks = bootinfo.acpi.nr_banks;
 
     size = ROUNDUP(est_size + ect_size + fw_vendor_size, 8);
     /* plus 1 for new created tables */
@@ -124,10 +122,10 @@  void __init acpi_create_efi_mmap_table(struct domain *d,
         fill_efi_memory_descriptor(desc, EfiConventionalMemory,
                                    mem->bank[i].start, mem->bank[i].size);
 
-    for ( i = 0; i < acpi_mem.nr_banks; i++, desc++ )
+    for ( i = 0; i < bootinfo.acpi.nr_banks; i++, desc++ )
         fill_efi_memory_descriptor(desc, EfiACPIReclaimMemory,
-                                   acpi_mem.bank[i].start,
-                                   acpi_mem.bank[i].size);
+                                   bootinfo.acpi.bank[i].start,
+                                   bootinfo.acpi.bank[i].size);
 
     fill_efi_memory_descriptor(desc, EfiACPIReclaimMemory,
                                d->arch.efi_acpi_gpa, d->arch.efi_acpi_len);
@@ -135,7 +133,7 @@  void __init acpi_create_efi_mmap_table(struct domain *d,
     tbl_add[TBL_MMAP].start = d->arch.efi_acpi_gpa
                               + acpi_get_table_offset(tbl_add, TBL_MMAP);
     tbl_add[TBL_MMAP].size = sizeof(EFI_MEMORY_DESCRIPTOR)
-                             * (mem->nr_banks + acpi_mem.nr_banks + 1);
+                             * (mem->nr_banks + bootinfo.acpi.nr_banks + 1);
 }
 
 /* Create /hypervisor/uefi node for efi properties. */
diff --git a/xen/arch/arm/efi/efi-dom0.h b/xen/arch/arm/efi/efi-dom0.h
deleted file mode 100644
index 3cd4caa..0000000
--- a/xen/arch/arm/efi/efi-dom0.h
+++ /dev/null
@@ -1,8 +0,0 @@ 
-#ifndef __ARM_EFI_DOM0_H__
-#define __ARM_EFI_DOM0_H__
-
-#include <asm/setup.h>
-
-extern struct meminfo acpi_mem;
-
-#endif
diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h
index 3da7a49..7c76185 100644
--- a/xen/include/asm-arm/setup.h
+++ b/xen/include/asm-arm/setup.h
@@ -43,6 +43,9 @@  struct bootmodules {
 struct bootinfo {
     struct meminfo mem;
     struct bootmodules modules;
+#ifdef CONFIG_ACPI
+    struct meminfo acpi;
+#endif
 };
 
 extern struct bootinfo bootinfo;