From 7e05c2e69bf8e9c94b7ab0da63b62546fe79796e Mon Sep 17 00:00:00 2001 From: Christian Geddes Date: Fri, 26 Jul 2019 10:50:15 -0500 Subject: [PATCH] Always update EECACHE header when we find a new eeprom entry The plan of this caching algorithm is to make a cache entry for every OCMB/DIMM, Proc, and Node eeprom that we detect in the XML. We will only copy the contents of the EEPROM if the target is found to be present, but we still must make header entries in for targets that are not present. Change-Id: I46328b84f7095eec9df7abb2f40b0d11ed0c4324 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/81192 Tested-by: Jenkins Server Reviewed-by: Matt Derksen Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Glenn Miles Reviewed-by: Daniel M Crowell --- src/usr/i2c/eepromCache.C | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/usr/i2c/eepromCache.C b/src/usr/i2c/eepromCache.C index 85145937605..436496d01c4 100644 --- a/src/usr/i2c/eepromCache.C +++ b/src/usr/i2c/eepromCache.C @@ -102,6 +102,9 @@ errlHndl_t cacheEeprom(TARGETING::Target* i_target, bool l_updateHeader = true; bool l_updateContents = true; + // Initially assume this is a new eeprom cache entry + bool l_newEntryDetected = true; + do{ // eepromReadAttributes keys off the eepromRole value // to determine what attribute to lookup to get eeprom info @@ -222,6 +225,9 @@ errlHndl_t cacheEeprom(TARGETING::Target* i_target, if( memcmp(l_recordHeaderToUpdate, &l_eepromRecordHeader, NUM_BYTE_UNIQUE_ID ) == 0 ) { l_recordHeaderToUpdateIndex = i; + // We have matched with existing eeprom in the PNOR's EECACHE + // section. So we know this is not a new entry. + l_newEntryDetected = false; if( l_recordHeaderToUpdate->completeRecord.cache_copy_size != l_eepromRecordHeader.completeRecord.cache_copy_size) { @@ -414,16 +420,15 @@ errlHndl_t cacheEeprom(TARGETING::Target* i_target, else if(!i_present) { // If the target is not present, then do not update contents - // or header l_updateContents = false; - l_updateHeader = false; + // Only update header if this is a new entry + l_updateHeader = l_newEntryDetected; } - // The check below makes sure that is isnt a new entry, because - // new entries do not have internal_offset set in header. + // The check below makes sure that is isnt a new entry // If there is a matching header entry in PNOR marked 'invalid' // but we now see the target as present, this indicates a replacement // part has been added where a part was removed - else if(l_recordHeaderToUpdate->completeRecord.internal_offset != UNSET_INTERNAL_OFFSET_VALUE) + else if(!l_newEntryDetected) { TRACFCOMP(g_trac_eeprom, "cacheEeprom() Detected replacement of a part" " Master 0x%.08X Engine 0x%.02X" @@ -953,4 +958,4 @@ uint64_t lookupEepromHeaderAddr(const eepromRecordHeader& i_eepromRecordHeader) return l_vaddr; } -} +} \ No newline at end of file