From patchwork Mon Jun 16 17:12:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 360204 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 864E21400AA for ; Tue, 17 Jun 2014 03:14:56 +1000 (EST) Received: from localhost ([::1]:45647 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwaUg-0001ZR-Fx for incoming@patchwork.ozlabs.org; Mon, 16 Jun 2014 13:14:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58876) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwaSf-0006aL-6K for qemu-devel@nongnu.org; Mon, 16 Jun 2014 13:12:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwaSX-0002lg-MP for qemu-devel@nongnu.org; Mon, 16 Jun 2014 13:12:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60127) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwaSX-0002lZ-D6 for qemu-devel@nongnu.org; Mon, 16 Jun 2014 13:12:41 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5GHCeHB006378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 16 Jun 2014 13:12:40 -0400 Received: from dell-pet610-01.lab.eng.brq.redhat.com (dell-pet610-01.lab.eng.brq.redhat.com [10.34.42.20]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5GHCWON014922; Mon, 16 Jun 2014 13:12:39 -0400 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 16 Jun 2014 19:12:28 +0200 Message-Id: <1402938749-13371-5-git-send-email-imammedo@redhat.com> In-Reply-To: <1402938749-13371-1-git-send-email-imammedo@redhat.com> References: <1402938749-13371-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: lcapitulino@redhat.com, pkrempa@redhat.com, mst@redhat.com Subject: [Qemu-devel] [PATCH v2 4/5] qmp: add query-acpi-ospm-status command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org ... to get ACPI OSPM status reported by ACPI devices via _OST method. Signed-off-by: Igor Mammedov Reviewed-by: Eric Blake --- 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 8179c79..58751e0 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -4918,3 +4918,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 177ac25..fa037bf 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -3637,3 +3637,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 835fd78..dca6efb 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; +}