Skip to content

Commit

Permalink
Set the I2C MUX bus selector in the i2cPresence function
Browse files Browse the repository at this point in the history
- Expanded the i2cPresence API to take in the I2C MUX bus selector
  and the I2C MUX path.  This will facilitate setting the bus selector
  within the i2cPresence function.
- Set the I2C MUX bus selector in the i2cPresence function via the
  call to i2cAccessMux.
- Simplified the i2cAccessMux API.  It only takes in what it really uses.
- Added several dump utility functions that are strictly there to
  dump certain data structures on an as needed basis.  Was useful
  to have these utilities to see certain data structures but does
  not slow down the run time because the user must explicitly call
  them.
- The structures that can get dumped are TARGETING::EepromVpdPrimaryInfo,
  eeprom_addr_t, TARGETING::FapiI2cControlInfo and I2C::misc_args_t.

Change-Id: I14943687a934bfb21bc5cf3db0540b7e629a6257
RTC:203596
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/71011
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-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>
Reviewed-by: Matt Derksen <mderkse1@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
  • Loading branch information
velozr authored and crgeddes committed Jan 30, 2019
1 parent 5408943 commit 602885b
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 102 deletions.
10 changes: 7 additions & 3 deletions src/include/usr/i2c/i2cif.H
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,17 @@ errlHndl_t i2cSetupActiveMasters ( i2cProcessType i_setupType,
* @param[in] i_port - The device's port
* @param[in] i_engine - The device's engine number
* @param[in] i_devAddr - The device's address
* @param[in] i_i2cMuxBusSelector - The Selector for the I2C MUX
* @param[in] i_i2cMuxPath - The entity path to the I2C MUX
*
* @return bool - True if chip is present, False otherwise.
*/
bool i2cPresence( TARGETING::Target * i_target,
uint64_t i_port,
uint64_t i_engine,
uint64_t i_devAddr );
uint64_t i_port,
uint64_t i_engine,
uint64_t i_devAddr,
uint8_t i_i2cMuxBusSelector,
const TARGETING::EntityPath & i_i2cMuxPath );


/**
Expand Down
71 changes: 67 additions & 4 deletions src/usr/i2c/eepromdd.C
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,66 @@ DEVICE_REGISTER_ROUTE( DeviceFW::WILDCARD,
DeviceFW::EEPROM,
TARGETING::TYPE_MCS,
eepromPerformOp );


/**
*
* @brief A useful utility to dump (trace out) the EepromVpdPrimaryInfo data.
* Use as needed.
*
* @param [in] i_i2cInfo - The EepromVpdPrimaryInfo data to dump for user
*
*/
void dumpEepromData(const TARGETING::EepromVpdPrimaryInfo & i_i2cInfo)
{
TRACFCOMP (g_trac_eeprom, INFO_MRK"EepromVpdPrimaryInfo data: "
"engine=%d, port=%d, devAddr=0X%X, writePageSize=%d, "
"maxMemorySizeKB=0x%X, chipCount=%d, writeCycleTime=%d",
i_i2cInfo.engine, i_i2cInfo.port, i_i2cInfo.devAddr,
i_i2cInfo.writePageSize, i_i2cInfo.maxMemorySizeKB,
i_i2cInfo.chipCount, i_i2cInfo.writeCycleTime);

char* l_masterPath = i_i2cInfo.i2cMasterPath.toString();
char* l_muxPath = i_i2cInfo.i2cMuxPath.toString();
TRACFCOMP (g_trac_eeprom, INFO_MRK"EepromVpdPrimaryInfo data cont.: "
"masterPath=%s, muxSelector=0x%X, muxPath=%s",
l_masterPath, i_i2cInfo.i2cMuxBusSelector, l_muxPath);

free(l_masterPath);
free(l_muxPath);
l_masterPath = l_muxPath = nullptr;
}


/**
*
* @brief A useful utility to dump (trace out) the eeprom_addr_t data.
* Use as needed.
*
* @param [in] i_i2cInfo - The eeprom_addr_t data to dump for user
*
*/
void dumpEepromData(const eeprom_addr_t & i_i2cInfo)
{
TRACFCOMP (g_trac_eeprom, INFO_MRK"eeprom_addr_t data: \n"
"engine=%d, port=%d, devAddr=0X%X, writePageSize=%d, \n"
"devSize_KB=0x%X, chipCount=%d, writeCycleTime=%d \n",
i_i2cInfo.engine, i_i2cInfo.port, i_i2cInfo.devAddr,
i_i2cInfo.writePageSize, i_i2cInfo.devSize_KB,
i_i2cInfo.chipCount, i_i2cInfo.writeCycleTime);

char* l_masterPath = i_i2cInfo.i2cMasterPath.toString();
char* l_muxPath = i_i2cInfo.i2cMuxPath.toString();
TRACFCOMP (g_trac_eeprom, INFO_MRK"eeprom_addr_t data cont.: \n"
"masterPath=%s, muxSelector=0x%X, muxPath=%s \n",
l_masterPath, i_i2cInfo.i2cMuxBusSelector, l_muxPath);

free(l_masterPath);
free(l_muxPath);
l_masterPath = l_muxPath = nullptr;
}


// ------------------------------------------------------------------
// eepromPerformOp
// ------------------------------------------------------------------
Expand Down Expand Up @@ -424,9 +484,11 @@ bool eepromPresence ( TARGETING::Target * i_target )

//Check for the target at the I2C level
l_present = I2C::i2cPresence(i2cMasterTarget,
i2cInfo.port,
i2cInfo.engine,
i2cInfo.devAddr );
i2cInfo.port,
i2cInfo.engine,
i2cInfo.devAddr,
i2cInfo.i2cMuxBusSelector,
i2cInfo.i2cMuxPath);

if( !l_present )
{
Expand Down Expand Up @@ -1506,7 +1568,8 @@ errlHndl_t eepromReadAttributes ( TARGETING::Target * i_target,
bool fail_reading_attribute = false;

TRACDCOMP( g_trac_eeprom,
ENTER_MRK"eepromReadAttributes()" );
ENTER_MRK"eepromReadAttributes() huid=0x%.8X",
TARGETING::get_huid(i_target) );

// These variables will be used to hold the EEPROM attribute data
// Note: each 'EepromVpd' struct is kept the same via the attributes
Expand Down

0 comments on commit 602885b

Please sign in to comment.