diff mbox series

[24/32] acpi: Move the QMP command from monitor/ to hw/acpi/

Message ID 20230124121946.1139465-25-armbru@redhat.com (mailing list archive)
State New, archived
Headers show
Series Move and clean up monitor command code | expand

Commit Message

Markus Armbruster Jan. 24, 2023, 12:19 p.m. UTC
This moves the command from MAINTAINERS section "QMP" to section
"ACPI/SMBIOS)".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/acpi/acpi-qmp-cmds.c | 30 ++++++++++++++++++++++++++++++
 monitor/qmp-cmds.c      | 21 ---------------------
 hw/acpi/meson.build     |  1 +
 3 files changed, 31 insertions(+), 21 deletions(-)
 create mode 100644 hw/acpi/acpi-qmp-cmds.c

Comments

Philippe Mathieu-Daudé Jan. 24, 2023, 12:25 p.m. UTC | #1
On 24/1/23 13:19, Markus Armbruster wrote:
> This moves the command from MAINTAINERS section "QMP" to section
> "ACPI/SMBIOS)".
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>   hw/acpi/acpi-qmp-cmds.c | 30 ++++++++++++++++++++++++++++++
>   monitor/qmp-cmds.c      | 21 ---------------------
>   hw/acpi/meson.build     |  1 +
>   3 files changed, 31 insertions(+), 21 deletions(-)
>   create mode 100644 hw/acpi/acpi-qmp-cmds.c

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

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;
+}
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index ab23e52f97..cc22f3fcc7 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -22,12 +22,10 @@ 
 #include "sysemu/runstate-action.h"
 #include "sysemu/block-backend.h"
 #include "qapi/error.h"
-#include "qapi/qapi-commands-acpi.h"
 #include "qapi/qapi-commands-control.h"
 #include "qapi/qapi-commands-misc.h"
 #include "qapi/type-helpers.h"
 #include "hw/mem/memory-device.h"
-#include "hw/acpi/acpi_dev_interface.h"
 #include "hw/intc/intc.h"
 #include "hw/rdma/rdma.h"
 
@@ -153,22 +151,3 @@  void qmp_add_client(const char *protocol, const char *fdname,
         close(fd);
     }
 }
-
-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;
-}
diff --git a/hw/acpi/meson.build b/hw/acpi/meson.build
index 30054a8cdc..7818846d88 100644
--- a/hw/acpi/meson.build
+++ b/hw/acpi/meson.build
@@ -36,3 +36,4 @@  softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('acpi-stub.c', 'aml-build-stub
                                                   'acpi-mem-hotplug-stub.c', 'acpi-cpu-hotplug-stub.c',
                                                   'acpi-pci-hotplug-stub.c', 'acpi-nvdimm-stub.c',
                                                   'cxl-stub.c'))
+softmmu_ss.add(files('acpi-qmp-cmds.c'))