xref: /qemu/include/hw/acpi/acpi_dev_interface.h (revision 80e5db303dc82e357df923dc2bfcb858c20282a0)
1521b3673SIgor Mammedov #ifndef ACPI_DEV_INTERFACE_H
2521b3673SIgor Mammedov #define ACPI_DEV_INTERFACE_H
3521b3673SIgor Mammedov 
4521b3673SIgor Mammedov #include "qom/object.h"
5521b3673SIgor Mammedov #include "qapi-types.h"
6ac35f13bSIgor Mammedov #include "hw/boards.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,
14eaf23bf7SIgor Mammedov } AcpiEventStatusBits;
15eaf23bf7SIgor Mammedov 
16521b3673SIgor Mammedov #define TYPE_ACPI_DEVICE_IF "acpi-device-interface"
17521b3673SIgor Mammedov 
18521b3673SIgor Mammedov #define ACPI_DEVICE_IF_CLASS(klass) \
19521b3673SIgor Mammedov      OBJECT_CLASS_CHECK(AcpiDeviceIfClass, (klass), \
20521b3673SIgor Mammedov                         TYPE_ACPI_DEVICE_IF)
21521b3673SIgor Mammedov #define ACPI_DEVICE_IF_GET_CLASS(obj) \
22521b3673SIgor Mammedov      OBJECT_GET_CLASS(AcpiDeviceIfClass, (obj), \
23521b3673SIgor Mammedov                       TYPE_ACPI_DEVICE_IF)
24521b3673SIgor Mammedov #define ACPI_DEVICE_IF(obj) \
25521b3673SIgor Mammedov      INTERFACE_CHECK(AcpiDeviceIf, (obj), \
26521b3673SIgor Mammedov                      TYPE_ACPI_DEVICE_IF)
27521b3673SIgor Mammedov 
28521b3673SIgor Mammedov 
29521b3673SIgor Mammedov typedef struct AcpiDeviceIf {
30521b3673SIgor Mammedov     /* <private> */
31521b3673SIgor Mammedov     Object Parent;
32521b3673SIgor Mammedov } AcpiDeviceIf;
33521b3673SIgor Mammedov 
34eaf23bf7SIgor Mammedov void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event);
35eaf23bf7SIgor Mammedov 
36521b3673SIgor Mammedov /**
37521b3673SIgor Mammedov  * AcpiDeviceIfClass:
38521b3673SIgor Mammedov  *
39521b3673SIgor Mammedov  * ospm_status: returns status of ACPI device objects, reported
40521b3673SIgor Mammedov  *              via _OST method if device supports it.
41eaf23bf7SIgor Mammedov  * send_event: inject a specified event into guest
42ac35f13bSIgor Mammedov  * madt_cpu: fills @entry with Interrupt Controller Structure
43ac35f13bSIgor Mammedov  *           for CPU indexed by @uid in @apic_ids array,
44ac35f13bSIgor Mammedov  *           returned structure types are:
45ac35f13bSIgor Mammedov  *           0 - Local APIC, 9 - Local x2APIC, 0xB - GICC
46521b3673SIgor Mammedov  *
47521b3673SIgor Mammedov  * Interface is designed for providing unified interface
48521b3673SIgor Mammedov  * to generic ACPI functionality that could be used without
49521b3673SIgor Mammedov  * knowledge about internals of actual device that implements
50521b3673SIgor Mammedov  * ACPI interface.
51521b3673SIgor Mammedov  */
52521b3673SIgor Mammedov typedef struct AcpiDeviceIfClass {
53521b3673SIgor Mammedov     /* <private> */
54521b3673SIgor Mammedov     InterfaceClass parent_class;
55521b3673SIgor Mammedov 
56521b3673SIgor Mammedov     /* <public> */
57521b3673SIgor Mammedov     void (*ospm_status)(AcpiDeviceIf *adev, ACPIOSTInfoList ***list);
58eaf23bf7SIgor Mammedov     void (*send_event)(AcpiDeviceIf *adev, AcpiEventStatusBits ev);
59ac35f13bSIgor Mammedov     void (*madt_cpu)(AcpiDeviceIf *adev, int uid,
60*80e5db30SIgor Mammedov                      const CPUArchIdList *apic_ids, GArray *entry);
61521b3673SIgor Mammedov } AcpiDeviceIfClass;
62521b3673SIgor Mammedov #endif
63