summary refs log tree commit diff stats
path: root/hw/acpi/acpi-qmp-cmds.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2023-01-24 13:19:38 +0100
committerMarkus Armbruster <armbru@redhat.com>2023-02-04 07:56:54 +0100
commit5bd26d78d9629a9d3f4780a162f09272978eae3d (patch)
treec6cb24ac9af7d9dfd47a97c5f63cb3f9ba41ff72 /hw/acpi/acpi-qmp-cmds.c
parent6a5fcf6c1e06561a14b4456807a5c8f8cc3f936a (diff)
downloadfocaccia-qemu-5bd26d78d9629a9d3f4780a162f09272978eae3d.tar.gz
focaccia-qemu-5bd26d78d9629a9d3f4780a162f09272978eae3d.zip
acpi: Move the QMP command from monitor/ to hw/acpi/
This moves the command from MAINTAINERS section "QMP" to section
"ACPI/SMBIOS)".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20230124121946.1139465-25-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'hw/acpi/acpi-qmp-cmds.c')
-rw-r--r--hw/acpi/acpi-qmp-cmds.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/hw/acpi/acpi-qmp-cmds.c b/hw/acpi/acpi-qmp-cmds.c
new file mode 100644
index 0000000000..2d47cac52c
--- /dev/null
+++ b/hw/acpi/acpi-qmp-cmds.c
@@ -0,0 +1,30 @@
+/*
+ * QMP commands related to ACPI
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or
+ * (at your option) any later version.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/acpi/acpi_dev_interface.h"
+#include "qapi/error.h"
+#include "qapi/qapi-commands-acpi.h"
+
+ACPIOSTInfoList *qmp_query_acpi_ospm_status(Error **errp)
+{
+    bool ambig;
+    ACPIOSTInfoList *head = NULL;
+    ACPIOSTInfoList **prev = &head;
+    Object *obj = object_resolve_path_type("", TYPE_ACPI_DEVICE_IF, &ambig);
+
+    if (obj) {
+        AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(obj);
+        AcpiDeviceIf *adev = ACPI_DEVICE_IF(obj);
+
+        adevc->ospm_status(adev, &prev);
+    } else {
+        error_setg(errp, "command is not supported, missing ACPI device");
+    }
+
+    return head;
+}