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 | |
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')
-rw-r--r-- | src/usr/devtree/bld_devtree.C | 8 | ||||
-rw-r--r-- | src/usr/fsi/fsidd.C | 37 | ||||
-rw-r--r-- | src/usr/fsi/fsidd.H | 15 |
3 files changed, 56 insertions, 4 deletions
diff --git a/src/usr/devtree/bld_devtree.C b/src/usr/devtree/bld_devtree.C index d0d73e07d..ff1fa59c2 100644 --- a/src/usr/devtree/bld_devtree.C +++ b/src/usr/devtree/bld_devtree.C @@ -52,6 +52,7 @@ $ */ #include <util/align.H> #include <vector> #include <vfs/vfs.H> +#include <fsi/fsiif.H> trace_desc_t *g_trac_devtree = NULL; TRAC_INIT(&g_trac_devtree, "DEVTREE", 4096); @@ -844,7 +845,7 @@ errlHndl_t bld_fdt_mem(devTree * i_dt, bool i_smallTree) for ( size_t memb = 0; (!errhdl) && (memb < l_memBufList.size()); memb++ ) { - const TARGETING::Target * l_pMemB = l_memBufList[memb]; + TARGETING::Target * l_pMemB = l_memBufList[memb]; //Get MMIO Offset from parent MCS attribute. PredicateCTM l_mcs(CLASS_UNIT,TYPE_MCS, MODEL_NA); @@ -898,9 +899,10 @@ errlHndl_t bld_fdt_mem(devTree * i_dt, bool i_smallTree) i_dt->addPropertyCell32(membNode, "ibm,chip-id",l_cenId); //Add the CMFSI (which CMFSI 0 or 1) and port - //TODO RTC93298 make which CMFSI correct + FSI::FsiLinkInfo_t linkinfo; + FSI::getFsiLinkInfo( l_pMemB, linkinfo ); uint32_t cmfsiCells[2] = - {0,l_pMemB->getAttr<ATTR_FSI_MASTER_PORT>()}; + {linkinfo.mPort,linkinfo.link}; i_dt->addPropertyCells32(membNode, "ibm,fsi-master-port", cmfsiCells, 2); } 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 |