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
);
20 * build_dev_aml: adds device specific AML blob to provided scope
22 * Interface is designed for providing generic callback that builds device
25 struct AcpiDevAmlIfClass
{
27 InterfaceClass parent_class
;
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
;
42 static inline void call_dev_aml_func(DeviceState
*dev
, Aml
*scope
)
44 dev_aml_fn fn
= get_dev_aml_func(dev
);
46 fn(ACPI_DEV_AML_IF(dev
), scope
);
50 void qbus_build_aml(BusState
*bus
, Aml
*scope
);