| 1 | #ifndef ACPI_DEV_INTERFACE_H |
| 2 | #define ACPI_DEV_INTERFACE_H |
| 3 | |
| 4 | #include "qapi/qapi-types-acpi.h" |
| 5 | #include "qom/object.h" |
| 6 | #include "hw/core/qdev.h" |
| 7 | |
| 8 | /* These values are part of guest ABI, and can not be changed */ |
| 9 | typedef enum { |
| 10 | ACPI_PCI_HOTPLUG_STATUS = 2, |
| 11 | ACPI_CPU_HOTPLUG_STATUS = 4, |
| 12 | ACPI_MEMORY_HOTPLUG_STATUS = 8, |
| 13 | ACPI_NVDIMM_HOTPLUG_STATUS = 16, |
| 14 | ACPI_VMGENID_CHANGE_STATUS = 32, |
| 15 | ACPI_POWER_DOWN_STATUS = 64, |
| 16 | ACPI_GENERIC_ERROR = 128, |
| 17 | } AcpiEventStatusBits; |
| 18 | |
| 19 | #define TYPE_ACPI_DEVICE_IF "acpi-device-interface" |
| 20 | |
| 21 | typedef struct AcpiDeviceIfClass AcpiDeviceIfClass; |
| 22 | DECLARE_CLASS_CHECKERS(AcpiDeviceIfClass, ACPI_DEVICE_IF, |
| 23 | TYPE_ACPI_DEVICE_IF) |
| 24 | #define ACPI_DEVICE_IF(obj) \ |
| 25 | INTERFACE_CHECK(AcpiDeviceIf, (obj), \ |
| 26 | TYPE_ACPI_DEVICE_IF) |
| 27 | |
| 28 | typedef struct AcpiDeviceIf AcpiDeviceIf; |
| 29 | |
| 30 | /** |
| 31 | * AcpiDeviceIfClass: |
| 32 | * |
| 33 | * ospm_status: returns status of ACPI device objects, reported |
| 34 | * via _OST method if device supports it. |
| 35 | * send_event: inject a specified event into guest |
| 36 | * madt_cpu: fills @entry with Interrupt Controller Structure |
| 37 | * for CPU indexed by @uid in @apic_ids array, |
| 38 | * returned structure types are: |
| 39 | * 0 - Local APIC, 9 - Local x2APIC, 0xB - GICC |
| 40 | * |
| 41 | * Interface is designed for providing unified interface |
| 42 | * to generic ACPI functionality that could be used without |
| 43 | * knowledge about internals of actual device that implements |
| 44 | * ACPI interface. |
| 45 | */ |
| 46 | struct AcpiDeviceIfClass { |
| 47 | /* <private> */ |
| 48 | InterfaceClass parent_class; |
| 49 | |
| 50 | /* <public> */ |
| 51 | void (*ospm_status)(AcpiDeviceIf *adev, ACPIOSTInfoList ***list); |
| 52 | void (*send_event)(AcpiDeviceIf *adev, AcpiEventStatusBits ev); |
| 53 | }; |
| 54 | #endif |