[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 33/35] acpi: tpm-tis: use AcpiDevAmlIfClass:build_dev_aml to
From: |
Ani Sinha |
Subject: |
Re: [PATCH 33/35] acpi: tpm-tis: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML |
Date: |
Wed, 18 May 2022 16:15:58 +0530 |
On Mon, May 16, 2022 at 8:57 PM Igor Mammedov <imammedo@redhat.com> wrote:
>
> .. 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>
> ---
> 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 414b9240b2..58284438f8 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -1755,40 +1755,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 },
> { }
> }
> };
> --
> 2.31.1
>
- [PATCH 31/35] acpi: pc/q35: tpm-tis: fix TPM device scope, (continued)
- [PATCH 31/35] acpi: pc/q35: tpm-tis: fix TPM device scope, Igor Mammedov, 2022/05/16
- [PATCH 29/35] tests: acpi: update expected DSDT.pvpanic-isa blob, Igor Mammedov, 2022/05/16
- [PATCH 30/35] tests: acpi: white-list DSDT.tis.tpm2/DSDT.tis.tpm12 expected blobs, Igor Mammedov, 2022/05/16
- [PATCH 32/35] acpi: pc/q35: remove not needed 'if' condition on pci bus, Igor Mammedov, 2022/05/16
- [PATCH 35/35] x86: acpi-build: do not include hw/isa/isa.h directly, Igor Mammedov, 2022/05/16
- [PATCH 34/35] tests: acpi: update expected DSDT.tis.tpm2/DSDT.tis.tpm12 blobs, Igor Mammedov, 2022/05/16
- [PATCH 33/35] acpi: tpm-tis: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML, Igor Mammedov, 2022/05/16
- Re: [PATCH 33/35] acpi: tpm-tis: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML,
Ani Sinha <=
- Re: [PATCH 00/35] pc/q35: refactor ISA and SMBUS AML generation, Michael S. Tsirkin, 2022/05/16
- Re: [PATCH 00/35] pc/q35: refactor ISA and SMBUS AML generation, Gerd Hoffmann, 2022/05/17