Message ID | 20221017102146.2254096-7-imammedo@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86: clean up ACPI PCI code part 2 | expand |
On Mon, Oct 17, 2022 at 3:52 PM Igor Mammedov <imammedo@redhat.com> wrote: > > It will be used in followup commits to figure out if > device has it's own, device specific AML block. > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Ani Sinha <ani@anisinha.ca> > --- > include/hw/acpi/acpi_aml_interface.h | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/include/hw/acpi/acpi_aml_interface.h b/include/hw/acpi/acpi_aml_interface.h > index ab76f0e55d..436da069d6 100644 > --- a/include/hw/acpi/acpi_aml_interface.h > +++ b/include/hw/acpi/acpi_aml_interface.h > @@ -29,11 +29,20 @@ struct AcpiDevAmlIfClass { > dev_aml_fn build_dev_aml; > }; > > -static inline void call_dev_aml_func(DeviceState *dev, Aml *scope) > +static inline dev_aml_fn get_dev_aml_func(DeviceState *dev) > { > if (object_dynamic_cast(OBJECT(dev), TYPE_ACPI_DEV_AML_IF)) { > AcpiDevAmlIfClass *klass = ACPI_DEV_AML_IF_GET_CLASS(dev); > - klass->build_dev_aml(ACPI_DEV_AML_IF(dev), scope); > + return klass->build_dev_aml; > + } > + return NULL; > +} > + > +static inline void call_dev_aml_func(DeviceState *dev, Aml *scope) > +{ > + dev_aml_fn fn = get_dev_aml_func(dev); > + if (fn) { > + fn(ACPI_DEV_AML_IF(dev), scope); > } > } > > -- > 2.31.1 >
diff --git a/include/hw/acpi/acpi_aml_interface.h b/include/hw/acpi/acpi_aml_interface.h index ab76f0e55d..436da069d6 100644 --- a/include/hw/acpi/acpi_aml_interface.h +++ b/include/hw/acpi/acpi_aml_interface.h @@ -29,11 +29,20 @@ struct AcpiDevAmlIfClass { dev_aml_fn build_dev_aml; }; -static inline void call_dev_aml_func(DeviceState *dev, Aml *scope) +static inline dev_aml_fn get_dev_aml_func(DeviceState *dev) { if (object_dynamic_cast(OBJECT(dev), TYPE_ACPI_DEV_AML_IF)) { AcpiDevAmlIfClass *klass = ACPI_DEV_AML_IF_GET_CLASS(dev); - klass->build_dev_aml(ACPI_DEV_AML_IF(dev), scope); + return klass->build_dev_aml; + } + return NULL; +} + +static inline void call_dev_aml_func(DeviceState *dev, Aml *scope) +{ + dev_aml_fn fn = get_dev_aml_func(dev); + if (fn) { + fn(ACPI_DEV_AML_IF(dev), scope); } }
It will be used in followup commits to figure out if device has it's own, device specific AML block. Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- include/hw/acpi/acpi_aml_interface.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)