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