1521b3673SIgor Mammedov #ifndef ACPI_DEV_INTERFACE_H
2521b3673SIgor Mammedov #define ACPI_DEV_INTERFACE_H
3521b3673SIgor Mammedov 
4*27c9188fSPhilippe Mathieu-Daudé #include "qapi/qapi-types-acpi.h"
5521b3673SIgor Mammedov #include "qom/object.h"
6a27bd6c7SMarkus Armbruster #include "hw/qdev-core.h"
7521b3673SIgor Mammedov 
8eaf23bf7SIgor Mammedov /* These values are part of guest ABI, and can not be changed */
9eaf23bf7SIgor Mammedov typedef enum {
10eaf23bf7SIgor Mammedov     ACPI_PCI_HOTPLUG_STATUS = 2,
11eaf23bf7SIgor Mammedov     ACPI_CPU_HOTPLUG_STATUS = 4,
12eaf23bf7SIgor Mammedov     ACPI_MEMORY_HOTPLUG_STATUS = 8,
13b097cc52SXiao Guangrong     ACPI_NVDIMM_HOTPLUG_STATUS = 16,
14d03637bcSBen Warren     ACPI_VMGENID_CHANGE_STATUS = 32,
151962f31bSShameer Kolothum     ACPI_POWER_DOWN_STATUS = 64,
16eaf23bf7SIgor Mammedov } AcpiEventStatusBits;
17eaf23bf7SIgor Mammedov 
18521b3673SIgor Mammedov #define TYPE_ACPI_DEVICE_IF "acpi-device-interface"
19521b3673SIgor Mammedov 
20db1015e9SEduardo Habkost typedef struct AcpiDeviceIfClass AcpiDeviceIfClass;
218110fa1dSEduardo Habkost DECLARE_CLASS_CHECKERS(AcpiDeviceIfClass, ACPI_DEVICE_IF,
22521b3673SIgor Mammedov                        TYPE_ACPI_DEVICE_IF)
23521b3673SIgor Mammedov #define ACPI_DEVICE_IF(obj) \
24521b3673SIgor Mammedov      INTERFACE_CHECK(AcpiDeviceIf, (obj), \
25521b3673SIgor Mammedov                      TYPE_ACPI_DEVICE_IF)
26521b3673SIgor Mammedov 
27aa1b35b9SMarc-André Lureau typedef struct AcpiDeviceIf AcpiDeviceIf;
28521b3673SIgor Mammedov 
29eaf23bf7SIgor Mammedov void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event);
30eaf23bf7SIgor Mammedov 
31521b3673SIgor Mammedov /**
32521b3673SIgor Mammedov  * AcpiDeviceIfClass:
33521b3673SIgor Mammedov  *
34521b3673SIgor Mammedov  * ospm_status: returns status of ACPI device objects, reported
35521b3673SIgor Mammedov  *              via _OST method if device supports it.
36eaf23bf7SIgor Mammedov  * send_event: inject a specified event into guest
37ac35f13bSIgor Mammedov  * madt_cpu: fills @entry with Interrupt Controller Structure
38ac35f13bSIgor Mammedov  *           for CPU indexed by @uid in @apic_ids array,
39ac35f13bSIgor Mammedov  *           returned structure types are:
40ac35f13bSIgor Mammedov  *           0 - Local APIC, 9 - Local x2APIC, 0xB - GICC
41521b3673SIgor Mammedov  *
42521b3673SIgor Mammedov  * Interface is designed for providing unified interface
43521b3673SIgor Mammedov  * to generic ACPI functionality that could be used without
44521b3673SIgor Mammedov  * knowledge about internals of actual device that implements
45521b3673SIgor Mammedov  * ACPI interface.
46521b3673SIgor Mammedov  */
47db1015e9SEduardo Habkost struct AcpiDeviceIfClass {
48521b3673SIgor Mammedov     /* <private> */
49521b3673SIgor Mammedov     InterfaceClass parent_class;
50521b3673SIgor Mammedov 
51521b3673SIgor Mammedov     /* <public> */
52521b3673SIgor Mammedov     void (*ospm_status)(AcpiDeviceIf *adev, ACPIOSTInfoList ***list);
53eaf23bf7SIgor Mammedov     void (*send_event)(AcpiDeviceIf *adev, AcpiEventStatusBits ev);
54db1015e9SEduardo Habkost };
55521b3673SIgor Mammedov #endif
56