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