diff mbox

[10/33] pc: acpi: simplify build_legacy_cpu_hotplug_aml() signature

Message ID 1463496205-251412-11-git-send-email-imammedo@redhat.com
State New
Headers show

Commit Message

Igor Mammedov May 17, 2016, 2:43 p.m. UTC
since IO block used by CPU hotplug is fixed size and
initialized it the same file as build_legacy_cpu_hotplug_aml()
just use ACPI_GPE_PROC_LEN directly instead of passing
it around in several files.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/cpu_hotplug.c         | 6 +++---
 hw/i386/acpi-build.c          | 5 +----
 include/hw/acpi/cpu_hotplug.h | 2 +-
 3 files changed, 5 insertions(+), 8 deletions(-)

Comments

Marcel Apfelbaum May 30, 2016, 6:31 p.m. UTC | #1
On 05/17/2016 05:43 PM, Igor Mammedov wrote:
> since IO block used by CPU hotplug is fixed size and
> initialized it the same file as build_legacy_cpu_hotplug_aml()
> just use ACPI_GPE_PROC_LEN directly instead of passing
> it around in several files.
>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/cpu_hotplug.c         | 6 +++---
>   hw/i386/acpi-build.c          | 5 +----
>   include/hw/acpi/cpu_hotplug.h | 2 +-
>   3 files changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
> index 2d4e034..36ea6c2 100644
> --- a/hw/acpi/cpu_hotplug.c
> +++ b/hw/acpi/cpu_hotplug.c
> @@ -87,7 +87,7 @@ void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
>   }
>
>   void build_legacy_cpu_hotplug_aml(Aml *ctx, MachineState *machine,
> -                                  uint16_t io_base, uint16_t io_len)
> +                                  uint16_t io_base)
>   {
>       Aml *dev;
>       Aml *crs;
> @@ -226,13 +226,13 @@ void build_legacy_cpu_hotplug_aml(Aml *ctx, MachineState *machine,
>       aml_append(dev, aml_name_decl("_STA", aml_int(0xB)));
>       crs = aml_resource_template();
>       aml_append(crs,
> -        aml_io(AML_DECODE16, io_base, io_base, 1, io_len)
> +        aml_io(AML_DECODE16, io_base, io_base, 1, ACPI_GPE_PROC_LEN)
>       );
>       aml_append(dev, aml_name_decl("_CRS", crs));
>       aml_append(sb_scope, dev);
>       /* declare CPU hotplug MMIO region and PRS field to access it */
>       aml_append(sb_scope, aml_operation_region(
> -        "PRST", AML_SYSTEM_IO, aml_int(io_base), io_len));
> +        "PRST", AML_SYSTEM_IO, aml_int(io_base), ACPI_GPE_PROC_LEN));
>       field = aml_field("PRST", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
>       aml_append(field, aml_named_field("PRS", 256));
>       aml_append(sb_scope, field);
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 2f6de43..b33fec9 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -94,7 +94,6 @@ typedef struct AcpiPmInfo {
>       uint32_t gpe0_blk_len;
>       uint32_t io_base;
>       uint16_t cpu_hp_io_base;
> -    uint16_t cpu_hp_io_len;
>       uint16_t mem_hp_io_base;
>       uint16_t mem_hp_io_len;
>       uint16_t pcihp_io_base;
> @@ -142,7 +141,6 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)
>       }
>       assert(obj);
>
> -    pm->cpu_hp_io_len = ACPI_GPE_PROC_LEN;
>       pm->mem_hp_io_base = ACPI_MEMORY_HOTPLUG_BASE;
>       pm->mem_hp_io_len = ACPI_MEMORY_HOTPLUG_IO_LEN;
>
> @@ -1935,8 +1933,7 @@ build_dsdt(GArray *table_data, GArray *linker,
>           build_q35_pci0_int(dsdt);
>       }
>
> -    build_legacy_cpu_hotplug_aml(dsdt, machine, pm->cpu_hp_io_base,
> -                                 pm->cpu_hp_io_len);
> +    build_legacy_cpu_hotplug_aml(dsdt, machine, pm->cpu_hp_io_base);
>       build_memory_hotplug_aml(dsdt, nr_mem, pm->mem_hp_io_base,
>                                pm->mem_hp_io_len);
>
> diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h
> index 241b50f..6d729d8 100644
> --- a/include/hw/acpi/cpu_hotplug.h
> +++ b/include/hw/acpi/cpu_hotplug.h
> @@ -28,5 +28,5 @@ void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
>                                     AcpiCpuHotplug *gpe_cpu, uint16_t base);
>
>   void build_legacy_cpu_hotplug_aml(Aml *ctx, MachineState *machine,
> -                                  uint16_t io_base, uint16_t io_len);
> +                                  uint16_t io_base);
>   #endif
>


Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>

Thanks,
Marcel
diff mbox

Patch

diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
index 2d4e034..36ea6c2 100644
--- a/hw/acpi/cpu_hotplug.c
+++ b/hw/acpi/cpu_hotplug.c
@@ -87,7 +87,7 @@  void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
 }
 
 void build_legacy_cpu_hotplug_aml(Aml *ctx, MachineState *machine,
-                                  uint16_t io_base, uint16_t io_len)
+                                  uint16_t io_base)
 {
     Aml *dev;
     Aml *crs;
@@ -226,13 +226,13 @@  void build_legacy_cpu_hotplug_aml(Aml *ctx, MachineState *machine,
     aml_append(dev, aml_name_decl("_STA", aml_int(0xB)));
     crs = aml_resource_template();
     aml_append(crs,
-        aml_io(AML_DECODE16, io_base, io_base, 1, io_len)
+        aml_io(AML_DECODE16, io_base, io_base, 1, ACPI_GPE_PROC_LEN)
     );
     aml_append(dev, aml_name_decl("_CRS", crs));
     aml_append(sb_scope, dev);
     /* declare CPU hotplug MMIO region and PRS field to access it */
     aml_append(sb_scope, aml_operation_region(
-        "PRST", AML_SYSTEM_IO, aml_int(io_base), io_len));
+        "PRST", AML_SYSTEM_IO, aml_int(io_base), ACPI_GPE_PROC_LEN));
     field = aml_field("PRST", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
     aml_append(field, aml_named_field("PRS", 256));
     aml_append(sb_scope, field);
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 2f6de43..b33fec9 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -94,7 +94,6 @@  typedef struct AcpiPmInfo {
     uint32_t gpe0_blk_len;
     uint32_t io_base;
     uint16_t cpu_hp_io_base;
-    uint16_t cpu_hp_io_len;
     uint16_t mem_hp_io_base;
     uint16_t mem_hp_io_len;
     uint16_t pcihp_io_base;
@@ -142,7 +141,6 @@  static void acpi_get_pm_info(AcpiPmInfo *pm)
     }
     assert(obj);
 
-    pm->cpu_hp_io_len = ACPI_GPE_PROC_LEN;
     pm->mem_hp_io_base = ACPI_MEMORY_HOTPLUG_BASE;
     pm->mem_hp_io_len = ACPI_MEMORY_HOTPLUG_IO_LEN;
 
@@ -1935,8 +1933,7 @@  build_dsdt(GArray *table_data, GArray *linker,
         build_q35_pci0_int(dsdt);
     }
 
-    build_legacy_cpu_hotplug_aml(dsdt, machine, pm->cpu_hp_io_base,
-                                 pm->cpu_hp_io_len);
+    build_legacy_cpu_hotplug_aml(dsdt, machine, pm->cpu_hp_io_base);
     build_memory_hotplug_aml(dsdt, nr_mem, pm->mem_hp_io_base,
                              pm->mem_hp_io_len);
 
diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h
index 241b50f..6d729d8 100644
--- a/include/hw/acpi/cpu_hotplug.h
+++ b/include/hw/acpi/cpu_hotplug.h
@@ -28,5 +28,5 @@  void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
                                   AcpiCpuHotplug *gpe_cpu, uint16_t base);
 
 void build_legacy_cpu_hotplug_aml(Aml *ctx, MachineState *machine,
-                                  uint16_t io_base, uint16_t io_len);
+                                  uint16_t io_base);
 #endif