summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qapi-schema.json10
-rw-r--r--qmp-commands.hx22
-rw-r--r--qmp.c20
3 files changed, 52 insertions, 0 deletions
diff --git a/qapi-schema.json b/qapi-schema.json
index ff30ace82b..98350048f6 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3276,3 +3276,13 @@
'slot-type': 'ACPISlotType',
'source': 'int',
'status': 'int' } }
+
+##
+# @query-acpi-ospm-status
+#
+# Lists ACPI OSPM status of ACPI device objects,
+# which might be reported via _OST method
+#
+# Since: 2.1
+##
+{ 'command': 'query-acpi-ospm-status', 'returns': ['ACPIOSTInfo'] }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 81054d0b1b..e4a1c80434 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3639,3 +3639,25 @@ Example:
"type": "dimm"
} ] }
EQMP
+
+ {
+ .name = "query-acpi-ospm-status",
+ .args_type = "",
+ .mhandler.cmd_new = qmp_marshal_input_query_acpi_ospm_status,
+ },
+
+SQMP
+@query-acpi-ospm-status
+--------------------
+
+Return list of ACPIOSTInfo for devices that support status reporting
+via ACPI _OST method.
+
+Example:
+-> { "execute": "query-acpi-ospm-status" }
+<- { "return": [ { "device": "d1", "slot": "0", "slot-type": "DIMM", "source": 1, "status": 0},
+ { "slot": "1", "slot-type": "DIMM", "source": 0, "status": 0},
+ { "slot": "2", "slot-type": "DIMM", "source": 0, "status": 0},
+ { "slot": "3", "slot-type": "DIMM", "source": 0, "status": 0}
+ ]}
+EQMP
diff --git a/qmp.c b/qmp.c
index 835fd78851..dca6efb7b8 100644
--- a/qmp.c
+++ b/qmp.c
@@ -29,6 +29,7 @@
#include "hw/boards.h"
#include "qom/object_interfaces.h"
#include "hw/mem/pc-dimm.h"
+#include "hw/acpi/acpi_dev_interface.h"
NameInfo *qmp_query_name(Error **errp)
{
@@ -639,3 +640,22 @@ MemoryDeviceInfoList *qmp_query_memory_devices(Error **errp)
return head;
}
+
+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;
+}