diff options
author | Dan Crowell <dcrowell@us.ibm.com> | 2014-04-17 17:28:31 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-05-21 17:33:37 -0500 |
commit | 3faeb6dd6cbc8929ac94d92525d1d4f5dcfe9156 (patch) | |
tree | e85f34a6f2ff5457a366a80936d4cf1d54f80eb0 /src/usr/fsi | |
parent | 42e2de679d889a35d67ff0be4f5433ef3b495ff7 (diff) | |
download | talos-hostboot-3faeb6dd6cbc8929ac94d92525d1d4f5dcfe9156.tar.gz talos-hostboot-3faeb6dd6cbc8929ac94d92525d1d4f5dcfe9156.zip |
Set CMFSI fields correctly in the devtree for altmaster
Change-Id: I4a36c70d36ec0603d053d5198a2aa78c07c63334
RTC: 35041
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/10626
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/fsi')
-rw-r--r-- | src/usr/fsi/fsidd.C | 37 | ||||
-rw-r--r-- | src/usr/fsi/fsidd.H | 15 |
2 files changed, 51 insertions, 1 deletions
diff --git a/src/usr/fsi/fsidd.C b/src/usr/fsi/fsidd.C index 440b8ccd6..9ff9d304c 100644 --- a/src/usr/fsi/fsidd.C +++ b/src/usr/fsi/fsidd.C @@ -335,6 +335,15 @@ errlHndl_t resetPib2Opb( TARGETING::Target* i_target ) } +/** + * @brief Retrieve some FSI attribute information + */ +void getFsiLinkInfo( TARGETING::Target* i_slave, + FsiLinkInfo_t& o_info ) +{ + Singleton<FsiDD>::instance().getFsiLinkInfo( i_slave, o_info ); +} + }; //end FSI namespace @@ -1010,6 +1019,8 @@ FsiDD::FsiDD() // add a dummy value to catch NULL FsiChipInfo_t info; iv_fsiInfoMap[NULL] = info; + + mutex_init(&iv_dataMutex); } /** @@ -2831,7 +2842,8 @@ FsiDD::FsiChipInfo_t FsiDD::getFsiInfo( TARGETING::Target* i_target ) { FsiChipInfo_t info; - //@fixme - Maps aren't threadsafe, fix when RTC:98898 is done + mutex_lock(&iv_dataMutex); + // Check if we have a cached version first std::map<TARGETING::Target*,FsiChipInfo_t>::iterator itr = iv_fsiInfoMap.find(i_target); @@ -2847,5 +2859,28 @@ FsiDD::FsiChipInfo_t FsiDD::getFsiInfo( TARGETING::Target* i_target ) iv_fsiInfoMap[i_target] = info; } + mutex_unlock(&iv_dataMutex); + return info; } + +/** + * @brief Retrieve some FSI attribute information + */ +void FsiDD::getFsiLinkInfo( TARGETING::Target* i_slave, + FSI::FsiLinkInfo_t& o_info ) +{ + FsiChipInfo_t info = getFsiInfo( i_slave ); + o_info.master = info.master; + o_info.type = info.type; + o_info.link = info.port; + o_info.cascade = info.cascade; + o_info.mPort = 0; + if( info.master + && (info.master != iv_master ) + && (getFsiInfo(info.master).flagbits.flipPort) ) + { + o_info.mPort = 1; + } +} + diff --git a/src/usr/fsi/fsidd.H b/src/usr/fsi/fsidd.H index b2f671f07..d0503857d 100644 --- a/src/usr/fsi/fsidd.H +++ b/src/usr/fsi/fsidd.H @@ -131,6 +131,16 @@ class FsiDD */ errlHndl_t resetPib2Opb( TARGETING::Target* i_target ); + /** + * @brief Retrieve some FSI attribute information + * + * @param[in] i_slave Slave Chip Target to query + * @param[out] o_info FSI Link Information + */ + void getFsiLinkInfo( TARGETING::Target* i_slave, + FSI::FsiLinkInfo_t& o_info ); + + protected: /** * @brief Constructor @@ -594,6 +604,11 @@ class FsiDD */ std::map<TARGETING::Target*,FsiChipInfo_t> iv_fsiInfoMap; + /** + * Mutex to protect the internal maps + */ + mutex_t iv_dataMutex; + private: // let my testcase poke around |