summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/include/usr/i2c/i2cif.H2
-rwxr-xr-xsrc/usr/i2c/i2c.C10
-rw-r--r--src/usr/isteps/istep06/host_init_fsi.C91
-rw-r--r--src/usr/secureboot/trusted/trustedboot.C28
4 files changed, 96 insertions, 35 deletions
diff --git a/src/include/usr/i2c/i2cif.H b/src/include/usr/i2c/i2cif.H
index 5fa3216e4..a902fbcbf 100644
--- a/src/include/usr/i2c/i2cif.H
+++ b/src/include/usr/i2c/i2cif.H
@@ -93,6 +93,8 @@ enum i2cEngineSelect : uint8_t
I2C_ENGINE_SELECT_ONLY_1 |
I2C_ENGINE_SELECT_ONLY_2 |
I2C_ENGINE_SELECT_ONLY_3,
+
+ I2C_ENGINE_SELECT_NONE = 0x00,
};
/**
diff --git a/src/usr/i2c/i2c.C b/src/usr/i2c/i2c.C
index 3aed2eb02..950f7bbff 100755
--- a/src/usr/i2c/i2c.C
+++ b/src/usr/i2c/i2c.C
@@ -3346,16 +3346,18 @@ errlHndl_t i2cProcessActiveMasters ( i2cProcessType i_processType,
{
TRACUCOMP( g_trac_i2c,INFO_MRK
"i2cProcessActiveMasters: skipping tgt=0x%X "
- "due to FSI::isSlavePresent returned=%d",
- TARGETING::get_huid(tgt), check );
+ "due to FSI::isSlavePresent returned=%s (%d)",
+ TARGETING::get_huid(tgt),
+ check ? "true" : "false", check );
continue;
}
else
{
TRACUCOMP( g_trac_i2c,INFO_MRK
"i2cProcessActiveMasters: keeping tgt=0x%X due "
- "to FSI::isSlavePresent returned=%d",
- TARGETING::get_huid(tgt), check );
+ "to FSI::isSlavePresent returned=%s (%d)",
+ TARGETING::get_huid(tgt),
+ check ? "true" : "false", check );
}
}
diff --git a/src/usr/isteps/istep06/host_init_fsi.C b/src/usr/isteps/istep06/host_init_fsi.C
index 0a87c1fe8..c8ec1d065 100644
--- a/src/usr/isteps/istep06/host_init_fsi.C
+++ b/src/usr/isteps/istep06/host_init_fsi.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* Contributors Listed Below - COPYRIGHT 2015,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -30,14 +30,84 @@
#include <errl/errlmanager.H>
#include <fsi/fsiif.H>
#include <i2c/i2cif.H>
+#include <i2c/tpmddif.H>
#include <initservice/taskargs.H>
#include <initservice/isteps_trace.H>
#include <initservice/initserviceif.H>
#include <isteps/hwpisteperror.H>
+#include <attributeenums.H>
+#include <secureboot/trustedbootif.H>
+#include <config.h>
+
+//Targeting
+#include <targeting/common/commontargeting.H>
+#include <targeting/common/util.H>
+#include <targeting/common/utilFilter.H>
+#include <targeting/common/target.H>
+
+using namespace TARGETING;
+using namespace I2C;
+using namespace TRUSTEDBOOT;
namespace ISTEP_06
{
+/* @brief Find Processor I2C Engines Connected to TPMs
+ *
+ * This helper function loops through all of the TPMs in the system
+ * blueprint and finds all of the Processors that serve as their I2C
+ * Masters. It then keeps track of which processor I2C engine(s) are
+ * used.
+ *
+ * @return i2cEngineSelect - bit-wise enum indicating which processor engine(s)
+ * were found
+ */
+i2cEngineSelect find_proc_i2c_engines_for_tpm ( void )
+{
+ int engineSelect = static_cast<int>(I2C_ENGINE_SELECT_NONE);
+
+#ifdef CONFIG_TPMDD
+ // Get all TPMs to setup our array
+ TargetHandleList tpmList;
+ getTPMs(tpmList,TPM_FILTER::ALL_IN_BLUEPRINT);
+
+ TPMDD::tpm_info_t tpmData;
+ for (auto tpm : tpmList)
+ {
+ memset(&tpmData, 0, sizeof(tpmData));
+ errlHndl_t readErr = tpmReadAttributes(tpm,
+ tpmData,
+ TPMDD::TPM_LOCALITY_0);
+
+ if (nullptr != readErr)
+ {
+ // We are just looking for configured TPMs here
+ // so we ignore any errors
+ delete readErr;
+ readErr = nullptr;
+ }
+ else
+ {
+ // If TPM is connected to a processor then keep track
+ // of what engine needs to be reset
+ if (tpmData.i2cTarget->getAttr<ATTR_TYPE>() == TYPE_PROC)
+ {
+ engineSelect |= static_cast<int>(i2cEngineToEngineSelect(tpmData.engine));
+ }
+ }
+ }
+
+ // There should only be 1 such bus per processor. So if we found multiple
+ // engines then we know that there are different proc/engine combinations
+ // and we'd need a I2C reset intferace to support that. This check here
+ // makes sure we add that support when its necessary.
+ assert(__builtin_popcount(engineSelect)==1, "find_proc_i2c_engines_for_tpm: Only one engine should be found");
+
+#endif
+ return static_cast<i2cEngineSelect>(engineSelect);
+}
+
+
void* host_init_fsi( void *io_pArgs )
{
errlHndl_t l_err = NULL;
@@ -55,10 +125,25 @@ void* host_init_fsi( void *io_pArgs )
break;
}
- // Only reset the I2C Masters if FSP is not running
+ // Reset all I2C Masters if FSP is not running
if ( !INITSERVICE::spBaseServicesEnabled() )
{
- l_err = I2C::i2cResetActiveMasters(I2C::I2C_ALL, false);
+ l_err = i2cResetActiveMasters(I2C_ALL, false);
+ if (l_err)
+ {
+ // Commit this error
+ errlCommit( l_err, ISTEP_COMP_ID );
+ }
+ }
+ // FSP cannot access I2C buses where the TPMs and PCIe Hot Plug
+ // devices are due to a lack of a FSI connection to this bus.
+ // Therefore, reset all host-mode I2C engines connected to these buses
+ else
+ {
+ l_err = i2cResetActiveMasters(
+ I2C_PROC_HOST,
+ false,
+ find_proc_i2c_engines_for_tpm());
if (l_err)
{
// Commit this error
diff --git a/src/usr/secureboot/trusted/trustedboot.C b/src/usr/secureboot/trusted/trustedboot.C
index 88d1158d0..2f27064ca 100644
--- a/src/usr/secureboot/trusted/trustedboot.C
+++ b/src/usr/secureboot/trusted/trustedboot.C
@@ -52,7 +52,6 @@
#include <config.h>
#include <devicefw/driverif.H>
#include <i2c/tpmddif.H>
-#include <i2c/i2cif.H>
#include "trustedboot.H"
#include "trustedTypes.H"
#include "trustedbootCmds.H"
@@ -275,33 +274,6 @@ void* host_update_master_tpm( void *io_pArgs )
if( hwasState.present
&& hwasState.functional)
{
- // If MPIPL do I2C Reset to any processor's I2C engine that is
- // driving the TPMs
- TARGETING::Target* sys = nullptr;
- (void) tS.getTopLevelTarget( sys );
- assert(sys, "host_update_master_tpm() system target is nullptr");
-
- if (sys->getAttr<TARGETING::ATTR_IS_MPIPL_HB>())
- {
- err = I2C::i2cResetActiveMasters(
- I2C::I2C_PROC_HOST,
- true,
- I2C::i2cEngineToEngineSelect(tpmData.engine));
-
- if (nullptr != err)
- {
- // Commit log and continue
- TRACFCOMP(g_trac_trustedboot,ERR_MRK
- "host_update_master_tpm(): Committing I2C "
- "Reset Fail plid=0x%X but continuing",
- err->plid());
- err->collectTrace(TRBOOT_COMP_NAME);
- errlCommit(err, TRBOOT_COMP_ID);
- err = nullptr;
- }
-
- }
-
// API call will set TPM init attempted appropriately
tpmInitialize(pPrimaryTpm);
}
OpenPOWER on IntegriCloud