diff options
author | Mike Baiocchi <baiocchi@us.ibm.com> | 2014-11-21 08:43:28 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-12-15 10:53:05 -0600 |
commit | 5815883924b059a6594eb5e554b26a2bb8a712dc (patch) | |
tree | 42b03d340bad20668ac30b5179bd52a2001762fb /src | |
parent | 8f0edf314a9c9198d95b0c7598e269cf8b7f232a (diff) | |
download | talos-hostboot-5815883924b059a6594eb5e554b26a2bb8a712dc.tar.gz talos-hostboot-5815883924b059a6594eb5e554b26a2bb8a712dc.zip |
Use FSI-based I2C for MVPD access in OpenPower
This code defaults all slave processors to use FSI I2C access method at
the start of the IPL. Then in istep 6.12 it calls a new function
i2cSetAccessMode() to set them to Host I2C access method for the rest of the
IPL.
Change-Id: Ib13d274aa9a64a533bce79d34e75c0bee4d3e5c8
RTC: 116439
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/14590
Tested-by: Jenkins Server
Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/include/usr/i2c/i2cif.H | 22 | ||||
-rw-r--r-- | src/usr/hwas/hostbootIstep.C | 7 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/slave_sbe/slave_sbe.C | 6 | ||||
-rwxr-xr-x | src/usr/i2c/i2c.C | 107 | ||||
-rw-r--r-- | src/usr/targeting/common/xmltohb/target_types.xml | 4 | ||||
-rw-r--r-- | src/usr/targeting/targetservicestart.C | 10 |
6 files changed, 149 insertions, 7 deletions
diff --git a/src/include/usr/i2c/i2cif.H b/src/include/usr/i2c/i2cif.H index b554c6fca..2599124d6 100644 --- a/src/include/usr/i2c/i2cif.H +++ b/src/include/usr/i2c/i2cif.H @@ -84,6 +84,28 @@ bool i2cPresence( TARGETING::Target * i_target, uint64_t i_devAddr ); +/** +* @enum i2cSetAccessModeType +* +* @brief I2C Set Access Mode Type specifies what targets will be set to +* a specific I2C Access Mode (Host or FSI) +* +*/ +enum i2cSetAccessModeType +{ + I2C_SET_ACCESS_MODE_INVALID = 0x00, + I2C_SET_ACCESS_MODE_PROC_HOST = 0x01 +}; + + +/** + * @brief This function will set the I2C_SWITCH attribute for certain + * targets to a specific mode (Host or FSI) based on the input. + * + * @param i2cSetModeType - Specifies which targets to be set and which + * mode to set them to + */ +void i2cSetAccessMode( i2cSetAccessModeType i_setModeType ); }; // end namespace I2C diff --git a/src/usr/hwas/hostbootIstep.C b/src/usr/hwas/hostbootIstep.C index 1ea2d5b93..47a961c63 100644 --- a/src/usr/hwas/hostbootIstep.C +++ b/src/usr/hwas/hostbootIstep.C @@ -92,18 +92,17 @@ void* host_init_fsi( void *io_pArgs ) l_errl = FSI::initializeHardware( ); if (l_errl) { + // This error should get returned break; } - - //@TODO RTC:116439 - /* l_errl = I2C::i2cResetMasters(I2C::I2C_RESET_PROC_ALL); if (l_errl) { + // Commit this error + errlCommit( l_errl, HWPF_COMP_ID ); break; } - */ } while (0); diff --git a/src/usr/hwpf/hwp/slave_sbe/slave_sbe.C b/src/usr/hwpf/hwp/slave_sbe/slave_sbe.C index 696697345..f49b6c208 100644 --- a/src/usr/hwpf/hwp/slave_sbe/slave_sbe.C +++ b/src/usr/hwpf/hwp/slave_sbe/slave_sbe.C @@ -442,8 +442,12 @@ void* call_proc_check_slave_sbe_seeprom_complete( void *io_pArgs ) } } // endfor - l_errl = I2C::i2cResetMasters(I2C::I2C_RESET_PROC_ALL); + // Slave processors should now use Host I2C Access Method + I2C::i2cSetAccessMode( I2C::I2C_SET_ACCESS_MODE_PROC_HOST ); + + // Reset the Processor's I2C Masters + l_errl = I2C::i2cResetMasters(I2C::I2C_RESET_PROC_ALL); if (l_errl) { // Commit error diff --git a/src/usr/i2c/i2c.C b/src/usr/i2c/i2c.C index f44993fbe..95471f13e 100755 --- a/src/usr/i2c/i2c.C +++ b/src/usr/i2c/i2c.C @@ -2698,6 +2698,113 @@ errlHndl_t i2cResetMasters ( i2cResetType i_resetType ) } // ------------------------------------------------------------------ +// i2cSetAccessMode +// NOTE: currently just supporting I2C_SET_MODE_PROC_HOST +// ------------------------------------------------------------------ +void i2cSetAccessMode( i2cSetAccessModeType i_setModeType ) +{ + TRACDCOMP( g_trac_i2c, + ENTER_MRK"i2cSetAccessMode(): %d", i_setModeType ); + + TARGETING::I2cSwitches switches; + + bool mutex_success = false; + mutex_t * engineLock = NULL; + misc_args_t args; + + + do + { + // Get list of targets + TARGETING::TargetHandleList tgtList; + + // Support for I2C_SET_MODE_PROC_HOST + TARGETING::getAllChips(tgtList, + TARGETING::TYPE_PROC, + true); // true: return functional targets + + if( 0 == tgtList.size() ) + { + TRACFCOMP(g_trac_i2c, + INFO_MRK"i2cSetAccessMode: No Targets found!"); + break; + } + + TRACUCOMP( g_trac_i2c, + INFO_MRK"i2cSetAccessMode: Targets: %d", + tgtList.size() ); + + // Check and set each target + for( uint32_t i = 0; i < tgtList.size(); i++ ) + { + TARGETING::Target* tgt = tgtList[i]; + + // Get the mutex for engine 0 + args.engine = 0; + mutex_success = i2cGetEngineMutex( tgt, + args, + engineLock ); + + if( !mutex_success ) + { + TRACFCOMP( g_trac_i2c,ERR_MRK"i2cSetAccessMode: Error from " + "i2cGetEngineMutex() getting engine 0 lock for " + "tgt=0x%X", TARGETING::get_huid(tgt)); + continue; + } + + // Lock on this engine + TRACUCOMP( g_trac_i2c, + INFO_MRK"Obtaining lock for engine: %d", + args.engine ); + + (void)mutex_lock( engineLock ); + + TRACUCOMP( g_trac_i2c, + INFO_MRK"Locked on engine: %d", + args.engine ); + + + switches = tgt->getAttr<TARGETING::ATTR_I2C_SWITCHES>(); + + TRACUCOMP( g_trac_i2c,"i2cSetAccessMode: tgt=0x%X switches: " + "host=%d, fsi=%d", + TARGETING::get_huid(tgt), switches.useHostI2C, + switches.useFsiI2C); + + // Support for I2C_SET_MODE_PROC_HOST + if ((switches.useHostI2C != 1) || + (switches.useFsiI2C != 0) ) + { + switches.useHostI2C = 1; + switches.useFsiI2C = 0; + + tgt->setAttr<TARGETING::ATTR_I2C_SWITCHES>(switches); + + TRACFCOMP( g_trac_i2c,"i2cSetAccessMode: tgt=0x%X " + "I2C_SWITCHES updated: host=%d, fsi=%d", + TARGETING::get_huid(tgt), switches.useHostI2C, + switches.useFsiI2C); + } + + // Unlock + (void) mutex_unlock( engineLock ); + TRACUCOMP( g_trac_i2c, + INFO_MRK"Unlocked engine: %d", + args.engine ); + + } // end of target for loop + + } while( 0 ); + + TRACDCOMP( g_trac_i2c, + EXIT_MRK"i2cSetAccessMode"); + + return; +} + + +// ------------------------------------------------------------------ // i2cRegisterOp // ------------------------------------------------------------------ errlHndl_t i2cRegisterOp ( DeviceFW::OperationType i_opType, diff --git a/src/usr/targeting/common/xmltohb/target_types.xml b/src/usr/targeting/common/xmltohb/target_types.xml index 6def4603f..09c70b684 100644 --- a/src/usr/targeting/common/xmltohb/target_types.xml +++ b/src/usr/targeting/common/xmltohb/target_types.xml @@ -497,8 +497,8 @@ <attribute> <id>I2C_SWITCHES</id> <default> - <field><id>useFsiI2C</id><value>0</value></field> - <field><id>useHostI2C</id><value>1</value></field> + <field><id>useFsiI2C</id><value>1</value></field> + <field><id>useHostI2C</id><value>0</value></field> <field><id>reserved</id><value>0</value></field> </default> </attribute> diff --git a/src/usr/targeting/targetservicestart.C b/src/usr/targeting/targetservicestart.C index 8677c61ce..d3446b4c3 100644 --- a/src/usr/targeting/targetservicestart.C +++ b/src/usr/targeting/targetservicestart.C @@ -214,6 +214,16 @@ static void initializeAttributes(TargetService& i_targetService) l_switches.useFsiScom = 0; l_pMasterProcChip->setAttr<ATTR_SCOM_SWITCHES>(l_switches); + + // Master can only use Host I2C so needs to be set before + // doing any I2C accesses + I2cSwitches l_i2c_switches = + l_pMasterProcChip->getAttr<ATTR_I2C_SWITCHES>(); + l_i2c_switches.useHostI2C = 1; + l_i2c_switches.useFsiI2C = 0; + l_pMasterProcChip->setAttr<ATTR_I2C_SWITCHES>(l_i2c_switches); + + errlHndl_t l_errl = NULL; size_t l_size = sizeof(uint64_t); uint64_t l_data; |