[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 35/39] acpi: add interface to access user-installe
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 35/39] acpi: add interface to access user-installed tables |
Date: |
Tue, 15 Oct 2013 09:32:56 +0300 |
Also add a new API to install builtin tables, so
that we can distinguish between the two.
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
include/hw/acpi/acpi.h | 4 ++++
hw/acpi/core.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h
index 51733d3..6bbcb17 100644
--- a/include/hw/acpi/acpi.h
+++ b/include/hw/acpi/acpi.h
@@ -165,6 +165,10 @@ extern int acpi_enabled;
extern char unsigned *acpi_tables;
extern size_t acpi_tables_len;
+uint8_t *acpi_table_first(void);
+uint8_t *acpi_table_next(uint8_t *current);
+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);
#endif /* !QEMU_HW_ACPI_H */
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);
--
MST
- [Qemu-devel] [PULL v2 25/39] acpi: ssdt pcihp: updat generated file, (continued)
- [Qemu-devel] [PULL v2 25/39] acpi: ssdt pcihp: updat generated file, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 26/39] loader: use file path size from fw_cfg.h, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 24/39] acpi: pre-compiled ASL files, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 27/39] i386: add bios linker/loader, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 28/39] loader: allow adding ROMs in done callbacks, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 29/39] i386: define pc guest info, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 30/39] acpi/piix: add macros for acpi property names, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 31/39] piix: APIs for pc guest info, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 32/39] ich9: APIs for pc guest info, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 33/39] pvpanic: add API to access io port, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 35/39] acpi: add interface to access user-installed tables,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 34/39] hpet: add API to find it, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 36/39] pc: use new api to add builtin tables, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 37/39] i386: ACPI table generation code from seabios, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 38/39] ssdt: fix PBLK length, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 39/39] ssdt-proc: update generated file, Michael S. Tsirkin, 2013/10/15