Skip to content

Commit

Permalink
qmp: add query-acpi-ospm-status command
Browse files Browse the repository at this point in the history
... to get ACPI OSPM status reported by ACPI devices
via _OST method.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
Igor Mammedov authored and mstsirkin committed Jun 19, 2014
1 parent 43f5041 commit 02419bc
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
10 changes: 10 additions & 0 deletions qapi-schema.json
Expand Up @@ -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'] }
22 changes: 22 additions & 0 deletions qmp-commands.hx
Expand Up @@ -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
20 changes: 20 additions & 0 deletions qmp.c
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}

0 comments on commit 02419bc

Please sign in to comment.