|
|
9ae3a8 |
From 99ac82bfa364eef3e6aa27a12d4eb5e23c7ccfb1 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
Message-Id: <99ac82bfa364eef3e6aa27a12d4eb5e23c7ccfb1.1387298827.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
In-Reply-To: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
References: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
From: "Michael S. Tsirkin" <mst@redhat.com>
|
|
|
9ae3a8 |
Date: Tue, 17 Dec 2013 15:19:02 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 46/56] acpi: add interface to access user-installed tables
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1387293161-4085-47-git-send-email-mst@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 56353
|
|
|
9ae3a8 |
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 46/57] acpi: add interface to access user-installed tables
|
|
|
9ae3a8 |
Bugzilla: 1034876
|
|
|
9ae3a8 |
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Also add a new API to install builtin tables, so
|
|
|
9ae3a8 |
that we can distinguish between the two.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 60de1163d5b5013fe964ac0792e9a64a823e73a3)
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
include/hw/acpi/acpi.h | 4 ++++
|
|
|
9ae3a8 |
hw/acpi/core.c | 40 ++++++++++++++++++++++++++++++++++++++++
|
|
|
9ae3a8 |
2 files changed, 44 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/acpi/core.c | 40 ++++++++++++++++++++++++++++++++++++++++
|
|
|
9ae3a8 |
include/hw/acpi/acpi.h | 4 ++++
|
|
|
9ae3a8 |
2 files changed, 44 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/acpi/core.c b/hw/acpi/core.c
|
|
|
9ae3a8 |
index 42eeace..3352d17 100644
|
|
|
9ae3a8 |
--- a/hw/acpi/core.c
|
|
|
9ae3a8 |
+++ b/hw/acpi/core.c
|
|
|
9ae3a8 |
@@ -309,6 +309,46 @@ out:
|
|
|
9ae3a8 |
error_propagate(errp, err);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+static bool acpi_table_builtin = false;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+void acpi_table_add_builtin(const QemuOpts *opts, Error **errp)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ acpi_table_builtin = true;
|
|
|
9ae3a8 |
+ acpi_table_add(opts, errp);
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+unsigned acpi_table_len(void *current)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ struct acpi_table_header *hdr = current - sizeof(hdr->_length);
|
|
|
9ae3a8 |
+ return hdr->_length;
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+static
|
|
|
9ae3a8 |
+void *acpi_table_hdr(void *h)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ struct acpi_table_header *hdr = h;
|
|
|
9ae3a8 |
+ return &hdr->sig;
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+uint8_t *acpi_table_first(void)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ if (acpi_table_builtin || !acpi_tables) {
|
|
|
9ae3a8 |
+ return NULL;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ return acpi_table_hdr(acpi_tables + ACPI_TABLE_PFX_SIZE);
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+uint8_t *acpi_table_next(uint8_t *current)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ uint8_t *next = current + acpi_table_len(current);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (next - acpi_tables >= acpi_tables_len) {
|
|
|
9ae3a8 |
+ return NULL;
|
|
|
9ae3a8 |
+ } else {
|
|
|
9ae3a8 |
+ return acpi_table_hdr(next);
|
|
|
9ae3a8 |
+ }
|
|
|
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 635be7b..bb7136d 100644
|
|
|
9ae3a8 |
--- a/include/hw/acpi/acpi.h
|
|
|
9ae3a8 |
+++ b/include/hw/acpi/acpi.h
|
|
|
9ae3a8 |
@@ -165,6 +165,10 @@ extern int acpi_enabled;
|
|
|
9ae3a8 |
extern char unsigned *acpi_tables;
|
|
|
9ae3a8 |
extern size_t acpi_tables_len;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+uint8_t *acpi_table_first(void);
|
|
|
9ae3a8 |
+uint8_t *acpi_table_next(uint8_t *current);
|
|
|
9ae3a8 |
+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 |
#endif /* !QEMU_HW_ACPI_H */
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.11.7
|
|
|
9ae3a8 |
|