xref: /openbmc/qemu/hw/acpi/acpi-qmp-cmds.c (revision 5bd26d78)
1 /*
2  * QMP commands related to ACPI
3  *
4  * This work is licensed under the terms of the GNU GPL, version 2 or
5  * (at your option) any later version.
6  */
7 
8 #include "qemu/osdep.h"
9 #include "hw/acpi/acpi_dev_interface.h"
10 #include "qapi/error.h"
11 #include "qapi/qapi-commands-acpi.h"
12 
qmp_query_acpi_ospm_status(Error ** errp)13 ACPIOSTInfoList *qmp_query_acpi_ospm_status(Error **errp)
14 {
15     bool ambig;
16     ACPIOSTInfoList *head = NULL;
17     ACPIOSTInfoList **prev = &head;
18     Object *obj = object_resolve_path_type("", TYPE_ACPI_DEVICE_IF, &ambig);
19 
20     if (obj) {
21         AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(obj);
22         AcpiDeviceIf *adev = ACPI_DEVICE_IF(obj);
23 
24         adevc->ospm_status(adev, &prev);
25     } else {
26         error_setg(errp, "command is not supported, missing ACPI device");
27     }
28 
29     return head;
30 }
31