aboutsummaryrefslogtreecommitdiff
path: root/hw/acpi
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2013-10-07 14:41:40 +0300
committerMichael S. Tsirkin <mst@redhat.com>2013-10-14 17:48:53 +0300
commit60de1163d5b5013fe964ac0792e9a64a823e73a3 (patch)
treea2de55b3a511f4b1a72c6697e0058a42a21a10df /hw/acpi
parent64e9df8d34e493e59c1920358257a7576a560a1a (diff)
downloadqemu-60de1163d5b5013fe964ac0792e9a64a823e73a3.zip
qemu-60de1163d5b5013fe964ac0792e9a64a823e73a3.tar.gz
qemu-60de1163d5b5013fe964ac0792e9a64a823e73a3.tar.bz2
acpi: add interface to access user-installed tables
Also add a new API to install builtin tables, so that we can distinguish between the two. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/acpi')
-rw-r--r--hw/acpi/core.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index 7467b88..4d25d8e 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -309,6 +309,46 @@ out:
error_propagate(errp, err);
}
+static bool acpi_table_builtin = false;
+
+void acpi_table_add_builtin(const QemuOpts *opts, Error **errp)
+{
+ acpi_table_builtin = true;
+ acpi_table_add(opts, errp);
+}
+
+unsigned acpi_table_len(void *current)
+{
+ struct acpi_table_header *hdr = current - sizeof(hdr->_length);
+ return hdr->_length;
+}
+
+static
+void *acpi_table_hdr(void *h)
+{
+ struct acpi_table_header *hdr = h;
+ return &hdr->sig;
+}
+
+uint8_t *acpi_table_first(void)
+{
+ if (acpi_table_builtin || !acpi_tables) {
+ return NULL;
+ }
+ return acpi_table_hdr(acpi_tables + ACPI_TABLE_PFX_SIZE);
+}
+
+uint8_t *acpi_table_next(uint8_t *current)
+{
+ uint8_t *next = current + acpi_table_len(current);
+
+ if (next - acpi_tables >= acpi_tables_len) {
+ return NULL;
+ } else {
+ return acpi_table_hdr(next);
+ }
+}
+
static void acpi_notify_wakeup(Notifier *notifier, void *data)
{
ACPIREGS *ar = container_of(notifier, ACPIREGS, wakeup);