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>
This commit is contained in:
Rajiv Andrade 2010-05-13 17:37:54 -03:00 committed by James Morris
parent b3139bbc52
commit 7f2ab000c6
2 changed files with 25 additions and 21 deletions

View File

@ -17,14 +17,16 @@ menuconfig TCG_TPM
obtained at: <http://sourceforge.net/projects/trousers>. To obtained at: <http://sourceforge.net/projects/trousers>. To
compile this driver as a module, choose M here; the module compile this driver as a module, choose M here; the module
will be called tpm. If unsure, say N. will be called tpm. If unsure, say N.
Note: For more TPM drivers enable CONFIG_PNP, CONFIG_ACPI Notes:
1) For more TPM drivers enable CONFIG_PNP, CONFIG_ACPI
and CONFIG_PNPACPI. and CONFIG_PNPACPI.
2) Without ACPI enabled, the BIOS event log won't be accessible,
which is required to validate the PCR 0-7 values.
if TCG_TPM if TCG_TPM
config TCG_TIS config TCG_TIS
tristate "TPM Interface Specification 1.2 Interface" tristate "TPM Interface Specification 1.2 Interface"
depends on PNP
---help--- ---help---
If you have a TPM security chip that is compliant with the If you have a TPM security chip that is compliant with the
TCG TIS 1.2 TPM specification say Yes and it will be accessible TCG TIS 1.2 TPM specification say Yes and it will be accessible

View File

@ -598,7 +598,7 @@ out_err:
tpm_remove_hardware(chip->dev); tpm_remove_hardware(chip->dev);
return rc; return rc;
} }
#ifdef CONFIG_PNP
static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
const struct pnp_device_id *pnp_id) const struct pnp_device_id *pnp_id)
{ {
@ -663,7 +663,7 @@ static struct pnp_driver tis_pnp_driver = {
module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id, module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id,
sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444); sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444);
MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe");
#endif
static int tpm_tis_suspend(struct platform_device *dev, pm_message_t msg) static int tpm_tis_suspend(struct platform_device *dev, pm_message_t msg)
{ {
return tpm_pm_suspend(&dev->dev, msg); return tpm_pm_suspend(&dev->dev, msg);
@ -690,21 +690,21 @@ MODULE_PARM_DESC(force, "Force device probe rather than using ACPI entry");
static int __init init_tis(void) static int __init init_tis(void)
{ {
int rc; int rc;
#ifdef CONFIG_PNP
if (!force)
return pnp_register_driver(&tis_pnp_driver);
#endif
if (force) { rc = platform_driver_register(&tis_drv);
rc = platform_driver_register(&tis_drv); if (rc < 0)
if (rc < 0)
return rc;
if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0)))
return PTR_ERR(pdev);
if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) {
platform_device_unregister(pdev);
platform_driver_unregister(&tis_drv);
}
return rc; return rc;
if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0)))
return PTR_ERR(pdev);
if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) {
platform_device_unregister(pdev);
platform_driver_unregister(&tis_drv);
} }
return rc;
return pnp_register_driver(&tis_pnp_driver);
} }
static void __exit cleanup_tis(void) static void __exit cleanup_tis(void)
@ -728,12 +728,14 @@ static void __exit cleanup_tis(void)
list_del(&i->list); list_del(&i->list);
} }
spin_unlock(&tis_lock); spin_unlock(&tis_lock);
#ifdef CONFIG_PNP
if (force) { if (!force) {
platform_device_unregister(pdev);
platform_driver_unregister(&tis_drv);
} else
pnp_unregister_driver(&tis_pnp_driver); pnp_unregister_driver(&tis_pnp_driver);
return;
}
#endif
platform_device_unregister(pdev);
platform_driver_unregister(&tis_drv);
} }
module_init(init_tis); module_init(init_tis);