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