diff mbox series

[02/35] acpi: make isa_build_aml() support AcpiDevAmlIf interface

Message ID 20220516152610.1963435-3-imammedo@redhat.com (mailing list archive)
State New, archived
Headers show
Series pc/q35: refactor ISA and SMBUS AML generation | expand

Commit Message

Igor Mammedov May 16, 2022, 3:25 p.m. UTC
To allow incremental conversion from ISADeviceClass::build_aml
to AcpiDevAmlIf, add support for the later without removing
the former. Once conversion is complete, another commit will
drop ISADeviceClass::build_aml related code.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/isa/isa-bus.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Ani Sinha May 18, 2022, 10:13 a.m. UTC | #1
On Mon, May 16, 2022 at 8:56 PM Igor Mammedov <imammedo@redhat.com> wrote:
>
> To allow incremental conversion from ISADeviceClass::build_aml
> to AcpiDevAmlIf, add support for the later without removing
> the former. Once conversion is complete, another commit will
> drop ISADeviceClass::build_aml related code.
>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>

Reviewed-by: Ani Sinha <ani@anisinha.ca>

> ---
>  hw/isa/isa-bus.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
> index cd5ad3687d..237e2cee12 100644
> --- a/hw/isa/isa-bus.c
> +++ b/hw/isa/isa-bus.c
> @@ -24,6 +24,7 @@
>  #include "hw/sysbus.h"
>  #include "sysemu/sysemu.h"
>  #include "hw/isa/isa.h"
> +#include "hw/acpi/acpi_aml_interface.h"
>
>  static ISABus *isabus;
>
> @@ -196,8 +197,12 @@ void isa_build_aml(ISABus *bus, Aml *scope)
>      QTAILQ_FOREACH(kid, &bus->parent_obj.children, sibling) {
>          dev = ISA_DEVICE(kid->child);
>          dc = ISA_DEVICE_GET_CLASS(dev);
> +        bool has_build_dev_aml = !!object_dynamic_cast(OBJECT(dev),
> +                                                       TYPE_ACPI_DEV_AML_IF);
>          if (dc->build_aml) {
>              dc->build_aml(dev, scope);
> +        } else if (has_build_dev_aml) {
> +            call_dev_aml_func(DEVICE(dev), scope);
>          }
>      }
>  }
> --
> 2.31.1
>
diff mbox series

Patch

diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index cd5ad3687d..237e2cee12 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -24,6 +24,7 @@ 
 #include "hw/sysbus.h"
 #include "sysemu/sysemu.h"
 #include "hw/isa/isa.h"
+#include "hw/acpi/acpi_aml_interface.h"
 
 static ISABus *isabus;
 
@@ -196,8 +197,12 @@  void isa_build_aml(ISABus *bus, Aml *scope)
     QTAILQ_FOREACH(kid, &bus->parent_obj.children, sibling) {
         dev = ISA_DEVICE(kid->child);
         dc = ISA_DEVICE_GET_CLASS(dev);
+        bool has_build_dev_aml = !!object_dynamic_cast(OBJECT(dev),
+                                                       TYPE_ACPI_DEV_AML_IF);
         if (dc->build_aml) {
             dc->build_aml(dev, scope);
+        } else if (has_build_dev_aml) {
+            call_dev_aml_func(DEVICE(dev), scope);
         }
     }
 }