aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/acpi-build.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-06-01 15:22:46 +0100
committerPeter Maydell <peter.maydell@linaro.org>2015-06-01 15:22:46 +0100
commitb821cbe274c5a5cacf1a7b28360d869ae1e6e0c3 (patch)
tree400b2e88bf5c577a4cbc5695d4fb12b30360df89 /hw/i386/acpi-build.c
parent9657cafceb90accedd574a3accb3d344def8e764 (diff)
parent830d70db692e374b55555f4407f96a1ceefdcc97 (diff)
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
pc, pci, tpm, virtio, vhost enhancements and fixes A bunch of cleanups and fixes all over the place, enhancements in TPM, virtio and vhost. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Mon Jun 1 13:19:48 2015 BST using RSA key ID D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" * remotes/mst/tags/for_upstream: (60 commits) vhost-user: add multi queue support virtio: make features 64bit wide qdev: add 64bit properties virtio-mmio: ioeventfd support hw/acpi/aml-build: Fix memory leak acpi: add aml_while() term acpi: add aml_increment() term acpi: add aml_shiftright() term acpi: add aml_shiftleft() term acpi: add aml_index() term acpi: add aml_lless() term acpi: add aml_add() term TPM2 ACPI table support tpm: Probe for connected TPM 1.2 or TPM 2 Extend TPM TIS interface to support TPM 2 Add stream ID to MSI write acpi: Simplify printing to dynamic string i386: drop FDC in pc-q35-2.4+ if neither it nor floppy drives are wanted i386/pc_q35: don't insist on board FDC if there's no default floppy i386/pc: '-drive if=floppy' should imply a board-default FDC ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/i386/acpi-build.c')
-rw-r--r--hw/i386/acpi-build.c43
1 files changed, 38 insertions, 5 deletions
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 3d19de68fc..2c7399b9db 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -41,6 +41,7 @@
#include "hw/acpi/memory_hotplug.h"
#include "sysemu/tpm.h"
#include "hw/acpi/tpm.h"
+#include "sysemu/tpm_backend.h"
/* Supported chipsets: */
#include "hw/acpi/piix4.h"
@@ -106,7 +107,7 @@ typedef struct AcpiPmInfo {
typedef struct AcpiMiscInfo {
bool has_hpet;
- bool has_tpm;
+ TPMVersion tpm_version;
const unsigned char *dsdt_code;
unsigned dsdt_size;
uint16_t pvpanic_port;
@@ -234,7 +235,7 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)
static void acpi_get_misc_info(AcpiMiscInfo *info)
{
info->has_hpet = hpet_find();
- info->has_tpm = tpm_find();
+ info->tpm_version = tpm_get_version();
info->pvpanic_port = pvpanic_port();
info->applesmc_io_base = applesmc_port();
}
@@ -414,6 +415,7 @@ build_madt(GArray *table_data, GArray *linker, AcpiCpuInfo *cpu,
}
#include "hw/i386/ssdt-tpm.hex"
+#include "hw/i386/ssdt-tpm2.hex"
/* Assign BSEL property to all buses. In the future, this can be changed
* to only assign to buses that support hotplug.
@@ -733,7 +735,7 @@ build_ssdt(GArray *table_data, GArray *linker,
if (misc->pvpanic_port) {
scope = aml_scope("\\_SB.PCI0.ISA");
- dev = aml_device("PEVR");
+ dev = aml_device("PEVT");
aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0001")));
crs = aml_resource_template();
@@ -748,6 +750,9 @@ build_ssdt(GArray *table_data, GArray *linker,
aml_append(field, aml_named_field("PEPT", 8));
aml_append(dev, field);
+ /* device present, functioning, decoding, not shown in UI */
+ aml_append(dev, aml_name_decl("_STA", aml_int(0xB)));
+
method = aml_method("RDPT", 0);
aml_append(method, aml_store(aml_name("PEPT"), aml_local(0)));
aml_append(method, aml_return(aml_local(0)));
@@ -1026,6 +1031,25 @@ build_tpm_ssdt(GArray *table_data, GArray *linker)
memcpy(tpm_ptr, ssdt_tpm_aml, sizeof(ssdt_tpm_aml));
}
+static void
+build_tpm2(GArray *table_data, GArray *linker)
+{
+ Acpi20TPM2 *tpm2_ptr;
+ void *tpm_ptr;
+
+ tpm_ptr = acpi_data_push(table_data, sizeof(ssdt_tpm2_aml));
+ memcpy(tpm_ptr, ssdt_tpm2_aml, sizeof(ssdt_tpm2_aml));
+
+ tpm2_ptr = acpi_data_push(table_data, sizeof *tpm2_ptr);
+
+ tpm2_ptr->platform_class = cpu_to_le16(TPM2_ACPI_CLASS_CLIENT);
+ tpm2_ptr->control_area_address = cpu_to_le64(0);
+ tpm2_ptr->start_method = cpu_to_le32(TPM2_START_METHOD_MMIO);
+
+ build_header(linker, table_data,
+ (void *)tpm2_ptr, "TPM2", sizeof(*tpm2_ptr), 4);
+}
+
typedef enum {
MEM_AFFINITY_NOFLAGS = 0,
MEM_AFFINITY_ENABLED = (1 << 0),
@@ -1340,12 +1364,21 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
acpi_add_table(table_offsets, tables_blob);
build_hpet(tables_blob, tables->linker);
}
- if (misc.has_tpm) {
+ if (misc.tpm_version != TPM_VERSION_UNSPEC) {
acpi_add_table(table_offsets, tables_blob);
build_tpm_tcpa(tables_blob, tables->linker, tables->tcpalog);
acpi_add_table(table_offsets, tables_blob);
- build_tpm_ssdt(tables_blob, tables->linker);
+ switch (misc.tpm_version) {
+ case TPM_VERSION_1_2:
+ build_tpm_ssdt(tables_blob, tables->linker);
+ break;
+ case TPM_VERSION_2_0:
+ build_tpm2(tables_blob, tables->linker);
+ break;
+ default:
+ assert(false);
+ }
}
if (guest_info->numa_nodes) {
acpi_add_table(table_offsets, tables_blob);