Skip to content

Commit

Permalink
Add Support for Nuvoton 75x Model of TPMs
Browse files Browse the repository at this point in the history
This commit adds the ability for hostboot code to support the
Nuvoton 75x TPMs along with the current support of the 65x models.
A new attribute TPM_MODEL is used to configure the appropriate
settings for each model.

Change-Id: I14b0f6606a1a94d0ed300fd51bbf3f50e63dfb01
RTC:202356
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/70464
Reviewed-by: Ilya Smirnov <ismirno@us.ibm.com>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
mabaiocchi authored and dcrowell77 committed Jan 17, 2019
1 parent fba889a commit b5c6e0b
Show file tree
Hide file tree
Showing 7 changed files with 377 additions and 127 deletions.
35 changes: 33 additions & 2 deletions src/include/usr/i2c/tpmddif.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2018 */
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -62,6 +62,20 @@ enum tpm_locality_t
TPM_LOCALITY_4 = 4,
};

/**
* @brief TPM Models that are supported
*
* @note Must stay in sync with TPM_MODEL in attribute_types_hb.xml
* @note Not using Attribute Enums since FSP does not currently support
* overriding enum values
*/
enum tpm_model_t : uint8_t
{
TPM_MODEL_UNDETERMINED = 0x00,
TPM_MODEL_65x = 0x01,
TPM_MODEL_75x = 0x02,
};

/**
* @brief Structure of common parameters needed by different parts of
* the code.
Expand All @@ -84,6 +98,15 @@ struct tpm_info_t
uint8_t i2cMuxBusSelector; ///< The Selector for the I2C MUX
TARGETING::EntityPath i2cMuxPath; ///< I2C MUX path

uint8_t model; ///< TPM Model
uint8_t sts; ///< STS
uint8_t burstCount; ///< burstCount
uint8_t tpmHash; ///< TPM Hash
uint8_t wrFifo; ///< Write FIFO
uint8_t rdFifo; ///< Read FIFO
uint8_t vendorIdOffset; ///< Vendor ID Offset
uint32_t vendorId; ///< Vendor ID

/**
* @brief Construct a default tpm_info_t
*/
Expand All @@ -100,7 +123,15 @@ struct tpm_info_t
offset(0),
addrSize(LAST_DEVICE_TYPE),
i2cMuxBusSelector(I2C_MUX::NOT_APPLICABLE),
i2cMuxPath()
i2cMuxPath(),
model(TPM_MODEL_UNDETERMINED),
sts(0),
burstCount(0),
tpmHash(0),
wrFifo(0),
rdFifo(0),
vendorIdOffset(0),
vendorId(0)
{
}
};
Expand Down
4 changes: 3 additions & 1 deletion src/include/usr/i2c/tpmddreasoncodes.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2011,2018 */
/* Contributors Listed Below - COPYRIGHT 2011,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -87,6 +87,8 @@ enum tpmReasonCode
TPM_RC_TPM_NOT_DETECTED = TPMDD_COMP_ID | 0x0D,
TPM_RC_UNEXPECTED_VENDOR_ID = TPMDD_COMP_ID | 0x0E,
TPM_RC_UNEXPECTED_FAMILY_ID = TPMDD_COMP_ID | 0x0F,
TPM_ATTR_MODEL_NOT_FOUND = TPMDD_COMP_ID | 0x10,
TPM_ATTR_INVALID_MODEL = TPMDD_COMP_ID | 0x11,
};

}; // end TPMDD
Expand Down
5 changes: 3 additions & 2 deletions src/usr/i2c/test/tpmddtest.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -142,7 +142,8 @@ class TPMDDTest: public CxxTest::TestSuite
continue;
}
else if ((data & TPMDD::TPM_VENDORID_MASK)
!= TPMDD::TPM_VENDORID)
// Only 65x supported in simics for now:
!= TPMDD::TPM_VENDORID_65x)
{
fails++;
TS_FAIL( "testTPMReadVendorID - Failed to read "
Expand Down

0 comments on commit b5c6e0b

Please sign in to comment.