summaryrefslogtreecommitdiffstats
path: root/src/usr/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/i2c')
-rwxr-xr-xsrc/usr/i2c/test/tpmddtest.H23
-rwxr-xr-xsrc/usr/i2c/tpmdd.C35
2 files changed, 41 insertions, 17 deletions
diff --git a/src/usr/i2c/test/tpmddtest.H b/src/usr/i2c/test/tpmddtest.H
index b2e58eca6..fe1c0f703 100755
--- a/src/usr/i2c/test/tpmddtest.H
+++ b/src/usr/i2c/test/tpmddtest.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -76,7 +76,8 @@ class TPMDDTest: public CxxTest::TestSuite
// Let's see if the requested chip is functional
tpm_info_t tpmInfo;
memset(&tpmInfo, 0, sizeof(tpm_info_t));
- errlHndl_t err = tpmReadAttributes (testTarget, tpmInfo);
+ errlHndl_t err = tpmReadAttributes (testTarget, tpmInfo,
+ TPM_LOCALITY_0);
if (NULL != err)
{
@@ -127,7 +128,8 @@ class TPMDDTest: public CxxTest::TestSuite
&data,
dataSize,
DEVICE_TPM_ADDRESS( TPM_OP_READVENDORID,
- 0) );
+ 0,
+ TPM_LOCALITY_0) );
if( NULL != err )
{
@@ -191,7 +193,8 @@ class TPMDDTest: public CxxTest::TestSuite
&data,
dataSize,
DEVICE_TPM_ADDRESS( TPM_OP_LASTOP,
- 0) );
+ 0,
+ TPM_LOCALITY_0) );
if( NULL == err )
{
@@ -216,7 +219,8 @@ class TPMDDTest: public CxxTest::TestSuite
&data,
dataSize,
DEVICE_TPM_ADDRESS( TPM_OP_READVENDORID,
- 0) );
+ 0,
+ TPM_LOCALITY_0) );
if( NULL == err )
{
@@ -273,7 +277,8 @@ class TPMDDTest: public CxxTest::TestSuite
&data,
dataSize,
DEVICE_TPM_ADDRESS( TPM_OP_READVENDORID,
- 0) );
+ 0,
+ TPM_LOCALITY_0) );
if( NULL == err ||
err->reasonCode() != TPM_OVERFLOW_ERROR)
@@ -423,7 +428,8 @@ class TPMDDTest: public CxxTest::TestSuite
&data,
dataSize,
DEVICE_TPM_ADDRESS( TPM_OP_TRANSMIT,
- cmdSize) );
+ cmdSize,
+ TPM_LOCALITY_0) );
TRUSTEDBOOT::TPM2_BaseOut* resp =
reinterpret_cast<TRUSTEDBOOT::TPM2_BaseOut*>(data);
@@ -511,7 +517,8 @@ class TPMDDTest: public CxxTest::TestSuite
&data,
dataSize,
DEVICE_TPM_ADDRESS(TPM_OP_TRANSMIT,
- cmdSize) );
+ cmdSize,
+ TPM_LOCALITY_0) );
if( NULL == err ||
err->reasonCode() != TPM_OVERFLOW_ERROR)
diff --git a/src/usr/i2c/tpmdd.C b/src/usr/i2c/tpmdd.C
index 4581d0265..fe7c42fc2 100755
--- a/src/usr/i2c/tpmdd.C
+++ b/src/usr/i2c/tpmdd.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2011,2016 */
+/* Contributors Listed Below - COPYRIGHT 2011,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -102,23 +102,28 @@ errlHndl_t tpmPerformOp( DeviceFW::OperationType i_opType,
tpm_info_t tpmInfo;
uint64_t commandSize = 0;
bool unlock = false;
+ tpm_locality_t locality = TPM_LOCALITY_0;
- tpmInfo.operation = ((TPMDD::tpm_op_types_t)va_arg( i_args, uint64_t ));
+ tpmInfo.operation = static_cast<TPMDD::tpm_op_types_t>
+ (va_arg( i_args, uint64_t ));
commandSize = va_arg( i_args, uint64_t );
+ locality = static_cast<TPMDD::tpm_locality_t>(va_arg( i_args, uint64_t ));
TRACDCOMP( g_trac_tpmdd,
ENTER_MRK"tpmPerformOp()" );
TRACUCOMP (g_trac_tpmdd, ENTER_MRK"tpmPerformOp(): "
- "i_opType=%d, operation=%d, buflen=%d, cmdlen=%d",
- (uint64_t) i_opType, tpmInfo.operation, io_buflen,
+ "i_opType=%d, operation=%d, loc=%d, buflen=%d, cmdlen=%d",
+ (uint64_t) i_opType, tpmInfo.operation,
+ locality, io_buflen,
commandSize);
do
{
// Read Attributes needed to complete the operation
err = tpmReadAttributes( i_target,
- tpmInfo );
+ tpmInfo,
+ locality);
if( err )
{
@@ -306,7 +311,8 @@ bool tpmPresence ( TARGETING::Target * i_target)
// Read Attributes needed to complete the operation
err = tpmReadAttributes( i_target,
- tpmInfo );
+ tpmInfo,
+ TPM_LOCALITY_0);
if( err )
{
@@ -1125,7 +1131,8 @@ errlHndl_t tpmPrepareAddress ( void * io_buffer,
// tpmReadAttributes
// ------------------------------------------------------------------
errlHndl_t tpmReadAttributes ( TARGETING::Target * i_target,
- tpm_info_t & io_tpmInfo )
+ tpm_info_t & io_tpmInfo,
+ tpm_locality_t i_locality )
{
errlHndl_t err = NULL;
@@ -1177,8 +1184,18 @@ errlHndl_t tpmReadAttributes ( TARGETING::Target * i_target,
// Successful reading of Attribute, so extract the data
io_tpmInfo.port = tpmData.port;
- io_tpmInfo.devAddr = tpmData.devAddrLocality0;
- /// @TODO RTC: 134415 Need to handle locality4
+ if (TPM_LOCALITY_0 == i_locality)
+ {
+ io_tpmInfo.devAddr = tpmData.devAddrLocality0;
+ }
+ else if (TPM_LOCALITY_4 == i_locality)
+ {
+ io_tpmInfo.devAddr = tpmData.devAddrLocality4;
+ }
+ else
+ {
+ assert(false, "Unsupported locality");
+ }
io_tpmInfo.engine = tpmData.engine;
io_tpmInfo.i2cMasterPath = tpmData.i2cMasterPath;
io_tpmInfo.tpmEnabled = tpmData.tpmEnabled;
OpenPOWER on IntegriCloud