From 740541cdd9e0c49ffe3cc2b9f6268a26b308d2c8 Mon Sep 17 00:00:00 2001 From: Matthew Raybuck Date: Thu, 11 Apr 2019 14:31:01 -0500 Subject: Infer presense detection of Explorer chip from VPD EEPROM During presense detection the explorer chip is being held in reset. In this state it will not respond to any I2C operations and therefore we cannot physically detect the chip during normal presense detection. Instead we infer its presense based on the presense of the associated VPD EEPROM. Change-Id: Id07eb77fc9c3eab09e852b191ad4a32832880c38 RTC:203722 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/75891 Reviewed-by: Christian R. Geddes Reviewed-by: Matt Derksen Tested-by: Jenkins Server Reviewed-by: Michael Baiocchi Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell --- src/usr/i2c/i2cTargetPres.C | 64 ++++++++------------------------------------- 1 file changed, 11 insertions(+), 53 deletions(-) diff --git a/src/usr/i2c/i2cTargetPres.C b/src/usr/i2c/i2cTargetPres.C index 054091b1f..5e7fb5d3b 100644 --- a/src/usr/i2c/i2cTargetPres.C +++ b/src/usr/i2c/i2cTargetPres.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ +/* Contributors Listed Below - COPYRIGHT 2018,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -28,10 +28,12 @@ #include #include #include +#include #include #include #include "i2c_common.H" + extern trace_desc_t* g_trac_i2c; //#define TRACSSCOMP(args...) TRACFCOMP(args) @@ -219,62 +221,18 @@ errlHndl_t ocmbI2CPresencePerformOp(DeviceFW::OperationType i_opType, int64_t i_accessType, va_list i_args) { - bool l_ocmbPresent = 0; - // Error log which will eventually be returned - errlHndl_t l_returnedError = nullptr; - // Useful if two errors occur, but we still want to return first one - // from this function errlHndl_t l_invalidateErrl = nullptr; - l_returnedError = genericI2CTargetPresenceDetect(i_target, - io_buflen, - l_ocmbPresent); + // @TODO RTC 208696: Gemini vs Explorer Presence Detection via SPD + // This function will be updated to differentiate between Explorer and + // Gemini OCMB chips. For now, presense of an OCMB chip is inferred by + // the presense of the eeprom. + bool l_ocmbPresent = EEPROM::eepromPresence(i_target); - if (l_returnedError) - { - TRACFCOMP( g_trac_i2c, ERR_MRK"ocmbI2CTargetPresenceDetect() " - "Error detecting OCMB target 0x%.08X, io_buffer will not be set.", - " Invalidating SPD cache for target in pnor. ", - TARGETING::get_huid(i_target)); - } - else - { - // Copy variable describing if target is present or not to i/o buffer param - memcpy(io_buffer, &l_ocmbPresent, sizeof(l_ocmbPresent)); - io_buflen = sizeof(l_ocmbPresent); - } + memcpy(io_buffer, &l_ocmbPresent, sizeof(l_ocmbPresent)); + io_buflen = sizeof(l_ocmbPresent); - // If OCMB was found to not be present, or an error occurred - // while checking presence, invalidate the pnor cache of this - // SPD data - if(!l_ocmbPresent || l_returnedError) - { - // Invalidate the SPD in PNOR - l_invalidateErrl = VPD::invalidatePnorCache(i_target); - - if (l_invalidateErrl) - { - TRACFCOMP( g_trac_i2c, ERR_MRK"ocmbI2CTargetPresenceDetect() " - "Error invalidating SPD in PNOR for target 0x%.08X", - TARGETING::get_huid(i_target)); - // If there was an error found while running genericI2CTargetPresenceDetect - // then we want return that error and just link the error we found from - // invalidatePnorCache and commit it right away. If this is the first error - // we encounter then we will just return the error from invalidatePnorCache - if(l_returnedError) - { - l_invalidateErrl->plid(l_returnedError->plid()); - errlCommit(l_invalidateErrl, I2C_COMP_ID); - } - else - { - l_returnedError = l_invalidateErrl; - l_invalidateErrl = nullptr; - } - } - } - - return l_returnedError; + return l_invalidateErrl; } /** -- cgit v1.2.1