[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 099/106] acpi: introduce TYPE_ACPI_DEVICE_IF inter
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 099/106] acpi: introduce TYPE_ACPI_DEVICE_IF interface |
Date: |
Wed, 18 Jun 2014 19:22:13 +0300 |
From: Igor Mammedov <address@hidden>
... it will be used to abstract generic ACPI bits from
device that implements ACPI interface.
ACPIOSTInfo type is used for passing-through raw _OST
event/status codes reported by guest OS to a management
layer. It lets management tools interpret values
as specified by ACPI spec if it is interested in it.
QEMU doesn't encode these values as enum, since it
doesn't need to handle them and it allows interface
to scale well without any changes in QEMU while guest
OS and management evolves in time.
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Acked-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
qapi-schema.json | 31 ++++++++++++++++++++++++++
include/hw/acpi/acpi_dev_interface.h | 43 ++++++++++++++++++++++++++++++++++++
hw/acpi/acpi_interface.c | 15 +++++++++++++
hw/acpi/Makefile.objs | 1 +
4 files changed, 90 insertions(+)
create mode 100644 include/hw/acpi/acpi_dev_interface.h
create mode 100644 hw/acpi/acpi_interface.c
diff --git a/qapi-schema.json b/qapi-schema.json
index d51a208..ff30ace 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3245,3 +3245,34 @@
# Since: 2.1
##
{ 'command': 'query-memory-devices', 'returns': ['MemoryDeviceInfo'] }
+
+## @ACPISlotType
+#
+# @DIMM: memory slot
+#
+{ 'enum': 'ACPISlotType', 'data': [ 'DIMM' ] }
+
+## @ACPIOSTInfo
+#
+# OSPM Status Indication for a device
+# For description of possible values of @source and @status fields
+# see "_OST (OSPM Status Indication)" chapter of ACPI5.0 spec.
+#
+# @device: #optional device ID associated with slot
+#
+# @slot: slot ID, unique per slot of a given @slot-type
+#
+# @slot-type: type of the slot
+#
+# @source: an integer containing the source event
+#
+# @status: an integer containing the status code
+#
+# Since: 2.1
+##
+{ 'type': 'ACPIOSTInfo',
+ 'data' : { '*device': 'str',
+ 'slot': 'str',
+ 'slot-type': 'ACPISlotType',
+ 'source': 'int',
+ 'status': 'int' } }
diff --git a/include/hw/acpi/acpi_dev_interface.h
b/include/hw/acpi/acpi_dev_interface.h
new file mode 100644
index 0000000..f245f8d
--- /dev/null
+++ b/include/hw/acpi/acpi_dev_interface.h
@@ -0,0 +1,43 @@
+#ifndef ACPI_DEV_INTERFACE_H
+#define ACPI_DEV_INTERFACE_H
+
+#include "qom/object.h"
+#include "qapi-types.h"
+
+#define TYPE_ACPI_DEVICE_IF "acpi-device-interface"
+
+#define ACPI_DEVICE_IF_CLASS(klass) \
+ OBJECT_CLASS_CHECK(AcpiDeviceIfClass, (klass), \
+ TYPE_ACPI_DEVICE_IF)
+#define ACPI_DEVICE_IF_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(AcpiDeviceIfClass, (obj), \
+ TYPE_ACPI_DEVICE_IF)
+#define ACPI_DEVICE_IF(obj) \
+ INTERFACE_CHECK(AcpiDeviceIf, (obj), \
+ TYPE_ACPI_DEVICE_IF)
+
+
+typedef struct AcpiDeviceIf {
+ /* <private> */
+ Object Parent;
+} AcpiDeviceIf;
+
+/**
+ * AcpiDeviceIfClass:
+ *
+ * ospm_status: returns status of ACPI device objects, reported
+ * via _OST method if device supports it.
+ *
+ * Interface is designed for providing unified interface
+ * to generic ACPI functionality that could be used without
+ * knowledge about internals of actual device that implements
+ * ACPI interface.
+ */
+typedef struct AcpiDeviceIfClass {
+ /* <private> */
+ InterfaceClass parent_class;
+
+ /* <public> */
+ void (*ospm_status)(AcpiDeviceIf *adev, ACPIOSTInfoList ***list);
+} AcpiDeviceIfClass;
+#endif
diff --git a/hw/acpi/acpi_interface.c b/hw/acpi/acpi_interface.c
new file mode 100644
index 0000000..c181bb2
--- /dev/null
+++ b/hw/acpi/acpi_interface.c
@@ -0,0 +1,15 @@
+#include "hw/acpi/acpi_dev_interface.h"
+#include "qemu/module.h"
+
+static void register_types(void)
+{
+ static const TypeInfo acpi_dev_if_info = {
+ .name = TYPE_ACPI_DEVICE_IF,
+ .parent = TYPE_INTERFACE,
+ .class_size = sizeof(AcpiDeviceIfClass),
+ };
+
+ type_register_static(&acpi_dev_if_info);
+}
+
+type_init(register_types)
diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
index 004e1b2..acd2389 100644
--- a/hw/acpi/Makefile.objs
+++ b/hw/acpi/Makefile.objs
@@ -1,2 +1,3 @@
common-obj-$(CONFIG_ACPI) += core.o piix4.o ich9.o pcihp.o cpu_hotplug.o
common-obj-$(CONFIG_ACPI) += memory_hotplug.o
+common-obj-$(CONFIG_ACPI) += acpi_interface.o
--
MST
- [Qemu-devel] [PULL v2 089/106] tests: fix memory leak in test of string input visitor, (continued)
- [Qemu-devel] [PULL v2 089/106] tests: fix memory leak in test of string input visitor, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 088/106] hmp: add info memdev, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 090/106] qapi: make string input visitor parse int list, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 091/106] qapi: make string output visitor parse int list, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 093/106] qdev: reorganize error reporting in bus_set_realized, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 092/106] qapi: fix build on glib < 2.28, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 094/106] qdev: recursively unrealize devices when unrealizing bus, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 096/106] pc: acpi: do not hardcode preprocessor, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 095/106] qmp: clean out whitespace, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 097/106] numa: handle mmaped memory allocation failure correctly, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 099/106] acpi: introduce TYPE_ACPI_DEVICE_IF interface,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 098/106] qmp: add query-memory-devices command, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 100/106] acpi: implement ospm_status() method for PIIX4/ICH9_LPC devices, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 101/106] qmp: add query-acpi-ospm-status command, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 102/106] qmp: add ACPI_DEVICE_OST event handling, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 104/106] qapi: fix input visitor bugs, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 103/106] acpi: rephrase comment, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 019/106] acpi: rename cpu_hotplug_defs.h to pc-hotplug.h, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 016/106] pc: add memory hotplug handler to PC_MACHINE, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 077/106] memory: add error propagation to file-based RAM allocation, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 040/106] migration: export SELF_ANNOUNCE_ROUNDS, Michael S. Tsirkin, 2014/06/18