summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaymes Wilks <mjwilks@us.ibm.com>2018-07-19 12:57:03 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-08-13 10:40:27 -0500
commit8b8b8de8870034b121aad1aa1f571bb9e3d2dbc5 (patch)
treee91d5c057b9c4776f96a189511929e39273e1b1c
parentce0ea22d0d9d93b1bf1cc491d93f7907c05185dc (diff)
downloadtalos-hostboot-8b8b8de8870034b121aad1aa1f571bb9e3d2dbc5.tar.gz
talos-hostboot-8b8b8de8870034b121aad1aa1f571bb9e3d2dbc5.zip
Implement generic i2c device callouts for FSP
Creates a new type of callout for i2c devices which populates the error log user details section with the address, port, engine, and i2c master of the device being called out. The change only affects the FSP path. Change-Id: I92acc092f105ee21346594f5e3733957e15ad768 RTC:94872 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/63223 Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com> 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> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com> Reviewed-by: MURULIDHAR NATARAJU <murulidhar@in.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r--src/include/usr/errl/errlentry.H19
-rw-r--r--src/include/usr/errl/errludcallout.H24
-rw-r--r--src/include/usr/hwas/common/hwasCallout.H43
-rw-r--r--src/usr/errl/errlentry.C63
-rw-r--r--src/usr/errl/errludcallout.C39
-rw-r--r--src/usr/errl/plugins/errludcallout.H12
-rw-r--r--src/usr/hwas/common/hwasCallout.C29
-rw-r--r--src/usr/hwas/hwasPlatCallout.C24
-rwxr-xr-xsrc/usr/i2c/i2c.C18
9 files changed, 258 insertions, 13 deletions
diff --git a/src/include/usr/errl/errlentry.H b/src/include/usr/errl/errlentry.H
index 3ed040ae0..677bf06de 100644
--- a/src/include/usr/errl/errlentry.H
+++ b/src/include/usr/errl/errlentry.H
@@ -616,6 +616,25 @@ public:
const HWAS::sensorTypeEnum i_sensorType,
const HWAS::callOutPriority i_priority);
+ /**
+ * @brief Add an i2c device callout. Use this callout type for i2c devices
+ * that do not have target associated with them.
+ *
+ * @param[in] i_i2cMaster The i2c master target. Cannot be nullptr.
+ Cannot be the master sentinel.
+ * @param[in] i_engine The i2c device engine
+ * @param[in] i_port The i2c device port
+ * @param[in] i_address The i2c device address
+ * @param[in] i_priority Priority of the callout
+ *
+ * @return void
+ */
+ void addI2cDeviceCallout(const TARGETING::Target *i_i2cMaster,
+ const uint8_t i_engine,
+ const uint8_t i_port,
+ const uint8_t i_address,
+ const HWAS::callOutPriority i_priority);
+
/**
* @brief Import flattened error log
diff --git a/src/include/usr/errl/errludcallout.H b/src/include/usr/errl/errludcallout.H
index 663243809..9d6acba9f 100644
--- a/src/include/usr/errl/errludcallout.H
+++ b/src/include/usr/errl/errludcallout.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2017 */
+/* Contributors Listed Below - COPYRIGHT 2012,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -174,6 +174,28 @@ private:
const HWAS::callOutPriority i_priority );
+ /**
+ * @brief Construct an i2c device callout user detail
+ *
+ * @param[in] i_pTargData The hardware target data or in other words
+ * the bytes in memory that comprise the
+ * entity path of the target
+ * @param[in] i_targDataLen length of i_pTargData in bytes
+ * @param[in] i_engine The i2c device engine
+ * @param[in] i_port The i2c device port
+ * @param[in] i_address The i2c device address
+ * @param[in] i_priority Priority of the callout
+ *
+ * @return void
+ */
+ ErrlUserDetailsCallout(
+ const void *i_pTargData,
+ const uint32_t i_targDataLen,
+ const uint8_t i_engine,
+ const uint8_t i_port,
+ const uint8_t i_address,
+ const HWAS::callOutPriority i_priority);
+
// Disabled
ErrlUserDetailsCallout(const ErrlUserDetailsCallout &);
diff --git a/src/include/usr/hwas/common/hwasCallout.H b/src/include/usr/hwas/common/hwasCallout.H
index 9bb0722fa..01275a012 100644
--- a/src/include/usr/hwas/common/hwasCallout.H
+++ b/src/include/usr/hwas/common/hwasCallout.H
@@ -137,7 +137,7 @@ enum clockTypeEnum
MEMCLK_TYPE = 2,
OSCREFCLK_TYPE = 3,
OSCPCICLK_TYPE = 4,
-
+
// Specify a specific clock source for the case where the code can determine
// which of the redundant sources is actually at fault
OSCPCICLK0_TYPE = 10, //Specifically clock 0
@@ -172,12 +172,13 @@ enum sensorTypeEnum
};
//
-const uint8_t HW_CALLOUT = 0x01;
-const uint8_t PROCEDURE_CALLOUT = 0x02;
-const uint8_t BUS_CALLOUT = 0x03;
-const uint8_t CLOCK_CALLOUT = 0x04;
-const uint8_t PART_CALLOUT = 0x05;
-const uint8_t SENSOR_CALLOUT = 0x06;
+const uint8_t HW_CALLOUT = 0x01;
+const uint8_t PROCEDURE_CALLOUT = 0x02;
+const uint8_t BUS_CALLOUT = 0x03;
+const uint8_t CLOCK_CALLOUT = 0x04;
+const uint8_t PART_CALLOUT = 0x05;
+const uint8_t SENSOR_CALLOUT = 0x06;
+const uint8_t I2C_DEVICE_CALLOUT = 0x07;
const uint8_t TARGET_IS_SENTINEL = 0xF0;
@@ -216,6 +217,12 @@ typedef struct callout_ud
uint32_t sensorId;
sensorTypeEnum sensorType;
};
+ struct { // type == I2C_DEVICE_CALLOUT
+ uint8_t engine;
+ uint8_t port;
+ uint8_t address;
+ // one Target will follow
+ };
}; // union
} callout_ud_t;
@@ -353,6 +360,28 @@ errlHndl_t platHandlePartCallout(
DeconfigEnum i_deconfigState = DECONFIG,
GARD_ErrorType i_gardErrorType = GARD_Fatal);
+/**
+ * @brief platform specific code to handle a bus callout that has been
+ * found in an errlog
+ *
+ * @param[in] i_i2cMaster I2c master target for the i2c device
+ * @param[in] i_engine I2c device engine
+ * @param[in] i_port I2c device port
+ * @param[in] i_address I2c device address
+ * @param[in] i_priority Enum indicating the priority of the callout
+ * @param[in] io_errl Reference to error log handle
+ *
+ * @return errlHndl_t valid errlHndl_t handle if there was an error,
+ * nullptr if no errors;
+ */
+errlHndl_t platHandleI2cDeviceCallout(
+ TARGETING::Target *i_i2cMaster,
+ uint8_t i_engine,
+ uint8_t i_port,
+ uint8_t i_address,
+ callOutPriority i_priority,
+ errlHndl_t &io_errl);
+
#endif // not PARSER
}; // end namespace
diff --git a/src/usr/errl/errlentry.C b/src/usr/errl/errlentry.C
index b31ef8b8c..3d183b923 100644
--- a/src/usr/errl/errlentry.C
+++ b/src/usr/errl/errlentry.C
@@ -540,11 +540,11 @@ void ErrlEntry::addHwCallout(const TARGETING::Target *i_target,
#ifdef CONFIG_ERRL_ENTRY_TRACE
TRACFCOMP(g_trac_errl, ENTER_MRK
"addHwCallout(\"MASTER_PROC_SENTINEL\" 0x%x 0x%x 0x%x)",
- i_target, i_priority, i_deconfigState, i_gardErrorType);
+ i_priority, i_deconfigState, i_gardErrorType);
#else
TRACDCOMP(g_trac_errl, ENTER_MRK
"addHwCallout(\"MASTER_PROC_SENTINEL\" 0x%x 0x%x 0x%x)",
- i_target, i_priority, i_deconfigState, i_gardErrorType);
+ i_priority, i_deconfigState, i_gardErrorType);
#endif
//need to override deconfig value to avoid possible deadlocks
@@ -1060,6 +1060,14 @@ void ErrlEntry::setSubSystemIdBasedOnCallouts()
"callout to determine SSID", pData->sensorType);
iv_User.setSubSys(getSubSystem(pData->sensorType));
}
+ else if (pData->type == HWAS::I2C_DEVICE_CALLOUT)
+ {
+ TRACFCOMP(g_trac_errl, INFO_MRK
+ "setting subsystem for type 0x%x "
+ "callout to I2C Device", pData->type);
+
+ iv_User.setSubSys(EPUB_CEC_HDW_I2C_DEVS);
+ }
else
{
TRACFCOMP(g_trac_errl, ERR_MRK
@@ -1809,6 +1817,57 @@ bool ErrlEntry::isSevVisible( void )
return l_vis;
}
+void ErrlEntry::addI2cDeviceCallout(const TARGETING::Target *i_i2cMaster,
+ const uint8_t i_engine,
+ const uint8_t i_port,
+ const uint8_t i_address,
+ const HWAS::callOutPriority i_priority)
+{
+ do {
+
+ if (i_i2cMaster == nullptr ||
+ i_i2cMaster == TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL)
+ {
+
+ TRACFCOMP(g_trac_errl, ERR_MRK
+ "addI2cDeviceCallout mistakenly called with %s target. "
+ "Adding high priority callout to the error log.",
+ i_i2cMaster? "MASTER_SENTINEL": "nullptr");
+ addProcedureCallout( HWAS::EPUB_PRC_HB_CODE,
+ HWAS::SRCI_PRIORITY_HIGH);
+ collectTrace(ERRL_COMP_NAME);
+ break;
+ }
+
+ #ifdef CONFIG_ERRL_ENTRY_TRACE
+ TRACFCOMP(g_trac_errl, ENTER_MRK
+ "addI2cDeviceCallout(i2cm=0x%.8x e=0x%x p=0x%x devAddr=0x%x pri=0x%x)",
+ get_huid(i_i2cMaster), i_engine, i_port, i_address, i_priority);
+ #else
+ TRACDCOMP(g_trac_errl, ENTER_MRK
+ "addI2cDeviceCallout(i2cm=0x%.8x e=0x%x p=0x%x devAddr=0x%x pri=0x%x)",
+ get_huid(i_i2cMaster), i_engine, i_port, i_address, i_priority);
+ #endif
+
+ const void* pData = nullptr;
+ uint32_t size = 0;
+ TARGETING::EntityPath* ep = nullptr;
+ getTargData( i_i2cMaster, ep, pData, size );
+
+
+ ErrlUserDetailsCallout(pData, size,
+ i_engine, i_port, i_address, i_priority).addToLog(this);
+
+ if (ep)
+ {
+ delete ep;
+ ep = nullptr;
+ }
+
+ } while (0);
+
+
+} // addI2cDeviceCallout
} // End namespace
diff --git a/src/usr/errl/errludcallout.C b/src/usr/errl/errludcallout.C
index 334d3c9a2..3e8c0b522 100644
--- a/src/usr/errl/errludcallout.C
+++ b/src/usr/errl/errludcallout.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2017 */
+/* Contributors Listed Below - COPYRIGHT 2012,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -227,4 +227,39 @@ ErrlUserDetailsCallout::ErrlUserDetailsCallout(const uint32_t i_sensorID,
TRACDCOMP(g_trac_errl, "Sensor Callout exit");
} // Sensor callout
-}
+//------------------------------------------------------------------------------
+// I2c Device Callout
+ErrlUserDetailsCallout::ErrlUserDetailsCallout(
+ const void *i_pTargData,
+ const uint32_t i_targDataLen,
+ const uint8_t i_engine,
+ const uint8_t i_port,
+ const uint8_t i_address,
+ const HWAS::callOutPriority i_priority)
+{
+ TRACDCOMP(g_trac_errl, "I2c Device Callout");
+
+ assert(i_pTargData != nullptr, "Bug! I2c Device Callout added with null i2c master target");
+
+ // Set up ErrUserDetails instance variables
+ iv_CompId = ERRL_COMP_ID;
+ iv_Version =1;
+ iv_SubSection = ERRL_UDT_CALLOUT;
+
+ uint32_t pDataLength = sizeof(HWAS::callout_ud_t) + i_targDataLen;
+ HWAS::callout_ud_t *pData = reinterpret_cast<HWAS::callout_ud_t *>
+ (reallocUsrBuf(pDataLength));
+
+ pData->type = HWAS::I2C_DEVICE_CALLOUT;
+ pData->engine = i_engine;
+ pData->port = i_port;
+ pData->address = i_address;
+ pData->priority = i_priority;
+
+ memcpy(pData + 1, i_pTargData, i_targDataLen);
+
+ TRACDCOMP(g_trac_errl, "I2c Device Callout exit");
+} // I2c Device Callout
+
+} // namespace ERRORRLOG
+
diff --git a/src/usr/errl/plugins/errludcallout.H b/src/usr/errl/plugins/errludcallout.H
index 147407ccd..4df646c7b 100644
--- a/src/usr/errl/plugins/errludcallout.H
+++ b/src/usr/errl/plugins/errludcallout.H
@@ -219,6 +219,18 @@ case HWAS::_type: i_parser.PrintString( "Bus Type", #_type); break;
break; // BUS_CALLOUT
}
+ case HWAS::I2C_DEVICE_CALLOUT:
+ {
+ i_parser.PrintString( "Callout type", "I2c Device Callout");
+ i_parser.PrintNumber( "Engine","0x%.2x", pData->engine );
+ i_parser.PrintNumber( "Port","0x%.2x", pData->port );
+ i_parser.PrintNumber( "DevAddr","0x%.2x", pData->address );
+
+ uint8_t *l_ptr = reinterpret_cast<uint8_t *>(pData+1);
+ printEntityPath(l_ptr, i_parser, "Target");
+
+ break; // I2C_DEVICE_CALLOUT
+ }
case HWAS::HW_CALLOUT:
{
i_parser.PrintString( "Callout type", "Hardware Callout");
diff --git a/src/usr/hwas/common/hwasCallout.C b/src/usr/hwas/common/hwasCallout.C
index 588833572..a7ea7e224 100644
--- a/src/usr/hwas/common/hwasCallout.C
+++ b/src/usr/hwas/common/hwasCallout.C
@@ -242,6 +242,35 @@ void processCallout(errlHndl_t &io_errl,
}
break;
} // PART_CALLOUT
+ case (I2C_DEVICE_CALLOUT):
+ {
+ TARGETING::Target *i2cMaster = nullptr;
+
+ uint8_t * l_targetData = reinterpret_cast<uint8_t *>(pCalloutUD + 1);
+ bool wasErr = retrieveTarget(l_targetData, i2cMaster, io_errl);
+
+ if (!wasErr)
+ {
+ errlHndl_t errl = nullptr;
+
+ // TODO RTC 94872 - Uncomment this later after the FSP team
+ // implements it.
+ //
+ // errlHndl_t errl = platHandleI2cDeviceCallout(
+ // i2cMaster,
+ // pCalloutUD->engine,
+ // pCalloutUD->port,
+ // pCalloutUD->address,
+ // pCalloutUD->priority,
+ // io_errl);
+ if (errl)
+ {
+ HWAS_ERR("processCallout: error from platHandleI2cDeviceCallout");
+ errlCommit(errl, HWAS_COMP_ID);
+ }
+ }
+ break;
+ } // I2C_DEVICE_CALLOUT
default:
{
diff --git a/src/usr/hwas/hwasPlatCallout.C b/src/usr/hwas/hwasPlatCallout.C
index 5c6f8e687..ce1ec18b6 100644
--- a/src/usr/hwas/hwasPlatCallout.C
+++ b/src/usr/hwas/hwasPlatCallout.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2017 */
+/* Contributors Listed Below - COPYRIGHT 2013,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -192,6 +192,28 @@ errlHndl_t platHandleBusCallout(
}
//******************************************************************************
+// platHandleI2cDeviceCallout
+//******************************************************************************
+errlHndl_t platHandleI2cDeviceCallout(
+ TARGETING::Target *i_i2cMaster,
+ uint8_t i_engine,
+ uint8_t i_port,
+ uint8_t i_address,
+ callOutPriority i_priority,
+ errlHndl_t &io_errl)
+{
+ // WARNING:
+ // this hostboot code should not change io_errl, unless the caller of the
+ // processCallouts() function also changes, as today it (errlentry.C) calls
+ // from the errlEntry object
+
+ errlHndl_t errl = nullptr;
+
+ // hostboot does not yet handle or do any action for i2c callouts
+ return errl;
+}
+
+//******************************************************************************
// platHandleClockCallout
//******************************************************************************
errlHndl_t platHandleClockCallout(
diff --git a/src/usr/i2c/i2c.C b/src/usr/i2c/i2c.C
index db93bb2d7..4045ab26c 100755
--- a/src/usr/i2c/i2c.C
+++ b/src/usr/i2c/i2c.C
@@ -56,6 +56,8 @@
#include <i2c/eepromif.H>
#include <i2c/tpmddif.H>
+// TODO RTC 94872 Remove the following include in a future commit
+#include <initservice/initserviceif.H>
// ----------------------------------------------
// Globals
@@ -4442,6 +4444,22 @@ void addHwCalloutsI2c(errlHndl_t i_err,
break;
}
}
+ // For the FSP, non-TPM case add an I2c Device callout.
+ // TODO RTC 94872 In a future commit, we will want FSP to handle
+ // the TPM case also, but we won't add it here until FSP fully
+ // supports the new i2c callout type. The reasoning is that we still need
+ // TPMs to be called out as before in the interim. The other i2c devices
+ // (that were never called out to begin with) are the only ones being added
+ // as the new type, because FSP will treat the new type as unknown until
+ // support for the new type is added.
+ if (l_devFound == false && INITSERVICE::spBaseServicesEnabled())
+ {
+ i_err->addI2cDeviceCallout(i_target,
+ i_args.engine,
+ i_args.port,
+ i_args.devAddr,
+ HWAS::SRCI_PRIORITY_HIGH);
+ }
// Could also be an issue with Processor or its bus
// -- both on the same FRU
OpenPOWER on IntegriCloud