qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC 2/5] acpi: introduce TYPE_ACPI_DEVICE_IF interface


From: Igor Mammedov
Subject: [Qemu-devel] [RFC 2/5] acpi: introduce TYPE_ACPI_DEVICE_IF interface
Date: Wed, 28 May 2014 16:57:33 +0200

... it will be used to abstract generic ACPI bits from
device that implements ACPI interface.

Signed-off-by: Igor Mammedov <address@hidden>
---
 hw/acpi/Makefile.objs                |    1 +
 hw/acpi/acpi_interface.c             |   15 ++++++++++++
 include/hw/acpi/acpi_dev_interface.h |   43 ++++++++++++++++++++++++++++++++++
 qapi-schema.json                     |   18 ++++++++++++++
 4 files changed, 77 insertions(+), 0 deletions(-)
 create mode 100644 hw/acpi/acpi_interface.c
 create mode 100644 include/hw/acpi/acpi_dev_interface.h

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
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/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/qapi-schema.json b/qapi-schema.json
index 0cc3eb3..834ec59 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -4775,3 +4775,21 @@
 # Since: 2.1
 ##
 { 'command': 'query-memory-devices', 'returns': ['MemoryDeviceInfo'] }
+
+## @ACPIOSTInfo
+#
+# OSPM Status Indication for a device
+# possible values are as desribed in "_OST (OSPM Status Indication)"
+# chapter, decribing method _OST in ACPI spec.
+#
+# @source_event: Arg0 - An Integer containing the source event
+#
+# @status_code: Arg1 – An Integer containing the status code
+#
+# Since: 2.1
+##
+{ 'type': 'ACPIOSTInfo',
+  'data'  : { 'device': 'str',
+              'source': 'int',
+              'status': 'int',
+              'slot': 'int' } }
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]