diff options
author | Christian Geddes <crgeddes@us.ibm.com> | 2019-05-23 15:02:12 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2019-06-05 16:39:35 -0500 |
commit | 3f6ff0a8bddfd7d9b916239707e04ff52be4c8fb (patch) | |
tree | 6869efe3287069acaa1f35f7b497ecc054fa117c /src/usr/i2c | |
parent | a70922169308a63b7ea2c4191bce1172910579fa (diff) | |
download | talos-hostboot-3f6ff0a8bddfd7d9b916239707e04ff52be4c8fb.tar.gz talos-hostboot-3f6ff0a8bddfd7d9b916239707e04ff52be4c8fb.zip |
Clean up some comments and refactor how we determine new cache entry
While code was added to handle detecting new OCMB parts a new check
was added to make sure an entry was newly added to cache to make it so
we didnt do new part validation on entries that had not been cached yet.
This commit removes what was added and leverages existing information we
had earlier on in the caching algorith. Also in this commit a few minor
comments were addressed related to tracing and doxygen comments.
Change-Id: Ie3454181449320a6a570c15692cc1f71c819ba22
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/77814
Reviewed-by: Matthew Raybuck <matthew.raybuck@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: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Chen Du <duchen@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/i2c')
-rw-r--r-- | src/usr/i2c/eepromCache.C | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/usr/i2c/eepromCache.C b/src/usr/i2c/eepromCache.C index 7fa2b9861..8eb858883 100644 --- a/src/usr/i2c/eepromCache.C +++ b/src/usr/i2c/eepromCache.C @@ -358,6 +358,9 @@ errlHndl_t cacheEeprom(TARGETING::Target* i_target, // to be the current "end of cache" offset in the toc. l_eepromRecordHeader.completeRecord.internal_offset = l_eecacheSectionHeaderPtr->end_of_cache; l_eecacheSectionHeaderPtr->end_of_cache += l_eepromLen; + + // Set cached_copy_valid to 0 until the cache contents actually gets loaded + l_recordHeaderToUpdate->completeRecord.cached_copy_valid = 0; l_updateContents = i_present; break; } @@ -444,29 +447,14 @@ errlHndl_t cacheEeprom(TARGETING::Target* i_target, } - uint64_t l_eepromCacheVaddr = lookupEepromAddr(l_eepromRecordHeader); - const uint64_t l_invalidAddress = 0xFFFFFFFFFFFFFFFF; - - // If the virtual address of the eeprom record header is an invalid - // address then this is the first time this target's eeprom is being - // cached. - bool l_isNewCacheEntry = false; - if (memcmp( - reinterpret_cast<void *>(l_eepromCacheVaddr), - &l_invalidAddress, sizeof(uint64_t)) == 0) - { - l_isNewCacheEntry = true; - } - - // At this point we have found a match in the PNOR but we need - // to decide what all needs an update. - // // Only check if the cache is in sync with HARDWARE if there is an // existing EECACHE section. Otherwise, the code after this logic will // take care of adding a new eeprom cache section for the target. - if ( l_recordHeaderToUpdate->completeRecord.cached_copy_valid - && !l_isNewCacheEntry) + if (l_recordHeaderToUpdate->completeRecord.cached_copy_valid) { + // At this point we have found a match in the PNOR but we need + // to decide what all needs an update. + // Create namespace alias for targeting to reduce number of // new lines required to be within line character limit. namespace T = TARGETING; @@ -622,6 +610,13 @@ errlHndl_t cacheEeprom(TARGETING::Target* i_target, break; } + // If cache copy was not valid before, it is now valid, we must update the header + if (!l_recordHeaderToUpdate->completeRecord.cached_copy_valid) + { + l_eepromRecordHeader.completeRecord.cached_copy_valid = 0x01; + l_updateHeader = true; + } + } // Above we have determined whether the header entry for the eeprom at |