summary refs log tree commit diff stats
path: root/hw/acpi/memory_hotplug.c
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2014-06-16 19:12:27 +0200
committerMichael S. Tsirkin <mst@redhat.com>2014-06-19 18:44:22 +0300
commit43f50410088847376c8b146e817a9042bd2a5f36 (patch)
treea8e170b918adc00773966b0ce966f0ee616975d9 /hw/acpi/memory_hotplug.c
parent521b3673ac16ec7fa33b1ec2cdfe75ec708f073e (diff)
downloadfocaccia-qemu-43f50410088847376c8b146e817a9042bd2a5f36.tar.gz
focaccia-qemu-43f50410088847376c8b146e817a9042bd2a5f36.zip
acpi: implement ospm_status() method for PIIX4/ICH9_LPC devices
... using TYPE_ACPI_DEVICE_IF interface.
Which provides status reporting of ACPI declared memory devices

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>
Diffstat (limited to 'hw/acpi/memory_hotplug.c')
-rw-r--r--hw/acpi/memory_hotplug.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
index 71c7a5e83f..e7009bc355 100644
--- a/hw/acpi/memory_hotplug.c
+++ b/hw/acpi/memory_hotplug.c
@@ -4,6 +4,37 @@
 #include "hw/boards.h"
 #include "trace.h"
 
+static ACPIOSTInfo *acpi_memory_device_status(int slot, MemStatus *mdev)
+{
+    ACPIOSTInfo *info = g_new0(ACPIOSTInfo, 1);
+
+    info->slot_type = ACPI_SLOT_TYPE_DIMM;
+    info->slot = g_strdup_printf("%d", slot);
+    info->source = mdev->ost_event;
+    info->status = mdev->ost_status;
+    if (mdev->dimm) {
+        DeviceState *dev = DEVICE(mdev->dimm);
+        if (dev->id) {
+            info->device = g_strdup(dev->id);
+            info->has_device = true;
+        }
+    }
+    return info;
+}
+
+void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list)
+{
+    int i;
+
+    for (i = 0; i < mem_st->dev_count; i++) {
+        ACPIOSTInfoList *elem = g_new0(ACPIOSTInfoList, 1);
+        elem->value = acpi_memory_device_status(i, &mem_st->devs[i]);
+        elem->next = NULL;
+        **list = elem;
+        *list = &elem->next;
+    }
+}
+
 static uint64_t acpi_memory_hotplug_read(void *opaque, hwaddr addr,
                                          unsigned int size)
 {