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