From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsYmT-0000s7-3H for qemu-devel@nongnu.org; Thu, 05 Jun 2014 10:36:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsYmK-0006kN-NJ for qemu-devel@nongnu.org; Thu, 05 Jun 2014 10:36:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25421) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsYmK-0006kD-Ek for qemu-devel@nongnu.org; Thu, 05 Jun 2014 10:36:28 -0400 From: Igor Mammedov Date: Thu, 5 Jun 2014 16:36:07 +0200 Message-Id: <1401978968-7733-5-git-send-email-imammedo@redhat.com> In-Reply-To: <1401978968-7733-1-git-send-email-imammedo@redhat.com> References: <1401978968-7733-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH 4/5] qmp: add query-acpi-ospm-status command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pkrempa@redhat.com, mst@redhat.com, armbru@redhat.com, lcapitulino@redhat.com, vasilis.liaskovitis@profitbricks.com ... to get ACPI OSPM status reported by ACPI devices via _OST method. Signed-off-by: Igor Mammedov --- qapi-schema.json | 10 ++++++++++ qmp-commands.hx | 22 ++++++++++++++++++++++ qmp.c | 20 ++++++++++++++++++++ 3 files changed, 52 insertions(+), 0 deletions(-) diff --git a/qapi-schema.json b/qapi-schema.json index 6d5651e..39052ae 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -4806,3 +4806,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 c0e0d9e..1a0cfb3 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -3599,3 +3599,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 66d2d67..3adcc6a 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; +} -- 1.7.1