34b321
From 5ccdcc1c49246cce9b1536e28a4977c65d72531c Mon Sep 17 00:00:00 2001
34b321
From: Laszlo Ersek <lersek@redhat.com>
34b321
Date: Wed, 11 May 2016 12:33:47 +0200
34b321
Subject: [PATCH 08/10] acpi: add function to extract oem_id and oem_table_id
34b321
 from the user's SLIC
34b321
34b321
RH-Author: Laszlo Ersek <lersek@redhat.com>
34b321
Message-id: <1462970028-10959-7-git-send-email-lersek@redhat.com>
34b321
Patchwork-id: 70383
34b321
O-Subject: [RHEL-7.3 qemu-kvm PATCH v2 6/7] acpi: add function to extract oem_id and oem_table_id from the user's SLIC
34b321
Bugzilla: 1330969
34b321
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
34b321
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
34b321
RH-Acked-by: Thomas Huth <thuth@redhat.com>
34b321
34b321
The acpi_get_slic_oem() function stores pointers to these fields in the
34b321
(first) SLIC table that the user passes in with the -acpitable switch.
34b321
34b321
Cc: "Michael S. Tsirkin" <mst@redhat.com> (supporter:ACPI/SMBIOS)
34b321
Cc: Igor Mammedov <imammedo@redhat.com> (supporter:ACPI/SMBIOS)
34b321
Cc: Richard W.M. Jones <rjones@redhat.com>
34b321
Cc: Aleksei Kovura <alex3kov@zoho.com>
34b321
Cc: Michael Tokarev <mjt@tls.msk.ru>
34b321
Cc: Steven Newbury <steve@snewbury.org.uk>
34b321
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1248758
34b321
LP: https://bugs.launchpad.net/qemu/+bug/1533848
34b321
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
34b321
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
34b321
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
34b321
Reviewed-by: Steven Newbury <steve@snewbury.org.uk>
34b321
(cherry picked from commit 88594e4fd1e916b778968b2bdd8d7375ca2fe8d8)
34b321
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
34b321
---
34b321
 include/hw/acpi/acpi.h |  7 +++++++
34b321
 hw/acpi/core.c         | 16 ++++++++++++++++
34b321
 2 files changed, 23 insertions(+)
34b321
34b321
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
34b321
---
34b321
 hw/acpi/core.c         | 16 ++++++++++++++++
34b321
 include/hw/acpi/acpi.h |  7 +++++++
34b321
 2 files changed, 23 insertions(+)
34b321
34b321
diff --git a/hw/acpi/core.c b/hw/acpi/core.c
34b321
index 88efba7..99c5918 100644
34b321
--- a/hw/acpi/core.c
34b321
+++ b/hw/acpi/core.c
34b321
@@ -349,6 +349,22 @@ uint8_t *acpi_table_next(uint8_t *current)
34b321
     }
34b321
 }
34b321
 
34b321
+int acpi_get_slic_oem(AcpiSlicOem *oem)
34b321
+{
34b321
+    uint8_t *u;
34b321
+
34b321
+    for (u = acpi_table_first(); u; u = acpi_table_next(u)) {
34b321
+        struct acpi_table_header *hdr = (void *)(u - sizeof(hdr->_length));
34b321
+
34b321
+        if (memcmp(hdr->sig, "SLIC", 4) == 0) {
34b321
+            oem->id = hdr->oem_id;
34b321
+            oem->table_id = hdr->oem_table_id;
34b321
+            return 0;
34b321
+        }
34b321
+    }
34b321
+    return -1;
34b321
+}
34b321
+
34b321
 static void acpi_notify_wakeup(Notifier *notifier, void *data)
34b321
 {
34b321
     ACPIREGS *ar = container_of(notifier, ACPIREGS, wakeup);
34b321
diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h
34b321
index bb7136d..1e59ec9 100644
34b321
--- a/include/hw/acpi/acpi.h
34b321
+++ b/include/hw/acpi/acpi.h
34b321
@@ -171,4 +171,11 @@ unsigned acpi_table_len(void *current);
34b321
 void acpi_table_add(const QemuOpts *opts, Error **errp);
34b321
 void acpi_table_add_builtin(const QemuOpts *opts, Error **errp);
34b321
 
34b321
+typedef struct AcpiSlicOem AcpiSlicOem;
34b321
+struct AcpiSlicOem {
34b321
+  char *id;
34b321
+  char *table_id;
34b321
+};
34b321
+int acpi_get_slic_oem(AcpiSlicOem *oem);
34b321
+
34b321
 #endif /* !QEMU_HW_ACPI_H */
34b321
-- 
34b321
1.8.3.1
34b321