acpi/tpm: Gracefully handle missing TPM module.

When TPM support is enabled, verify the TPM_DID_VID field is not
all zeroes or all ones before returning 0xf in the _STA method.

This avoids these kernel errors when no module is installed:
[    3.426426] tpm_tis 00:01: tpm_transmit: tpm_send: error -5
[    3.432049] tpm_tis: probe of 00:01 failed with error -5

Change-Id: Ia089d4232e0986b3bc635d346e68d982e8aecd44
Signed-off-by: Tobias Diedrich <ranma+coreboot@tdiedrich.de>
Reviewed-on: https://review.coreboot.org/13713
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
This commit is contained in:
Tobias Diedrich 2016-02-15 13:13:58 +01:00 committed by Duncan Laurie
parent 05082737a9
commit 85a255fbd8
1 changed files with 24 additions and 15 deletions

View File

@ -21,10 +21,33 @@ Device (TPM)
Name (_CID, 0x310cd041) Name (_CID, 0x310cd041)
Name (_UID, 1) Name (_UID, 1)
OperationRegion (TREG, SystemMemory,
CONFIG_TPM_TIS_BASE_ADDRESS, 0x5000)
Field (TREG, ByteAcc, NoLock, Preserve)
{
/* TPM_INT_ENABLE_0 */
Offset (0x0008),
, 3,
ITPL, 2, /* Interrupt type and polarity */
/* TPM_INT_VECTOR_0 */
Offset (0x000C),
IVEC, 4, /* SERIRQ vector */
/* TPM_DID_VID */
Offset (0x0f00),
DVID, 32, /* Device and vendor ID */
}
Method (_STA, 0) Method (_STA, 0)
{ {
#if CONFIG_LPC_TPM && !CONFIG_TPM_DEACTIVATE #if CONFIG_LPC_TPM && !CONFIG_TPM_DEACTIVATE
If (LAnd (LGreater (DVID, 0), LLess (DVID, 0xffffffff))) {
Return (0xf) Return (0xf)
} Else {
/* TPM module missing */
Return (0x0)
}
#else #else
Return (0x0) Return (0x0)
#endif #endif
@ -45,20 +68,6 @@ Device (TPM)
Method (_CRS, 0, Serialized) Method (_CRS, 0, Serialized)
{ {
OperationRegion (TREG, SystemMemory,
CONFIG_TPM_TIS_BASE_ADDRESS, 0x5000)
Field (TREG, ByteAcc, NoLock, Preserve)
{
/* TPM_INT_ENABLE_0 */
Offset (0x0008),
, 3,
ITPL, 2, /* Interrupt type and polarity */
/* TPM_INT_VECTOR_0 */
Offset (0x000C),
IVEC, 4, /* SERIRQ vector */
}
CreateField (^IBUF, ^TIRQ._INT, 32, TVEC) CreateField (^IBUF, ^TIRQ._INT, 32, TVEC)
CreateBitField (^IBUF, ^TIRQ._HE, TTYP) CreateBitField (^IBUF, ^TIRQ._HE, TTYP)
CreateBitField (^IBUF, ^TIRQ._LL, TPOL) CreateBitField (^IBUF, ^TIRQ._LL, TPOL)