[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 33/54] acpi: tpm-tis: use AcpiDevAmlIfClass:build_dev_aml to provi
From: |
Michael S. Tsirkin |
Subject: |
[PULL 33/54] acpi: tpm-tis: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML |
Date: |
Fri, 10 Jun 2022 03:58:38 -0400 |
From: Igor Mammedov <imammedo@redhat.com>
.. and clean up not longer needed conditionals in DSTD build code
tpm-tis AML will be fetched and included when ISA bridge will
build its own AML code (including attached devices).
Expected AML change:
the device under separate _SB.PCI0.ISA scope is moved directly
under Device(ISA) node.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20220608135340.3304695-34-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/i386/acpi-build.c | 34 ----------------------------------
hw/tpm/tpm_tis_isa.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 34 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 1204b6da05..0b65fc99cd 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1804,40 +1804,6 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
Aml *scope = aml_scope("PCI0");
/* Scan all PCI buses. Generate tables to support hotplug. */
build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
-
-#ifdef CONFIG_TPM
- if (TPM_IS_TIS_ISA(tpm)) {
- dev = aml_device("ISA.TPM");
- if (misc->tpm_version == TPM_VERSION_2_0) {
- aml_append(dev, aml_name_decl("_HID",
- aml_string("MSFT0101")));
- aml_append(dev,
- aml_name_decl("_STR",
- aml_string("TPM 2.0 Device")));
- } else {
- aml_append(dev, aml_name_decl("_HID",
- aml_eisaid("PNP0C31")));
- }
- aml_append(dev, aml_name_decl("_UID", aml_int(1)));
-
- aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
- crs = aml_resource_template();
- aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
- TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
- /*
- FIXME: TPM_TIS_IRQ=5 conflicts with PNP0C0F irqs,
- Rewrite to take IRQ from TPM device model and
- fix default IRQ value there to use some unused IRQ
- */
- /* aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ)); */
- aml_append(dev, aml_name_decl("_CRS", crs));
-
- tpm_build_ppi_acpi(tpm, dev);
-
- aml_append(scope, dev);
- }
-#endif
-
aml_append(sb_scope, scope);
}
}
diff --git a/hw/tpm/tpm_tis_isa.c b/hw/tpm/tpm_tis_isa.c
index 3477afd735..91e3792248 100644
--- a/hw/tpm/tpm_tis_isa.c
+++ b/hw/tpm/tpm_tis_isa.c
@@ -30,6 +30,7 @@
#include "tpm_prop.h"
#include "tpm_tis.h"
#include "qom/object.h"
+#include "hw/acpi/acpi_aml_interface.h"
struct TPMStateISA {
/*< private >*/
@@ -138,10 +139,39 @@ static void tpm_tis_isa_realizefn(DeviceState *dev, Error
**errp)
}
}
+static void build_tpm_tis_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
+{
+ Aml *dev, *crs;
+ TPMStateISA *isadev = TPM_TIS_ISA(adev);
+ TPMIf *ti = TPM_IF(isadev);
+
+ dev = aml_device("TPM");
+ if (tpm_tis_isa_get_tpm_version(ti) == TPM_VERSION_2_0) {
+ aml_append(dev, aml_name_decl("_HID", aml_string("MSFT0101")));
+ aml_append(dev, aml_name_decl("_STR", aml_string("TPM 2.0 Device")));
+ } else {
+ aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
+ }
+ aml_append(dev, aml_name_decl("_UID", aml_int(1)));
+ aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
+ crs = aml_resource_template();
+ aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE, TPM_TIS_ADDR_SIZE,
+ AML_READ_WRITE));
+ /*
+ * FIXME: TPM_TIS_IRQ=5 conflicts with PNP0C0F irqs,
+ * fix default TPM_TIS_IRQ value there to use some unused IRQ
+ */
+ /* aml_append(crs, aml_irq_no_flags(isadev->state.irq_num)); */
+ aml_append(dev, aml_name_decl("_CRS", crs));
+ tpm_build_ppi_acpi(ti, dev);
+ aml_append(scope, dev);
+}
+
static void tpm_tis_isa_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
TPMIfClass *tc = TPM_IF_CLASS(klass);
+ AcpiDevAmlIfClass *adevc = ACPI_DEV_AML_IF_CLASS(klass);
device_class_set_props(dc, tpm_tis_isa_properties);
dc->vmsd = &vmstate_tpm_tis_isa;
@@ -151,6 +181,7 @@ static void tpm_tis_isa_class_init(ObjectClass *klass, void
*data)
tc->request_completed = tpm_tis_isa_request_completed;
tc->get_version = tpm_tis_isa_get_tpm_version;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
+ adevc->build_dev_aml = build_tpm_tis_isa_aml;
}
static const TypeInfo tpm_tis_isa_info = {
@@ -161,6 +192,7 @@ static const TypeInfo tpm_tis_isa_info = {
.class_init = tpm_tis_isa_class_init,
.interfaces = (InterfaceInfo[]) {
{ TYPE_TPM_IF },
+ { TYPE_ACPI_DEV_AML_IF },
{ }
}
};
--
MST
- [PULL 24/54] acpi: applesmc: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML, (continued)
- [PULL 24/54] acpi: applesmc: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML, Michael S. Tsirkin, 2022/06/10
- [PULL 25/54] tests: acpi: update expected blobs, Michael S. Tsirkin, 2022/06/10
- [PULL 26/54] tests: acpi: white-lists expected DSDT.pvpanic-isa blob, Michael S. Tsirkin, 2022/06/10
- [PULL 27/54] tests: acpi: add pvpanic-isa: testcase, Michael S. Tsirkin, 2022/06/10
- [PULL 28/54] acpi: pvpanic-isa: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML, Michael S. Tsirkin, 2022/06/10
- [PULL 29/54] tests: acpi: update expected DSDT.pvpanic-isa blob, Michael S. Tsirkin, 2022/06/10
- [PULL 30/54] tests: acpi: white-list DSDT.tis.tpm2/DSDT.tis.tpm12 expected blobs, Michael S. Tsirkin, 2022/06/10
- [PULL 34/54] tests: acpi: update expected DSDT.tis.tpm2/DSDT.tis.tpm12 blobs, Michael S. Tsirkin, 2022/06/10
- [PULL 32/54] acpi: pc/q35: remove not needed 'if' condition on pci bus, Michael S. Tsirkin, 2022/06/10
- [PULL 31/54] acpi: pc/q35: tpm-tis: fix TPM device scope, Michael S. Tsirkin, 2022/06/10
- [PULL 33/54] acpi: tpm-tis: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML,
Michael S. Tsirkin <=
- [PULL 38/54] hw/cxl: Push linking of CXL targets into i386/pc rather than in machine.c, Michael S. Tsirkin, 2022/06/10
- [PULL 39/54] tests/acpi: Allow modification of q35 CXL CEDT table., Michael S. Tsirkin, 2022/06/10
- [PULL 37/54] hw/acpi/cxl: Pass in the CXLState directly rather than MachineState, Michael S. Tsirkin, 2022/06/10
- [PULL 40/54] pci/pci_expander_bridge: For CXL HB delay the HB register memory region setup., Michael S. Tsirkin, 2022/06/10
- [PULL 35/54] x86: acpi-build: do not include hw/isa/isa.h directly, Michael S. Tsirkin, 2022/06/10
- [PULL 43/54] hw/machine: Drop cxl_supported flag as no longer useful, Michael S. Tsirkin, 2022/06/10
- [PULL 42/54] hw/cxl: Move the CXLState from MachineState to machine type specific state., Michael S. Tsirkin, 2022/06/10
- [PULL 36/54] hw/cxl: Make the CXL fixed memory window setup a machine parameter., Michael S. Tsirkin, 2022/06/10
- [PULL 41/54] tests/acpi: Update q35/CEDT.cxl for new memory addresses., Michael S. Tsirkin, 2022/06/10
- [PULL 44/54] pci: fix overflow in snprintf string formatting, Michael S. Tsirkin, 2022/06/10