1 #ifndef ACPI_DEV_INTERFACE_H
2 #define ACPI_DEV_INTERFACE_H
3 
4 #include "qapi/qapi-types-misc.h"
5 #include "qom/object.h"
6 #include "hw/boards.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 } AcpiEventStatusBits;
16 
17 #define TYPE_ACPI_DEVICE_IF "acpi-device-interface"
18 
19 #define ACPI_DEVICE_IF_CLASS(klass) \
20      OBJECT_CLASS_CHECK(AcpiDeviceIfClass, (klass), \
21                         TYPE_ACPI_DEVICE_IF)
22 #define ACPI_DEVICE_IF_GET_CLASS(obj) \
23      OBJECT_GET_CLASS(AcpiDeviceIfClass, (obj), \
24                       TYPE_ACPI_DEVICE_IF)
25 #define ACPI_DEVICE_IF(obj) \
26      INTERFACE_CHECK(AcpiDeviceIf, (obj), \
27                      TYPE_ACPI_DEVICE_IF)
28 
29 typedef struct AcpiDeviceIf AcpiDeviceIf;
30 
31 void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event);
32 
33 /**
34  * AcpiDeviceIfClass:
35  *
36  * ospm_status: returns status of ACPI device objects, reported
37  *              via _OST method if device supports it.
38  * send_event: inject a specified event into guest
39  * madt_cpu: fills @entry with Interrupt Controller Structure
40  *           for CPU indexed by @uid in @apic_ids array,
41  *           returned structure types are:
42  *           0 - Local APIC, 9 - Local x2APIC, 0xB - GICC
43  *
44  * Interface is designed for providing unified interface
45  * to generic ACPI functionality that could be used without
46  * knowledge about internals of actual device that implements
47  * ACPI interface.
48  */
49 typedef struct AcpiDeviceIfClass {
50     /* <private> */
51     InterfaceClass parent_class;
52 
53     /* <public> */
54     void (*ospm_status)(AcpiDeviceIf *adev, ACPIOSTInfoList ***list);
55     void (*send_event)(AcpiDeviceIf *adev, AcpiEventStatusBits ev);
56     void (*madt_cpu)(AcpiDeviceIf *adev, int uid,
57                      const CPUArchIdList *apic_ids, GArray *entry);
58 } AcpiDeviceIfClass;
59 #endif
60