On 02/18/2011 10:33 AM, Andreas Niederl wrote:
Signed-off-by: Andreas Niederl<andreas.nied...@iaik.tugraz.at>
---
Makefile.target | 3 +++
hw/acpi.c | 28 ++++++++++++++++++++++++++++
hw/pc.h | 1 +
hw/tpm.h | 2 ++
hw/tpm_acpi.c | 40 ++++++++++++++++++++++++++++++++++++++++
hw/tpm_ssdt.dsl | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
hw/tpm_ssdt.hex | 41 +++++++++++++++++++++++++++++++++++++++++
hw/tpm_tis.c | 1 +
rules.mak | 7 ++++++-
vl.c | 23 +++++++++++++++++++++++
10 files changed, 200 insertions(+), 1 deletions(-)
create mode 100644 hw/tpm_acpi.c
create mode 100644 hw/tpm_ssdt.dsl
create mode 100644 hw/tpm_ssdt.hex
diff --git a/Makefile.target b/Makefile.target
index 5a0fd40..33ffe19 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -211,6 +211,9 @@ obj-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o
# Inter-VM PCI shared memory
obj-$(CONFIG_KVM) += ivshmem.o
+# TPM acpi support
+obj-$(CONFIG_TPM) += tpm_acpi.o
+
# Hardware support
obj-i386-y += vga.o
obj-i386-y += mc146818rtc.o i8259.o pc.o
diff --git a/hw/acpi.c b/hw/acpi.c
index 8071e7b..93656c5 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -35,6 +35,34 @@ struct acpi_table_header
char *acpi_tables;
size_t acpi_tables_len;
+
+/*
+ * add a table directly (e.g. iasl C source output)
+ */
+int acpi_table_add_raw(const char *t, uint32_t length)
+{
+ char *p;
+
+ if (!acpi_tables) {
+ acpi_tables_len = sizeof(uint16_t);
+ acpi_tables = qemu_mallocz(acpi_tables_len);
+ }
+ acpi_tables = qemu_realloc(acpi_tables,
+ acpi_tables_len + sizeof(uint16_t) + length);
+ p = acpi_tables + acpi_tables_len;
+ acpi_tables_len += sizeof(uint16_t) + length;
+
+ *(uint16_t*)p = cpu_to_le32(length);
+ p += sizeof(uint16_t);
+
+ memcpy(p, t, length);
+
+ /* increase number of tables */
+ (*(uint16_t*)acpi_tables) =
+ cpu_to_le32(le32_to_cpu(*(uint16_t*)acpi_tables) + 1);
+ return 0;
+}
+
Does it show up in Linux? I am trying to find the code that connects it
to the RSDT, but don't see any.
Stefan