Skip to content

Commit b89e66e

Browse files
srajivxjamesmorris
authored andcommitted
TPM: ACPI/PNP dependency removal
This patch pushes the ACPI dependency into the device driver code itself. Now, even without ACPI/PNP enabled, the device can be registered using the TIS specified memory space. This will however result in the lack of access to the bios event log, being the only implication of such ACPI removal. Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com> Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Signed-off-by: James Morris <jmorris@namei.org>
1 parent fcaaade commit b89e66e

2 files changed

Lines changed: 32 additions & 22 deletions

File tree

‎drivers/char/tpm/Kconfig‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,28 @@ menuconfig TCG_TPM
1717
obtained at: <http://sourceforge.net/projects/trousers>. To
1818
compile this driver as a module, choose M here; the module
1919
will be called tpm. If unsure, say N.
20-
Note: For more TPM drivers enable CONFIG_PNP, CONFIG_ACPI
21-
and CONFIG_PNPACPI.
20+
Note: For more TPM drivers and BIOS LOG access enable
21+
CONFIG_PNP, CONFIG_ACPI and CONFIG_PNPACPI.
2222

2323
if TCG_TPM
2424

2525
config TCG_TIS
2626
tristate "TPM Interface Specification 1.2 Interface"
27-
depends on PNP
2827
---help---
2928
If you have a TPM security chip that is compliant with the
3029
TCG TIS 1.2 TPM specification say Yes and it will be accessible
3130
from within Linux. To compile this driver as a module, choose
3231
M here; the module will be called tpm_tis.
3332

33+
config TCG_BIOS_LOG
34+
bool "TPM bios mesurement log"
35+
depends on X86
36+
select ACPI
37+
---help---
38+
ACPI is required for access to bios measurements lists and therefore
39+
to validate the PCR[0] value. So say Yes in case you want this
40+
feature and, consequently, ACPI will be enabled.
41+
3442
config TCG_NSC
3543
tristate "National Semiconductor TPM Interface"
3644
---help---

‎drivers/char/tpm/tpm_tis.c‎

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
597597
tpm_remove_hardware(chip->dev);
598598
return rc;
599599
}
600-
600+
#ifdef CONFIG_PNP
601601
static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
602602
const struct pnp_device_id *pnp_id)
603603
{
@@ -662,7 +662,7 @@ static struct pnp_driver tis_pnp_driver = {
662662
module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id,
663663
sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444);
664664
MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe");
665-
665+
#endif
666666
static int tpm_tis_suspend(struct platform_device *dev, pm_message_t msg)
667667
{
668668
return tpm_pm_suspend(&dev->dev, msg);
@@ -689,21 +689,21 @@ MODULE_PARM_DESC(force, "Force device probe rather than using ACPI entry");
689689
static int __init init_tis(void)
690690
{
691691
int rc;
692+
#ifdef CONFIG_PNP
693+
if (!force)
694+
return pnp_register_driver(&tis_pnp_driver);
695+
#endif
692696

693-
if (force) {
694-
rc = platform_driver_register(&tis_drv);
695-
if (rc < 0)
696-
return rc;
697-
if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0)))
698-
return PTR_ERR(pdev);
699-
if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) {
700-
platform_device_unregister(pdev);
701-
platform_driver_unregister(&tis_drv);
702-
}
697+
rc = platform_driver_register(&tis_drv);
698+
if (rc < 0)
703699
return rc;
700+
if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0)))
701+
return PTR_ERR(pdev);
702+
if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) {
703+
platform_device_unregister(pdev);
704+
platform_driver_unregister(&tis_drv);
704705
}
705-
706-
return pnp_register_driver(&tis_pnp_driver);
706+
return rc;
707707
}
708708

709709
static void __exit cleanup_tis(void)
@@ -727,12 +727,14 @@ static void __exit cleanup_tis(void)
727727
list_del(&i->list);
728728
}
729729
spin_unlock(&tis_lock);
730-
731-
if (force) {
732-
platform_device_unregister(pdev);
733-
platform_driver_unregister(&tis_drv);
734-
} else
730+
#ifdef CONFIG_PNP
731+
if (!force) {
735732
pnp_unregister_driver(&tis_pnp_driver);
733+
return;
734+
}
735+
#endif
736+
platform_device_unregister(pdev);
737+
platform_driver_unregister(&tis_drv);
736738
}
737739

738740
module_init(init_tis);

0 commit comments

Comments
 (0)