diff options
author | Mike Baiocchi <baiocchi@us.ibm.com> | 2014-01-09 08:13:06 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-01-15 16:35:08 -0600 |
commit | 728120d7abd9c4d7ebfca8b212a2bdc4a4f93b4e (patch) | |
tree | 7d535ef36a6c6bec6501aee0a0baad502b127927 /src/usr/i2c | |
parent | f2ebd48e3d24964ddaabbbc0c93a25ef843aae47 (diff) | |
download | talos-hostboot-728120d7abd9c4d7ebfca8b212a2bdc4a4f93b4e.tar.gz talos-hostboot-728120d7abd9c4d7ebfca8b212a2bdc4a4f93b4e.zip |
Add Callouts to I2C and VPD drivers
Callouts were added to I2C, EEPROM, MVPD and CVPD (via IPVPD code),
and SPD code.
Change-Id: Ibcb14ea3a228a5175b6faed06189286b0e0526bc
RTC: 69113
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/7966
Tested-by: Jenkins Server
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/i2c')
-rwxr-xr-x | src/usr/i2c/eepromdd.C | 58 | ||||
-rw-r--r-- | src/usr/i2c/errlud_i2c.C | 280 | ||||
-rw-r--r-- | src/usr/i2c/errlud_i2c.H | 113 | ||||
-rwxr-xr-x | src/usr/i2c/i2c.C | 180 | ||||
-rwxr-xr-x | src/usr/i2c/i2c.H | 34 | ||||
-rw-r--r-- | src/usr/i2c/makefile | 30 | ||||
-rw-r--r-- | src/usr/i2c/plugins/EEPROM_COMP_ID_Parse.C | 27 | ||||
-rw-r--r-- | src/usr/i2c/plugins/I2C_COMP_ID_Parse.C | 27 | ||||
-rw-r--r-- | src/usr/i2c/plugins/errludP_i2c.H | 259 | ||||
-rw-r--r-- | src/usr/i2c/plugins/i2cUdParserFactory.H | 70 |
10 files changed, 972 insertions, 106 deletions
diff --git a/src/usr/i2c/eepromdd.C b/src/usr/i2c/eepromdd.C index ce9b4be85..f44f4f0e3 100755 --- a/src/usr/i2c/eepromdd.C +++ b/src/usr/i2c/eepromdd.C @@ -45,6 +45,7 @@ #include <i2c/eepromif.H> #include <i2c/i2creasoncodes.H> #include "eepromdd.H" +#include "errlud_i2c.H" // ---------------------------------------------- // Globals @@ -168,7 +169,11 @@ errlHndl_t eepromPerformOp( DeviceFW::OperationType i_opType, TWO_UINT32_TO_UINT64( i2cInfo.offset, io_buflen ), - i2cInfo.devSize_KB ); + i2cInfo.devSize_KB, + true /*Add HB SW Callout*/ ); + + err->collectTrace( EEPROM_COMP_NAME ); + break; } @@ -218,18 +223,23 @@ errlHndl_t eepromPerformOp( DeviceFW::OperationType i_opType, EEPROM_PERFORM_OP, EEPROM_INVALID_OPERATION, i_opType, - i2cInfo.chip ); + i2cInfo.chip, + true /*Add HB SW Callout*/ ); + + err->collectTrace( EEPROM_COMP_NAME ); break; } } while( 0 ); - - // If there is an error, add target and trace to log - if ( (err != NULL) && (i_target != NULL) ) + // If there is an error, add parameter info to log + if ( err != NULL ) { - err->collectTrace(EEPROM_COMP_NAME); - ERRORLOG::ErrlUserDetailsTarget(i_target).addToLog(err); + EEPROM::UdEepromParms( i_opType, + i_target, + io_buflen, + i2cInfo ) + .addToLog(err); } TRACDCOMP( g_trac_eeprom, @@ -830,7 +840,11 @@ errlHndl_t eepromPrepareAddress ( void * io_buffer, EEPROM_PREPAREADDRESS, EEPROM_INVALID_DEVICE_TYPE, i_i2cInfo.addrSize, - i_i2cInfo.chip); + i_i2cInfo.chip, + true /*Add HB SW Callout*/ ); + + err->collectTrace( EEPROM_COMP_NAME ); + break; } @@ -928,7 +942,10 @@ errlHndl_t eepromReadAttributes ( TARGETING::Target * i_target, EEPROM_READATTRIBUTES, EEPROM_INVALID_CHIP, o_i2cInfo.chip, - TARGETING::get_huid(i_target) ); + TARGETING::get_huid(i_target), + true /*Add HB SW Callout*/ ); + + err->collectTrace( EEPROM_COMP_NAME ); break; } @@ -957,6 +974,14 @@ errlHndl_t eepromReadAttributes ( TARGETING::Target * i_target, TARGETING::get_huid(i_target), o_i2cInfo.chip); + // Could be FSP or HB code's fault + err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, + HWAS::SRCI_PRIORITY_MED); + err->addProcedureCallout(HWAS::EPUB_PRC_SP_CODE, + HWAS::SRCI_PRIORITY_MED); + + err->collectTrace( EEPROM_COMP_NAME ); + break; } @@ -1004,7 +1029,10 @@ errlHndl_t eepromReadAttributes ( TARGETING::Target * i_target, EEPROM_READATTRIBUTES, EEPROM_INVALID_ADDR_OFFSET_SIZE, TARGETING::get_huid(i_target), - o_i2cInfo.addrSize); + o_i2cInfo.addrSize, + true /*Add HB SW Callout*/ ); + + err->collectTrace( EEPROM_COMP_NAME ); break; @@ -1078,7 +1106,10 @@ errlHndl_t eepromGetI2CMasterTarget ( TARGETING::Target * i_target, EEPROM_GETI2CMASTERTARGET, EEPROM_DIMM_I2C_MASTER_PATH_ERROR, i_i2cInfo.chip, - TARGETING::get_huid(i_target) ); + TARGETING::get_huid(i_target), + true /*Add HB SW Callout*/ ); + + err->collectTrace( EEPROM_COMP_NAME ); break; } @@ -1105,7 +1136,10 @@ errlHndl_t eepromGetI2CMasterTarget ( TARGETING::Target * i_target, EEPROM_GETI2CMASTERTARGET, EEPROM_TARGET_NULL, i_i2cInfo.chip, - TARGETING::get_huid(i_target) ); + TARGETING::get_huid(i_target), + true /*Add HB SW Callout*/ ); + + err->collectTrace( EEPROM_COMP_NAME ); break; } diff --git a/src/usr/i2c/errlud_i2c.C b/src/usr/i2c/errlud_i2c.C new file mode 100644 index 000000000..599c2ad6d --- /dev/null +++ b/src/usr/i2c/errlud_i2c.C @@ -0,0 +1,280 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/i2c/errlud_i2c.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2013,2014 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +/** + * @file errlud_fsi.C + * + * @brief Implementation of classes to log FSI FFDC + */ +#include "errlud_i2c.H" +#include <i2c/i2creasoncodes.H> +#include <i2c/eepromddreasoncodes.H> +#include <devicefw/driverif.H> +#include "eepromdd.H" +#include "i2c.H" + +namespace I2C +{ + +//------------------------------------------------------------------------------ +// I2C User Details +//------------------------------------------------------------------------------ +UdI2CParms::UdI2CParms( uint8_t i_opType, + TARGETING::Target * i_target, + uint64_t i_buflen, + int64_t i_accessType, + misc_args_t i_args ) +{ + // Set up Ud instance variables + iv_CompId = I2C_COMP_ID; + iv_Version = 1; + iv_SubSection = I2C_UDT_PARAMETERS; + + //***** Memory Layout ***** + // 1 byte : Op Type Description + // 1 byte : Op Type (DeviceFW::OperationType) + // 4 bytes : Target HUID + // 8 bytes : Length of In/Out Buffer + // 8 bytes : Access Type (DeviceFW::AccessType) + // 1 byte : Port + // 1 byte : Engine + // 8 bytes : Device Address + // 1 byte : Flag: skip_mode_setup; + // 1 byte : Flag: with_stop; + // 1 byte : Flag: read_not_write; + // 8 bytes : Bus Speed (kbits/sec) + // 2 bytes : Bit Rate Divisor + // 8 bytes : Timeout Interval + // 8 bytes : Timeout Count; + + + char * l_pBuf = reinterpret_cast<char *>( + reallocUsrBuf(sizeof(uint8_t)*2 + +sizeof(uint32_t) + +sizeof(uint64_t)*2 + +sizeof(uint8_t)*2 + +sizeof(uint64_t) + +sizeof(uint8_t)*3 + +sizeof(uint64_t) + +sizeof(uint16_t) + +sizeof(uint64_t)*2 ) ); + uint64_t tmp64 = 0; + uint32_t tmp32 = 0; + uint16_t tmp16 = 0; + uint8_t tmp8 = 0; + + if( i_opType == DeviceFW::READ ) + { + tmp8 = 0; + } + else if( i_opType == DeviceFW::WRITE ) + { + tmp8 = 1; + } + else + { + tmp8 = 2; + } + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + tmp8 = i_opType; + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + tmp32 = TARGETING::get_huid(i_target); + memcpy(l_pBuf, &tmp32, sizeof(tmp32)); + l_pBuf += sizeof(tmp32); + + tmp64 = i_buflen; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_accessType; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp8 = i_args.port; + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + tmp8 = i_args.engine; + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + tmp64 = i_args.devAddr; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp8 = i_args.skip_mode_setup; + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + tmp8 = i_args.with_stop; + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + tmp8 = i_args.read_not_write; + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + tmp64 = i_args.bus_speed; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp16 = i_args.bit_rate_divisor; + memcpy(l_pBuf, &tmp16, sizeof(tmp16)); + l_pBuf += sizeof(tmp16); + + tmp64 = i_args.timeout_interval; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_args.timeout_count; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + +} + +//------------------------------------------------------------------------------ +UdI2CParms::~UdI2CParms() +{ + +} + +} // end I2C namespace + +namespace EEPROM +{ + + +//------------------------------------------------------------------------------ +// EEPROM User Details +//------------------------------------------------------------------------------ +UdEepromParms::UdEepromParms( uint8_t i_opType, + TARGETING::Target * i_target, + uint64_t i_buflen, + eeprom_addr_t i_i2cInfo ) +{ + // Set up Ud instance variables + iv_CompId = EEPROM_COMP_ID; + iv_Version = 1; + iv_SubSection = EEPROM_UDT_PARAMETERS; + + //***** Memory Layout ***** + // 1 byte : Op Type Description + // 1 byte : Op Type (DeviceFW::OperationType) + // 4 bytes : Target HUID + // 8 bytes : Length of In/Out Buffer + // 8 bytes : Chip + // 8 bytes : Offset + // 8 bytes : Port + // 8 bytes : Engine + // 8 bytes : Device Address + // 1 byte : Address Size + // 8 bytes : Write Page Size + // 8 bytes : Device Size (in KB) + // 8 bytes : Write Cycle Time + + char * l_pBuf = reinterpret_cast<char *>( + reallocUsrBuf(sizeof(uint8_t)*2 + +sizeof(uint32_t) + +sizeof(uint64_t)*6 + +sizeof(uint8_t) + +sizeof(uint64_t)*3 )); + + uint64_t tmp64 = 0; + uint32_t tmp32 = 0; + uint8_t tmp8 = 0; + + if( i_opType == DeviceFW::READ ) + { + tmp8 = 0; + } + else if( i_opType == DeviceFW::WRITE ) + { + tmp8 = 1; + } + else + { + tmp8 = 2; + } + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + tmp8 = i_opType; + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + tmp32 = TARGETING::get_huid(i_target); + memcpy(l_pBuf, &tmp32, sizeof(tmp32)); + l_pBuf += sizeof(tmp32); + + tmp64 = i_buflen; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_i2cInfo.chip; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_i2cInfo.offset; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_i2cInfo.port; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_i2cInfo.engine; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_i2cInfo.devAddr; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp8 = static_cast<uint8_t>(i_i2cInfo.addrSize); + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + tmp64 = i_i2cInfo.writePageSize; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_i2cInfo.devSize_KB; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_i2cInfo.writeCycleTime; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + +} + +//------------------------------------------------------------------------------ +UdEepromParms::~UdEepromParms() +{ + +} + +} // end EEPROM namespace diff --git a/src/usr/i2c/errlud_i2c.H b/src/usr/i2c/errlud_i2c.H new file mode 100644 index 000000000..fcaf606c4 --- /dev/null +++ b/src/usr/i2c/errlud_i2c.H @@ -0,0 +1,113 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/i2c/errlud_i2c.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef ERRL_UD_I2C_H +#define ERRL_UD_I2C_H + +/** + * @file errlud_i2c.H + * + * Defines the classes that logs and parses various I2C and EEPROM data + */ + +#include <errl/errluserdetails.H> +#include <devicefw/driverif.H> +#include "i2c.H" +#include "eepromdd.H" + +namespace I2C +{ + +/** + * @class UdI2CParms + * + * Adds I2C information to an error log as user detail data + */ +class UdI2CParms : public ERRORLOG::ErrlUserDetails +{ + public: + /** + * @brief Constructor + * + * @param i_opType Operation Type + * @param i_target Chip being detected/acted upon + * @param i_buflen Length of In/Out Buffer + * @param i_accessType Access Type + * @param i_args Miscellaneous Parameters + */ + UdI2CParms( uint8_t i_opType, + TARGETING::Target * i_target, + uint64_t i_buflen, + int64_t i_accessType, + misc_args_t i_args ); + + /** + * @brief Destructor + */ + virtual ~UdI2CParms(); + + private: + // Disabled + UdI2CParms(UdI2CParms &); + UdI2CParms & operator=(UdI2CParms &); +}; + +} // end I2C namespace + +namespace EEPROM +{ +/** + * @class UdEepromParms + * + * Adds EEPROM information to an error log as user detail data + */ +class UdEepromParms : public ERRORLOG::ErrlUserDetails +{ + public: + /** + * @brief Constructor + * + * @param i_opType Operation Type + * @param i_target Chip being detected/acted upon + * @param i_buflen Length of In/Out Buffer + * @param i_i2cInfo Miscellaneous Parameters + */ + UdEepromParms( uint8_t i_opType, + TARGETING::Target * i_target, + uint64_t i_buflen, + eeprom_addr_t i_i2cInfo ); + + /** + * @brief Destructor + */ + virtual ~UdEepromParms(); + + private: + // Disabled + UdEepromParms(UdEepromParms &); + UdEepromParms & operator=(UdEepromParms &); +}; + +} // end EEPROM namespace + + +#endif diff --git a/src/usr/i2c/i2c.C b/src/usr/i2c/i2c.C index 1f5cf336a..cc86fafe7 100755 --- a/src/usr/i2c/i2c.C +++ b/src/usr/i2c/i2c.C @@ -44,6 +44,8 @@ #include <i2c/i2cif.H> #include "i2c.H" +#include "errlud_i2c.H" + // ---------------------------------------------- // Globals // ---------------------------------------------- @@ -74,6 +76,40 @@ TRAC_INIT( & g_trac_i2cr, "I2CR", KILOBYTE ); namespace I2C { +/** + * @brief Addresses for each of the registers in each engine. + */ +static i2c_addrs_t masterAddrs[] = +{ + { /* Master 0 */ + I2C_MASTER0_ADDR | 0x4, // FIFO + I2C_MASTER0_ADDR | 0x5, // Command Register + I2C_MASTER0_ADDR | 0x6, // Mode Register + I2C_MASTER0_ADDR | 0x8, // Interrupt Mask Register + I2C_MASTER0_ADDR | 0xA, // Interrupt Register + I2C_MASTER0_ADDR | 0xB, // Status Register (Read) + I2C_MASTER0_ADDR | 0xB, // Reset (Write) + }, + { /* Master 1 */ + I2C_MASTER1_ADDR | 0x4, // FIFO + I2C_MASTER1_ADDR | 0x5, // Command Register + I2C_MASTER1_ADDR | 0x6, // Mode Register + I2C_MASTER1_ADDR | 0x8, // Interrupt Mask Register + I2C_MASTER1_ADDR | 0xA, // Interrupt Register + I2C_MASTER1_ADDR | 0xB, // Status Register (Read) + I2C_MASTER1_ADDR | 0xB, // Reset (Write) + }, + { /* Master 2 */ + I2C_MASTER2_ADDR | 0x4, // FIFO + I2C_MASTER2_ADDR | 0x5, // Command Register + I2C_MASTER2_ADDR | 0x6, // Mode Register + I2C_MASTER2_ADDR | 0x8, // Interrupt Mask Register + I2C_MASTER2_ADDR | 0xA, // Interrupt Register + I2C_MASTER2_ADDR | 0xB, // Status Register (Read) + I2C_MASTER2_ADDR | 0xB, // Reset (Write) + } +}; + // Register the perform Op with the routing code for Procs. DEVICE_REGISTER_ROUTE( DeviceFW::WILDCARD, DeviceFW::I2C, @@ -159,7 +195,10 @@ errlHndl_t i2cPerformOp( DeviceFW::OperationType i_opType, I2C_PERFORM_OP, I2C_MASTER_SENTINEL_TARGET, i_opType, - 0x0 ); + 0x0, + true /*Add HB SW Callout*/ ); + + err->collectTrace( "I2C", 256); break; } @@ -345,7 +384,10 @@ errlHndl_t i2cPerformOp( DeviceFW::OperationType i_opType, I2C_PERFORM_OP, I2C_INVALID_OP_TYPE, i_opType, - userdata2 ); + userdata2, + true /*Add HB SW Callout*/ ); + + err->collectTrace( "I2C", 256); // No Operation performed, so can break and skip the section // that handles operation errors @@ -390,10 +432,16 @@ errlHndl_t i2cPerformOp( DeviceFW::OperationType i_opType, args.engine ); } - // If there is an error, add target to log - if ( (err != NULL) && (i_target != NULL) ) + // If there is an error, add parameter info to log + if ( err != NULL ) { - ERRORLOG::ErrlUserDetailsTarget(i_target).addToLog(err); + + I2C::UdI2CParms( i_opType, + i_target, + io_buflen, + i_accessType, + args ) + .addToLog(err); } TRACDCOMP( g_trac_i2c, @@ -512,6 +560,21 @@ errlHndl_t i2cRead ( TARGETING::Target * i_target, status.value, userdata2 ); + // For now limited in what we can call out: + // Could be an issue with Processor or its bus + // -- both on the same FRU + // @todo RTC 94872 - update this callout + err->addHwCallout( i_target, + HWAS::SRCI_PRIORITY_HIGH, + HWAS::NO_DECONFIG, + HWAS::GARD_NULL ); + + // Or HB code failed to do the procedure correctly + err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, + HWAS::SRCI_PRIORITY_LOW); + + err->collectTrace( "I2C", 256); + break; } } @@ -527,7 +590,7 @@ errlHndl_t i2cRead ( TARGETING::Target * i_target, &fifo.value, size, DEVICE_SCOM_ADDRESS( - masterAddrs[i_args.engine].fifo ) ); + I2C::masterAddrs[i_args.engine].fifo ) ); TRACUCOMP( g_trac_i2c, INFO_MRK"i2cRead() - FIFO[0x%lx] = 0x%016llx", @@ -830,6 +893,22 @@ errlHndl_t i2cWaitForCmdComp ( TARGETING::Target * i_target, status.value, engine ); + + // For now limited in what we can call out: + // Could be an issue with Processor or its bus + // -- both on the same FRU + // @todo RTC 94872 - update this callout + err->addHwCallout( i_target, + HWAS::SRCI_PRIORITY_HIGH, + HWAS::NO_DECONFIG, + HWAS::GARD_NULL ); + + // Or HB code failed to do the procedure correctly + err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, + HWAS::SRCI_PRIORITY_LOW); + + err->collectTrace( "I2C", 256); + break; } } while( 0 == status.command_complete ); /* Command Complete */ @@ -1014,7 +1093,20 @@ errlHndl_t i2cCheckForErrors ( TARGETING::Target * i_target, i_statusVal.value, intRegVal ); - // @todo RTC:69113 - Add target and I2C traces to the errorlog. + // For now limited in what we can call out: + // Could be an issue with Processor or its bus + // -- both on the same FRU + // @todo RTC 94872 - update this callout + err->addHwCallout( i_target, + HWAS::SRCI_PRIORITY_HIGH, + HWAS::NO_DECONFIG, + HWAS::GARD_NULL ); + + // Or HB code failed to do the procedure correctly + err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, + HWAS::SRCI_PRIORITY_LOW); + + err->collectTrace( "I2C" ); break; } @@ -1040,7 +1132,20 @@ errlHndl_t i2cCheckForErrors ( TARGETING::Target * i_target, i_statusVal.value, intRegVal ); - // @todo RTC:69113 - Add target and I2C traces to the errorlog. + // For now limited in what we can call out: + // Could be an issue with Processor or its bus + // -- both on the same FRU + // @todo RTC 94872 - update this callout + err->addHwCallout( i_target, + HWAS::SRCI_PRIORITY_HIGH, + HWAS::NO_DECONFIG, + HWAS::GARD_NULL ); + + // Or HB code failed to do the procedure correctly + err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, + HWAS::SRCI_PRIORITY_LOW); + + err->collectTrace( "I2C" ); break; } @@ -1130,6 +1235,21 @@ errlHndl_t i2cWaitForFifoSpace ( TARGETING::Target * i_target, status.value, 0x0 ); + // For now limited in what we can call out: + // Could be an issue with Processor or its bus + // -- both on the same FRU + // @todo RTC 94872 - update this callout + err->addHwCallout( i_target, + HWAS::SRCI_PRIORITY_HIGH, + HWAS::NO_DECONFIG, + HWAS::GARD_NULL ); + + // Or HB code failed to do the procedure correctly + err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, + HWAS::SRCI_PRIORITY_LOW); + + err->collectTrace( "I2C", 256); + break; } } @@ -1359,24 +1479,7 @@ errlHndl_t i2cSetupMasters ( void ) if( 0 == centList.size() ) { TRACFCOMP( g_trac_i2c, - ERR_MRK"i2cSetupMasters: No Centaur chips found!" ); - - /*@ - * @errortype - * @reasoncode I2C_NO_CENTAUR_FOUND - * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE - * @moduleid I2C_SETUP_MASTERS - * @userdata1 <UNUSED> - * @userdata2 <UNUSED> - * @frucallout <NONE> - * @devdesc No Centaur chips found to programm I2C bus - * divisor - */ - err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE, - I2C_SETUP_MASTERS, - I2C_NO_CENTAUR_FOUND, - 0x0, 0x0 ); - break; + INFO_MRK"i2cSetupMasters: No Centaur chips found!" ); } TRACUCOMP( g_trac_i2c, @@ -1468,24 +1571,7 @@ errlHndl_t i2cSetupMasters ( void ) if( 0 == procList.size() ) { TRACFCOMP( g_trac_i2c, - ERR_MRK"i2cSetupMasters: No Processor chips found!" ); - - /*@ - * @errortype - * @reasoncode I2C_NO_PROC_FOUND - * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE - * @moduleid I2C_SETUP_MASTERS - * @userdata1 <UNUSED> - * @userdata2 <UNUSED> - * @frucallout <NONE> - * @devdesc No Centaur chips found to programm I2C bus - * divisor - */ - err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE, - I2C_SETUP_MASTERS, - I2C_NO_PROC_FOUND, - 0x0, 0x0 ); - break; + INFO_MRK"i2cSetupMasters: No Processor chips found!" ); } TRACUCOMP( g_trac_i2c, @@ -1630,7 +1716,11 @@ errlHndl_t i2cSetBusVariables ( TARGETING::Target * i_target, I2C_SET_BUS_VARIABLES, I2C_INVALID_BUS_SPEED_MODE, i_mode, - 0x0 ); + 0x0, + true /*Add HB SW Callout*/ ); + + err->collectTrace( "I2C", 256); + break; } diff --git a/src/usr/i2c/i2c.H b/src/usr/i2c/i2c.H index 329877376..aa23790d7 100755 --- a/src/usr/i2c/i2c.H +++ b/src/usr/i2c/i2c.H @@ -117,40 +117,6 @@ struct i2c_addrs_t }; /** - * @brief Addresses for each of the registers in each engine. - */ -static i2c_addrs_t masterAddrs[] = -{ - { /* Master 0 */ - I2C_MASTER0_ADDR | 0x4, // FIFO - I2C_MASTER0_ADDR | 0x5, // Command Register - I2C_MASTER0_ADDR | 0x6, // Mode Register - I2C_MASTER0_ADDR | 0x8, // Interrupt Mask Register - I2C_MASTER0_ADDR | 0xA, // Interrupt Register - I2C_MASTER0_ADDR | 0xB, // Status Register (Read) - I2C_MASTER0_ADDR | 0xB, // Reset (Write) - }, - { /* Master 1 */ - I2C_MASTER1_ADDR | 0x4, // FIFO - I2C_MASTER1_ADDR | 0x5, // Command Register - I2C_MASTER1_ADDR | 0x6, // Mode Register - I2C_MASTER1_ADDR | 0x8, // Interrupt Mask Register - I2C_MASTER1_ADDR | 0xA, // Interrupt Register - I2C_MASTER1_ADDR | 0xB, // Status Register (Read) - I2C_MASTER1_ADDR | 0xB, // Reset (Write) - }, - { /* Master 2 */ - I2C_MASTER2_ADDR | 0x4, // FIFO - I2C_MASTER2_ADDR | 0x5, // Command Register - I2C_MASTER2_ADDR | 0x6, // Mode Register - I2C_MASTER2_ADDR | 0x8, // Interrupt Mask Register - I2C_MASTER2_ADDR | 0xA, // Interrupt Register - I2C_MASTER2_ADDR | 0xB, // Status Register (Read) - I2C_MASTER2_ADDR | 0xB, // Reset (Write) - } -}; - -/** * @brief Structure used to pass important variables between functions */ struct misc_args_t diff --git a/src/usr/i2c/makefile b/src/usr/i2c/makefile index 568ecbd69..b1133f258 100644 --- a/src/usr/i2c/makefile +++ b/src/usr/i2c/makefile @@ -1,29 +1,29 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. # -# $Source: src/usr/i2c/makefile $ +# $Source: src/usr/i2c/makefile $ # -# IBM CONFIDENTIAL +# IBM CONFIDENTIAL # -# COPYRIGHT International Business Machines Corp. 2011 +# COPYRIGHT International Business Machines Corp. 2011,2014 # -# p1 +# p1 # -# Object Code Only (OCO) source materials -# Licensed Internal Code Source Materials -# IBM HostBoot Licensed Internal Code +# Object Code Only (OCO) source materials +# Licensed Internal Code Source Materials +# IBM HostBoot Licensed Internal Code # -# The source code for this program is not published or other- -# wise divested of its trade secrets, irrespective of what has -# been deposited with the U.S. Copyright Office. +# The source code for this program is not published or otherwise +# divested of its trade secrets, irrespective of what has been +# deposited with the U.S. Copyright Office. # -# Origin: 30 +# Origin: 30 # -# IBM_PROLOG_END +# IBM_PROLOG_END_TAG ROOTPATH = ../../.. MODULE = i2c -OBJS = i2c.o eepromdd.o +OBJS = i2c.o eepromdd.o errlud_i2c.o SUBDIRS = test.d diff --git a/src/usr/i2c/plugins/EEPROM_COMP_ID_Parse.C b/src/usr/i2c/plugins/EEPROM_COMP_ID_Parse.C new file mode 100644 index 000000000..34d93b04a --- /dev/null +++ b/src/usr/i2c/plugins/EEPROM_COMP_ID_Parse.C @@ -0,0 +1,27 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/i2c/plugins/EEPROM_COMP_ID_Parse.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#include "errludparser.H" +#include "i2cUdParserFactory.H" + +ERRL_MAKE_UD_PARSER(EEPROM::UserDetailsParserFactory, hbfw::EEPROM_COMP_ID) + diff --git a/src/usr/i2c/plugins/I2C_COMP_ID_Parse.C b/src/usr/i2c/plugins/I2C_COMP_ID_Parse.C new file mode 100644 index 000000000..db0618393 --- /dev/null +++ b/src/usr/i2c/plugins/I2C_COMP_ID_Parse.C @@ -0,0 +1,27 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/i2c/plugins/I2C_COMP_ID_Parse.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#include "errludparser.H" +#include "i2cUdParserFactory.H" + +ERRL_MAKE_UD_PARSER(I2C::UserDetailsParserFactory, hbfw::I2C_COMP_ID) + diff --git a/src/usr/i2c/plugins/errludP_i2c.H b/src/usr/i2c/plugins/errludP_i2c.H new file mode 100644 index 000000000..1756c098e --- /dev/null +++ b/src/usr/i2c/plugins/errludP_i2c.H @@ -0,0 +1,259 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/i2c/plugins/errludP_i2c.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef ERRL_UDP_I2C_H +#define ERRL_UDP_I2C_H + +/** + * @file errludP_i2c.H + * + * Defines the ErrlUserDetailsParser classes that parse I2C and EEPROM FFDC + */ + +#include "errluserdetails.H" +#include <string.h> + +/** + * Some macros to manipulate data types cleanly + */ +#define TO_UINT8(ptr) (*(reinterpret_cast<uint8_t*>(ptr))) +#define TO_UINT16(ptr) (ntohs(*(reinterpret_cast<uint16_t*>(ptr)))) +#define TO_UINT32(ptr) (ntohl(*(reinterpret_cast<uint32_t*>(ptr)))) +#define TO_UINT64(ptr) (ntohll(*(reinterpret_cast<uint64_t*>(ptr)))) + +namespace I2C +{ + +/** + * @class UdParserI2CParms + * + * Parses UdI2CParms + */ +class UdParserI2CParms : public ERRORLOG::ErrlUserDetailsParser +{ +public: + /** + * @brief Constructor + */ + UdParserI2CParms() {} + + /** + * @brief Destructor + */ + virtual ~UdParserI2CParms() {} + + /** + * @brief Parses string user detail data from an error log + * + * @param i_version Version of the data + * @param i_parse ErrlUsrParser object for outputting information + * @param i_pBuffer Pointer to buffer containing detail data + * @param i_buflen Length of the buffer + */ + virtual void parse(errlver_t i_version, + ErrlUsrParser & i_parser, + void * i_pBuffer, + const uint32_t i_buflen) const + { + char* l_databuf = static_cast<char*>(i_pBuffer); + i_parser.PrintHeading("I2C Parameters"); + + //***** Memory Layout ***** + // 1 byte : Op Type Description + // 1 byte : Op Type (DeviceFW::OperationType) + // 4 bytes : Target HUID + // 8 bytes : Length of In/Out Buffer + // 8 bytes : Access Type (DeviceFW::AccessType) + // 1 byte : Port + // 1 byte : Engine + // 8 bytes : Device Address + // 1 byte : Flag: skip_mode_setup; + // 1 byte : Flag: with_stop; + // 1 byte : Flag: read_not_write; + // 8 bytes : Bus Speed (kbits/sec) + // 2 bytes : Bit Rate Divisor + // 8 bytes : Timeout Interval + // 8 bytes : Timeout Count; + + uint8_t op = TO_UINT8(l_databuf); + l_databuf += sizeof(uint8_t); + + if( op == 0 ) + { + i_parser.PrintHeading("I2C Read"); + } + else if( op == 1 ) + { + i_parser.PrintHeading("I2C Write"); + } + else + { + i_parser.PrintHeading("Unknown I2C Operation"); + } + + i_parser.PrintNumber("Op Type Value","%.2lX",TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + i_parser.PrintNumber("Target HUID","%.8lX",TO_UINT32(l_databuf)); + l_databuf += sizeof(uint32_t); + i_parser.PrintNumber("Length I/O Buff","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Access Type","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Port","%.2lX",TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + i_parser.PrintNumber("Engine","%.2lX",TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + i_parser.PrintNumber("Device Address","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Flag: skip_mode_setup","%.2lX", + TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + i_parser.PrintNumber("Flag: with_stop","%.2lX",TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + i_parser.PrintNumber("Flag: read_not_write","%.2lX", + TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + i_parser.PrintNumber("Bus Speed (kbits/sec)","%.16lX", + TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Bit Rate Divisor","%.4lX",TO_UINT16(l_databuf)); + l_databuf += sizeof(uint16_t); + i_parser.PrintNumber("Timeout Interval","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Timeout Count","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + + } + +private: + // Disabled + UdParserI2CParms(const UdParserI2CParms&); + UdParserI2CParms & operator=(const UdParserI2CParms&); +}; + +} // end I2C namespace + +namespace EEPROM +{ + +/** + * @class UdParserEepromParms + * + * Parses UdEepromParms + */ +class UdParserEepromParms : public ERRORLOG::ErrlUserDetailsParser +{ +public: + /** + * @brief Constructor + */ + UdParserEepromParms() {} + + /** + * @brief Destructor + */ + virtual ~UdParserEepromParms() {} + + /** + * @brief Parses string user detail data from an error log + * + * @param i_version Version of the data + * @param i_parse ErrlUsrParser object for outputting information + * @param i_pBuffer Pointer to buffer containing detail data + * @param i_buflen Length of the buffer + */ + virtual void parse(errlver_t i_version, + ErrlUsrParser & i_parser, + void * i_pBuffer, + const uint32_t i_buflen) const + { + char* l_databuf = static_cast<char*>(i_pBuffer); + i_parser.PrintHeading("EEPROM Parameters"); + + //***** Memory Layout ***** + // 1 byte : Op Type Description + // 1 byte : Op Type (DeviceFW::OperationType) + // 4 bytes : Target HUID + // 8 bytes : Length of In/Out Buffer + // 8 bytes : Chip + // 8 bytes : Offset + // 8 bytes : Port + // 8 bytes : Engine + // 8 bytes : Device Address + // 1 byte : Address Size + // 8 bytes : Write Page Size + // 8 bytes : Device Size (in KB) + // 8 bytes : Write Cycle Time + + uint8_t op = TO_UINT8(l_databuf); + l_databuf += sizeof(uint8_t); + + if( op == 0 ) + { + i_parser.PrintHeading("EEPROM Read"); + } + else if( op == 1 ) + { + i_parser.PrintHeading("EEPROM Write"); + } + else + { + i_parser.PrintHeading("Unknown EEPROM Operation"); + } + + i_parser.PrintNumber("Op Type Value","%.2lX",TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + i_parser.PrintNumber("Target HUID","%.8lX",TO_UINT32(l_databuf)); + l_databuf += sizeof(uint32_t); + i_parser.PrintNumber("Length I/O Buff","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Chip","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Offset","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Port","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Engine","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Device Address","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Address Size","%.2lX",TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + i_parser.PrintNumber("Write Page Size","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Device Size (in KB)","%.16lX", + TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Write Cycle Time","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + + } + +private: + // Disabled + UdParserEepromParms(const UdParserEepromParms&); + UdParserEepromParms & operator=(const UdParserEepromParms&); +}; + +} // end EEPROM NAMESPACE + +#endif diff --git a/src/usr/i2c/plugins/i2cUdParserFactory.H b/src/usr/i2c/plugins/i2cUdParserFactory.H new file mode 100644 index 000000000..aacd401e8 --- /dev/null +++ b/src/usr/i2c/plugins/i2cUdParserFactory.H @@ -0,0 +1,70 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/i2c/plugins/i2cUdParserFactory.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#if !defined(_I2CUDPARSERFACTORY_H) +#define _I2CUDPARSERFACTORY_H + +#include "errludparserfactory.H" +#include "errludP_i2c.H" + +namespace I2C +{ + class UserDetailsParserFactory + : public ERRORLOG::ErrlUserDetailsParserFactory + { + public: + UserDetailsParserFactory() + { + registerParser<I2C::UdParserI2CParms> + (I2C_UDT_PARAMETERS); + } + + private: + + UserDetailsParserFactory(const UserDetailsParserFactory &); + UserDetailsParserFactory & operator= + (const UserDetailsParserFactory &); + }; +}; + +namespace EEPROM +{ + class UserDetailsParserFactory + : public ERRORLOG::ErrlUserDetailsParserFactory + { + public: + UserDetailsParserFactory() + { + registerParser<EEPROM::UdParserEepromParms> + (EEPROM_UDT_PARAMETERS); + } + + private: + + UserDetailsParserFactory(const UserDetailsParserFactory &); + UserDetailsParserFactory & operator= + (const UserDetailsParserFactory &); + }; +}; + +#endif + |