qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: qemu-devel@nongnu.org
Cc: Aleksei Kovura <alex3kov@zoho.com>,
	Steven Newbury <steve@snewbury.org.uk>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Michael Tokarev <mjt@tls.msk.ru>,
	"Richard W.M. Jones" <rjones@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>
Subject: [Qemu-devel] [PATCH v2 3/4] acpi: add function to extract oem_id and oem_table_id from the user's SLIC
Date: Mon, 18 Jan 2016 15:12:12 +0100	[thread overview]
Message-ID: <1453126333-19474-4-git-send-email-lersek@redhat.com> (raw)
In-Reply-To: <1453126333-19474-1-git-send-email-lersek@redhat.com>

The acpi_get_slic_oem() function stores pointers to these fields in the
(first) SLIC table that the user passes in with the -acpitable switch.

Cc: "Michael S. Tsirkin" <mst@redhat.com> (supporter:ACPI/SMBIOS)
Cc: Igor Mammedov <imammedo@redhat.com> (supporter:ACPI/SMBIOS)
Cc: Richard W.M. Jones <rjones@redhat.com>
Cc: Aleksei Kovura <alex3kov@zoho.com>
Cc: Michael Tokarev <mjt@tls.msk.ru>
Cc: Steven Newbury <steve@snewbury.org.uk>
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1248758
LP: https://bugs.launchpad.net/qemu/+bug/1533848
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---

Notes:
    v2:
    - introduce [MST]

 include/hw/acpi/acpi.h |  7 +++++++
 hw/acpi/core.c         | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h
index b20bd55..2de3021 100644
--- a/include/hw/acpi/acpi.h
+++ b/include/hw/acpi/acpi.h
@@ -196,4 +196,11 @@ unsigned acpi_table_len(void *current);
 void acpi_table_add(const QemuOpts *opts, Error **errp);
 void acpi_table_add_builtin(const QemuOpts *opts, Error **errp);
 
+typedef struct AcpiSlicOem AcpiSlicOem;
+struct AcpiSlicOem {
+  char *id;
+  char *table_id;
+};
+int acpi_get_slic_oem(AcpiSlicOem *oem);
+
 #endif /* !QEMU_HW_ACPI_H */
diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index 21e113d..a9d0f68 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -349,6 +349,22 @@ uint8_t *acpi_table_next(uint8_t *current)
     }
 }
 
+int acpi_get_slic_oem(AcpiSlicOem *oem)
+{
+    uint8_t *u;
+
+    for (u = acpi_table_first(); u; u = acpi_table_next(u)) {
+        struct acpi_table_header *hdr = (void *)(u - sizeof(hdr->_length));
+
+        if (memcmp(hdr->sig, "SLIC", 4) == 0) {
+            oem->id = hdr->oem_id;
+            oem->table_id = hdr->oem_table_id;
+            return 0;
+        }
+    }
+    return -1;
+}
+
 static void acpi_notify_wakeup(Notifier *notifier, void *data)
 {
     ACPIREGS *ar = container_of(notifier, ACPIREGS, wakeup);
-- 
1.8.3.1

  parent reply	other threads:[~2016-01-18 14:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-18 14:12 [Qemu-devel] [PATCH v2 0/4] set the OEM fields in the RSDT and the FADT from the SLIC Laszlo Ersek
2016-01-18 14:12 ` [Qemu-devel] [PATCH v2 1/4] acpi: take oem_id in build_header(), optionally Laszlo Ersek
2016-01-19  3:27   ` Shannon Zhao
2016-01-18 14:12 ` [Qemu-devel] [PATCH v2 2/4] acpi: expose oem_id and oem_table_id in build_rsdt() Laszlo Ersek
2016-01-19  3:29   ` Shannon Zhao
2016-01-18 14:12 ` Laszlo Ersek [this message]
2016-01-18 14:12 ` [Qemu-devel] [PATCH v2 4/4] pc: set the OEM fields in the RSDT and the FADT from the SLIC Laszlo Ersek
2016-01-19  7:35 ` [Qemu-devel] [PATCH v2 0/4] " Steven Newbury
2016-01-19  7:40   ` Steven Newbury
2016-01-27 18:31 ` Laszlo Ersek
2016-02-03 18:51   ` Laszlo Ersek
2016-02-03 19:02     ` Michael Tokarev
2016-02-03 19:45       ` Laszlo Ersek
2016-02-03 20:37       ` Richard W.M. Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1453126333-19474-4-git-send-email-lersek@redhat.com \
    --to=lersek@redhat.com \
    --cc=alex3kov@zoho.com \
    --cc=imammedo@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    --cc=steve@snewbury.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).