tests/qapi-schema: Tidy up pylint warnings and advice
[qemu/armbru.git] / include / hw / acpi / acpi_aml_interface.h
blob11748a88664480d545332996674e576bcf97ae6b
1 #ifndef ACPI_AML_INTERFACE_H
2 #define ACPI_AML_INTERFACE_H
4 #include "qom/object.h"
5 #include "hw/acpi/aml-build.h"
6 #include "hw/qdev-core.h"
8 #define TYPE_ACPI_DEV_AML_IF "acpi-dev-aml-interface"
9 typedef struct AcpiDevAmlIfClass AcpiDevAmlIfClass;
10 DECLARE_CLASS_CHECKERS(AcpiDevAmlIfClass, ACPI_DEV_AML_IF, TYPE_ACPI_DEV_AML_IF)
11 #define ACPI_DEV_AML_IF(obj) \
12 INTERFACE_CHECK(AcpiDevAmlIf, (obj), TYPE_ACPI_DEV_AML_IF)
14 typedef struct AcpiDevAmlIf AcpiDevAmlIf;
15 typedef void (*dev_aml_fn)(AcpiDevAmlIf *adev, Aml *scope);
17 /**
18 * AcpiDevAmlIfClass:
20 * build_dev_aml: adds device specific AML blob to provided scope
22 * Interface is designed for providing generic callback that builds device
23 * specific AML blob.
25 struct AcpiDevAmlIfClass {
26 /* <private> */
27 InterfaceClass parent_class;
29 /* <public> */
30 dev_aml_fn build_dev_aml;
33 static inline dev_aml_fn get_dev_aml_func(DeviceState *dev)
35 if (object_dynamic_cast(OBJECT(dev), TYPE_ACPI_DEV_AML_IF)) {
36 AcpiDevAmlIfClass *klass = ACPI_DEV_AML_IF_GET_CLASS(dev);
37 return klass->build_dev_aml;
39 return NULL;
42 static inline void call_dev_aml_func(DeviceState *dev, Aml *scope)
44 dev_aml_fn fn = get_dev_aml_func(dev);
45 if (fn) {
46 fn(ACPI_DEV_AML_IF(dev), scope);
50 void qbus_build_aml(BusState *bus, Aml *scope);
52 #endif