diff options
author | Andres Lugo-Reyes <aalugore@us.ibm.com> | 2015-01-12 13:03:40 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-01-30 10:26:55 -0600 |
commit | 28ffc52b25ecd146e26d3b4de09601bd5fce5fea (patch) | |
tree | 4a5ae9b621e365d48ddc683067e4acca8332f387 /src/usr/hwpf/hwp/occ | |
parent | a6a045feeaea8758ce03d4b86da86c72ab10edac (diff) | |
download | talos-hostboot-28ffc52b25ecd146e26d3b4de09601bd5fce5fea.tar.gz talos-hostboot-28ffc52b25ecd146e26d3b4de09601bd5fce5fea.zip |
Add support for stopAllOCCs in runtime
RTC:119085
Change-Id: I9576bddd1d7abf7b221e56e7fbb3450fd8b2d54a
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/15092
Reviewed-by: PRACHI GUPTA <pragupta@us.ibm.com>
Tested-by: Jenkins Server
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/hwp/occ')
-rw-r--r-- | src/usr/hwpf/hwp/occ/occ.C | 181 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/occ/occ_common.C | 192 |
2 files changed, 190 insertions, 183 deletions
diff --git a/src/usr/hwpf/hwp/occ/occ.C b/src/usr/hwpf/hwp/occ/occ.C index b516ba87f..f56c90925 100644 --- a/src/usr/hwpf/hwp/occ/occ.C +++ b/src/usr/hwpf/hwp/occ/occ.C @@ -441,186 +441,5 @@ namespace HBOCC return l_errl; } - /** - * @brief Stops OCCs on all Processors in the node - */ - errlHndl_t stopOCCs() - { - TRACUCOMP( g_fapiTd,ENTER_MRK"stopOCCs" ); - errlHndl_t l_errl = NULL; - bool winkle_loaded = false; - - do { - //OCC requires the build_winkle_images library - if ( !VFS::module_is_loaded( "libbuild_winkle_images.so" ) ) - { - l_errl = VFS::module_load( "libbuild_winkle_images.so" ); - - if ( l_errl ) - { - // load module returned with errl set - TRACFCOMP( g_fapiTd,ERR_MRK"stopOCCs: Could not load build_winkle module" ); - // break from do loop if error occured - break; - } - winkle_loaded = true; - } - - TargetHandleList procChips; - getAllChips(procChips, TYPE_PROC, true); - - if(procChips.size() == 0) - { - TRACFCOMP( g_fapiTd,INFO_MRK"stopOCCs: No processors found" ); - //We'll never get this far in the IPL without any processors, - // so just exit. - break; - } - - TRACUCOMP( g_fapiTd, - INFO_MRK"stopOCCs: %d procs found", - procChips.size()); - - //The OCC Procedures require processors within a DCM be - //setup together. If DCM installed is set, we work under - //the assumption that each nodeID is a DCM. So sort the - //list by NodeID then call OCC Procedures on NodeID pairs. - std::sort(procChips.begin(), - procChips.end(), - orderByNodeAndPosition); - - //The OCC master for the node must be reset last. For all - //OP systems there is only a single OCC that can be the - //master so it is safe to look at the MASTER_CAPABLE flag. - Target* masterProc0 = NULL; - Target* masterProc1 = NULL; - - TargetHandleList::iterator itr1 = procChips.begin(); - - if(0 == (*itr1)->getAttr<ATTR_PROC_DCM_INSTALLED>()) - { - TRACUCOMP( g_fapiTd, - INFO_MRK"stopOCCs: non-dcm path entered"); - - for (TargetHandleList::iterator itr = procChips.begin(); - itr != procChips.end(); - ++itr) - { - TargetHandleList pOccs; - getChildChiplets(pOccs, *itr, TYPE_OCC); - if (pOccs.size() > 0) - { - if( pOccs[0]->getAttr<ATTR_OCC_MASTER_CAPABLE>() ) - { - masterProc0 = *itr; - continue; - } - } - - l_errl = HBOCC::stopOCC( *itr, NULL ); - if (l_errl) - { - TRACFCOMP( g_fapiImpTd, ERR_MRK"stopOCCs: stop failed"); - errlCommit (l_errl, HWPF_COMP_ID); - // just commit and try the next chip - } - } - if (l_errl) - { - break; - } - } - else - { - TRACUCOMP( g_fapiTd, - INFO_MRK"stopOCCs: Following DCM Path"); - - for (TargetHandleList::iterator itr = procChips.begin(); - itr != procChips.end(); - ++itr) - { - Target* targ0 = *itr; - Target* targ1 = NULL; - - TRACUCOMP( g_fapiImpTd, INFO_MRK"stopOCCs: Cur target nodeID=%d", - targ0->getAttr<ATTR_FABRIC_NODE_ID>()); - - //if the next target in the list is in the same node - // they are on the same DCM, so bump itr forward - // and update targ0 pointer - if((itr+1) != procChips.end()) - { - TRACUCOMP( g_fapiImpTd, INFO_MRK"stopOCCs: n+1 target nodeID=%d", ((*(itr+1))->getAttr<ATTR_FABRIC_NODE_ID>())); - - if((targ0->getAttr<ATTR_FABRIC_NODE_ID>()) == - ((*(itr+1))->getAttr<ATTR_FABRIC_NODE_ID>())) - { - //need to flip the numbers because we were reversed - targ1 = targ0; - itr++; - targ0 = *itr; - } - } - - TargetHandleList pOccs; - getChildChiplets(pOccs, targ0, TYPE_OCC); - if (pOccs.size() > 0) - { - if( pOccs[0]->getAttr<ATTR_OCC_MASTER_CAPABLE>() ) - { - masterProc0 = targ0; - masterProc1 = targ1; - continue; - } - } - - l_errl = HBOCC::stopOCC( targ0, targ1 ); - if (l_errl) - { - TRACFCOMP( g_fapiImpTd, ERR_MRK"stopOCCs: stop failed"); - errlCommit (l_errl, HWPF_COMP_ID); - // just commit and try the next module - } - } - if (l_errl) - { - break; - } - } - - //now do the master OCC - if( masterProc0 ) - { - l_errl = HBOCC::stopOCC( masterProc0, masterProc1 ); - if (l_errl) - { - TRACFCOMP( g_fapiImpTd, ERR_MRK"stopOCCs: stop failed on master"); - break; - } - } - } while(0); - - //make sure we always unload the module if we loaded it - if (winkle_loaded) - { - errlHndl_t l_tmpErrl = - VFS::module_unload( "libbuild_winkle_images.so" ); - if ( l_tmpErrl ) - { - TRACFCOMP( g_fapiTd,ERR_MRK"stopOCCs: Error unloading build_winkle module" ); - if(l_errl) - { - errlCommit( l_tmpErrl, HWPF_COMP_ID ); - } - else - { - l_errl = l_tmpErrl; - } - } - } - - TRACUCOMP( g_fapiTd,EXIT_MRK"stopOCCs" ); - return l_errl; - } } //end OCC namespace diff --git a/src/usr/hwpf/hwp/occ/occ_common.C b/src/usr/hwpf/hwp/occ/occ_common.C index e059fe23a..97d36f48f 100644 --- a/src/usr/hwpf/hwp/occ/occ_common.C +++ b/src/usr/hwpf/hwp/occ/occ_common.C @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/hwpf/hwp/occ/occ.C $ */ +/* $Source: src/usr/hwpf/hwp/occ/occ_common.C $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2014 */ +/* Contributors Listed Below - COPYRIGHT 2013,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -475,5 +475,193 @@ namespace HBOCC EXIT_MRK"stopOCC"); return err; } + + /** + * @brief Stops OCCs on all Processors in the node + */ + errlHndl_t stopAllOCCs() + { + TRACFCOMP( g_fapiTd,ENTER_MRK"stopAllOCCs" ); + errlHndl_t l_errl = NULL; + bool winkle_loaded = false; + do { + +#ifndef __HOSTBOOT_RUNTIME + //OCC requires the build_winkle_images library + if ( !VFS::module_is_loaded( "libbuild_winkle_images.so" ) ) + { + l_errl = VFS::module_load( "libbuild_winkle_images.so" ); + + if ( l_errl ) + { + // load module returned with errl set + TRACFCOMP( g_fapiTd,ERR_MRK"loadnStartAllOccs: Could not load build_winkle module" ); + // break from do loop if error occured + break; + } + winkle_loaded = true; + } +#endif + + + TargetHandleList procChips; + getAllChips(procChips, TYPE_PROC, true); + + if(procChips.size() == 0) + { + TRACFCOMP( g_fapiTd,INFO_MRK"loadnStartAllOccs: No processors found" ); + //We'll never get this far in the IPL without any processors, + // so just exit. + break; + } + + TRACFCOMP( g_fapiTd, + INFO_MRK"loadnStartAllOccs: %d procs found", + procChips.size()); + + //The OCC Procedures require processors within a DCM be + //setup together. If DCM installed is set, we work under + //the assumption that each nodeID is a DCM. So sort the + //list by NodeID then call OCC Procedures on NodeID pairs. + std::sort(procChips.begin(), + procChips.end(), + orderByNodeAndPosition); + + //The OCC master for the node must be reset last. For all + //OP systems there is only a single OCC that can be the + //master so it is safe to look at the MASTER_CAPABLE flag. + Target* masterProc0 = NULL; + Target* masterProc1 = NULL; + + TargetHandleList::iterator itr1 = procChips.begin(); + + if(0 == (*itr1)->getAttr<ATTR_PROC_DCM_INSTALLED>()) + { + TRACUCOMP( g_fapiTd, + INFO_MRK"stopAllOCCs: non-dcm path entered"); + + for (TargetHandleList::iterator itr = procChips.begin(); + itr != procChips.end(); + ++itr) + { + TargetHandleList pOccs; + getChildChiplets(pOccs, *itr, TYPE_OCC); + if (pOccs.size() > 0) + { + if( pOccs[0]->getAttr<ATTR_OCC_MASTER_CAPABLE>() ) + { + masterProc0 = *itr; + continue; + } + } + + l_errl = HBOCC::stopOCC( *itr, NULL ); + if (l_errl) + { + TRACFCOMP( g_fapiImpTd, ERR_MRK"stopAllOCCs: stop failed"); + errlCommit (l_errl, HWPF_COMP_ID); + // just commit and try the next chip + } + } + if (l_errl) + { + break; + } + } + else + { + TRACFCOMP( g_fapiTd, + INFO_MRK"stopAllOCCs: Following DCM Path"); + + for (TargetHandleList::iterator itr = procChips.begin(); + itr != procChips.end(); + ++itr) + { + Target* targ0 = *itr; + Target* targ1 = NULL; + + TRACFCOMP( g_fapiImpTd, INFO_MRK"stopAllOCCs: Cur target nodeID=%d", + targ0->getAttr<ATTR_FABRIC_NODE_ID>()); + + //if the next target in the list is in the same node + // they are on the same DCM, so bump itr forward + // and update targ0 pointer + if((itr+1) != procChips.end()) + { + TRACFCOMP( g_fapiImpTd, INFO_MRK"stopAllOCCs: n+1 target nodeID=%d", ((*(itr+1))->getAttr<ATTR_FABRIC_NODE_ID>())); + + if((targ0->getAttr<ATTR_FABRIC_NODE_ID>()) == + ((*(itr+1))->getAttr<ATTR_FABRIC_NODE_ID>())) + { + //need to flip the numbers because we were reversed + targ1 = targ0; + itr++; + targ0 = *itr; + } + } + + TargetHandleList pOccs; + getChildChiplets(pOccs, targ0, TYPE_OCC); + if (pOccs.size() > 0) + { + if( pOccs[0]->getAttr<ATTR_OCC_MASTER_CAPABLE>() ) + { + masterProc0 = targ0; + masterProc1 = targ1; + continue; + } + } + + l_errl = HBOCC::stopOCC( targ0, targ1 ); + if (l_errl) + { + TRACFCOMP( g_fapiImpTd, ERR_MRK"stopAllOCCs: stop failed"); + errlCommit (l_errl, HWPF_COMP_ID); + // just commit and try the next module + } + } + if (l_errl) + { + break; + } + } + + //now do the master OCC + if( masterProc0 ) + { + l_errl = HBOCC::stopOCC( masterProc0, masterProc1 ); + if (l_errl) + { + TRACFCOMP( g_fapiImpTd, ERR_MRK"stopAllOCCs: stop failed on master"); + break; + } + } + } while(0); + + //make sure we always unload the module if we loaded it + if (winkle_loaded) + { +#ifndef __HOSTBOOT_RUNTIME + errlHndl_t l_tmpErrl = + VFS::module_unload( "libbuild_winkle_images.so" ); + if ( l_tmpErrl ) + { + TRACFCOMP( g_fapiTd,ERR_MRK"stopAllOCCs: Error unloading build_winkle module" ); + if(l_errl) + { + errlCommit( l_tmpErrl, HWPF_COMP_ID ); + } + else + { + l_errl = l_tmpErrl; + } + } +#endif + } + + TRACFCOMP( g_fapiTd,EXIT_MRK"stopAllOCCs" ); + return l_errl; + } + } //end OCC namespace |