diff options
author | Dan Crowell <dcrowell@us.ibm.com> | 2016-02-08 11:06:44 -0600 |
---|---|---|
committer | William G. Hoffa <wghoffa@us.ibm.com> | 2016-04-04 09:09:04 -0400 |
commit | 4b4772ef8b18f2e9c80795c47b3a5f81b3521c1f (patch) | |
tree | 82653a7d7cba5d1b4988fdefb2ef5d9f307b178c /src/usr/hwpf/hwp/tod_init | |
parent | feb51c34883347e80dd242266bd064a419cbdc88 (diff) | |
download | blackbird-hostboot-4b4772ef8b18f2e9c80795c47b3a5f81b3521c1f.tar.gz blackbird-hostboot-4b4772ef8b18f2e9c80795c47b3a5f81b3521c1f.zip |
Remove more old fapi1 stuff
Deleted src/include/usr/hwpf/hwp/ to ensure no old usage
Deleted a couple modules that have no P9 equivalent
Moved tod_init under istep18
Deleted old initfile related code
Deleted old pll related code
Change-Id: I9c1746609c7ca2a723241158b3958bb891b0629b
RTC: 146345
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/21888
Tested-by: Jenkins Server
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Tested-by: FSP CI Jenkins
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/hwp/tod_init')
31 files changed, 0 insertions, 9162 deletions
diff --git a/src/usr/hwpf/hwp/tod_init/TodAssert.H b/src/usr/hwpf/hwp/tod_init/TodAssert.H deleted file mode 100644 index ac4706b24..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodAssert.H +++ /dev/null @@ -1,58 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodAssert.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -#ifndef TODASSERT_H -#define TODASSERT_H - -/** - * @file TodAssert.H - * - * There are two different assert types provided: - * Standard assert behavior: - * assert(foo) - * - * Standard assert behavior with a custom trace message: - * assert(foo, "This is a trace %d", 1234) - */ - -#include <assert.h> - -namespace TOD -{ - -/** - * @brief Forward common tod assert requests to platform specific handler - * - * @par Detailed Description: - * Forwards assert request to platform specific assert macro which verifies - * condition, calls custom trace if provided, and ultimately calls platform - * assert - * - * @param[in] expr,... - * Printf-like expression to act as the assert message - */ -#define TOD_ASSERT(expr,...) \ - assert(expr,__VA_ARGS__) - -} - -#endif diff --git a/src/usr/hwpf/hwp/tod_init/TodControls.C b/src/usr/hwpf/hwp/tod_init/TodControls.C deleted file mode 100755 index d3cb2e751..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodControls.C +++ /dev/null @@ -1,1369 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodControls.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -/** - * @file TodControls.C - * - * @brief This file implements the methods declared in TodControls class - * - * HWP_IGNORE_VERSION_CHECK - * - */ - -#include <fapiPlatHwpInvoker.H> -#include <targeting/common/attributes.H> -#include <targeting/common/targetservice.H> -#include <targeting/common/utilFilter.H> -#include <p8_scom_addresses.H> -#include <tod_init/tod_init_reasoncodes.H> -#include "TodAssert.H" -#include "TodTrace.H" -#include "TodDrawer.H" -#include "TodProc.H" -#include "TodTypes.H" -#include "TodControls.H" -#include "TodSvcUtil.H" -#include "proc_tod_setup/proc_tod_setup.H" -#include <list> -#include <map> - -using namespace TARGETING; - -namespace TOD -{ - -//------------------------------------------------------------------------------ -//Static globals -//------------------------------------------------------------------------------ -//const static char DIR_PATH_SERERATOR = '/'; -//const static mode_t DIR_CREATION_MODE = 0777; -//const static char * FILE_WRITE_MODE = "w+"; -//const static char * FILE_READ_MODE = "r"; - -TodControls & TodControls::getTheInstance() -{ - return Singleton<TodControls>::instance(); -} - -//****************************************************************************** -//TodControls::TodControls -//****************************************************************************** -TodControls::TodControls() -{ - TOD_ENTER("TodControls constructor"); - TOD_EXIT("TodControls constructor"); -} - -//****************************************************************************** -//TodControls::~TodControls -//****************************************************************************** -TodControls::~TodControls() -{ - TOD_ENTER("TodControls destructor"); - - destroy(TOD_PRIMARY); - destroy(TOD_SECONDARY); - - TOD_EXIT("TodControls destructor"); -} - -//****************************************************************************** -//TodControls::pickMDMT -//****************************************************************************** -errlHndl_t TodControls::pickMdmt(const proc_tod_setup_tod_sel i_config) -{ - TOD_ENTER("pickMdmt"); - errlHndl_t l_errHdl=NULL; - - //MDMT is the master processor that drives TOD signals to all the remaining - //processors on the system, as such wherever possible algoritm will try to - //ensure that primary and secondary topology provides redundancy of MDMT. - - //Whenever there is an existing MDMT for the opposite configuration following - //considerations will go in deciding the MDMT for configuration passed - //through i_config - //1. MDMT will be chosen from a node other that the node on which other MDMDT - // belongs in multinode system - //2. In single node system MDMT will be chosen from a different fabric node - // (tod drawer ) - //3. Last a processor different from MDMT on the same fabric node will be - // chosen, if other options are not feasible - - do - { - proc_tod_setup_tod_sel l_oppConfig = (i_config == TOD_PRIMARY ) ? - TOD_SECONDARY : TOD_PRIMARY; - - TodProc * l_pTodProc = NULL; - TodProc * l_oppMdmt = iv_todConfig[l_oppConfig].iv_mdmt; - TodDrawerContainer l_todDrawerList; - l_todDrawerList = iv_todConfig[i_config].iv_todDrawerList; - - TodProc * l_lastProcWithMaxCores = NULL; - TodDrawer * l_lastMasterTodDrawer = NULL; - uint32_t l_lastMaxCoreCount = 0; - uint32_t l_coreCount=0; - uint32_t l_maxPossibleCoresPerProc = getMaxPossibleCoresPerProc(); - - if ( l_oppMdmt ) - { - //1.Try to find MDMT on a TOD drawer that is not on the same - // physical node as opposite MDMT - - //Iterate the list of TOD drawers - for (TodDrawerContainer::iterator l_todDrawerIter = - l_todDrawerList.begin(); - l_todDrawerIter != l_todDrawerList.end() ; - ++l_todDrawerIter) - { - //TodProc --> TodDrawer --> Node - if ( l_oppMdmt->getParentDrawer()->getParentNodeTarget()-> - getAttr<ATTR_HUID>() - != - (*l_todDrawerIter)->getParentNodeTarget()-> - getAttr<ATTR_HUID>()) - { - l_pTodProc = NULL; - l_coreCount = 0; - (*l_todDrawerIter)-> - getProcWithMaxCores(NULL,l_pTodProc,l_coreCount); - if ( l_pTodProc ) - { - TOD_INF("returned core count = %d ",l_coreCount); - if ( l_coreCount > l_lastMaxCoreCount) - { - l_lastProcWithMaxCores = l_pTodProc; - l_lastMaxCoreCount = l_coreCount; - l_lastMasterTodDrawer = (*l_todDrawerIter); - if (l_lastMaxCoreCount == l_maxPossibleCoresPerProc) - { - break; - } - } - } - - } - } - - if ( l_lastProcWithMaxCores ) - { - l_lastMasterTodDrawer->setMasterDrawer(true); - iv_todConfig[i_config].iv_mdmt = l_lastProcWithMaxCores; - l_lastProcWithMaxCores->setMasterType(TodProc::TOD_MASTER); - break; - } - - //2.Try to find MDMT on a TOD drawer that is on the same physical - // node as the possible opposite MDMT but on different TOD drawer - for (TodDrawerContainer::iterator l_todDrawerIter = - l_todDrawerList.begin(); - l_todDrawerIter != l_todDrawerList.end() ; - ++l_todDrawerIter) - { - if ( (l_oppMdmt->getParentDrawer()->getParentNodeTarget()-> - getAttr<ATTR_HUID>() - == - (*l_todDrawerIter)->getParentNodeTarget()-> - getAttr<ATTR_HUID>()) - //Same node as opposite MDMT - && - (l_oppMdmt->getParentDrawer()->getId() - != - (*l_todDrawerIter)->getId()))//Different Drawer - { - l_pTodProc = NULL; - l_coreCount = 0; - (*l_todDrawerIter)-> - getProcWithMaxCores(NULL,l_pTodProc,l_coreCount); - if ( l_pTodProc ) - { - if ( l_coreCount > l_lastMaxCoreCount) - { - l_lastProcWithMaxCores = l_pTodProc; - l_lastMaxCoreCount = l_coreCount; - l_lastMasterTodDrawer = (*l_todDrawerIter); - if (l_lastMaxCoreCount == l_maxPossibleCoresPerProc) - { - break; - } - } - - } - - } - } - - if ( l_lastProcWithMaxCores ) - { - l_lastMasterTodDrawer->setMasterDrawer(true); - iv_todConfig[i_config].iv_mdmt = l_lastProcWithMaxCores; - l_lastProcWithMaxCores->setMasterType(TodProc::TOD_MASTER); - break; - } - - //3.Try to find MDMT on the same TOD drawer as the TOD Drawer of - // opposite MDMT - for (TodDrawerContainer::iterator l_todDrawerIter = - l_todDrawerList.begin(); - l_todDrawerIter != l_todDrawerList.end() ; - ++l_todDrawerIter) - { - l_coreCount = 0; - if ( l_oppMdmt->getParentDrawer()->getId() == - (*l_todDrawerIter)->getId() ) - { - //This is the TOD drawer on which opposite MDMT exists, - //try to avoid processor chip of opposite MDMT while - //getting the proc with max cores - (*l_todDrawerIter)->getProcWithMaxCores( - iv_todConfig[l_oppConfig].iv_mdmt,l_pTodProc - ,l_coreCount); - if ( l_pTodProc ) - { - iv_todConfig[i_config].iv_mdmt = l_pTodProc; - (*l_todDrawerIter)->setMasterDrawer(true); - l_pTodProc->setMasterType(TodProc::TOD_MASTER); - break; - } - } - } - - if ( iv_todConfig[i_config].iv_mdmt ) - { - break; - } - - //If we reach here only option left is MDMT on the other config so - //select it. So we look for a proc in this config's set of TOD - //drawers, find the one which is same as the MDMT on the other - //config (based on the HUID). - bool l_mdmtFound = false; - for(TodDrawerContainer::iterator l_drwItr = - iv_todConfig[i_config].iv_todDrawerList.begin(); - l_drwItr != iv_todConfig[i_config].iv_todDrawerList.end(); - ++l_drwItr) - { - const TodProcContainer& l_procs = (*l_drwItr)->getProcs(); - for(TodProcContainer::const_iterator - l_procItr = l_procs.begin(); - l_procItr != l_procs.end(); - ++l_procItr) - { - if( (*l_procItr)->getTarget()->getAttr<ATTR_HUID>() - == - (iv_todConfig[l_oppConfig].iv_mdmt)-> - getTarget()->getAttr<ATTR_HUID>() ) - { - iv_todConfig[i_config].iv_mdmt = (*l_procItr); - (*l_procItr)->setMasterType(TodProc::TOD_MASTER); - (*l_drwItr)->setMasterDrawer(true); - l_mdmtFound = true; - break; - } - } - - if(l_mdmtFound) - { - break; - } - } - - if(l_mdmtFound) - { - break; - } - } - else - { //There is no MDMT configured for the other topology hence select - //the MDMT from any TOD drawer - for (TodDrawerContainer::iterator l_todDrawerIter = - l_todDrawerList.begin(); - l_todDrawerIter != l_todDrawerList.end() ; - ++l_todDrawerIter) - { - l_pTodProc = NULL; - l_coreCount = 0; - (*l_todDrawerIter)->getProcWithMaxCores( - NULL,l_pTodProc,l_coreCount); - if ( l_pTodProc ) - { - if ( l_coreCount > l_lastMaxCoreCount) - { - l_lastProcWithMaxCores = l_pTodProc; - l_lastMaxCoreCount = l_coreCount; - l_lastMasterTodDrawer = (*l_todDrawerIter); - if (l_lastMaxCoreCount == l_maxPossibleCoresPerProc) - { - break; - } - } - } - } - - if ( l_lastProcWithMaxCores ) - { - l_lastMasterTodDrawer->setMasterDrawer(true); - iv_todConfig[i_config].iv_mdmt = l_lastProcWithMaxCores; - l_lastProcWithMaxCores->setMasterType(TodProc::TOD_MASTER); - break; - } - } - - if ( !iv_todConfig[i_config].iv_mdmt ) - { - TOD_ERR("MDMT NOT FOUND for configuration 0x%02X",i_config); - - /*@ - * @errortype - * @reasoncode TOD_NO_MASTER_PROC - * @moduleid TOD_PICK_MDMT - * @userdata1 TOD configuration type - * @devdesc MDMT could not be found for the supplied topology - * type - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_INFORMATIONAL, - TOD_PICK_MDMT, - TOD_NO_MASTER_PROC, - i_config); - } - - }while(0); - - if ( iv_todConfig[i_config].iv_mdmt ) - { - TOD_INF("MDMT for configuration %d , is proc " - "0%08X", i_config, iv_todConfig[i_config].iv_mdmt-> - getTarget()->getAttr<ATTR_HUID>()); - } - TOD_EXIT("pickMdmt. errHdl = %p", l_errHdl); - return l_errHdl; - -} - -//****************************************************************************** -//TodControls::buildTodDrawers -//****************************************************************************** -errlHndl_t TodControls::buildTodDrawers( - const proc_tod_setup_tod_sel i_config) -{ - TOD_ENTER("buildTodDrawers"); - errlHndl_t l_errHdl = NULL; - - do{ - - TARGETING::TargetHandleList l_funcNodeTargetList; - - //Get the system pointer - TARGETING::Target* l_pSysTarget = NULL; - (void)TARGETING::targetService().getTopLevelTarget(l_pSysTarget); - - //We should not be reaching here without a valid system target - TOD_ASSERT(l_pSysTarget,"NULL system target "); - - //Build the list of functional nodes - l_errHdl = getFuncNodeTargetsOnSystem( l_pSysTarget, - l_funcNodeTargetList); - if ( l_errHdl ) - { - TOD_ERR("For System target 0x%08X getFuncNodeTargetsOnSystem " - "returned error ",l_pSysTarget->getAttr<ATTR_HUID>()); - break; - } - - //If there was no functional node found then we must return - if ( l_funcNodeTargetList.empty() ) - { - TOD_ERR("For System target 0x%08X no functional node found ", - l_pSysTarget->getAttr<TARGETING::ATTR_HUID>()); - /*@ - * @errortype - * @reasoncode TOD_NO_FUNC_NODE_AVAILABLE - * @moduleid TOD_BUILD_TOD_DRAWERS - * @userdata1 system target's HUID - * @devdesc MDMT could not find a functional node - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_INFORMATIONAL, - TOD_BUILD_TOD_DRAWERS, - TOD_NO_FUNC_NODE_AVAILABLE, - l_pSysTarget->getAttr<ATTR_HUID>()); - break; - } - - //For each node target find the prcessor chip on it - TARGETING::TargetHandleList l_funcProcTargetList; - - TARGETING::PredicateCTM - l_procCTM(TARGETING::CLASS_CHIP,TARGETING::TYPE_PROC); - - TARGETING::PredicateHwas l_funcPred; - l_funcPred.functional(true); - TARGETING::PredicatePostfixExpr l_funcProcPostfixExpr; - l_funcProcPostfixExpr.push(&l_procCTM).push(&l_funcPred).And(); - - TodDrawerContainer& l_todDrawerList = - iv_todConfig[i_config].iv_todDrawerList; - TodDrawerContainer::iterator l_todDrawerIter; - bool b_foundDrawer = false; - - for( uint32_t l_nodeIndex = 0; - l_nodeIndex < l_funcNodeTargetList.size(); - ++l_nodeIndex ) - { - l_funcProcTargetList.clear(); - - //Find the funcational Proc targets on the system - TARGETING::targetService().getAssociated(l_funcProcTargetList, - l_funcNodeTargetList[l_nodeIndex], - TARGETING::TargetService::CHILD, - TARGETING::TargetService::ALL, - &l_funcProcPostfixExpr); - - //Go over the list of procs and insert them in respective fabric - //node list ( TOD drawer ) - for ( uint32_t l_procIndex =0 ; - l_procIndex < l_funcProcTargetList.size(); - ++l_procIndex ) - { - b_foundDrawer = false; - //Traverse over the fabric node list (TOD drawer) and find if - //there is an existing fabric node for this proc - - for ( l_todDrawerIter = l_todDrawerList.begin() ; - l_todDrawerIter != l_todDrawerList.end() ; - ++l_todDrawerIter) - { - if ( (*l_todDrawerIter)->getId() == - l_funcProcTargetList[l_procIndex]-> - getAttr<ATTR_FABRIC_NODE_ID>()) - { - //Add the proc to this fabric node, such that - //TodProc has the target pointer and the pointer to - //the TOD drawer to which it belongs - TodProc *l_procPtr = - new TodProc - (l_funcProcTargetList[l_procIndex], - (*l_todDrawerIter)); - (*l_todDrawerIter)->addProc(l_procPtr); - l_procPtr = NULL; //Nullifying the pointer after - //transferring ownership - - b_foundDrawer = true; - break; - } - - } // end drawer list loop - - if (!b_foundDrawer ) - { - //Create a new TOD drawer and add it to the TOD drawer list - //Create a TOD drawer with the fabric node id and the - //pointer to the node to which this fabric node belongs - TodDrawer *l_pTodDrawer = new - TodDrawer(l_funcProcTargetList[l_procIndex]-> - getAttr<ATTR_FABRIC_NODE_ID>(), - l_funcNodeTargetList[l_nodeIndex]); - - //Create a TodProc passing the target pointer and the - //pointer of TodDrawer to which this processor belongs - TodProc *l_pTodProc = new - TodProc(l_funcProcTargetList[l_procIndex], - l_pTodDrawer); - - //push the processor ( TodProc ) , into the TOD drawer - l_pTodDrawer->addProc(l_pTodProc); - - //push the Tod drawer ( TodDrawer ) , into the - //TodControls - l_todDrawerList.push_back(l_pTodDrawer); - //Nullify the pointers after transfering the ownership - l_pTodDrawer = NULL; - l_pTodProc = NULL; - - } - - }// end proc list loop - - } // end node list loop - - //Validate that we had atlease one TOD drawer at the end of this process - //else generate an error - if (iv_todConfig[i_config].iv_todDrawerList.empty()) - { - TOD_ERR("No TOD drawer could be built for the configuration " - " %s ", (i_config == TOD_PRIMARY ? "Primary " : - "Secondary") ); - /*@ - * @errortype - * @reasoncode TOD_NO_DRAWERS - * @moduleid TOD_BUILD_TOD_DRAWERS - * @userdata1 TOD configuration - * @devdesc No TOD drawer could be configured for this topology - * type - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - TOD_BUILD_TOD_DRAWERS, - TOD_NO_DRAWERS, - i_config); - } - - }while(0); - TOD_EXIT("buildTodDrawers. errHdl = %p", l_errHdl); - return l_errHdl; -} - -//****************************************************************************** -//TodControls::getTodConfigState -//****************************************************************************** -errlHndl_t TodControls::getTodConfigState( - TOD_CONFIG_STATE& o_configState, - proc_tod_setup_tod_sel& o_activeConfig, - bool& o_isTodRunning)const -{ - TOD_ENTER("getTodConfigState"); - errlHndl_t l_errHdl = NULL; - o_configState = TOD_UNCHANGED; - o_activeConfig = TOD_PRIMARY; - o_isTodRunning = false; - - do - { - //Get the currently active TOD configuration - l_errHdl = queryActiveConfig (o_activeConfig,o_isTodRunning); - if ( l_errHdl ) - { - TOD_ERR("Call to queryActiveConfig failed "); - break; - } - //Need to read the TodSystemFile to decide if HW configuration has - //changed since the last time TOD was configured - std::vector<TodChipData> l_todChipDataVector; - l_errHdl = TodControls::readTodProcDataFromFile(l_todChipDataVector); - if ( l_errHdl ) //Indicates hard failure not limited to failure of tod - //logic only, we cannot continue with flow - { - TOD_ERR("Failed loading TodChipData from TodSystemFile"); - break; - } - - //Determine if the TOD HW has changed since the last time topology was - //created - //1) File data is valid but HW has changed => Report TOD_MODIFIED - //2) File data is valid and HW has not changed => Report TOD_UNCHANGED - //3) Authenticity of file data is in question => Report - //TOD_UNKNOWN - - //Check if TodSystemFile has topology data for atleast one node - if ( hasNoValidData ( l_todChipDataVector )) - { - TOD_INF("No valid data found in the file TodSystemFile"); - o_configState = TOD_UNKNOWN; - break; - } - - //For each functional processor present in the system, if we - //have, old configuration data in the TodSystemConfig file then - //validate it. - - //Get the processors present in the system - TARGETING::PredicateCTM - l_procFilter(TARGETING::CLASS_CHIP,TARGETING::TYPE_PROC, - TARGETING::MODEL_NA); - - TARGETING::PredicateHwas l_presencePredicate; - l_presencePredicate.present(true); - - TARGETING::PredicatePostfixExpr l_presenceAndProcChipFilter; - l_presenceAndProcChipFilter.push(&l_procFilter). - push(&l_presencePredicate).And(); - - TARGETING::TargetRangeFilter l_filter( - TARGETING::targetService().begin(), - TARGETING::targetService().end(), - &l_presenceAndProcChipFilter); - - bool l_state = false; //Variable for keeping functional state of - //the processor - uint32_t l_ordinalId = TOD_INVALID_UNITID; - //Initializing to some value not expected to be ordinal id - - ecmdDataBufferBase l_chipCtrlRegBuf(64); - - //Initialize l_chipCtrlRegBuf it will be used later - - FAPI_INVOKE_HWP(l_errHdl, init_chip_ctrl_reg, l_chipCtrlRegBuf); - if ( l_errHdl ) - { - TOD_ERR("init_chip_ctrl_reg returned error "); - break; - } - - for ( ; l_filter ; ++l_filter ) - { - l_state = false; - if ((*l_filter)->getAttr<ATTR_HWAS_STATE>().functional) - { - l_state = true; - } - - // use position attribute on one drawer only machine - l_ordinalId=(*l_filter)->getAttr<ATTR_POSITION>(); - - if ( l_state ) //Functional processor - { - //Check if TodSystemData file also indicates the processor as - //functional - - //Indexing into l_todChipDataVector is safe as size of vector is - //always determined by the maximum possible processors for this - //system type - if(((l_todChipDataVector[l_ordinalId].header.flags) & - TOD_FUNC) != 0 ) - { - - //File data says that the chip is functional do some more - //validation on the data - - //Check if the chip control register (0x40010) data is valid - //This data does not depend on topology, so it should tally - if ( (l_todChipDataVector[l_ordinalId].regs.ccr) != - l_chipCtrlRegBuf.getWord(0) ) - { - TOD_INF("Chip control register read from TodSystemData" - "is not valid for the processor 0x%08X", - (*l_filter)->getAttr<TARGETING::ATTR_HUID>()); - //We do not have a valid data no need to continue - //further - o_configState = TOD_UNKNOWN; - break; - } - } - else - { - //New hardware has been added - TOD_INF("New processor detected 0x%08X", - (*l_filter)->getAttr<ATTR_HUID>()); - o_configState = TOD_MODIFIED; - } - - } - else - { - //Check if this chip was functional earlier - if ( ((l_todChipDataVector[l_ordinalId].header.flags) & - TOD_FUNC) != 0 ) - { - //HW has been removed - o_configState = TOD_MODIFIED; - TOD_INF("Processor 0x%08X is no more available ", - (*l_filter)->getAttr<ATTR_HUID>()); - } - } - } - - }while(0); - - TOD_EXIT(" config state = %d, active config = %d, TOD HW State = " - "%d errHdl = %p", - o_configState, o_activeConfig , o_isTodRunning, l_errHdl); - - return l_errHdl; -} - -//****************************************************************************** -//TodControls::isTodRunning -//****************************************************************************** -errlHndl_t TodControls::isTodRunning(bool& o_isTodRunning)const -{ - TOD_ENTER("isTodRunning"); - errlHndl_t l_errHdl = NULL; - TARGETING::Target* l_primaryMdmt=NULL; - TARGETING::Target* l_secondaryMdmt=NULL; - o_isTodRunning = false; - - do - { - //Read the TOD HW to get the configured MDMT - l_errHdl = getConfiguredMdmt(l_primaryMdmt,l_secondaryMdmt); - if ( l_errHdl ) - { - TOD_ERR("Failed getting configured MDMTs" ); - break; - } - - if ( l_primaryMdmt || l_secondaryMdmt ) //If there is atleast one MDMT - //configured , check the chipTOD HW status by reading the TOD - //status register TOD_PSS_MSS_STATUS_REG_00040008 - { - ecmdDataBufferBase l_primaryMdmtBuf(64); - ecmdDataBufferBase l_secondaryMdmtBuf(64); - - if ( l_primaryMdmt ) - { - l_errHdl = todGetScom(l_primaryMdmt, - TOD_PSS_MSS_STATUS_REG_00040008, - l_primaryMdmtBuf); - if ( l_errHdl ) - { - TOD_ERR("Scom failed for status register " - "TOD_PSS_MSS_STATUS_REG_00040008 on primary MDMT"); - break; - } - } - - if ( l_secondaryMdmt ) - { - l_errHdl = todGetScom(l_secondaryMdmt, - TOD_PSS_MSS_STATUS_REG_00040008, - l_secondaryMdmtBuf); - if ( l_errHdl ) - { - TOD_ERR("Scom failed for status register " - "TOD_PSS_MSS_STATUS_REG_00040008 on secondary MDMT"); - break; - } - } - - //If all the bits of TOD_PSS_MSS_STATUS_REG_00040008 are off then - //ChipTOD HW is not running - if ((l_primaryMdmtBuf.getWord(0) == 0 ) && - (l_secondaryMdmtBuf.getWord(0)== 0)) - { - break; - } - - o_isTodRunning = true; - } - - }while(0); - - TOD_EXIT("TOD HW State = %d errHdl = %p",o_isTodRunning, l_errHdl); - return l_errHdl; -} - -//****************************************************************************** -//TodControls::queryActiveConfig -//****************************************************************************** -errlHndl_t TodControls::queryActiveConfig( - proc_tod_setup_tod_sel& o_activeConfig, - bool& o_isTodRunning)const -{ - TOD_ENTER("queryActiveConfig"); - errlHndl_t l_errHdl = NULL; - TARGETING::Target* l_primaryMdmt=NULL; - TARGETING::Target* l_secondaryMdmt=NULL; - - o_isTodRunning = false; - o_activeConfig = TOD_PRIMARY; - - do - { - //Read the configured Mdmt from TOD HW - l_errHdl = getConfiguredMdmt(l_primaryMdmt,l_secondaryMdmt); - if ( l_errHdl ) - { - TOD_ERR("Failed to get configured MDMTs" ); - break; - } - - if ( l_primaryMdmt || l_secondaryMdmt ) //If there is atleast one MDMT - //configured,` check the ChipTOD HW status by reading the TOD - //status register TOD_PSS_MSS_STATUS_REG_00040008 - { - ecmdDataBufferBase l_primaryMdmtBuf(64); - ecmdDataBufferBase l_secondaryMdmtBuf(64); - - if ( l_primaryMdmt ) - { - l_errHdl = todGetScom(l_primaryMdmt, - TOD_PSS_MSS_STATUS_REG_00040008, - l_primaryMdmtBuf); - if ( l_errHdl ) - { - TOD_ERR("Scom failed for status register " - "TOD_PSS_MSS_STATUS_REG_00040008 on primary MDMT"); - break; - } - } - - if ( l_secondaryMdmt ) - { - l_errHdl = todGetScom(l_secondaryMdmt, - TOD_PSS_MSS_STATUS_REG_00040008, - l_secondaryMdmtBuf); - if ( l_errHdl ) - { - TOD_ERR("Scom failed for status register " - "TOD_PSS_MSS_STATUS_REG_00040008 secondary MDMT "); - break; - } - } - - //If all the bits of TOD_PSS_MSS_STATUS_REG_00040008 are off then - //ChipTOD HW is not running - if ((l_primaryMdmtBuf.getWord(0) == 0 ) && - (l_secondaryMdmtBuf.getWord(0)== 0)) - { - break; - } - - o_isTodRunning = true; - - //First 3 bits of TOD_PSS_MSS_STATUS_REG_00040008 indicates - //active TOD topology - // [0:2] == '111' secondary, '000' is primary - just check bit 0 - - //Putting the below check because of past TOD HW error. - //Both primary and secondary MDMT would claim that it is the active - //one,this happened during CHARM operation after failover from - //primary to econdary - //May be that error does not exists in P8 HW but in case it still - //exists we will be able to catch it - if ( l_primaryMdmt && l_secondaryMdmt ) - { - if ( - l_primaryMdmtBuf.isBitSet - (TOD_PSS_MSS_STATUS_REG_00040008_ACTIVE_BIT) - != - l_secondaryMdmtBuf.isBitSet - (TOD_PSS_MSS_STATUS_REG_00040008_ACTIVE_BIT) - ) - { - TOD_ERR("TOD HW error, primary and secondary MDMT do not" - "agree on bits 0 of TOD status register 0x40008"); - /*@ - * @errortype - * @reasoncode TOD_HW_ERROR - * @moduleid TOD_QUERY_ACTIVE_CONFIG - * @userdata1 Status register bits of primary MDMT - * @userdata2 Status register bits of secondary MDMT - * @devdesc Error: primary and secondary MDMT do not - * agree on bits 0 of TOD status register - * 0x40008 - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - TOD_QUERY_ACTIVE_CONFIG, - TOD_HW_ERROR, - l_primaryMdmtBuf.getWord(0), - l_secondaryMdmtBuf.getWord(0) ); - break; - } - } - - if(l_primaryMdmtBuf.isBitSet - (TOD_PSS_MSS_STATUS_REG_00040008_ACTIVE_BIT)) - { - TOD_INF("Primary MDMT says secondary is configured "); - o_activeConfig = TOD_SECONDARY; - // If the primary says the secondary is active then what the - // secondary MDMT says is not important - no more checking - // required. - break; - } - - //The secondaryMDMT only needs to be checked if the primaryMDMT - //said it is active ( i.e. bit 0 is clear ) - - //If the secondary says the secondary is active then primary was - //not found - if ( l_secondaryMdmtBuf.isBitSet - (TOD_PSS_MSS_STATUS_REG_00040008_ACTIVE_BIT)) - { - TOD_INF("Secondary MDMT says secondary is configured "); - o_activeConfig = TOD_SECONDARY; - break; - } - } - //Else not yet initialized, just return primary - - }while(0); - - TOD_EXIT("queryActiveConfig. errHdl = %p", l_errHdl); - return l_errHdl; -} - -//****************************************************************************** -//TodControls::getConfiguredMdmt -//****************************************************************************** -errlHndl_t TodControls::getConfiguredMdmt( - TARGETING::Target*& o_primaryMdmt, - TARGETING::Target*& o_secondaryMdmt) const -{ - TOD_ENTER("getConfiguredMdmt"); - errlHndl_t l_errHdl = NULL; - o_primaryMdmt = NULL; - o_secondaryMdmt = NULL; - - do - { - //Find MDMT for primary and secondary topology from HW - - //Get the functional procs on the system - TARGETING::PredicateCTM - l_procFilter(TARGETING::CLASS_CHIP,TARGETING::TYPE_PROC, - TARGETING::MODEL_NA); - - TARGETING::PredicateHwas l_funcPred; - l_funcPred.functional(true); - - TARGETING::PredicatePostfixExpr l_stateAndProcChipFilter; - l_stateAndProcChipFilter.push(&l_procFilter). - push(&l_funcPred).And(); - - TARGETING::TargetHandleList l_procTargetList; - - ecmdDataBufferBase l_todCtrlReg(64); - - //TOD_PSS_MSS_CTRL_REG_00040007 - - TARGETING::TargetRangeFilter l_filter( - TARGETING::targetService().begin(), - TARGETING::targetService().end(), - &l_stateAndProcChipFilter); - - //Read the TOD control register TOD_PSS_MSS_CTRL_REG_00040007 for each - //processor and check for bits 1 and 9 - for ( ; l_filter; ++l_filter ) - { - l_errHdl = todGetScom(*l_filter, - TOD_PSS_MSS_CTRL_REG_00040007, - l_todCtrlReg); - - if ( l_errHdl ) - { - TOD_ERR("Scom failed for target 0x%08X on register" - "TOD_PSS_MSS_CTRL_REG_00040007 ", - (*l_filter)->getAttr<ATTR_HUID>()); - break; - } - - if ( - l_todCtrlReg.isBitSet - (TOD_PSS_MSS_CTRL_REG_00040007_PRIMARY_MDMT_BIT) )//primary MDMT - { - o_primaryMdmt = *l_filter; - TOD_INF("found primary MDMT HUID = 0x%08X", - o_primaryMdmt->getAttr<ATTR_HUID>()); - } - - if ( - l_todCtrlReg.isBitSet - (TOD_PSS_MSS_CTRL_REG_00040007_SECONDARY_MDMT_BIT) ) - //secondary MDMT - { - o_secondaryMdmt = *l_filter; - TOD_INF("found secondary MDMT HUID = 0x%08X", - o_secondaryMdmt->getAttr<ATTR_HUID>()); - } - - if ( o_primaryMdmt && o_secondaryMdmt ) - { - break; - } - } - - }while(0); - - TOD_EXIT("getConfiguredMdmt. errHdl = %p", l_errHdl); - return l_errHdl; -} - -//****************************************************************************** -//TodControls::destroy -//****************************************************************************** -void TodControls::destroy(const proc_tod_setup_tod_sel i_config) -{ - TOD_ENTER("destroy"); - - for(TodDrawerContainer::iterator l_itr = - iv_todConfig[i_config].iv_todDrawerList.begin(); - l_itr != iv_todConfig[i_config].iv_todDrawerList.end(); - ++l_itr) - { - if(*l_itr) - { - delete (*l_itr); - } - } - iv_todConfig[i_config].iv_todDrawerList.clear(); - iv_todConfig[i_config].iv_mdmt = NULL; - iv_todConfig[i_config].iv_isConfigured = false; - - TOD_EXIT("destroy"); -} - -//****************************************************************************** -//TodControls::writeTodProcData -//****************************************************************************** -errlHndl_t TodControls::writeTodProcData( - const proc_tod_setup_tod_sel i_config) -{ - TOD_ENTER("writeTodProcData"); - errlHndl_t l_errHdl = NULL; - - do - { - //As per the requirement specified by PHYP/HDAT, HB needs to fill - //data for every chip that can be installed on the system. - //It is also required that chip ID match the index of the entry in the - //array so we can possibly have valid chip data at different indexes in - //the array and the intermittent locations filled with the chip entries - //that does not exist on the system. All such entires will have default - //non-significant values - - TodChipData blank; - uint32_t l_maxProcCount = getMaxProcsOnSystem(); - - TOD_INF("Max possible processor chips for this system when configured " - "completely is %d",l_maxProcCount); - - iv_todChipDataVector.assign(l_maxProcCount,blank); - - TARGETING::ATTR_POSITION_type l_ordId = 0x0; - //Ordinal Id of the processors that form the topology - - //Fill the TodChipData structures with the actual value in the - //ordinal order - for(TodDrawerContainer::iterator l_itr = - iv_todConfig[i_config].iv_todDrawerList.begin(); - l_itr != iv_todConfig[i_config].iv_todDrawerList.end(); - ++l_itr) - { - const TodProcContainer& l_procs = - (*l_itr)->getProcs(); - - for(TodProcContainer::const_iterator - l_procItr = l_procs.begin(); - l_procItr != l_procs.end(); - ++l_procItr) - { - l_ordId = - (*l_procItr)->getTarget()->getAttr<ATTR_POSITION>(); - - //Clear the default flag for this chip, defaults to - //NON_FUNCTIONAL however this is a functional chip - iv_todChipDataVector[l_ordId].header.flags = TOD_NONE; - - //Fill the todChipData structure at position l_ordId - //inside iv_todChipDataVector with TOD register data - //values - (*l_procItr )->setTodChipData( - iv_todChipDataVector[l_ordId]); - - //Set flags to indicate if the proc chip is an MDMT - //See if the current proc chip is MDMT of the primary - //topology - if ( getConfigStatus(TOD_PRIMARY) - && - getMDMT(TOD_PRIMARY)) - { - if ( - (getMDMT(TOD_PRIMARY)->getTarget()-> - getAttr<ATTR_HUID>()) - == - ((*l_procItr)->getTarget()-> - getAttr<ATTR_HUID>()) - ) - { - - iv_todChipDataVector[l_ordId].header.flags |= - TOD_PRI_MDMT; - } - } - - //See if the current proc chip is MDMT of the secondary - //network - //Note: The chip can be theoretically both primary and - //secondary MDMDT - if ( getConfigStatus(TOD_SECONDARY) - && - getMDMT(TOD_SECONDARY)) - { - if ( - (getMDMT(TOD_SECONDARY)->getTarget()-> - getAttr<ATTR_HUID>()) - == - ((*l_procItr)->getTarget()-> - getAttr<ATTR_HUID>()) - ) - { - - iv_todChipDataVector[l_ordId].header.flags |= - TOD_SEC_MDMT; - } - - } - - } - } - - //Done with setting the data write it to the file - l_errHdl = writeTodProcDataToFile(); - if ( l_errHdl ) - { - TOD_ERR( "Failed writing TOD chip data to the file "); - break; - } - - }while(0); - - TOD_EXIT("writeTodProcData. errHdl = %p", l_errHdl); - return l_errHdl; - -}//end of writeTodProcData - - -//****************************************************************************** -//TodControls::writeTodProcDataToFile() -//****************************************************************************** -errlHndl_t TodControls::writeTodProcDataToFile() -{ - TOD_ENTER("writeTodProcDataToFile"); - errlHndl_t l_errHdl = NULL; -#ifndef __HOSTBOOT_MODULE - do - { - std::string l_fileOpenMode(FILE_WRITE_MODE); - char l_fileName[128]; - l_errHdl = getTodProcDataFilePath(l_fileName); - if(l_errHdl) - { - TOD_ERR("Failed getting the file path for sharing TOD data with " - " HDAT "); - break; - } - - //Create the parent directory in which file has to be written - std::string l_dirPath = l_fileName.substr - (0,l_fileName.find_last_of(DIR_PATH_SERERATOR)); - int rc = mkdir(l_dirPath.c_str(),DIR_CREATION_MODE); - - if ( rc != 0 ) - { - //EEXIST just means it already exists, which is fine - if (errno != EEXIST) - { - TOD_ERR("Error creating the directory %s " - "system returned error code %d", - l_dirPath.c_str(),errno); - break; - } - } - - UtilFile file; - l_errHdl = file.open(l_fileName.c_str(), l_fileOpenMode.c_str()); - if ( l_errHdl ) - { - TOD_ERR("Failed opening the file %s, with mode %s" , - l_fileName.c_str(),l_fileOpenMode.c_str()); - break; - } - - TodChipDataContainer::iterator l_chipDataItr = - iv_todChipDataVector.begin(); - file.write(reinterpret_cast<void *>((&(*l_chipDataItr))), - (iv_todChipDataVector.size()* sizeof(TodChipData))); - - l_errHdl = file.getLastError(); - if ( l_errHdl ) - { - TOD_ERR("Failed writing the tod chip data to file "); - break; - } - - l_errHdl = file.close(); - if ( l_errHdl ) - { - TOD_ERR("Failed closing the file %s", l_fileName.c_str()); - break; - } - - }while(0); -#endif - TOD_EXIT("writeTodProcDataToFile. errHdl = %p", l_errHdl); - return l_errHdl; - -} - -//***************************************************************************** -//TodControls::readTodProcDataFromFile -//****************************************************************************** -errlHndl_t TodControls::readTodProcDataFromFile( - std::vector<TodChipData>& o_todChipDataVector )const -{ - TOD_ENTER("readTodProcDataFromFile"); - errlHndl_t l_errHdl = NULL; -#ifndef __HOSTBOOT_MODULE - do - { - std::string l_todProcDataFile; - UtilFile l_file; - - l_errHdl = getTodProcDataFilePath(l_todProcDataFile); - if(l_errHdl) - { - TOD_ERR("Failed getting the path of TodSystemFile "); - break; - } - - if ( !UtilFile::exists(l_todProcDataFile.c_str())) - { - TOD_INF("File %s , does not exist",l_todProcDataFile.c_str()); - break; - } - - //Open the file for reading - l_errHdl = l_file.open(l_todProcDataFile.c_str(),FILE_READ_MODE); - if ( l_errHdl ) - { - TOD_ERR("Failed opening the file %s, with mode %s" , - l_todProcDataFile.c_str(),FILE_READ_MODE); - break; - } - - //The amount of data stored on TodSystemFile always depend on the - //maximum processor possible for the given system type - uint32_t l_maxProcCount = getMaxProcsOnSystem(); - - uint32_t l_bytesToRead = l_file.size(); - - if ( (l_bytesToRead == 0) || (l_bytesToRead > (l_maxProcCount * - sizeof(TodChipData)))) //Check for further safeguards - { - TOD_ERR("Error, File %s is corrupted" - ,l_todProcDataFile.c_str()); - - //Commit this locally, because system can still proceed if TOD HW is - //not running - l_errHdl->commit(HWSV_COMP_ID, ERRL_ACTION_REPORT, - ERRL_SEV_INFORMATIONAL); - delete l_errHdl; - l_errHdl = 0; - break; - } - - TodChipData blank; - o_todChipDataVector.assign(l_maxProcCount,blank); //Allocate memory with - //default values - - //Read the data from file - l_file.read(reinterpret_cast<void *>(&(*(o_todChipDataVector.begin()))), - l_bytesToRead); - - - l_errHdl = l_file.getLastError(); - if ( l_errHdl ) - { - TOD_ERR("Failed reading tod chip data from file "); - break; - - } - - l_errHdl = l_file.close(); - if ( l_errHdl ) - { - TOD_ERR("Failed closing the file %s", l_todProcDataFile.c_str()); - break; - } - //Not going to close the file in error path , UtilFile will close it. - - }while(0); -#endif - TOD_EXIT("readTodProcDataFromFile. errHdl = %p", l_errHdl); - return l_errHdl; -} - -//****************************************************************************** -//TodControls::getTodProcDataFilePath() -//****************************************************************************** -errlHndl_t TodControls::getTodProcDataFilePath(char * o_fileName) - const -{ - TOD_ENTER("getTodProcDataFilePath"); - errlHndl_t l_errHdl = NULL; -#ifndef __HOSTBOOT_MODULE - char *l_buf = NULL; - do - { - uint32_t l_fileSize = 0; - const char* l_stringToAppend = NULL; - const char* l_filePathKey[2] = - { P1_ROOT_PATH, - CINI_SYSTODFILE_PATH - }; - - - l_errHdl = UtilReg::path(l_filePathKey,(sizeof(l_filePathKey) / - sizeof(l_filePathKey[0])), - l_stringToAppend,l_buf,l_fileSize); - - if ( l_errHdl ) - { - TOD_ERR("Failed getting file path from the registry using keys" - "P1_ROOT_PATH and CINI_SYSTODFILE_PATH " ); - break; - } - - o_fileName = std::string(l_buf); - TOD_INF("Found file path %s",o_fileName.c_str()); - - - }while(0); - - if ( l_buf ) - { - delete l_buf; - } -#endif - TOD_EXIT("getTodProcDataFilePath. errHdl = %p", l_errHdl); - return l_errHdl; -} - - -//****************************************************************************** -//HwsvTodControls::hasNoValidData() -//****************************************************************************** -bool TodControls::hasNoValidData(const std::vector<TodChipData>& - i_todChipDataVector)const -{ - TOD_ENTER("hasNoValidData"); - bool result = true; - for(std::vector<TodChipData>::const_iterator l_iter = - i_todChipDataVector.begin(); - l_iter != i_todChipDataVector.end(); ++l_iter) - { - if(((*l_iter).header.flags & TOD_FUNC) != 0) - { - result = false; - break; - } - } - TOD_EXIT("hasNoValidData"); - return result; -} - - -}//end of namespace diff --git a/src/usr/hwpf/hwp/tod_init/TodControls.H b/src/usr/hwpf/hwp/tod_init/TodControls.H deleted file mode 100755 index 922a58f0b..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodControls.H +++ /dev/null @@ -1,635 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodControls.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -/** - * @file TodControls.H - * - * @brief This file declares the methods and members of TodControls class - * - * HWP_IGNORE_VERSION_CHECK - * - */ - -#ifndef TODCONTROLS_H -#define TODCONTROLS_H - -//------------------------------------------------------------------------------ -//Includes -//------------------------------------------------------------------------------ -#include <util/singleton.H> -#include "proc_tod_utils.H" -#include "TodDrawer.H" -#include <map> - -namespace TOD -{ - -//------------------------------------------------------------------------------ -//Forward declarations -//------------------------------------------------------------------------------ -class TodDrawer; -class TodProc; -class TodControls; -struct TodChipData; - -//------------------------------------------------------------------------------ -//Typedefs -//------------------------------------------------------------------------------ -typedef std::vector<TodChipData> TodChipDataContainer; - -//------------------------------------------------------------------------------ -//Static globals -//------------------------------------------------------------------------------ -//2 configs - primary/secondary -const static uint8_t TOD_NUM_CONFIGS = 2; -const static uint8_t TOD_PSS_MSS_STATUS_REG_00040008_ACTIVE_BIT = 0; -const static uint8_t TOD_PSS_MSS_CTRL_REG_00040007_PRIMARY_MDMT_BIT = 1; -const static uint8_t TOD_PSS_MSS_CTRL_REG_00040007_SECONDARY_MDMT_BIT = 9; - -const static uint32_t TOD_INVALID_UNITID = 0xFFFFFFEF; - -/** - * @class TodControls - * - * @brief TOD topology tree will comprise of the interconnected processor chips. - * This class manages the objects representing proc chips (TodProc) - * that are available to be wired in TOD network. - * The proc chips are contained in one or more Tod drawers - * (TodDrawer). - * The class has data structures that represent this relationship and - * hence enable establishment of TOD topology. - */ -class TodControls -{ -public: - - /** - * @brief Get singleton instance of this class. - * - * @return the (one and only) instance of TodControls - */ - static TodControls& getTheInstance(); - - /** - * @brief TOD_CONFIG_STATE enum will help to determine if there has been HW - * changes since the last time topology was created. - * i.e. new functional processor has become available or one of the - * processor that was part of old TOD topology has become non-functional - */ - enum TOD_CONFIG_STATE - { - TOD_UNCHANGED, //No change in the HW - TOD_MODIFIED, //Either new HW is available or some of them have - //been deconfigured - TOD_UNKNOWN, //Failed to determine if there was any change in the - //HW based on old topology data - }; - - /** - * @brief This method will build a list of functional TOD drawers - * available in the system - * - * @par Detailed Description: - * TOD drawers are represented by HwsvTodDrawer class, that - * basically provides a grouping of the HwsvTodProc objects such - * that processor chips beloning to a specific drawer connect - * over X bus and inter drawer connection is over A bus. TOD drawer - * is analogous to fabic node on the system. - * - * On a TULETA system each DCM chip is a fabric node however on a - * Brazos they can be different physical nodes. - * Each proc chip has an arribute representing the fabric node - * to which it belongs. - * - * The method will get all the functional proc chips on the system , - * and then group them according to fabric nodes. - * - * At the end of operation TOD topology infrastructure will either - * have iv_primTodDrawer or iv_secTodDrawerList completed with each - * drawer having a list of functional proc chips represented as - * HwsvTodProc pointers. - * - * @param[in] i_config - * Indicates the primary/secondary topology - * - * @return Error log handle indicating status of request. - * @retval NULL indicates successful completion of operation - * @retval !NULL indicates that the system doesn't have a TOD drawer, - * TOD topologies can't be created. - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ - errlHndl_t buildTodDrawers(const proc_tod_setup_tod_sel i_config); - - /** - * @brief This method will pick MDMT chip for the configuration - * requested - * - * @par Detailed Description: - * MDMT is a processor chip that is chosen to receive signals from - * the oscillator and it drives TOD signals to the remaining - * processors on the system. - * The criteria for choosing MDMT on a processor are as follows - * 1.Processor should be connected to the oscillator. ( This is - * invariably true for all processors on TULETA systems ) - * 2.Processor should be marked as functional in the targeting - * model. - * 3.Among the possible candidates the one which is having maximum - * number of functional cores should be preferred. - * - * Whenever possible the MDMT for the primary and secondary - * configurations should be located on different TOD drawers. In - * case of multi node systems, MDMT on secondary topology - * should be located on a TOD drawer that belongs to different - * node as compared to the MDMT of primary configuration. If it - * is not possible to locate the MDMTs on different TOD drawers, - * then different processor within the same TOD drawer should be - * preferred. - * - * @param[in] i_config - * Indicates the primary/secondary configuration for which the MDMT - * has to be picked - * - * @return Error log handle indicating the status of the request. - * @retval NULL if successful - * @retval !NULL if failed to pick the MDMT - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ - errlHndl_t pickMdmt(const proc_tod_setup_tod_sel i_config); - - /** - * @brief Destroy information pertaining to topology type - * i_config and free up associated memory - * - * @param[in] i_config - * Indicates the primary/secondary topology - * - * @return N/A - */ - void destroy(const proc_tod_setup_tod_sel i_config); - - /** - * @brief Gets a list of TOD drawers for a specific - * topology - * - * @param[in] i_config - * Indicates the primary/secondary topology - * - * @param[out] o_drawerList - * list of HwsvTodDrawer pointers, empty in case of error - * - * @return N/A - */ - void getDrawers(const proc_tod_setup_tod_sel i_config, - TodDrawerContainer& o_drawerList) const - { - o_drawerList = iv_todConfig[i_config].iv_todDrawerList; - } - - /** - * @brief Gets the MDMT for a specific topology - * - * @param[in] i_config - * Indicates the primary/secondary topology - * - * @param[out] o_pMDMT - * The HwsvTodProc pointer corresponding to the MDMT. NULL if error. - * - * @return Pointer to the data member iv_todConfig[i_config].iv_mdmt - */ - TodProc* getMDMT(const proc_tod_setup_tod_sel i_config) const - { - return iv_todConfig[i_config].iv_mdmt; - } - - /** - * - * @brief Setter method for iv_isConfigured variable of TodConfig structure - * for a specific configuration - * - * @param[in] i_config - * Indicates the primary/secondary topology - * - * @param[in] i_isConfigured - * Boolean variable to indicate the configuration status - * - * @return NA - */ - void setConfigStatus(const proc_tod_setup_tod_sel i_config, - const bool i_isConfigured ) - { - iv_todConfig[i_config].iv_isConfigured = i_isConfigured; - } - - /** - * - * @brief Getter method for iv_isConfigured variable of TodConfig structure - * for a specific configuration - * - * @param[in] i_config - * Indicates the primary/secondary topology - * - * @return bool, indicating iv_isConfigured's value - */ - bool getConfigStatus(const proc_tod_setup_tod_sel i_config) const - { - return iv_todConfig[i_config].iv_isConfigured; - } - - /** - * - * @brief getTodConfigState will enable other methods to make a decision - * regarding valid action to be performed to modify the - * topology. - * - * @par Detailed Description: - * On getting a topology creation/modification request, TOD service - * methods need to determine next course of action based on the ChipTOD - * HW state and the state of the data that is available in the - * TodSystemData file.(TodSystemData file contains the previously - * created TOD topology's information). This method will provide all - * the information that is required to determine next course of action. - * - * Following algorithm is used - * 1) Check TOD status register to determine TOD HW state and the active - * configuration - * 2) Read the TodSystemData to find, if HW has changed i.e. new - * functional processors became available or one of the processor that - * was functional when topology was created last time became - * non-functional. - * - * Method can report TOD config state as one of the following - * a)TOD_UNCHANGED ==> No change in the HW - * b)TOD_MODIFIED ==> HW has changed - * c)TOD_UNKNOWN ==> It is not possible to determine the state - * - * @param[out] o_configState - * This parameter will indicate to caller if the HW as seen by - * getTodConfigState is same as indicated by the TodSystemData or not. - * One of the enums listed in TOD_CONFIG_STATE will be returned. - * - * @param[out] o_isTodRunning - * It will be true if the ChipTOD HW is running. - * - * @param[out] o_activeConfig - * This parameter will carry back the information regarding the topology - * that has been currently selected by PHYP, if ChipTOD HW is running. - * In case TOD HW is not running then it will report TOD_PRIMARY, as - * that is the configuration to be picked by PHYP once the TOD logic - * starts running. - * - * @return Error log handle that will determine if method was successful in - * determining various parameters or not - * @retval NULL , Indicates success - * @retval !NULL , Failed getting the output parameters,in this case - * value of o_configState,o_isTodRunning and o_activeConfig should - * not be considered for any further action. - * - * This API may return one of the following "special" reason codes: - * NA - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ - errlHndl_t getTodConfigState ( TOD_CONFIG_STATE& o_configState, - proc_tod_setup_tod_sel& o_activeConfig, - bool& o_isTodRunning)const; - /** - * @brief isTodRunning returns the current state of ChipTOD HW i.e. - * whether it is running or not - * - * @par Detailed Description: - * This method should be used by the methods that want to make a decision - * on creating TOD topology. If TOD HW is not running then it is safe to - * create new topology, however if TOD HW is running, program cannot - * modify the currently active topology.( It is still possible to - * modify/re-create a backup topology) - * TOD status register bits are clear as long as TOD HW is not running, - * method will read status register. - * - * @param[out] o_isTodRunning, boolean parameter that will be set to true if - * ChipTOD HW is running - * - * @return Error log handle that will determine if method was successful in - * determining ChipTOD HW state - * @retval NULL , Indicates success i.e. o_isTodRunning parameter indicates - * ChipTOD HW state - * @retval !NULL , Failed getting the ChipTOD HW state , in this case value - * of o_isTodRunning should be ignored. - * - * This API may return one of the following "special" reason codes: - * NA - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ - errlHndl_t isTodRunning ( bool& o_isTodRunning)const; - - - - /** - * @brief This method will provide TOD topology register data to HDAT - * - * @par Detailed Description: - * HWSV needs to share TOD topology data with HDAT. - * HWSV also needs to persist with TOD topology data across non-memory - * preserving IPL's. - * Both the above requirements will be fulfilled by writing data - * to a file. - * This method will take the TOD register data and put it in the format - * required by HDAT, and then call helper method to write the same to a - * file - * - * @param[in] i_config - * Indicates the primary/secondary topology. When both Primary and - * Secondary topologies are successfully configured, the TOD register - * should be in synch for both primary and secondary, so passing any - * topology type will work here. However if there was a problem in - * building one of the topologies i.e. primary could be built but not - * the secondary then primary should be passed as i_config. - * - * @return Error log handle indicating the status of the request. - * @retval NULL if successful - * @retval !NULL if failed to write TOD configuration data - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the returned - * error based on what it decides to do with it. By default any - * returned error created by this function will be a non-reported - * tracing event error log. - */ - errlHndl_t writeTodProcData(const proc_tod_setup_tod_sel i_config); - - - /** - * - * @brief This is a helper method for writeTodProcDataToFile, it will - * determine file path where array of hwsvTodChipData structure has to - * be written by HWSV , HDAT will read this file. - * - * @par Detailed Description: - * The file to which data has to be written will be determined by the - * following registry keys - * 1. fstp/P1_Root (To determine the root directory of P1) - * 2. CINI_SYSTODFILE_PATH (To determine the directory and file name - * within P1_Root where the data is to be written) - * - * @param[in] o_fileName - * Output parameter to carry back the file name qualified by full path - * where the data has has to be written. - * - * @return Error log handle indicating the status of the request. - * @retval NULL if file path could be determined successfully - * @retval !NULL if file path could not be found - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the returned error - * based on what it decides to do with it. By default any returned - * error created by this function will be a non-reported tracing event - * error log. - */ - errlHndl_t getTodProcDataFilePath(char * o_fileName) const; - - /** - * @brief This is a helper method for writeTodProcData, it will write the - * array of hwsvTodChipData structures created by writeTodProcData to a - * file with P1 persistancy - * - * @par Detailed Description: - * The method will work on iv_todChipData and take help of - * getTodProcDataFilePath to detrmine the file path where - * iv_todChipData has to be written. - * - * @return Error log handle indicating the status of the request - * @retval NULL if the data could not be written successfully - * @retval !NULL if the data was written successfully - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the returned - * error based on what it decides to do with it. By default any - * returned error created by this function will be a non-reported - * tracing event error log. - */ - errlHndl_t writeTodProcDataToFile(); - - /** - * - * @brief Getter method for iv_todChipDataVector - * - * @return Constant reference to vector<hwsvTodChipData> that will carry - * back iv_todChipDataVector - * - */ - const TodChipDataContainer& getTodChipDataVector()const - { - return iv_todChipDataVector; - } - -protected: - /** - * @brief Constructor for the TodControls object. - */ - TodControls(); - - /** - * @brief Destructor for the TodControls object. - */ - ~TodControls(); - -private: - - /** - * - * @brief queryActiveConfig method will help to find the active TOD topology - * when ChipTOD HW is running,It will also report ChipTOD HW status. - * i.e. wheather it is currently running. In case ChipTOD HW is running - * active configuration should never be modified. - * - * @par Detailed Description: - * This method ports logic from P7. - * Bits 00:02 of the TOD status register ( 0x40008 ), indicates the - * topology that is currently active in HW. - * - * @param[out] o_activeConfig, active configuration [primary | secondary] - * In case the TOD HW is not running then primary will be returned. - * - * @param[out] o_isTodRunning, It will indicate if HW is running or not - * - * @return Error log handle that will indicate if method was successfully - * able to determine various parameters or not - * @retval NULL , Indicates success - * @retval !NULL , Failed getting all the output parameters,in this case - * values of o_configAction,o_isTodRunning should not be considered for - * any further action. - * - * This API may return one of the following "special" reason codes: - * NA - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ - - errlHndl_t queryActiveConfig( proc_tod_setup_tod_sel& o_activeConfig, - bool& o_isTodRunning) const; - - /** - * - * @brief getConfiguredMdmt method will determine primary and secondary MDMT - * ,if they are configured, using TOD register data. - * - * @par Detailed Description: - * TOD control register (0x40007) has bits that - * will be set for the processor when it is designated as primary MDMT - * or secondary MDMT. In case TOD HW indicates that MDMT is not set, - * output variables will be NULL. - * - * @param[out] o_primaryMdmt, Parameter in which target pointer of primary - * MDMT will be returned, it will be set to NULL if TOD HW does not - * shows that primary MDMT is configured. - * - * @param[out] o_secondaryMdmt, Parameter in which target pointer of - * secondary MDMT will be returned, it will be set to NULL if TOD HW - * does not show that secondary MDMT is configured. - * - * @return Error log handle indicating the status of request. - * @retval NULL , Indicates that method successfully executed its - * algorithm for determining MDMTs, however the individual output - * parameters must be checked to determine if the respective MDMT were - * found or not. - * @retval !NULL , Indicates a problem condition where method was not able - * to complete all the steps for determining MDMTs successfully. In the - * error condition output parameters should be ignored. - * - * This API may return one of the following "special" reason codes: - * NA - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ - errlHndl_t getConfiguredMdmt(TARGETING::Target*& o_primaryMdmt, - TARGETING::Target*& o_secondaryMdmt)const; - - /** - * @brief This method will read the TOD topology register data from - * TodSystemData file - * - * @par Detailed Description: - * TodSystemData file is a P1 persistent file that will retain the TOD - * topology data from previous configuration. Any request to recofigure - * backup topology should consider the previous topology data. This - * method will read the TodSystemData file and put the data in - * hwsvTodChipData structures. - * - * @param[out ] o_todChipDataVector , Array of hwsvTodChipData structures - * that will be populated with the data from TodSystemData file. - * - * @return Error log handle indicating the status of the request. - * @retval NULL if TodSystemData was successfully read. - * @retval !NULL if TodSystemData could not be read. This will happen if - * the file does not exist, one of the file operation failed or file - * does not have expected data. - * - * This API may return one of the following "special" reason codes: - * NA - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ - errlHndl_t readTodProcDataFromFile(std::vector<TodChipData>& - o_todChipDataVector )const; - - /** - * @brief This method will be used to determine if the data read from - * TodSystemData file indicates at least one functional processor - * - * @retval boolean value indicating presence or absence of valid data - * @retval false , There is useful data - * @retval true, No useful data found - */ - bool hasNoValidData(const std::vector<TodChipData>& - i_todChipDataVector)const; - - //Datastructure for a TOD topology : - //A list of TOD drawers (which will contain a list of HWSVTodProc's) - //The MDMT for this topology - struct TodConfig{ - TodDrawerContainer iv_todDrawerList; - TodProc* iv_mdmt; - bool iv_isConfigured; - TodConfig() : - iv_mdmt(NULL), - iv_isConfigured(false) - { - } - }; - - //Disabled copy constructor and assignment operator - TodControls(const TodControls& rhs); - TodControls& operator=(const TodControls& rhs); - - //Array of TOD configs - //The fact that TOD_PRIMARY and TOD_SECONDARY are defined as 0 and 1 - //make then as appropriate indices to the array - //iv_todConfig[0] -> primary - //iv_todConfig[1] -> secondary - TodConfig iv_todConfig[TOD_NUM_CONFIGS]; - - //hwsvTodChipData for the whole system (in ordinal order) - TodChipDataContainer iv_todChipDataVector; -}; - -} //end of namespace -#endif //TODCONTROLS_H diff --git a/src/usr/hwpf/hwp/tod_init/TodDrawer.C b/src/usr/hwpf/hwp/tod_init/TodDrawer.C deleted file mode 100755 index c78a75194..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodDrawer.C +++ /dev/null @@ -1,198 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodDrawer.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -/** - * @file TodDrawer.C - * - * @brief The file implements methods of TodDrawer class - * - * HWP_IGNORE_VERSION_CHECK - * - */ - -//------------------------------------------------------------------------------ -//Includes -//------------------------------------------------------------------------------ -#include "TodSvcUtil.H" -#include "TodDrawer.H" -#include "TodAssert.H" -#include "TodTrace.H" -#include <tod_init/tod_init_reasoncodes.H> - - -namespace TOD -{ - -//****************************************************************************** -// TodDrawer::TodDrawer -//****************************************************************************** -TodDrawer::TodDrawer(const uint8_t i_drawerId, - const TARGETING::Target* i_parentNode): - iv_todDrawerId(i_drawerId), - iv_isTodMaster(false), - iv_parentNodeTarget(i_parentNode) -{ - TOD_ASSERT(iv_parentNodeTarget, - "Error creating TOD drawer with id 0x%.2X, parent node" - "pointer passed as NULL", i_drawerId); - - TOD_ENTER("Created TOD drawer with id 0x%.2X, parent node 0x%.8X", - i_drawerId, - i_parentNode->getAttr<TARGETING::ATTR_HUID>()); - TOD_EXIT("TodDrawer constructor"); -} - -//****************************************************************************** -// TodDrawer::~TodDrawer -//****************************************************************************** -TodDrawer::~TodDrawer() -{ - TOD_ENTER("TodDrawer destructor"); - - for(TodProcContainer::iterator l_itr = iv_todProcList.begin(); - l_itr != iv_todProcList.end(); - ++l_itr) - { - delete (*l_itr); - } - iv_todProcList.clear(); - TOD_EXIT("TodDrawer destructor"); -} - -//****************************************************************************** -// TodDrawer::getProcWithMaxCores -//****************************************************************************** -void TodDrawer::getProcWithMaxCores( - const TodProc* i_procToIgnore, - TodProc*& o_pTodProc, - uint32_t& o_coreCount) const -{ - TOD_ENTER("getProcWithMaxCores"); - o_pTodProc = NULL; - o_coreCount = 0; - - do{ - //List of functional cores - TARGETING::TargetHandleList l_funcCoreTargetList; - TARGETING::PredicateCTM - l_coreCTM(TARGETING::CLASS_UNIT,TARGETING::TYPE_CORE); - - TARGETING::PredicateHwas l_funcPred; - l_funcPred.functional(true); - TARGETING::PredicatePostfixExpr l_funcCorePostfixExpr; - l_funcCorePostfixExpr.push(&l_coreCTM).push(&l_funcPred).And(); - - TodProc* l_pSelectedTarget = NULL; - uint32_t l_maxCores = 0; - - for(TodProcContainer::const_iterator l_procIter = - iv_todProcList.begin(); - l_procIter != iv_todProcList.end(); - ++l_procIter) - { - if((NULL != i_procToIgnore) && - (i_procToIgnore->getTarget()->getAttr<TARGETING::ATTR_HUID>() == - (*l_procIter)->getTarget()->getAttr<TARGETING::ATTR_HUID>())) - { - continue; - } - l_funcCoreTargetList.clear(); - //Find the funcational core targets on this proc - TARGETING::targetService().getAssociated(l_funcCoreTargetList, - (*l_procIter)->getTarget(), - TARGETING::TargetService::CHILD, - TARGETING::TargetService::ALL, - &l_funcCorePostfixExpr); - - if ( l_funcCoreTargetList.size() > l_maxCores ) - { - l_pSelectedTarget = *l_procIter; - l_maxCores = l_funcCoreTargetList.size(); - } - } - if ( l_maxCores > 0 ) - { - o_pTodProc = l_pSelectedTarget; - o_coreCount = l_maxCores; - TOD_INF("getProcWithMaxCores,On drawer %d, processor 0x%08X " - "has maximum cores count = %d ", - iv_todDrawerId, - l_pSelectedTarget->getTarget()->getAttr<TARGETING::ATTR_HUID>(), - l_maxCores); - } - - }while(0); - - TOD_EXIT("getProcWithMaxCores"); -} - - -//****************************************************************************** -// TodDrawer::findMasterProc -//****************************************************************************** -errlHndl_t TodDrawer::findMasterProc(TodProc*& o_drawerMaster) const -{ - TOD_ENTER("findMasterProc"); - - errlHndl_t l_errHdl = NULL; - - TodProc* l_pMasterProc = NULL; - - do{ - TodProcContainer::const_iterator l_procIter = iv_todProcList.begin(); - for (; l_procIter != iv_todProcList.end(); ++l_procIter) - { - if(((*l_procIter)->getMasterType() == TodProc::TOD_MASTER) - || - ((*l_procIter)->getMasterType() == TodProc::DRAWER_MASTER)) - { - l_pMasterProc = (*l_procIter); - break; - } - } - if(iv_todProcList.end() == l_procIter) - { - TOD_ERR("No master proc for drawer 0x%.2X",iv_todDrawerId); - /*@ - * @errortype - * @reasoncode TOD_NO_MASTER_PROC - * @moduleid TOD_FIND_MASTER_PROC - * @userdata1 TOD drawer id - * @devdesc No master proc set for this drawer - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_INFORMATIONAL, - TOD_LOG_INVALID_CONFIG, - TOD_INVALID_CONFIG, - iv_todDrawerId, 0); - } - }while(0); - - o_drawerMaster = l_pMasterProc; - - TOD_EXIT("findMasterProc, errHdl = %p", l_errHdl); - - return l_errHdl; -} - -}//end of namespace diff --git a/src/usr/hwpf/hwp/tod_init/TodDrawer.H b/src/usr/hwpf/hwp/tod_init/TodDrawer.H deleted file mode 100755 index ef1c52863..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodDrawer.H +++ /dev/null @@ -1,252 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodDrawer.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -#ifndef TODDRAWER_H -#define TODDRAWER_H - -/** - * @file TodDrawer.H - * - * @brief Contains TodDrawer class declaration - * - * HWP_IGNORE_VERSION_CHECK - * - */ - -#include <targeting/common/attributes.H> -#include <targeting/common/targetservice.H> -#include "TodProc.H" - -namespace TOD -{ - -class TodDrawer; // forward declaration -typedef std::list<TodDrawer*> TodDrawerContainer; - -/** - * @class TodDrawer - * - * @brief TodDrawer class provides a grouping of the TodProc objects - * that belong to a particular TOD drawer. Each processor chip belonging - * to a specific TOD drawer connect over X bus and inter TOD drawer - * connection is over A bus.Concept of TOD drawer is analogous - * to fabric node on the system. - * - * TOD drawers fall under two categories,master TOD drawer and slave - * TOD drawers. Master TOD drawer is the one on which MDMT sits, all - * the remaining TOD drawers are designated as slave drawers. - * - * MDMT should drive TOD signals to other processors on the master - * TOD drawer over X buses and to one processor on each slave drawer over - * A bus ( This processor is designated as MDST ). - * MDST is responsible for driving the TOD signals to the remaining - * processors on slave drawer. - */ -class TodDrawer -{ -public: - /** - * @brief Constructor for the TodDrawer object - * - * @param[in] i_drawerId - * this TOD drawer's id, it is nothing but the fabric node id attribute - * of the processors that belong to a fabric node type - * - * @param[in] i_parentNode - * container node's target - */ - TodDrawer(const uint8_t i_drawerId, - const TARGETING::Target* i_parentNode); - - /** - * @brief Destructor for the TodDrawer object. - * - * @par Detailed Description: - * Will destroy all HwsvTodProc objects that were added to this TOD - * drawer. - */ - ~TodDrawer(); - - /** - * @brief This method will return the TodProc object that is either a - * TOD master or Drawer Master - * - * @par Detailed Description: - * While creating the topology MDMT and MDST should be wired to the - * other processors on that TOD drawer over X buses. - * TodTopologyManager will use this method to determine which - * processor is the master for that drawer. - * The method will go over the iv_todProcList and return the processor - * that is marked as TodProc::TOD_MASTER or TodProc::DRAWER_MASTER - * - * @param[out] o_drawerMaster - * It will be set to master processor's address if master processor is - * successfully found. - * In case the master processor could not be found successfully - * o_drawerMaster will be set to NULL, and error handle will be retured. - * - * @return Error log handle, indicates status of request - * @retval NULL indicates that master processor was successfully found - * @retval !NULL indicates that the master processor could not be found - * successfully. The only possible reason for returning NULL can be - * that this method was called out of sequence i.e even before - * TodTopologyManager designated a processor on a given TOD drawer as - * master for that drawer. - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ - errlHndl_t findMasterProc(TodProc*& o_drawerMaster) const; - - /** - * @brief This method will determine the processor that has maximum number - * functional cores among the list of processor owned by the TOD drawer - * object - * - * @par Detailed Description: - * For creation of topology , first task is to choose the MDMT. One of - * the criteria for choosing MDMT is that it should be the processor - * with maximum number of functional cores. - * This method will serve as a a helper for pickMdmt, to determine - * which processor in the TOD drawer has maximum number of functional - * cores - * - * @param[in] i_procToIgnore , The TodProc object to be ignored while - * choosing desired proc. This is the case when there is existing MDMT - * for primar/secondary topology and MDMT has to be chosen for the - * other topology, peviously chosen MDMT should be avoided. - * - * @param[out] o_pTodProc, It will carry back pointer to the HwsvTodProc - * object that has the maximum number of cores. - * In the unlikely case of TOD drawer not having any processor with - * functional cores, this parameter will be set to NULL - * - * @param[out] o_coreCount, This will carry back the no. of cores that was - * found on processor with max functional core count. In case o_pTodProc - * is set to NULL this will be zero. - * - * @return N/A - */ - void getProcWithMaxCores( - const TodProc * i_procToIgnore, - TodProc *& o_pTodProc, - uint32_t& o_coreCount)const; - - /** - * @brief Getter method for iv_todProcList - * - * @param[out] o_procList - * Parameter in which iv_todProcList will be returned - * - * @return N/A - */ - const TodProcContainer& getProcs() const - { - return iv_todProcList; - } - - /** - * @brief setter method for iv_isTodMaster - * - * @param[in] i_masterTodDrawer - * true/false, indicating whether this TOD drawer is a master or not - * - * @return N/A - */ - void setMasterDrawer(const bool i_masterTodDrawer) - { - iv_isTodMaster = i_masterTodDrawer; - } - - /** - * @brief Adds a processor to this TOD drawer - * - * @param[in] i_proc - * A VTodProc pointer correspnding to the proc to be added - * - * @return N/A - */ - void addProc(TodProc* i_proc) - { - iv_todProcList.push_back(i_proc); - } - - /** - * @brief Get this TOD drawer's id (this will be - * the corresponding fabric node's id) - * - * @return TOD drawer's id - * @retval corresponding fabric node's id - */ - TARGETING::ATTR_FABRIC_NODE_ID_type getId() const - { - return iv_todDrawerId; - } - - /** - * @brief Checks if this TOD drawer is a master drawer for the system. - * The master status of TOD drawer is contained in iv_isTodMaster. - * - * @return bool value, it will be true if this TOD drawer is a master drawer - * ,false otherwise - */ - bool isMaster() const - { - return iv_isTodMaster; - } - - /** - * @brief Returns the containing node's target - * - * @return Target pointer - */ - const TARGETING::Target* getParentNodeTarget() const - { - return iv_parentNodeTarget; - } - -private: - //List of TodProc objects that belongs to TodDrawer instance - TodProcContainer iv_todProcList; - - //TOD drawer id, the value of this attribute will be derived from - //ATTR_FABRIC_NODE_ID attribute of the processors that belong to this - //TOD drawer, all the processors belonging to this TOD drawer will share - //the same value for ATTR_FABRIC_NODE_ID - TARGETING::ATTR_FABRIC_NODE_ID_type iv_todDrawerId; - - //This data member will identify if the current drawer is a Tod master - bool iv_isTodMaster; - - //Target pointer of the node to which TodDrawer belongs - const TARGETING::Target * iv_parentNodeTarget; -}; - -} //end of namespace - -#endif //TODDRAWER_H diff --git a/src/usr/hwpf/hwp/tod_init/TodHwpIntf.C b/src/usr/hwpf/hwp/tod_init/TodHwpIntf.C deleted file mode 100755 index d2dde150f..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodHwpIntf.C +++ /dev/null @@ -1,218 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodHwpIntf.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -/** - * @file TodHwpIntf.C - * - * @brief Implementation of TOD Hardware Procedure interfaces - * - * HWP_IGNORE_VERSION_CHECK - * - */ - -//------------------------------------------------------------------------------ -//Includes -//------------------------------------------------------------------------------ -#include <fapiPlatHwpInvoker.H> -#include <tod_init/tod_init_reasoncodes.H> -#include "TodTrace.H" -#include "TodHwpIntf.H" -#include "TodControls.H" -#include "proc_tod_setup.H" -#include "proc_tod_save_config.H" -#include "proc_tod_init.H" - -namespace TOD -{ - -errlHndl_t todSetupHwp(const proc_tod_setup_tod_sel i_topologyType) -{ - TOD_ENTER("todSetupHwp"); - - errlHndl_t l_errHdl = NULL; - - do - { - //Get the MDMT - TodProc* l_pMDMT = - TodControls::getTheInstance().getMDMT(i_topologyType); - if(NULL == l_pMDMT) - { - TOD_ERR("MDMT not found"); - /*@ - * @errortype - * @reasoncode TOD_NO_MASTER_PROC - * @moduleid TOD_SETUP_HWP - * @devdesc MDMT could not be found - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - TOD_SETUP_HWP, - TOD_NO_MASTER_PROC,0,0); - break; - } - - FAPI_INVOKE_HWP(l_errHdl, - proc_tod_setup, - l_pMDMT->getTopologyNode(), - i_topologyType, - TOD_OSC_0); - if(l_errHdl) - { - TOD_ERR("Error in call to proc_tod_setup. " - "Topology type 0x%.8X. " - "MDMT's HUID is 0x%.8X. " - "MDMT Master type : 0x%.8X. ", - i_topologyType, - l_pMDMT->getTarget()->getAttr<TARGETING::ATTR_HUID>(), - l_pMDMT->getMasterType()); - TOD_ERR("MDMT Bus RX 0x%.8X, Bus TX 0x%.8X.", - l_pMDMT->getBusIn(), l_pMDMT->getBusOut()); - break; - } - - //Mark the MDMT role in ATTR. Note the same chip - //can be both primary/secondary. Attr is volatile - //init'ed to zero - TARGETING::Target * l_proc = - const_cast<TARGETING::Target*>(l_pMDMT->getTarget()); - uint8_t l_role = l_proc->getAttr<TARGETING::ATTR_TOD_ROLE>(); - if (TOD_PRIMARY == i_topologyType) - { - l_role |= TARGETING::TOD_ROLE_PRIMARY; - } - else //Secondary - { - l_role |= TARGETING::TOD_ROLE_SECONDARY; - } - l_proc->setAttr<TARGETING::ATTR_TOD_ROLE>(l_role); - - }while(0); - - TOD_EXIT("todSetupHwp. errHdl = %p", l_errHdl); - - return l_errHdl; -} - -errlHndl_t todSaveRegsHwp(const proc_tod_setup_tod_sel i_topologyType) -{ - TOD_ENTER("todSaveRegsHwp"); - - errlHndl_t l_errHdl = NULL; - - do - { - //Get the MDMT - TodProc* l_pMDMT = - TodControls::getTheInstance().getMDMT(i_topologyType); - if(NULL == l_pMDMT) - { - TOD_ERR("MDMT not found"); - /*@ - * @errortype - * @reasoncode TOD_NO_MASTER_PROC - * @moduleid TOD_SAVEREGS_HWP - * @devdesc MDMT could not be found - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - TOD_SAVEREGS_HWP, - TOD_NO_MASTER_PROC,0,0); - break; - } - - FAPI_INVOKE_HWP(l_errHdl, - proc_tod_save_config, - l_pMDMT->getTopologyNode()); - if(l_errHdl) - { - TOD_ERR("Error in call to proc_tod_save_config. " - "Topology type 0x%.8X. " - "MDMT's HUID is 0x%.8X. " - "MDMT Master type : 0x%.8X. ", - i_topologyType, - l_pMDMT->getTarget()->getAttr<TARGETING::ATTR_HUID>(), - l_pMDMT->getMasterType()); - TOD_ERR("MDMT Bus RX 0x%.8X, Bus TX 0x%.8X.", - l_pMDMT->getBusIn(), l_pMDMT->getBusOut()); - break; - } - }while(0); - - TOD_EXIT("todSaveRegsHwp. errHdl = %p", l_errHdl); - - return l_errHdl; -} - -errlHndl_t todInitHwp(const proc_tod_setup_tod_sel i_topologyType) -{ - TOD_ENTER("todInitHwp"); - - errlHndl_t l_errHdl = NULL; - - do - { - //Get the MDMT - TodProc* l_pMDMT = - TodControls::getTheInstance().getMDMT(i_topologyType); - if(NULL == l_pMDMT) - { - TOD_ERR("MDMT not found"); - /*@ - * @errortype - * @reasoncode TOD_NO_MASTER_PROC - * @moduleid TOD_INIT_HWP - * @devdesc MDMT could not be found - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - TOD_INIT_HWP, - TOD_NO_MASTER_PROC,0,0); - break; - } - - FAPI_INVOKE_HWP(l_errHdl, - proc_tod_init, - l_pMDMT->getTopologyNode()); - - if(l_errHdl) - { - TOD_ERR("Error in call to proc_tod_init. " - "Topology type 0x%.8X. " - "MDMT's HUID is 0x%.8X. " - "MDMT Master type : 0x%.8X. ", - i_topologyType, - l_pMDMT->getTarget()->getAttr<TARGETING::ATTR_HUID>(), - l_pMDMT->getMasterType()); - TOD_ERR("MDMT Bus RX 0x%.8X, Bus TX 0x%.8X.", - l_pMDMT->getBusIn(), l_pMDMT->getBusOut()); - break; - } - }while(0); - - TOD_EXIT("todInitHwp. errHdl = %p", l_errHdl); - - return l_errHdl; -} - -} //namespace TOD diff --git a/src/usr/hwpf/hwp/tod_init/TodHwpIntf.H b/src/usr/hwpf/hwp/tod_init/TodHwpIntf.H deleted file mode 100755 index 7beba7cfe..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodHwpIntf.H +++ /dev/null @@ -1,118 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodHwpIntf.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -#ifndef TODHWPINTF_H -#define TODHWPINTF_H - -/** - * @file TodHwpIntf.H - * - * @brief TOD Hardware Procedure interfaces - * - * HWP_IGNORE_VERSION_CHECK - * - */ - -#include <errl/errlentry.H> -#include "proc_tod_utils.H" - -namespace TOD -{ - -/** - * @brief Invokes the TOD setup hardware procedure - * - * @par Detailed Description: - * We pass in the TOD topology to the HWP. The HWP traverses the - * the topology and writes various TOD registers with TOD specific - * information. It also computes TOD delays and writes appropriate regs. - * - * @param[in] i_topologyType - * Topology type : primary/secondary - * - * @return Error log handle indicating the status of the request - * @retval NULL HWP executed succesfully - * @retval !NULL HWP failure - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ -errlHndl_t todSetupHwp(const proc_tod_setup_tod_sel i_topologyType); - -/** - * @brief Invokes the TOD registry read HWP. - * - * @par Detailed Description: - * We pass in the TOD topology to the HWP. The HWP traverses the - * topology and fills up, for each TOD proc datastructure, an output - * field which corresponds to the TOD registers for that proc. The HWP - * gets the register content by scomming the register. - * Check proc_tod_utils.H : proc_tod_setup_conf_regs for the list of regs. - * - * @param[in] i_topologyType - * Topology type : primary/secondary - * - * @return Error log handle indicating the status of the request - * @retval NULL HWP executed succesfully - * @retval !NULL HWP failure - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ -errlHndl_t todSaveRegsHwp(const proc_tod_setup_tod_sel i_topologyType); - -/** - * @brief Invokes the TOD init HWP. - * - * @param[in] i_topologyType - * Topology type : primary/secondary - * - * @return Error log handle indicating the status of the request - * @retval NULL HWP executed succesfully - * @retval !NULL HWP failure - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ -errlHndl_t todInitHwp(const proc_tod_setup_tod_sel i_topologyType); - -} //namespace TOD - -#endif //TODHWPINTF_H diff --git a/src/usr/hwpf/hwp/tod_init/TodProc.C b/src/usr/hwpf/hwp/tod_init/TodProc.C deleted file mode 100755 index e3c31929d..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodProc.C +++ /dev/null @@ -1,546 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodProc.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -/** - * @file TodProc.C - * - * @brief The file implements methods of TodProc class - * - * HWP_IGNORE_VERSION_CHECK - * - */ - -//------------------------------------------------------------------------------ -//Includes -//------------------------------------------------------------------------------ -#include <targeting/common/attributes.H> -#include <targeting/common/targetservice.H> -#include <targeting/common/utilFilter.H> -#include <tod_init/tod_init_reasoncodes.H> -#include "TodDrawer.H" -#include "TodProc.H" -#include "TodTypes.H" -#include "TodAssert.H" -#include "TodTrace.H" - -namespace TOD -{ - -//****************************************************************************** -// TodProc::TodProc -//****************************************************************************** -TodProc::TodProc( - const TARGETING::Target* i_procTarget, - const TodDrawer* i_parentDrawer): - iv_procTarget(i_procTarget), - iv_parentDrawer(i_parentDrawer), - iv_tod_node_data(NULL), - iv_masterType(NOT_MASTER) -{ - TOD_ASSERT(iv_procTarget, "Target input i_procTarget is NULL "); - TOD_ASSERT(iv_parentDrawer, "TOD drawer input iv_parentDrawer is NULL "); - - TOD_ENTER("Created proc 0x%.8X on drawer 0x%.2X", - iv_procTarget->getAttr<TARGETING::ATTR_HUID>(), - iv_parentDrawer->getId()); - init(); - - TOD_EXIT("TodProc constructor"); -} - -//****************************************************************************** -// TodProc::~TodProc -//****************************************************************************** -TodProc::~TodProc() -{ - TOD_ENTER("TodProc destructor"); - - if(iv_tod_node_data) - { - delete iv_tod_node_data->i_target; - iv_tod_node_data->i_target = NULL; - delete iv_tod_node_data; - iv_tod_node_data = NULL; - } - iv_xbusTargetList.clear(); - iv_abusTargetList.clear(); - - TOD_EXIT("TodProc destructor"); -} - - -//****************************************************************************** -// TodProc::getMasterType -//****************************************************************************** -TodProc::ProcMasterType TodProc::getMasterType() const -{ - return iv_masterType; -} - -//****************************************************************************** -// TodProc::setMasterType -//****************************************************************************** -void TodProc::setMasterType(const ProcMasterType i_masterType) -{ - TOD_ENTER("setMasterType"); - - iv_masterType = i_masterType; - iv_tod_node_data->i_drawer_master = true; - if(TOD_MASTER == i_masterType) - { - iv_tod_node_data->i_tod_master = true; - } - - TOD_EXIT("setMasterType"); -} - -//****************************************************************************** -// TodProc::init -//****************************************************************************** -void TodProc::init() -{ - TOD_ENTER("init"); - - if(iv_tod_node_data) - { - if(iv_tod_node_data->i_target) - { - delete iv_tod_node_data->i_target; - } - delete iv_tod_node_data; - } - iv_tod_node_data = new tod_topology_node(); - //Initialize the iv_tod_node_data structure - iv_tod_node_data->i_target = new fapi::Target; - iv_tod_node_data->i_target->setType(fapi::TARGET_TYPE_PROC_CHIP); - iv_tod_node_data->i_target->set - (reinterpret_cast<void*>(const_cast<TARGETING::Target*>(iv_procTarget))); - iv_tod_node_data->i_tod_master = false; - iv_tod_node_data->i_drawer_master = false; - iv_tod_node_data->i_bus_rx = NONE; - iv_tod_node_data->i_bus_tx = NONE; - - TodTopologyNodeContainer::iterator l_childItr; - - for(l_childItr = iv_tod_node_data->i_children.begin(); - l_childItr != iv_tod_node_data->i_children.end(); - ++l_childItr) - { - delete (*l_childItr); - } - iv_tod_node_data->i_children.clear(); - - iv_xbusTargetList.clear(); - iv_abusTargetList.clear(); - - //Make a list of outgoing bus targets for this processor - TARGETING::PredicateCTM - l_xbusCTM(TARGETING::CLASS_UNIT,TARGETING::TYPE_XBUS); - TARGETING::PredicateCTM - l_abusCTM(TARGETING::CLASS_UNIT,TARGETING::TYPE_ABUS); - - TARGETING::TargetHandleList l_xbusTargetList; - TARGETING::TargetHandleList l_abusTargetList; - - TARGETING::PredicateIsFunctional l_func; - TARGETING::PredicatePostfixExpr l_funcAndXbusFilter; - TARGETING::PredicatePostfixExpr l_funcAndAbusFilter; - l_funcAndXbusFilter.push(&l_xbusCTM).push(&l_func).And(); - l_funcAndAbusFilter.push(&l_abusCTM).push(&l_func).And(); - - TARGETING::targetService().getAssociated(l_xbusTargetList, - iv_procTarget, - TARGETING::TargetService::CHILD, - TARGETING::TargetService::ALL, - &l_funcAndXbusFilter); - - //Push the X bus targets found to the iv_xbusTargetList - for(uint32_t l_index =0 ; l_index < l_xbusTargetList.size(); - ++l_index) - { - iv_xbusTargetList.push_back(l_xbusTargetList[l_index]); - } - - TARGETING::targetService().getAssociated(l_abusTargetList, - iv_procTarget, - TARGETING::TargetService::CHILD, - TARGETING::TargetService::ALL, - &l_funcAndAbusFilter); - //Push the A bus targets found to the iv_abusTargetList - for(uint32_t l_index =0 ; l_index < l_abusTargetList.size(); - ++l_index) - { - iv_abusTargetList.push_back(l_abusTargetList[l_index]); - } - - TOD_EXIT("init"); - - return; -} - -//****************************************************************************** -// TodProc::connect -//****************************************************************************** -errlHndl_t TodProc::connect( - TodProc* i_destination, - const TARGETING::TYPE i_busChipUnitType, - bool& o_isConnected) -{ - TOD_ENTER("Source proc HUID = 0x%08X " - "Destination proc HUID = 0x%08X " - "Bus type for connection = 0x%08X ", - iv_procTarget->getAttr<TARGETING::ATTR_HUID>(), - i_destination->getTarget()->getAttr<TARGETING::ATTR_HUID>(), - static_cast<uint32_t>(i_busChipUnitType)); - - errlHndl_t l_errHndl = NULL; - o_isConnected = false; - - do - { - if(iv_procTarget->getAttr<TARGETING::ATTR_HUID>() == - i_destination->getTarget()->getAttr<TARGETING::ATTR_HUID>()) - { - TOD_INF("This and the destination are the same procs"); - o_isConnected = true; - break; - } - - TARGETING::TargetHandleList* l_pBusList = NULL; - - //Check whether we've to connect over X or A bus - if(TARGETING::TYPE_XBUS == i_busChipUnitType) - { - l_pBusList = &iv_xbusTargetList; - } - else if(TARGETING::TYPE_ABUS == i_busChipUnitType) - { - l_pBusList = &iv_abusTargetList; - } - else - { - TOD_ERR("Bus type 0x%.8X passed to the method is not " - "supported", i_busChipUnitType); - logUnsupportedBusType(i_busChipUnitType,l_errHndl); - break; - } - - //From this proc (iv_procTarget), find if destination(i_destination) - //has a connection via the bus type i_busChipUnitType : - - //Step 1: Sequentially pick buses from either iv_xbusTargetList or - //iv_abusTargetList depending on the bus type specified as input - //Step 2: Get the parent of peer target of the bus target found in the - //previous step. If it matches with the destination, we got a connection - //Step 3: If a match is found then fill the i_bus_tx and i_bus_rx - //attributes for the destination proc and return - - const TARGETING::Target * l_proc = NULL; - TARGETING::TargetHandleList l_busList; - - TARGETING::TargetHandleList::iterator l_busIter = (*l_pBusList).begin(); - for(;l_busIter != (*l_pBusList).end() ; ++l_busIter) - { - l_busList.clear(); - - //Get the peer target for this bus connection - //I need to know the peer's (bus endpoint) attributes such as - //HUID, chip unit. Applying a result filter will get me the proc - //on the other end, but will abstract away the bus, which is not - //what I want. - getPeerTargets( - l_busList, - *l_busIter, - NULL, - NULL); - - //There should be only 1 peer - if(1 == l_busList.size()) - { - l_proc = getParentChip(l_busList[0]); - - if((l_proc) && - l_proc->getAttr<TARGETING::ATTR_HWAS_STATE>().functional && - (l_proc->getAttr<TARGETING::ATTR_HUID>() == - i_destination->iv_procTarget-> - getAttr<TARGETING::ATTR_HUID>())) - { - //We found a connection : - //iv_procTarget --- i_busChipUnitType --- i_destination - TOD_INF("Source processor 0x%.8X connects with the " - "destination processor 0x%.8X over " - "source bus 0x%.8X and destination bus 0x%.8X " - "via bus type 0x%.8X", - iv_procTarget->getAttr<TARGETING::ATTR_HUID>(), - i_destination->iv_procTarget-> - getAttr<TARGETING::ATTR_HUID>(), - (*l_busIter)->getAttr<TARGETING::ATTR_HUID>(), - l_busList[0]->getAttr<TARGETING::ATTR_HUID>(), - i_busChipUnitType); - - //Determine the bus type as per our format, for eg XBUS0 - //ATTR_CHIP_UNIT gives the instance number of - //the bus and it has direct correspondance to - //the port no. - //For instance a processor has two A buses - //then the one with ATTR_CHIP_UNIT 0 will be A0 - //and the one with ATTR_CHIP_UNIT 1 will be A1 - proc_tod_setup_bus l_busOut = NONE; - proc_tod_setup_bus l_busIn = NONE; - l_errHndl = getBusPort(i_busChipUnitType, - (*l_busIter)-> - getAttr<TARGETING::ATTR_CHIP_UNIT>(), - l_busOut); - if(NULL == l_errHndl) - { - l_errHndl = getBusPort(i_busChipUnitType, - l_busList[0]-> - getAttr<TARGETING::ATTR_CHIP_UNIT>(), - l_busIn); - } - if(l_errHndl) - { - //Should not be hitting this path if HW procedure is - //correctly defining all the bus types and ports - TOD_ERR("proc_tod_setup_bus type not found for " - "port 0x%.2X of bus type 0x%.8X. Source processor " - "0x%.8X, destination processor 0x%.8X", - (*l_busIter)-> - getAttr<TARGETING::ATTR_CHIP_UNIT>(), - i_busChipUnitType, - iv_procTarget-> - getAttr<TARGETING::ATTR_HUID>(), - i_destination->iv_procTarget-> - getAttr<TARGETING::ATTR_HUID>()); - break; - } - - //Set the bus connections for i_destination : - //Bus out from this proc = l_busOut; - //Bus in to destination = l_busIn; - i_destination->setConnections(l_busOut, l_busIn); - o_isConnected = true; - break; - } - } - } - if(l_errHndl) - { - break; - } - }while(0); - - TOD_EXIT("connect. errHdl = %p", l_errHndl); - - return l_errHndl; -} - -//****************************************************************************** -//TodProc::getBusPort -//****************************************************************************** -errlHndl_t TodProc::getBusPort( - const TARGETING::TYPE i_busChipUnitType, - const uint32_t i_busPort, - proc_tod_setup_bus& o_busPort) const -{ - TOD_ENTER("getBusPort"); - - errlHndl_t l_errHndl = NULL; - - if(TARGETING::TYPE_XBUS == i_busChipUnitType) - { - switch(i_busPort) - { - case 0: - o_busPort = XBUS0; - break; - case 1: - o_busPort = XBUS1; - break; - case 2: - o_busPort = XBUS2; - break; - case 3: - o_busPort = XBUS3; - break; - default: - TOD_ERR("Port 0x%.8X not supported for X bus", - i_busPort); - logUnsupportedBusPort(i_busPort, - i_busChipUnitType, - l_errHndl); - break; - } - } - else if(TARGETING::TYPE_ABUS == i_busChipUnitType) - { - switch(i_busPort) - { - case 0: - o_busPort = ABUS0; - break; - case 1: - o_busPort = ABUS1; - break; - case 2: - o_busPort = ABUS2; - break; - default: - TOD_ERR("Port 0x%.8X not supported for A bus", - i_busPort); - logUnsupportedBusPort(i_busPort, - i_busChipUnitType, - l_errHndl); - break; - } - } - else - { - TOD_ERR("Bus type 0X%.8X not supported",i_busChipUnitType); - logUnsupportedBusType(i_busChipUnitType, l_errHndl); - } - - TOD_EXIT("getBusPort. errHdl = %p", l_errHndl); - - return l_errHndl; -} - - -//****************************************************************************** -//TodProc::logUnsupportedBusType -//****************************************************************************** -void TodProc::logUnsupportedBusType(const int32_t i_busChipUnitType, - errlHndl_t& io_errHdl) const -{ - /*@ - * @errortype - * @moduleid TOD_LOG_UNSUPPORTED_BUSTYPE - * @reasoncode TOD_UNSUPPORTED_BUSTYPE - * @userdata1 Bus type that is not currently supported - * @devdesc Error: Unsupported bus type was detected - * Possible Causes: Invalid bus configuration in targeting, or - * getBusPort method has not been updated to support all the - * bus type on a given system. - * Resolution:Development team should be contacted. - */ - io_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - TOD_LOG_UNSUPPORTED_BUSTYPE, - TOD_UNSUPPORTED_BUSTYPE, - i_busChipUnitType, 0); -} - -//****************************************************************************** -//TodProc::logUnsupportedBusPort -//****************************************************************************** -void TodProc::logUnsupportedBusPort( - const int32_t i_busPort, - const int32_t i_busChipUnitType, - errlHndl_t& io_errHdl) const -{ - /*@ - * @errortype - * @reasoncode TOD_UNSUPPORTED_BUSPORT - * @moduleid TOD_LOG_UNSUPPORTED_BUSPORT - * @userdata1 Bus port that is not currently supported - * @userdata2 Bus Type for which the unsupported port has been reported - * @devdesc Error: Unsupported bus port was detected for the specified - * bus type. - * Possible Causes: Invalid bus configuration in targeting, or - * getBusPort method has not been updated to support all the - * possible port for a bus on a given system type. - * Resolution:Development team should be contacted. - */ - io_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - TOD_LOG_UNSUPPORTED_BUSPORT, - TOD_UNSUPPORTED_BUSPORT, - i_busPort, i_busChipUnitType); -} - -//****************************************************************************** -// TodProc::addChild -//****************************************************************************** -void TodProc::addChild(TodProc* i_child) -{ - TOD_ENTER("addChild"); - - if(iv_procTarget->getAttr<TARGETING::ATTR_HUID>() != - i_child->getTarget()->getAttr<TARGETING::ATTR_HUID>()) - { - iv_childrenList.push_back(i_child); - (iv_tod_node_data->i_children).push_back(i_child->getTopologyNode()); - } - - TOD_EXIT("addChild"); -} - -//****************************************************************************** -// TodProc::getTodRegs -//****************************************************************************** -void TodProc::getTodRegs(proc_tod_setup_conf_regs& o_todRegs) const -{ - o_todRegs.tod_m_path_ctrl_reg = - iv_tod_node_data->o_todRegs.tod_m_path_ctrl_reg; - o_todRegs.tod_pri_port_0_ctrl_reg = - iv_tod_node_data->o_todRegs.tod_pri_port_0_ctrl_reg; - o_todRegs.tod_pri_port_1_ctrl_reg = - iv_tod_node_data->o_todRegs.tod_pri_port_1_ctrl_reg; - o_todRegs.tod_sec_port_0_ctrl_reg = - iv_tod_node_data->o_todRegs.tod_sec_port_0_ctrl_reg; - o_todRegs.tod_sec_port_1_ctrl_reg = - iv_tod_node_data->o_todRegs.tod_sec_port_1_ctrl_reg; - o_todRegs.tod_s_path_ctrl_reg = - iv_tod_node_data->o_todRegs.tod_s_path_ctrl_reg; - o_todRegs.tod_i_path_ctrl_reg = - iv_tod_node_data->o_todRegs.tod_i_path_ctrl_reg; - o_todRegs.tod_pss_mss_ctrl_reg = - iv_tod_node_data->o_todRegs.tod_pss_mss_ctrl_reg; - o_todRegs.tod_chip_ctrl_reg = - iv_tod_node_data->o_todRegs.tod_chip_ctrl_reg; -} - -//****************************************************************************** -//TodProc::setTodChipData -//****************************************************************************** -void TodProc::setTodChipData(TodChipData& o_todChipData) const -{ - proc_tod_setup_conf_regs& l_todRegs = iv_tod_node_data->o_todRegs; - - o_todChipData.header.chipID = iv_procTarget-> - getAttr<TARGETING::ATTR_POSITION>(); - - o_todChipData.header.flags |= TOD_FUNC; - - o_todChipData.regs.mpcr = l_todRegs.tod_m_path_ctrl_reg.getWord(0); - o_todChipData.regs.pcrp0 = l_todRegs.tod_pri_port_0_ctrl_reg.getWord(0); - o_todChipData.regs.pcrp1 = l_todRegs.tod_pri_port_1_ctrl_reg.getWord(0); - o_todChipData.regs.scrp0 = l_todRegs.tod_sec_port_0_ctrl_reg.getWord(0); - o_todChipData.regs.scrp1 = l_todRegs.tod_sec_port_1_ctrl_reg.getWord(0); - o_todChipData.regs.spcr = l_todRegs.tod_s_path_ctrl_reg.getWord(0); - o_todChipData.regs.ipcr = l_todRegs.tod_i_path_ctrl_reg.getWord(0); - o_todChipData.regs.psmscr = l_todRegs.tod_pss_mss_ctrl_reg.getWord(0); - o_todChipData.regs.ccr = l_todRegs.tod_chip_ctrl_reg.getWord(0); -} - -} //end of namespace diff --git a/src/usr/hwpf/hwp/tod_init/TodProc.H b/src/usr/hwpf/hwp/tod_init/TodProc.H deleted file mode 100755 index 5b93505ce..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodProc.H +++ /dev/null @@ -1,408 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodProc.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -#ifndef TODPROC_H -#define TODPROC_H - -/** - * @file TodProc.H - * - * @brief Contains TodProc class declaration - * TodProc class encapsulates a proc chip target with other attributes - * that are necessary to define the proc chip in a TOD topology - * - * HWP_IGNORE_VERSION_CHECK - * - */ - -#include "proc_tod_utils.H" -#include "TodTypes.H" -#include "TodSvcUtil.H" - -namespace TOD -{ - -//------------------------------------------------------------------------------ -//Forward declarations -//------------------------------------------------------------------------------ -struct TodChipData; -class TodDrawer; -class TodProc; - -//------------------------------------------------------------------------------ -//Typedefs -//------------------------------------------------------------------------------ -typedef std::list<TodProc*> TodProcContainer; -typedef std::list<tod_topology_node*> TodTopologyNodeContainer; - -/** - * @class TodProc - * - * @brief TodProc class encapsulates a proc chip target with other - * attributes that helps to identify the position of proc chip in a - * TOD netwok and also define its connection with other proc chips - */ -class TodProc -{ -public: - //Specify proc master type : - //TOD master/drawer master - enum ProcMasterType - { - NOT_MASTER = 0x00, - TOD_MASTER = 0x01, - DRAWER_MASTER = 0x02 - }; - - /** - * @brief Constructor - * - * @param[in] i_procTarget - * Pointer to proc target - * - * @param[in] i_parentDrawer - * Pointer to TOD drawer in which this proc is contained - */ - TodProc(const TARGETING::Target* i_procTarget, - const TodDrawer* i_parentDrawer); - - /** - * @brief Destructor - */ - ~TodProc(); - - /** - * @brief The method will try to connect TodProc object, for which the - * method has been called to the TodProc object specificed in - * destination argument. - * - * @par Detailed Description: - * While creating the TOD topology TodTopologyManager will connect - * TodProc objects to the topology if they - * physically connect over A/X bus, to a TodProc object - * that is already part of the topology and also valid candidate for - * connecting the TodProc object under consideration. - * - * The process of connecting processors starts with MDMT and will - * continue till all the processors are connected. - * At each step TodTopologyManager will make call to connect - * method. This method will check if processor chip owned by - * TodProc object (for which the method is called ) is physically - * connected to the destination (passed as argument), over the bus type - * specified in argument to the method. - * - * If they connect then the i_bus_rx and i_bus_tx members of - * iv_tod_node_data will be filled up for the destination object - * such that - * i_bus_rx == The bus on destination object that connects to the - * this proc - * i_bus_tx == The bus on this proc that connects to the - * destination - * - * @param[in] i_destination, Pointer to destination TodProc object - * that has to be connected. - * - * @param[in] i_busChipUnitType, Type of the bus (A/X) for which connection - * has to be determined - * - * @param[out] o_isConnected, this parameter will be set to true if - * source and destination connect over the specified bus type. Before - * looking for o_isConnected the caller should check for returned error - * log handle and only if it is NULL o_isConnected should be considered. - * - * @return Error log handle, indicates status of request - * @retval NULL indicates that connect method's algorithm executed - * successfully, however in order to know if two processor objects - * connect over the specified bus or not o_isConnected has to be - * examined. - * @retval !NULL indicates that method connect could not be completed - * successfully. In this case o_isConnected should be ignored. - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ - errlHndl_t connect( - TodProc* i_destination, - const TARGETING::TYPE i_busChipUnitType, - bool& o_isConnected); - - /** - * @brief This is a helper method for connect, that will pick a value - * from proc_tod_setup_bus enum corresponding to the bus type and - * the port specified as argument - * - * @param[in] i_busChipUnitType , This will indicate A/X bus type - * - * @param[in] i_busPort , The port of the bus - * - * @param[out] o_busId , proc_tod_setup_bus enum member corresponding to - * the bus type and bus port specified as parameter. Before looking for - * o_busId caller should look for returned error handle and only if it - * is NULL, o_busId should be considered. - * - * @return Error log handle, indicates status of request - * @retval NULL, indicates o_busId was successfully found - * @retval !NULL, indicates that o_busId could not be found possibly - * because specified bus type and port combination is not supported - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ - errlHndl_t getBusPort( - const TARGETING::TYPE i_busChipUnitType, - const uint32_t i_busPort, - proc_tod_setup_bus& o_busId) const; - - /** - * @brief Method to create an errlHndl_t object for - * TOD_UNSUPPORTED_BUSTYPE - * - * @par Detailed Description: - * This error will be logged by a method if it finds that a particular - * bus type is not supported on TOD topology. - * - * @param[in] i_busChipUnitType, Type of bus that is not supported - * - * @param[out] io_errHdl - * On input this parameter will be either NULL or pointing to - * an existing error handle. - * On output this parameter will either have a newly created handle - * assigned to it ( If input parameter was NULL ) or a new SRC will be - * appened to existing error handle ( If the input was not NULL ) - * - * @return N/A - */ - void logUnsupportedBusType(const int32_t i_busChipUnitType, - errlHndl_t& io_errHdl) const; - - /** - * @brief Method to create an errlHndl_t object for - * TOD_UNSUPPORTED_BUSPORT - * - * @par Detailed Description: - * This error will be logged by getBusPort if it finds that the input - * bus port is not supported for a specified bus type, from - * TOD topology point of view. - * - * @param[in] i_busPort , Type of bus that is not currently supported. - * - * @param[out] io_errHdl - * On input this parameter will be either NULL or pointing to - * an existing error handle. - * On output this parameter will either have a newly created handle - * assigned to it ( If input parameter was NULL ) or a new SRC will be - * appened to existing error handle ( If the input was not NULL ) - * - * @return N/A - */ - void logUnsupportedBusPort( - const int32_t i_busPort, - const int32_t i_busChipUnitType, - errlHndl_t& io_errHdl) const; - - /** - * @brief Add a child TodProc to this (adds to iv_childrenList). - * Added child will receive TOD signal from the processor - * represented by this TodProc object. - * - * @param[in] i_child - * Pointer to child TodProc - * - * @return N/A - */ - void addChild(TodProc* i_child); - - /** - * @brief Setter method for iv_masterType - * - * @param[in] i_masterType - * Parameter to indicate the master type - * - * @return N/A - */ - void setMasterType(const ProcMasterType i_masterType); - - /** - * @brief Getter method for iv_masterType - * - * @return ProcMasterType, value of iv_masterType - */ - ProcMasterType getMasterType() const ; - - /** - * @brief Getter for TOD registers for this proc - * Check proc_tod_utils.H : proc_tod_setup_conf_regs for the list of - * registers. The registers are updated by the TOD HWP. - * - * @param[out] o_todRegs - * container of TOD registers - * - * @return N/A - */ - void getTodRegs(proc_tod_setup_conf_regs& o_todRegs) const; - - /** - * @brief This method will populate the TodChipData object passed as - * input with the TOD register values of the this proc. - * - * @param[out] o_todChipData - * The TodChipData object in which data has to be output - * - * @return NA - * - */ - void setTodChipData(TodChipData& o_todChipData) const; - - /** - * @brief Getter method for iv_tod_node_data - * - * @return tod_topology_node*, pointer to this proc's topology - * node structure - */ - tod_topology_node* getTopologyNode() - { - return iv_tod_node_data; - } - - /** - * @brief Getter method for iv_parentDrawer - * - * @return TodDrawer*, pointer to this proc's containing TOD drawer - */ - const TodDrawer* getParentDrawer() const - { - return iv_parentDrawer; - } - - /** - * @brief Getter method for tod_topology_node::i_bus_rx data member , - * i_bus_rx is the fabric bus over which current processor receives - * signals from its parent - * - * @return proc_tod_setup_bus bus type and port - */ - proc_tod_setup_bus getBusIn() const - { - return iv_tod_node_data->i_bus_rx; - } - - /** - * @brief Getter method for tod_topology_node::i_bus_tx data member , - * i_bus_tx is the bus over which signal is transmitted by the - * parent of this processor - * - * @return proc_tod_setup_bus bus type and port - */ - proc_tod_setup_bus getBusOut() const - { - return iv_tod_node_data->i_bus_tx; - } - - /** - * @brief Getter method for iv_procTarget - * - * @return Target pointer for this proc - */ - const TARGETING::Target* getTarget() const - { - return iv_procTarget; - } - - /** - * @brief Getter method for iv_childrenList. - * see also addChild - * - * @param[out] o_childrenList - * List of pointers to children TodProc - * - * @return N/A - */ - void getChildren(TodProcContainer& o_childrenList) const - { - o_childrenList = iv_childrenList; - } - - /** - * @brief Sets bus in and bus out - * - * @return N/A - */ - void setConnections(const proc_tod_setup_bus i_parentBusOut, - const proc_tod_setup_bus i_thisBusIn) - { - iv_tod_node_data->i_bus_tx = i_parentBusOut; - iv_tod_node_data->i_bus_rx = i_thisBusIn; - } - -private: - /* - * @brief Helper method to initialize the bus parameters - * (iv_xbusTargetList and iv_abusTargetList) and iv_tod_node_data, for - * this object. - * It will be called from the constructor. - * - * @return N/A - */ - void init(); - - //Target pointer to the processor chip, that is been encapsulated in - //the TodProc object - const TARGETING::Target* iv_procTarget; - - //Pointer to the parent TodDrawer object to which this processor - //belong - const TodDrawer * iv_parentDrawer; - - //List of X bus targets for this processor - TARGETING::TargetHandleList iv_xbusTargetList; - - //List of A bus targets for this processor - TARGETING::TargetHandleList iv_abusTargetList; - - //List of children that will receive TOD signal from this processor belongs - TodProcContainer iv_childrenList; - - //Pointer to the tod_topology_node object that defines TOD specific - //attributes for this processor chip, the reason this has been kept - //seperate is this data structure is shared across HB and HW procedure - tod_topology_node* iv_tod_node_data; - - //Data member to indicate if this processor is either a TOD_MASTER or - //DRAWER_MASTER - ProcMasterType iv_masterType; -}; - -}//end of namespace - -#endif // TODPROC_H diff --git a/src/usr/hwpf/hwp/tod_init/TodSvc.C b/src/usr/hwpf/hwp/tod_init/TodSvc.C deleted file mode 100755 index f76efe846..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodSvc.C +++ /dev/null @@ -1,296 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodSvc.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -/** - * @file TodSvc.C - * - * @brief Implements the TodSvc class that provides the Time Of Day service - * - * HWP_IGNORE_VERSION_CHECK - * - */ - -#include <p8_scom_addresses.H> -#include <errl/errlentry.H> -#include <errl/errlmanager.H> -#include <tod_init/tod_init_reasoncodes.H> -#include "TodTopologyManager.H" -#include "TodTrace.H" -#include "TodSvcUtil.H" -#include "TodHwpIntf.H" -#include "TodControls.H" -#include "TodSvc.H" -#include "proc_tod_utils.H" - -namespace TOD -{ - -TodSvc & TodSvc::getTheInstance() -{ - return Singleton<TodSvc>::instance(); -} - -//****************************************************************************** -//TodSvc::todSetup -//****************************************************************************** -errlHndl_t TodSvc::todSetup() -{ - TOD_ENTER("todSetup"); - - errlHndl_t l_errHdl = NULL; - bool l_isTodRunning = false; - TodTopologyManager l_primary(TOD_PRIMARY); - TodControls & l_Tod = TodControls::getTheInstance(); - - do - { - l_errHdl = l_Tod.isTodRunning(l_isTodRunning); - if ( l_errHdl ) - { - TOD_INF("Call to isTodRunning failed , cannot create topology"); - break; - } - - if ( l_isTodRunning ) - { - TOD_ERR("Cannot create TOD topology while the Chip TOD logic" - "is running "); - /*@ - * @errortype - * @reasoncode TOD_INVALID_ACTION - * @moduleid TOD_SETUP - * @userdata1 ChipTOD logic HW state , 1=running , zero otherwise - * @devdesc Error: can not create TOD topology when TOD - * HW is running - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_INFORMATIONAL, - TOD_SETUP, - TOD_INVALID_ACTION, - l_isTodRunning ? 1 : 0, 0); - break; - } - - l_Tod.destroy(TOD_PRIMARY); - l_Tod.destroy(TOD_SECONDARY); - - //We're going to setup TOD for this IPL - //1) Build a set of datastructures to setup creation of the TOD - //topologies. - l_errHdl = l_Tod.buildTodDrawers(TOD_PRIMARY); - if(l_errHdl) - { - TOD_ERR("TOD setup failure: failed to build TOD drawers " - "for primary topology."); - break; - } - - //2) Ask the topology manager to setup the primary topology - l_errHdl = l_primary.create(); - if(l_errHdl) - { - TOD_ERR("TOD setup failure: failed to create primary topology."); - break; - } - l_primary.dumpTopology(); - - //3) Call hardware procedures to configure the TOD hardware logic for - //the primary topology and to fill up the TOD regs. - l_errHdl = todSetupHwp(TOD_PRIMARY); - if(l_errHdl) - { - TOD_ERR("TOD setup failure: primary topology setup HWP."); - break; - } - l_errHdl = todSaveRegsHwp(TOD_PRIMARY); - if(l_errHdl) - { - TOD_ERR("TOD setup failure: primary topology register save HWP."); - break; - } - - //Primary successfully configured - l_Tod.setConfigStatus(TOD_PRIMARY,true); - - //Build datastructures for secondary topology - l_errHdl = l_Tod.buildTodDrawers(TOD_SECONDARY); - if(l_errHdl) - { - TOD_ERR("TOD setup failure: failed to build TOD drawers " - "for secondary topology."); - //Report the error as informational - loss of redundancy, - //but no loss of TOD function. - errlCommit( l_errHdl, TOD_COMP_ID ); - break; - } - - //4) Ask the topology manager to setup the secondary topology - TodTopologyManager l_secondary(TOD_SECONDARY); - l_errHdl = l_secondary.create(); - if(l_errHdl) - { - TOD_ERR("TOD setup failure: failed to create secondary topology."); - //Report the error as informational - loss of redundancy, - //but no loss of TOD function. - errlCommit( l_errHdl, TOD_COMP_ID ); - break; - } - l_secondary.dumpTopology(); - - //5) Call hardware procedures to configure the TOD hardware logic for - //the secondary topology and to fill up the TOD regs. - l_errHdl = todSetupHwp(TOD_SECONDARY); - if(l_errHdl) - { - TOD_ERR("TOD setup failure: secondary topology setup HWP."); - //Report the error as informational - loss of redundancy, - //but no loss of TOD function. - errlCommit( l_errHdl, TOD_COMP_ID ); - break; - } - - //Secondary successfully configured - l_Tod.setConfigStatus(TOD_SECONDARY,true); - - //Need to call this again if the secondary topology got set up, - //that would have updated more regs. - l_errHdl = todSaveRegsHwp(TOD_PRIMARY); - if(l_errHdl) - { - TOD_ERR("TOD setup failure: primary topology register save HWP."); - break; - } - - //Done with TOD setup - }while(0); - - if((NULL == l_errHdl) && - (false == l_isTodRunning )) - { - l_primary.dumpTodRegs(); - - //If we are then atleast Primary or both configurations were - //successfully setup. If both were successfuly setup then we can use - //writeTodProcData for either of them else we should call - //writeTodProcData for only primary. - //Ultimately it should be good enough to call the method for Primary - l_errHdl = l_Tod.writeTodProcData(TOD_PRIMARY); - if(l_errHdl) - { - TOD_ERR("TOD setup failure:Failed to write topology register data" - " to the file."); - } - } - - TOD_EXIT("todSetup. errHdl = %p", l_errHdl); - - return l_errHdl; -} - -//****************************************************************************** -//TodSvc::todInit -//****************************************************************************** -errlHndl_t TodSvc::todInit() -{ - return todInitHwp(TOD_PRIMARY); -} - -//****************************************************************************** -//TodSvc::readTod -//****************************************************************************** -errlHndl_t TodSvc::readTod(uint64_t& o_todValue) const -{ - TOD_ENTER("readTod"); - - errlHndl_t l_errHdl = NULL; - - do - { - //Get the MDMT - TodProc* l_pMDMT = - TodControls::getTheInstance().getMDMT(TOD_PRIMARY); - if(NULL == l_pMDMT) - { - TOD_ERR("MDMT not found"); - /*@ - * @errortype - * @reasoncode TOD_NO_MASTER_PROC - * @moduleid TOD_READ - * @devdesc MDMT could not be found - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_INFORMATIONAL, - TOD_READ, - TOD_NO_MASTER_PROC); - break; - } - - //SCOM the TOD value reg - ecmdDataBufferBase o_todValueBuf(64); - l_errHdl = todGetScom(l_pMDMT->getTarget(), - TOD_VALUE_REG_00040020, - o_todValueBuf); - if(l_errHdl) - { - TOD_ERR("TOD read error: failed to SCOM TOD value register " - "address 0x%.16llX on MDMT 0x%.8X.", - TOD_VALUE_REG_00040020, - l_pMDMT->getTarget()->getAttr<TARGETING::ATTR_HUID>()); - break; - } - o_todValue = o_todValueBuf.getDoubleWord(0); - - TOD_INF("TOD value : 0x%.16llx", o_todValue ); - - }while(0); - - TOD_EXIT("readTod. errHdl = %p", l_errHdl); - - return l_errHdl; -} - -//****************************************************************************** -//TodSvc::TodSvc -//****************************************************************************** -TodSvc::TodSvc() -{ - TOD_ENTER("TodSvc constructor"); - - TOD_EXIT("TodSvc constructor"); -} - -//****************************************************************************** -//TodSvc::~TodSvc -//****************************************************************************** -TodSvc::~TodSvc() -{ - TOD_ENTER("TodSvc destructor"); - - //Free up held memory - TodControls::getTheInstance().destroy(TOD_PRIMARY); - TodControls::getTheInstance().destroy(TOD_SECONDARY); - - TOD_EXIT("TodSvc destructor"); -} - -} //namespace TOD diff --git a/src/usr/hwpf/hwp/tod_init/TodSvc.H b/src/usr/hwpf/hwp/tod_init/TodSvc.H deleted file mode 100755 index 10e7c6216..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodSvc.H +++ /dev/null @@ -1,194 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodSvc.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -#ifndef TODSVC_H -#define TODSVC_H - -/** - * @file TodSvc.H - * - * @brief Defines the TodSvc class that provides the Time Of Day service - * The TodSvc class is a thread-safe singleton. - * - * HWP_IGNORE_VERSION_CHECK - * - */ - -#include <util/singleton.H> - -namespace TOD -{ - -/** - * @class TodSvc - * - * @brief Time Of Day service entry point - */ -class TodSvc -{ -public: - - /** - * @brief Get singleton instance of this class. - * - * @return the (one and only) instance of TodSvc - */ - static TodSvc& getTheInstance(); - - /** - * @brief This interface should be called during IPL to setup the - * time of day logic on the P8 processors sitting on the system. - * - * @par Detailed Description: - * All processors of a symmetric multiprocessor model must appear to - * have the same time. This is in order to ensure that time stamps - * accurately reflect the sequence of events occuring on these procs. - * - * To achieve this, each proc has a hardware time of day (TOD) logic. - * A TOD oscillator(a fixed frequency clock) can send out signals to - * keep the TOD clocks on the various procs in sync. - * - * Since the procs are connected by fabric buses, a signal sent out by - * the oscillator will reach the procs at different times. Besides, - * there are multiple bus paths to propagate TOD signals. To solve these - * issues, we (FSP HWSV) need to create a TOD topology. A TOD topology - * has a single Master Drawer Master TOD processor chip (MDMT), which - * receives input directly from the oscillator. The MDMT will propagate - * signals to other procs, MDSTs (Master Drawer Slave TOD Chips), - * in the fabric node/physical drawer in which it's contained, via X - * buses. This group of procs will be part of a TOD drawer. Inter TOD - * drawer communications will be via A buses. Via A bus, the MDMT will - * propagate TOD signals to designated masters in other drawers, SDMTs - * (Slave Drawer Master TOD Chips). In the their respective TOD - * drawers, SDMTs, like the MDMT, will use X buses to propagate signals - * to other SDSTs (Slave Drawer Slave TOD Chips). - * - * We will create a primary topology and a secondary topology, for - * redundancy. Once we create the topologies, the same will be passed - * on to a hardware procedure. The procedure will set bits in the TOD - * registers of the procs, to indicate the topology. THe procedure will - * also compute "delays", to be introduced to signals sent out by the - * oscillator. MDMT will have the longest delay and the furthest proc - * from the oscillator will have 0 delay. This helps ensuring that TOD - * signals are received at the same wall clock time. - * - * At runtime, PHYP will be able to read the TOD registers and - * determine the TOD topolgies. It will use the primary topology as the - * active topology for timekeeping. On detecting errors in the active - * topology, it can switch to the secondary and ask us to reconfigure a - * backup. - * - * @return Error log handle indicating the status of the request. - * @retval NULL if successful - * @retval !NULL if failed to setup TOD - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - * - * @note TOD setup is not allowed at FSP runtime - * @note Presence of a secondary topology is not critical to - * to TOD functionality, so an error in creating the same - * will be noted but not returned. - */ - errlHndl_t todSetup(); - - /** - * @brief This interface should be called during IPL to set the TOD - * into running state - * - * @return Error log handle indicating the status of the request. - * @retval NULL if successful - * @retval !NULL if failed to setup TOD - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ - errlHndl_t todInit(); - - /** - * @brief Reads the Time Of Day (TOD) value from the TOD register on - * the processor chip and returns the same. - * - * @par Detailed Description: - * This interface will read the TOD value from the TOD value register. - * We could read this from any of the processor that's part of the - * TOD topology, since the TOD value should be in sync across procs, - * so we'll read this from the MDMT's register. - * - * @param[out] o_todValue - * 64-bit contents of the TOD value register will be copied here - * in a big-endian format. Will be 0 on error. - * - * @return Error log handle indicating the status of the request. - * @retval NULL if successful - * @retval !NULL if failed to read TOD value - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ - errlHndl_t readTod(uint64_t& o_todValue) const; - -protected: - /** - * @brief Constructor. - * - * @note This is protected so that only SingletonHolder can call. - */ - TodSvc(); - - /** - * @brief Destructor. - * - * @note This is protected so that only SingletonHolder can call. - */ - ~TodSvc(); - -private: - //Disabled copy constructor and assignment operator - TodSvc(const TodSvc& rhs); - TodSvc& operator=(const TodSvc& rhs); - - //Indicates if we've already setup TOD - bool iv_todSetup; -}; - -} //namespace TOD - -#endif //TODSVC_H diff --git a/src/usr/hwpf/hwp/tod_init/TodSvcUtil.C b/src/usr/hwpf/hwp/tod_init/TodSvcUtil.C deleted file mode 100755 index 962af46e1..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodSvcUtil.C +++ /dev/null @@ -1,268 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodSvcUtil.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -/** - * @file TodSvcUtil.C - * - * @brief This file implements the various utility methods - * - * HWP_IGNORE_VERSION_CHECK - * - */ - -#include <targeting/common/attributes.H> -#include <targeting/common/targetservice.H> -#include <tod_init/tod_init_reasoncodes.H> -#include <devicefw/userif.H> - -#include "TodTrace.H" -#include "TodSvcUtil.H" - -using namespace TARGETING; - -namespace TOD { - -//****************************************************************************** -//logInvalidTodConfig -//****************************************************************************** -void logInvalidTodConfig( - const uint32_t i_config, - errlHndl_t& io_errHdl) -{ - /*@ - * @errortype - * @reasoncode TOD_INVALID_CONFIG - * @moduleid TOD_LOG_INVALID_CONFIG - * @userdata1 The problematic configuration (Primary/Secondary) - * @devdesc Error: Erroneous TOD configuration - * Possible Causes: Programming issue - * Resolution: Development team should be contacted. - */ - io_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - TOD_LOG_INVALID_CONFIG, - TOD_INVALID_CONFIG, - i_config, 0); -} - -//****************************************************************************** -//logUnsupportedOrdinalId -//****************************************************************************** -void logUnsupportedOrdinalId( - const uint32_t i_ordinalId, - errlHndl_t& io_errHdl) -{ - /*@ - * @errortype - * @reasoncode TOD_UNSUPORTED_ORDINALID - * @moduleid TOD_LOG_UNSUPORTED_ORDINALID - * @userdata1 Ordinal Id for which the error is logged - * @devdesc Error: The ordinal Id of one of the TOD procs did not fall - * in the range 0 <= Ordinal Id < getMaxProcsOnSystem - * Possible Causes: TOD logic has not been updated to support - * the latest system type where the no. of processor chips is - * either equal to or more than getMaxProcsOnSystem - * Resolution: Development team should be contacted. - */ - io_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - TOD_LOG_UNSUPORTED_ORDINALID, - TOD_UNSUPORTED_ORDINALID, - i_ordinalId, 0 ); -} - -//****************************************************************************** -//getMaxProcsOnSystem() -//****************************************************************************** -uint32_t getMaxProcsOnSystem() -{ - Target* sys = NULL; - targetService().getTopLevelTarget(sys); - - uint8_t l_maxProcs = 0; - sys->tryGetAttr<ATTR_MAX_PROC_CHIPS_PER_NODE>(l_maxProcs); - - return ( (uint32_t)l_maxProcs ); -} - -//****************************************************************************** -//getMaxPossibleCoresPerProc() -//****************************************************************************** -uint32_t getMaxPossibleCoresPerProc() -{ - Target* sys = NULL; - targetService().getTopLevelTarget(sys); - - uint8_t l_maxCores = 0; - sys->tryGetAttr<ATTR_MAX_EXS_PER_PROC_CHIP>(l_maxCores); - - return ( (uint32_t)l_maxCores ); -} - -//****************************************************************************** -//todGetScom() -//****************************************************************************** -errlHndl_t todGetScom(const TARGETING::Target * i_target, - const uint64_t i_address, - ecmdDataBufferBase & o_data) -{ - uint32_t l_ecmdRc; - errlHndl_t l_err = NULL; - - // Perform SCOM read - uint64_t l_data = 0; - size_t l_size = sizeof(uint64_t); - - l_err = deviceRead((TARGETING::Target *)i_target, - &l_data, - l_size, - DEVICE_SCOM_ADDRESS(i_address)); - - if (!l_err) - { - l_ecmdRc = o_data.setBitLength(64); - l_ecmdRc |= o_data.setDoubleWord(0, l_data); - if (l_ecmdRc) - { - /*@ - * @errortype - * @reasoncode TOD_ECMD_ERROR - * @moduleid TOD_GETSCOM - * @userdata1 return code from ecmdDataBufferBase operation(s) - * @devdesc Scom access error - */ - l_err = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_INFORMATIONAL, - TOD_LOG_UNSUPORTED_ORDINALID, - TOD_UNSUPORTED_ORDINALID, - l_ecmdRc, 0 ); - } - } - - return l_err; -} - -//****************************************************************************** -//getFuncNodeTargetsOnSystem -//****************************************************************************** -errlHndl_t getFuncNodeTargetsOnSystem(const TARGETING::Target* - i_pInputTarget, TARGETING::TargetHandleList& - o_functionalNodeTargetList) -{ - TOD_ENTER("getFuncNodeTargetsOnSystem"); - errlHndl_t l_errHdl = NULL; - o_functionalNodeTargetList.clear(); - - do{ - if (i_pInputTarget == NULL ) - { - TOD_ERR("NULL target passed in the call to method " - "getFuncNodeTargetsOnSystem "); - /*@ - * @errortype - * @reasoncode TOD_NULL_INPUT_TARGET - * @moduleid TOD_GETFUNCNODETARGETSONSYSTEM - * @userdata1 HUID of the target that was validated - * @devdesc Scom access error - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_INFORMATIONAL, - TOD_GETFUNCNODETARGETSONSYSTEM, - TOD_NULL_INPUT_TARGET ); - break; - } - - CLASS l_class = i_pInputTarget->getAttr<ATTR_CLASS>(); - TYPE l_type = i_pInputTarget->getAttr<ATTR_TYPE>(); - - if((TARGETING::CLASS_SYS == l_class) && - (TARGETING::TYPE_SYS == l_type))//System target - { - //create the predicate with CLASS_ENC and TYPE_NODE - TARGETING::PredicateCTM - l_nodeFilter(TARGETING::CLASS_ENC,TARGETING::TYPE_NODE); - - //Use PredicateIsFunctional to filter only functional nodes - TARGETING::PredicateIsFunctional l_isFunctional; - TARGETING::PredicatePostfixExpr l_functionalAndNodeFilter; - - l_functionalAndNodeFilter.push(&l_nodeFilter). - push(&l_isFunctional).And(); - - //Create an iterator to loop over the selected targets - TARGETING::TargetRangeFilter l_pFuncNode( - TARGETING::targetService().begin(), - TARGETING::targetService().end(), - &l_functionalAndNodeFilter ); - - for ( ; l_pFuncNode ; ++l_pFuncNode) - { - o_functionalNodeTargetList.push_back(*l_pFuncNode); - } - } - else if ((TARGETING::CLASS_ENC == l_class ) && - (TARGETING::TYPE_NODE == l_type )) //Node target - { - if (i_pInputTarget->getAttr<ATTR_HWAS_STATE>().functional) - { - o_functionalNodeTargetList.push_back( - const_cast<TARGETING::Target*>(i_pInputTarget)); - } - else - { - TOD_ERR("Failed to get the functional state for target 0x%08X", - i_pInputTarget->getAttr<TARGETING::ATTR_HUID>()); - break; - } - } - else - { - TOD_ERR("Invalid target 0x%08X passed in the call to method " - "getFuncNodeTargetsOnSystem ", - i_pInputTarget->getAttr<TARGETING::ATTR_HUID>()); - /*@ - * @errortype - * @reasoncode TOD_INVALID_TARGET - * @moduleid TOD_GETFUNCNODETARGETSONSYSTEM - * @userdata1 HUID of the target that was validated - * @devdesc Scom access error - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_INFORMATIONAL, - TOD_GETFUNCNODETARGETSONSYSTEM, - TOD_INVALID_TARGET, - i_pInputTarget->getAttr<TARGETING::ATTR_HUID>()); - break; - } - }while(0); - - if ( l_errHdl ) - { - o_functionalNodeTargetList.clear(); - } - - TOD_EXIT("getFuncNodeTargetsOnSystem. errHdl = %p", l_errHdl); - return l_errHdl; -} - -} //End of namespace TOD diff --git a/src/usr/hwpf/hwp/tod_init/TodSvcUtil.H b/src/usr/hwpf/hwp/tod_init/TodSvcUtil.H deleted file mode 100755 index b87a973a3..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodSvcUtil.H +++ /dev/null @@ -1,161 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodSvcUtil.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -/** - * @file TodSvcUtil.H - * - * @brief This file declares the various utility methods - * - * HWP_IGNORE_VERSION_CHECK - * - */ - -#ifndef TODSVCUTIL_H -#define TODSVCUTIL_H - -#include <errl/errlentry.H> -#include <ecmddatabuffer/ecmdDataBufferBase.H> - -namespace TOD -{ - /** - * @brief Method to create an errlHndl_t object for - * TOD_INVALID_CONFIG error - * - * @par Detailed Description: - * This will be logged if during the course of TOD operation an - * anomaly was found with the topology configuration or - * its related data. - * - * @param[in] i_config - * The problematic configuration Primary/Secondary - * - * @param[out] io_errHdl - * On input this parameter will be either NULL or pointing to - * an existing error handle. - * On output this parameter will either have a newly created handle - * assigned to it ( If input parameter was NULL ) or a new SRC will be - * appened to existing error handle ( If the input was not NULL ) - * @return NA - */ - void logInvalidTodConfig(const uint32_t i_config, - errlHndl_t& io_errHdl); - - /** - * @brief Method to create an errlHndl_t object for - * TOD_UNSUPPORTED_ORDINALID - * - * @par Detailed Description: - * The ordinal Id's of TOD procs should fall within the range of 0 - * <= Ordinal Id < getMaxProcsOnSystem. - * getMaxProcsOnSystem defines static count of the array of - * hwsvTodChipData structures that will be written in the file - * shared between HWSV and HDAT. - * Each hwsvTodChipData structure contains TOD chip register data - * for a specific chip. - * This error will be logged if at any point of time because of - * changes in system configuration the no. of proc chips becomes - * equal to or more than getMaxProcsOnSystem, and corresponding - * support still does not exist in TOD code and HDAT - * - * @param[in] i_ordId - * The ordinal Id that was found to be unsupported - * - * @param[out] io_errHdl - * On input this parameter will be either NULL or pointing to - * an existing error handle. - * On output this parameter will either have a newly created handle - * assigned to it ( If input parameter was NULL ) or a new SRC will be - * appened to existing error handle ( If the input was not NULL ) - * @return NA - * - */ - void logUnsupportedOrdinalId(const uint32_t i_ordId, - errlHndl_t& io_errHdl); - - /** - * - * @brief This method finds out the maximum number of proc chips that are - * possible on fully configured system of this type - * - * @return Count of procs - * The method should succeed always - */ - uint32_t getMaxProcsOnSystem(); - - - /** - * - * @brief This method finds out the maximum number of cores that is - * possible per proc for fully configured system of this type - * - * @return Count of cores - * The method should succeed always - */ - uint32_t getMaxPossibleCoresPerProc(); - - /** - * @brief This method read the scom register - * - * @param[in] i_target : target object - * @param[in] i_address : SCOM register address - * - * @param[out] o_data : content of the register if no error - * - * @return errlHndl_t : NULL if ok. Otherwise, there is an error - */ - errlHndl_t todGetScom(const TARGETING::Target * i_target, - const uint64_t i_address, - ecmdDataBufferBase & o_data); - - /** - * - * @brief This method will get the list of functional node target - * pointers for the supplied target that can be a node or system - * type. - * - * @par Detailed Description: - * If the input target is a system level target then target - * pointers for all the functional nodes in system will be - * collected. - * If the target sent is of node type then the method will simply - * push back the target that has been passed as argument, provided - * it is functional - * - * @param[in] i_pInputTarget - * Target sent as input to this method - * - * @param[out] o_functionalNodeTargetList - * List of functional node targets collected by the method - * @return Error log handle to carry back status of request - * @retval !NULL Indicates an error in collecting the node target.This - * can happen if input target is neither of system/node - * type. In error case o_functionalNodeTargetList will be empty. - * @retval NULL Indicates that there was no error in getting the targets. - */ - errlHndl_t getFuncNodeTargetsOnSystem(const TARGETING::Target * i_target, - TARGETING::TargetHandleList& o_functionalNodeTargetList); - -} //End of namespace TOD - -#endif diff --git a/src/usr/hwpf/hwp/tod_init/TodTopologyManager.C b/src/usr/hwpf/hwp/tod_init/TodTopologyManager.C deleted file mode 100755 index 6febabc77..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodTopologyManager.C +++ /dev/null @@ -1,617 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodTopologyManager.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -/** - * @file TodTopologyManager.C - * - * @brief TOD Topology Manager class implementation. Responsible for - * creating/modifying the primary and secondary topologies. - * - * HWP_IGNORE_VERSION_CHECK - * - */ - -#include <targeting/common/target.H> -#include <targeting/common/targetservice.H> -#include <tod_init/tod_init_reasoncodes.H> -#include "TodTopologyManager.H" -#include "TodControls.H" -#include "TodDrawer.H" -#include "TodProc.H" -#include "TodTrace.H" - -using namespace TARGETING; - -namespace TOD -{ - -//------------------------------------------------------------------------------ -//Global defines -//------------------------------------------------------------------------------ -//Strings used in topology/register dump to fsp-trace -static const char* TOD_PRIMARY_TOPOLOGY = "PRIMARY"; -static const char* TOD_SECONDARY_TOPOLOGY = "SECONDARY"; -static const char* NO_BUS = "NONE"; -static const char* X_BUS_0 = "XBUS0"; -static const char* X_BUS_1 = "XBUS1"; -static const char* X_BUS_2 = "XBUS2"; -static const char* X_BUS_3 = "XBUS3"; -static const char* A_BUS_0 = "ABUS0"; -static const char* A_BUS_1 = "ABUS1"; -static const char* A_BUS_2 = "ABUS2"; - -//****************************************************************************** -//TodTopologyManager::TodTopologyManager -//****************************************************************************** -TodTopologyManager::TodTopologyManager( - const proc_tod_setup_tod_sel i_topologyType) : - iv_topologyType(i_topologyType) -{ - TOD_ENTER("Topology type 0X%.8X", i_topologyType); - - TOD_EXIT("TodTopologyManager constructor"); -} - -//****************************************************************************** -//TodTopologyManager::~TodTopologyManager -//****************************************************************************** -TodTopologyManager::~TodTopologyManager() -{ - TOD_ENTER("TodTopologyManager destructor"); - - TOD_EXIT("TodTopologyManager destructor"); -} - -//****************************************************************************** -//TodTopologyManager::create -//****************************************************************************** -errlHndl_t TodTopologyManager::create() -{ - TOD_ENTER("create"); - - errlHndl_t l_errHdl = NULL; - - //The topology creation algorithm goes as follows : - //1)Pick the MDMT. - //2)In the master TOD drawer (the one in which MDMT lies), - //wire the procs together. - //3)Connect the MDMT to one processor in each of the slave TOD drawers - //(the TOD drawers other than the master TOD drawer) - //4)Wire the procs in the slave TOD drawers. - do - { - //1) Pick the MDMT. - l_errHdl = TodControls::getTheInstance().pickMdmt(iv_topologyType); - if(l_errHdl) - { - TOD_ERR("Couldn't pick MDMT."); - break; - } - - //Get the TOD drawers - TodDrawerContainer l_todDrwList; - TodControls::getTheInstance().getDrawers(iv_topologyType, - l_todDrwList); - //Find the TOD system master drawer (the one in which the MDMT lies) - TodDrawer* l_pMasterDrawer = NULL; - for(TodDrawerContainer::const_iterator l_itr = l_todDrwList.begin(); - l_itr != l_todDrwList.end(); - ++l_itr) - { - if((*l_itr)->isMaster()) - { - l_pMasterDrawer = *l_itr; - TOD_INF("TOD drawer(0x%.2X) is the master drawer", - l_pMasterDrawer->getId()); - break; - } - } - if(NULL == l_pMasterDrawer) - { - TOD_ERR("TOD master drawer not found"); - /*@ - * @errortype - * @reasoncode TOD_CREATION_ERR - * @moduleid TOD_TOPOLOGY_CREATE - * @userdata1 Topology type : primary/secondary - * @devdesc TOD master drawer not found - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_INFORMATIONAL, - TOD_TOPOLOGY_CREATE, - TOD_CREATION_ERR, - iv_topologyType ); - break; - } - - //2)In the master TOD drawer, wire the procs together. - l_errHdl = wireProcs(l_pMasterDrawer); - if(l_errHdl) - { - TOD_ERR("Couldn't wire one or more processors for " - "the master TOD drawer(0x%.2X)", - l_pMasterDrawer->getId()); - break; - } - - //3)Connect the MDMT to one processor in each of the TOD drawers - //other than the master TOD drawer. - for(TodDrawerContainer::iterator l_itr = l_todDrwList.begin(); - l_itr != l_todDrwList.end(); - ++l_itr) - { - if((*l_itr)->isMaster()) - { - //This is the master TOD drawer, we are connecting other - //TOD drawers to this. - continue; - } - l_errHdl = wireTodDrawer(*l_itr); - if(l_errHdl) - { - TOD_ERR("Couldn't wire TOD drawer(0x%.2X) to MDMT.", - (*l_itr)->getId()); - break; - } - } - if(l_errHdl) - { - break; - } - - //4)Wire the procs in the other TOD drawers (i.e other than the master) - for(TodDrawerContainer::const_iterator l_itr = - l_todDrwList.begin(); - l_itr != l_todDrwList.end(); - ++l_itr) - { - if((*l_itr)->isMaster()) - { - //We've done this already for the master TOD drawer - continue; - } - l_errHdl = wireProcs(*l_itr); - if(l_errHdl) - { - TOD_ERR("Couldn't wire one or more processors for " - "TOD drawer(0x%.2X).", - (*l_itr)->getId()); - break; - } - } - if(l_errHdl) - { - break; - } - }while(0); - - TOD_EXIT("create. errHdl = %p", l_errHdl); - - return l_errHdl; -} - -//****************************************************************************** -//TodTopologyManager::wireProcs -//****************************************************************************** -errlHndl_t TodTopologyManager::wireProcs(const TodDrawer* i_pTodDrawer) -{ - TOD_ENTER("wireProcs"); - - errlHndl_t l_errHdl = NULL; - - do - { - if(NULL == i_pTodDrawer) - { - TOD_ERR("TOD drawer not specified"); - /*@ - * @errortype - * @reasoncode TOD_CREATION_ERR_NO_DRAWER - * @moduleid TOD_WIRE_PROCS - * @userdata1 Topology type : primary/secondary - * @devdesc TOD drawer not specified - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_INFORMATIONAL, - TOD_WIRE_PROCS, - TOD_CREATION_ERR_NO_DRAWER, - iv_topologyType ); - break; - } - - TOD_INF("TOD drawer id %d", i_pTodDrawer->getId()); - - //The algorithm to wire procs in a TOD drawer goes as follows : - /* - Have a "sources" list which initially has only the drawer master - Have a "targets" list which has all the other procs. - While the sources list isn't empty, for each source "s" in sources - For each target "t" in targets - If s connects t via X bus - Remove t from targets and add it to sources, - since it's now a potential source - If targets isn't empty, we couldn't wire one or more procs - */ - - //Get the targets - TodProcContainer l_targetsList = i_pTodDrawer->getProcs(); - - //Check if we have procs to wire in the first place - if(l_targetsList.empty()) - { - TOD_INF("Nothing to wire on TOD drawer(0x%.2X)", - i_pTodDrawer->getId()); - break; - } - - //Push the drawer master onto the sources list - TodProc* l_pDrawerMaster = NULL; - l_errHdl = i_pTodDrawer->findMasterProc(l_pDrawerMaster); - if(l_errHdl) - { - TOD_ERR("Master TOD proc not set for TOD drawer(0x%.2X)", - i_pTodDrawer->getId()); - break; - } - TodProcContainer l_sourcesList; - l_sourcesList.push_back(l_pDrawerMaster); - - //Start connecting targets to sources - TodProcContainer::iterator l_sourceItr = l_sourcesList.begin(); - TodProcContainer::iterator l_targetItr; - bool l_connected = false; - while((NULL == l_errHdl) && (l_sourcesList.end() != l_sourceItr)) - { - for(l_targetItr = l_targetsList.begin(); - l_targetItr != l_targetsList.end();) - { - l_errHdl = (*l_sourceItr)->connect(*l_targetItr, - TARGETING::TYPE_XBUS, - l_connected); - if(l_errHdl) - { - TOD_ERR("Error tying to connect target 0x%.8X " - "to source 0x%.8X.", - (*l_targetItr)->getTarget()->getAttr<ATTR_HUID>(), - (*l_sourceItr)->getTarget()->getAttr<ATTR_HUID>()); - break; - } - if(l_connected) - { - //Prefer push_back to push_front since in case of multiple - //X bus path alternatives, the paths and hence the TOD - //delays will be shorter. - l_sourcesList.push_back(*l_targetItr); - (*l_sourceItr)->addChild(*l_targetItr); - l_targetItr = l_targetsList.erase(l_targetItr); - } - else - { - ++l_targetItr; - } - } - ++l_sourceItr; - } - if(l_errHdl) - { - break; - } - if(false == l_targetsList.empty()) - { - //We couldn't connect one or more procs in this drawer - TOD_ERR("TOD drawer(0x%.2X) has one or more procs not connected. " - "0x%.8X is the first such proc.", - i_pTodDrawer->getId(), - (*(l_targetsList.begin()))->getTarget()->getAttr<ATTR_HUID>()); - /*@ - * @errortype - * @reasoncode TOD_CREATION_ERR - * @moduleid TOD_WIRE_PROCS - * @userdata1 DrawerId = bit[0:31], Topology type = bit[32:63] - * @userdata2 HUID of first disconnected proc - * @devdesc TOD drawer has one or more disconnected procs - */ - uint64_t l_data = i_pTodDrawer->getId(); - l_data <<= 32; - l_data |= iv_topologyType; - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_INFORMATIONAL, - TOD_WIRE_PROCS, - TOD_CREATION_ERR, - l_data, - (*(l_targetsList.begin()))->getTarget()-> - getAttr<ATTR_HUID>()); - break; - } - }while(0); - - TOD_EXIT("wireProcs. errHdl = %p", l_errHdl); - - return l_errHdl; -} - -//****************************************************************************** -//TodTopologyManager::wireTodDrawer -//****************************************************************************** -errlHndl_t TodTopologyManager::wireTodDrawer(TodDrawer* i_pTodDrawer) -{ - TOD_ENTER("wireTodDrawer"); - - errlHndl_t l_errHdl = NULL; - - do - { - if(NULL == i_pTodDrawer) - { - TOD_ERR("TOD drawer not specified"); - /*@ - * @errortype - * @reasoncode TOD_CREATION_ERR - * @moduleid TOD_WIRE_DRAWERS - * @userdata1 Topology type : primary/secondary - * @devdesc TOD drawer not specified - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_INFORMATIONAL, - TOD_WIRE_DRAWERS, - TOD_CREATION_ERR, - iv_topologyType); - break; - } - - TOD_INF("TOD drawer id %d", i_pTodDrawer->getId()); - - //The algorithm to wire the slave TOD drawers to the mater TOD - //drawer (to the MDMT to be specific) goes as follows : - /* - For each slave TOD drawer "d" - For each proc "p" in d - If MDMT connects p via A bus - we are done, exit - */ - - //Get the MDMT - TodProc* l_pMDMT = - TodControls::getTheInstance().getMDMT(iv_topologyType); - if(NULL == l_pMDMT) - { - TOD_ERR("MDMT not found for topology type 0X%.8X", - iv_topologyType); - /*@ - * @errortype - * @reasoncode TOD_NO_MASTER_PROC - * @moduleid TOD_WIRE_DRAWERS - * @userdata1 Topology type : primary/secondary - * @devdesc MDMT could not be found - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_INFORMATIONAL, - TOD_WIRE_DRAWERS, - TOD_NO_MASTER_PROC, - iv_topologyType); - break; - } - - //Get the procs in this TOD drawer - TodProcContainer l_procs = i_pTodDrawer->getProcs(); - - //Check if we have procs - if(l_procs.empty()) - { - TOD_INF("Nothing to wire on TOD drawer(0x%.2X)", - i_pTodDrawer->getId()); - break; - } - - //Find a proc which connects to the MDMT via A bus - bool l_connected = false; - TodProcContainer::iterator l_itr; - for(l_itr = l_procs.begin(); - l_itr != l_procs.end(); - ++l_itr) - { - l_errHdl = l_pMDMT->connect(*l_itr, - TARGETING::TYPE_ABUS, - l_connected); - if(l_errHdl) - { - TOD_ERR("Error tying to connect target 0x%.4X " - "to MDMT 0x%.8X.", - (*l_itr)->getTarget()->getAttr<ATTR_HUID>(), - l_pMDMT->getTarget()->getAttr<ATTR_HUID>()); - break; - } - if(l_connected) - { - //Found a proc, designate this as the SDMT for this TOD drawer. - l_pMDMT->addChild(*l_itr); - (*l_itr)->setMasterType(TodProc::DRAWER_MASTER); - break; - } - } - if(l_errHdl) - { - break; - } - if(l_procs.end() == l_itr) - { - TOD_ERR("TOD drawer(0x%.2X) couldn't be wired", - i_pTodDrawer->getId()); - /*@ - * @errortype - * @reasoncode TOD_CANNOT_WIRE_DRAWER - * @moduleid TOD_WIRE_DRAWERS - * @userdata1 Topology type : primary/secondary - * @userdata2 TOD drawer id - * @devdesc TOD drawer couldn't be wired - */ - l_errHdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_INFORMATIONAL, - TOD_WIRE_DRAWERS, - TOD_CANNOT_WIRE_DRAWER, - iv_topologyType, - i_pTodDrawer->getId()); - break; - } - }while(0); - - TOD_EXIT("wireTodDrawer. errHdl = %p", l_errHdl); - - return l_errHdl; -} - -//****************************************************************************** -//TodTopologyManager::dumpTopology -//****************************************************************************** -void TodTopologyManager::dumpTopology() const -{ - TOD_ENTER("dumpTopology"); - - static const char* busnames[8] = {0}; - busnames[NONE] = NO_BUS; - busnames[XBUS0] = X_BUS_0; - busnames[XBUS1] = X_BUS_1; - busnames[XBUS2] = X_BUS_2; - busnames[XBUS3] = X_BUS_3; - busnames[ABUS0] = A_BUS_0; - busnames[ABUS1] = A_BUS_1; - busnames[ABUS2] = A_BUS_2; - - static const char* topologynames[2] = {0}; - topologynames[TOD_PRIMARY] = TOD_PRIMARY_TOPOLOGY; - topologynames[TOD_SECONDARY] = TOD_SECONDARY_TOPOLOGY; - - do - { - //Dump the inter and intra TOD drawer connections - TOD_INF("TOPOLOGY DUMP> Start, topology type %s", - topologynames[iv_topologyType]); - //Get the TOD drawers - TodDrawerContainer l_todDrwList; - TodControls::getTheInstance().getDrawers(iv_topologyType, l_todDrwList); - TodDrawerContainer::const_iterator l_drwItr = l_todDrwList.begin(); - while(l_todDrwList.end() != l_drwItr) - { - TOD_INF("TOPOLOGY DUMP> TOD Drawer(0x%.2X)",(*l_drwItr)->getId()); - //Get the procs on this drawer - TodProcContainer l_procList = (*l_drwItr)->getProcs(); - - TOD_INF("TOPOLOGY DUMP> " - "parent_huid---bus out---bus in---child_huid"); - TodProcContainer::const_iterator l_procItr = l_procList.begin(); - while(l_procList.end() != l_procItr) - { - //Get the children for this TOD proc - TodProcContainer l_childList; - (*l_procItr)->getChildren(l_childList); - TodProcContainer::const_iterator l_childItr = - l_childList.begin(); - while(l_childList.end() != l_childItr) - { - TOD_INF("TOPOLOGY DUMP> 0x%08X---%s---%s---0x%08X", - (*l_procItr)->getTarget()->getAttr<ATTR_HUID>(), - busnames[(*l_childItr)->getBusIn()], - busnames[(*l_childItr)->getBusOut()], - (*l_childItr)->getTarget()->getAttr<ATTR_HUID>()); - ++l_childItr; - } - ++l_procItr; - } - ++l_drwItr; - } - TOD_INF("TOPOLOGY DUMP> End"); - }while(0); - - TOD_EXIT("dumpTopology"); -} - -//****************************************************************************** -//TodTopologyManager::dumpTodRegs -//****************************************************************************** -void TodTopologyManager::dumpTodRegs() const -{ - TOD_ENTER("dumpTodRegs"); - - static const char* topologynames[2] = {0}; - topologynames[TOD_PRIMARY] = TOD_PRIMARY_TOPOLOGY; - topologynames[TOD_SECONDARY] = TOD_SECONDARY_TOPOLOGY; - - do - { - TOD_INF("TOD REGDUMP> Start, topology type %s", - topologynames[iv_topologyType]); - //Get the TOD drawers - TodDrawerContainer l_todDrwList; - TodControls::getTheInstance().getDrawers(iv_topologyType, l_todDrwList); - TodDrawerContainer::const_iterator l_drwItr = l_todDrwList.begin(); - while(l_todDrwList.end() != l_drwItr) - { - TOD_INF("TOD REGDUMP> TOD Drawer(0x%.2X)",(*l_drwItr)->getId()); - //Get the procs on this drawer - TodProcContainer l_procList = (*l_drwItr)->getProcs(); - TodProcContainer::const_iterator l_procItr = l_procList.begin(); - while(l_procList.end() != l_procItr) - { - TOD_INF("TOD REGDUMP> Proc HUID 0x%.8X", - (*l_procItr)->getTarget()->getAttr<ATTR_HUID>()); - if(TodProc::TOD_MASTER == (*l_procItr)->getMasterType()) - { - TOD_INF("TOD REGDUMP> This proc is the MDMT"); - } - else if(TodProc::DRAWER_MASTER == (*l_procItr)->getMasterType()) - { - TOD_INF("TOD REGDUMP> This proc is the SDMT " - " for this drawer"); - } - proc_tod_setup_conf_regs l_todRegs; - (*l_procItr)->getTodRegs(l_todRegs); - TOD_INF("TOD REGDUMP> MASTER PATH CONTROL REG 0x%.16llX", - l_todRegs.tod_m_path_ctrl_reg.getDoubleWord(0)); - TOD_INF("TOD REGDUMP> PORT 0 PRIMARY CONFIG REG 0x%.16llX", - l_todRegs.tod_pri_port_0_ctrl_reg.getDoubleWord(0)); - TOD_INF("TOD REGDUMP> PORT 1 PRIMARY CONFIG REG 0x%.16llX", - l_todRegs.tod_pri_port_1_ctrl_reg.getDoubleWord(0)); - TOD_INF("TOD REGDUMP> PORT 0 SECONDARY CONFIG REG 0x%.16llX", - l_todRegs.tod_sec_port_0_ctrl_reg.getDoubleWord(0)); - TOD_INF("TOD REGDUMP> PORT 1 SECONDARY CONFIG REG 0x%.16llX", - l_todRegs.tod_sec_port_1_ctrl_reg.getDoubleWord(0)); - TOD_INF("TOD REGDUMP> SLAVE PATH CONTROL REG 0x%.16llX", - l_todRegs.tod_s_path_ctrl_reg.getDoubleWord(0)); - TOD_INF("TOD REGDUMP> INTERNAL PATH CONTROL REG 0x%.16llX", - l_todRegs.tod_i_path_ctrl_reg.getDoubleWord(0)); - TOD_INF("TOD REGDUMP> PRIMARY/SECONDARY MASTER/SLAVE CONTROL" - " REG 0x%.16llX", - l_todRegs.tod_pss_mss_ctrl_reg.getDoubleWord(0)); - TOD_INF("TOD REGDUMP> CHIP CONTROL REG 0x%.16llX", - l_todRegs.tod_chip_ctrl_reg.getDoubleWord(0)); - ++l_procItr; - } - ++l_drwItr; - } - TOD_INF("TOD REGDUMP> End"); - }while(0); - - TOD_EXIT("dumpTodRegs"); -} - -} //namespace TOD diff --git a/src/usr/hwpf/hwp/tod_init/TodTopologyManager.H b/src/usr/hwpf/hwp/tod_init/TodTopologyManager.H deleted file mode 100755 index a3b1844f7..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodTopologyManager.H +++ /dev/null @@ -1,169 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodTopologyManager.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -#ifndef TODTOPOLOGYMANAGER_H -#define TODTOPOLOGYMANAGER_H - -/** - * @file TodTopologyManager.H - * - * @brief TOD Topology Manager class definition. Responsible for - * creating/modifying the primary and secondary topologies - * - * HWP_IGNORE_VERSION_CHECK - * - */ - -#include <errl/errlentry.H> -#include "proc_tod_utils/proc_tod_utils.H" - -namespace TOD -{ - -//------------------------------------------------------------------------------ -//Forward declarations -//------------------------------------------------------------------------------ -class TodDrawer; - -class TodTopologyManager -{ -public: - /** - * @brief Constructor. - * - * @par Detailed Description: - * Create a topology manager by specifying the type : - * TOD_PRIMARY/TOD_SECONDARY. Having separate managers - * for the primary/secondary topology allows exclusive - * operations on the topology and a greater degree of - * error management. - * - * @param[in] i_type - * Primary(TOD_PRIMARY) or Secondary(TOD_SECONDARY) - */ - TodTopologyManager(const proc_tod_setup_tod_sel i_type); - - /** - * @brief Destructor. - */ - ~TodTopologyManager(); - - /** - * @brief Create a TOD topology - * - * @par Detailed Description: - * The topology creation algorithm goes as follows: - * 1)Pick the MDMT. - * 2)In the master TOD drawer (the one in which MDMT lies), - * wire the procs together. - * 3)Connect the MDMT to one processor in each of the slave TOD drawers - * (the TOD drawers other than the master TOD drawer). - * 4)Wire the procs in the slave TOD drawers. - * - * @return Error log handle indicating the status of the request. - * @retval NULL if successful - * @retval !NULL if failed to create topology - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ - errlHndl_t create(); - - /** - * @brief Dumps the topology connections in this format to fsp-trace: - * parent---bus out---bus in---child. An example would be - * pu:k0:n0:s0:p00---XBUS1---XBUS1---pu:k0:n0:s0:p01 - * - * @return N/A - */ - void dumpTopology() const; - - /** - * @brief Dumps the TOD register values that the hardware procedure - * supplied us with to fsp-trace. Check proc_tod_utils.H : - * proc_tod_setup_conf_regs for the list of registers. - * - * @return N/A - */ - void dumpTodRegs() const; - -private: - /** - * @brief Wires, or sets the X bus connection paths between - * processors in the input TOD drawer - * - * @param[in] i_pTodDrawer - * Pointer to a HwsvTodDrawer - * - * @return Error log handle indicating the status of the request. - * @retval NULL if successful - * @retval !NULL if failed to wire one or more procs in the TOD drawer - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ - errlHndl_t wireProcs(const TodDrawer* i_pTodDrawer); - - /** - * @brief Wires, or sets the A bus connection paths between - * the MDMT and one of the processors in the input TOD - * drawer (thus designating that processor as the SDMT). - * - * @param[in] i_pTodDrawer - * Pointer to a TodDrawer - * - * @return Error log handle indicating the status of the request. - * @retval NULL if successful - * @retval !NULL if failed to connect the MDMT to any processor in the - * input TOD drawer. - * - * Error log handle points to a valid error log object whose primary - * SRC reason code (pError->getSRC()->reasonCode()) indicates the type - * of error. - * - * @note It is up to the caller to change the severity of the - * returned error based on what it decides to do with it. By default - * any returned error created by this function will be a non-reported - * tracing event error log. - */ - errlHndl_t wireTodDrawer(TodDrawer* i_pTodDrawer); - - //Holds the type of the topology this manager is working on : - //primary/secondary - proc_tod_setup_tod_sel iv_topologyType; -}; - -} //namespace TOD - -#endif //#define TODTOPOLOGYMANAGER_H diff --git a/src/usr/hwpf/hwp/tod_init/TodTrace.H b/src/usr/hwpf/hwp/tod_init/TodTrace.H deleted file mode 100644 index c41e966bc..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodTrace.H +++ /dev/null @@ -1,50 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodTrace.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -#ifndef TODTRACE_H -#define TODTRACE_H - -#include <tracinterface.H> - -namespace TOD -{ - -extern trace_desc_t * g_trac_tod; - -// field traces ------------------- - -#define TOD_TRAC(args...) TRACFCOMP(TOD::g_trac_tod, args) -#define TOD_ENTER(args...) TRACFCOMP(TOD::g_trac_tod, ENTER_MRK"" args) -#define TOD_EXIT(args...) TRACFCOMP(TOD::g_trac_tod, EXIT_MRK"" args) -#define TOD_ERR(args...) TRACFCOMP(TOD::g_trac_tod, ERR_MRK"" args) -#define TOD_INF(args...) TRACFCOMP(TOD::g_trac_tod, INFO_MRK"" args) - -// debug traces ------------------- - -#define TOD_DTRAC(args...) TRACDCOMP(TOD::g_trac_tod, args) -#define TOD_DENTER(args...) TRACDCOMP(TOD::g_trac_tod, ENTER_MRK"" args) -#define TOD_DEXIT(args...) TRACDCOMP(TOD::g_trac_tod, EXIT_MRK"" args) - -} - -#endif - diff --git a/src/usr/hwpf/hwp/tod_init/TodTypes.H b/src/usr/hwpf/hwp/tod_init/TodTypes.H deleted file mode 100755 index aacb21bdb..000000000 --- a/src/usr/hwpf/hwp/tod_init/TodTypes.H +++ /dev/null @@ -1,106 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/TodTypes.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -#ifndef TODTYPES_H -#define TODTYPES_H - -/** - * @file TodTypes.H - * - * @brief The file primarily conatins definition of data strucrtures that are - * required to share the tod topology register data between HB and HDAT. - * It also define the format of data that will be saved in file - * for persistency of TOD configuration data. - * - * HWP_IGNORE_VERSION_CHECK - * - */ - -namespace TOD -{ - - /** - * Enums for the TodChipHeader->flags, These values are defined as per - * details provided by HDAT data structure details provided by HDAT - */ - enum - { - TOD_NONE = 0x00000000, - TOD_SEC_MDMT = 0x00000001, - TOD_PRI_MDMT = 0x00000002, - TOD_FUNC = 0x00000004, - TOD_NONFUNC = 0x00000008, - }; - - - /** - * Sub structure of TodChipData, Represents the Chip ID details required - * by HDAT - * - */ - struct TodChipHeader - { - uint32_t chipID; //Chip ID - uint32_t flags; //Flags - TodChipHeader(void) : chipID(0),flags(TOD_NONFUNC) {} - }; - - /** - * Sub structure of TodChipData, That will contain the first 32 bits of - * all the TOD register values, that were populated during creation of the - * TOD topology. - * Out of the below register ipcr and ccr are required by HDAT. Others are - * there for persistancy - * - */ - struct TodRegs - { - uint32_t mpcr; //Master Path Control Register - uint32_t pcrp0; //Primary Configuration Register Port 0 - uint32_t pcrp1; //Primary Configuration Register Port 1 - uint32_t scrp0; //Secondary Configuration Register Port 0 - uint32_t scrp1; //Secondary Configuration Register Port 1 - uint32_t spcr; //Slave Path Control Register - uint32_t ipcr; //Internal Path Control Register - uint32_t psmscr; //Primary/Secondary Master/Slave Control Register - uint32_t ccr; //Chip Control Register - TodRegs(void) - : - mpcr(0),pcrp0(0),pcrp1(0),scrp0(0),scrp1(0), - spcr(0),ipcr(0),psmscr(0),ccr(0) - {} - }; - - /** - * TOD Data for each chip that HDAT will communicate - * to PHYP. - */ - struct TodChipData - { - TodChipHeader header; - TodRegs regs; - TodChipData(void) : header(), regs() {} - }; - -} //end of namespace - -#endif diff --git a/src/usr/hwpf/hwp/tod_init/makefile b/src/usr/hwpf/hwp/tod_init/makefile deleted file mode 100644 index fa8137de3..000000000 --- a/src/usr/hwpf/hwp/tod_init/makefile +++ /dev/null @@ -1,70 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/hwpf/hwp/tod_init/makefile $ -# -# OpenPOWER HostBoot Project -# -# COPYRIGHT International Business Machines Corp. 2013,2014 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. See the License for the specific language governing -# permissions and limitations under the License. -# -# IBM_PROLOG_END_TAG -ROOTPATH = ../../../../.. - -MODULE = tod_init - -## support for Targeting and fapi -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp - -## pointer to common HWP files -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/include - -## NOTE: add the base istep dir here. -##@ EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/@istepname -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/tod_init - -## Include sub dirs -## NOTE: add a new EXTRAINCDIR when you add a new HWP -##@ EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/??? -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/tod_init/proc_tod_setup -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/tod_init/proc_tod_save_config -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/tod_init/proc_tod_utils -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/tod_init/proc_tod_init - - -## NOTE: add new object files when you add a new HWP -OBJS += tod_init.o -OBJS += TodControls.o -OBJS += TodDrawer.o -OBJS += TodProc.o -OBJS += TodSvc.o -OBJS += TodSvcUtil.o -OBJS += TodHwpIntf.o -OBJS += TodTopologyManager.o -OBJS += proc_tod_setup.o -OBJS += proc_tod_save_config.o -OBJS += proc_tod_init.o -OBJS += proc_tod_utils.o - -## NOTE: add a new directory onto the vpaths when you add a new HWP -##@ VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/??? -VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/tod_init/proc_tod_setup -VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/tod_init/proc_tod_save_config -VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/tod_init/proc_tod_utils -VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/tod_init/proc_tod_init - -include ${ROOTPATH}/config.mk diff --git a/src/usr/hwpf/hwp/tod_init/proc_tod_init/proc_tod_init.C b/src/usr/hwpf/hwp/tod_init/proc_tod_init/proc_tod_init.C deleted file mode 100644 index 820863315..000000000 --- a/src/usr/hwpf/hwp/tod_init/proc_tod_init/proc_tod_init.C +++ /dev/null @@ -1,439 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/proc_tod_init/proc_tod_init.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2013,2014 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -// $Id: proc_tod_init.C,v 1.15 2014/10/23 18:56:17 jklazyns Exp $ -//------------------------------------------------------------------------------ -// *! (C) Copyright International Business Machines Corp. 2012 -// *! All Rights Reserved -- Property of IBM -// *! *** *** -// *! -// *! TITLE : proc_tod_init.C -// *! -// *! DESCRIPTION : Initializes the TOD topology to 'running' -// *! -// *! OWNER NAME : Nick Klazynski Email: jklazyns@us.ibm.com -// *! BACKUP NAME : Email: -// *! -// *! ADDITIONAL COMMENTS : -// *! -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// Includes -//------------------------------------------------------------------------------ -#include "proc_tod_utils.H" -#include "proc_tod_init.H" -#include "p8_scom_addresses.H" - -extern "C" -{ - -//------------------------------------------------------------------------------ -// Function definitions -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// function: proc_tod_init -// -// parameters: -// i_tod_node Reference to TOD topology (FAPI targets included within) -// -// i_failingTodProc, Pointer to the fapi target, the memory location -// addressed by this parameter will be populated with processor target -// which is not able to recieve proper singals from OSC. -// Caller needs to look at this parameter only when proc_tod_init fails -// and reason code indicates OSC failure. It is defaulted to NULL. -// -// returns: FAPI_RC_SUCCESS if TOD topology is successfully initialized -// else FAPI or ECMD error is sent through -//------------------------------------------------------------------------------ -fapi::ReturnCode proc_tod_init(const tod_topology_node* i_tod_node, - fapi::Target* i_failingTodProc ) -{ - fapi::ReturnCode rc; - - FAPI_INF("proc_tod_init: Start"); - do - { - if (i_tod_node == NULL) - { - FAPI_ERR("proc_tod_init: null node passed into function!"); - FAPI_SET_HWP_ERROR(rc, RC_PROC_TOD_NULL_NODE); - break; - } - - rc = proc_tod_clear_error_reg(i_tod_node); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_init: Failure clearing TOD error registers!"); - break; - } - - //Start configuring each node; (init_tod_node will recurse on each child) - rc = init_tod_node(i_tod_node,i_failingTodProc); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_init: Failure initializing TOD!"); - break; - } - - } while (0); - - FAPI_INF("proc_tod_init: End"); - return rc; -} - -//------------------------------------------------------------------------------ -// function: proc_tod_clear_error_reg -// -// parameters: i_tod_node Reference to TOD topology (FAPI targets included within) -// -// returns: FAPI_RC_SUCCESS if every TOD node is cleared of errors -// else FAPI or ECMD error is sent through -//------------------------------------------------------------------------------ -fapi::ReturnCode proc_tod_clear_error_reg(const tod_topology_node* i_tod_node) -{ - fapi::ReturnCode rc; - ecmdDataBufferBase data(64); - uint32_t rc_ecmd = 0; - fapi::Target* target = i_tod_node->i_target; - - FAPI_INF("proc_tod_clear_error_reg: Start"); - do - { - if (i_tod_node == NULL) - { - FAPI_ERR("proc_tod_clear_error_reg: null node passed into function!"); - FAPI_SET_HWP_ERROR(rc, RC_PROC_TOD_NULL_NODE); - break; - } - - FAPI_DBG("proc_tod_clear_error_reg: Clear any previous errors from TOD_ERROR_REG_00040030"); - rc_ecmd |= data.flushTo1(); - if (rc_ecmd) - { - FAPI_ERR("proc_tod_clear_error_reg: Error 0x%08X in ecmdDataBuffer setup for TOD_ERROR_REG_00040030.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(*target, TOD_ERROR_REG_00040030, data); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_clear_error_reg: Could not write TOD_ERROR_REG_00040030."); - break; - } - - for (std::list<tod_topology_node*>::const_iterator child = (i_tod_node->i_children).begin(); - child != (i_tod_node->i_children).end(); - ++child) - { - tod_topology_node* tod_node = *child; - rc = proc_tod_clear_error_reg(tod_node); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_clear_error_reg: Failure clearing errors from downstream node!"); - break; - } - } - if (!rc.ok()) - { - break; // error in above for loop - } - } while (0); - - FAPI_INF("proc_tod_clear_error_reg: End"); - return rc; -} - -//------------------------------------------------------------------------------ -// function: init_tod_node -// -// parameters: -// i_tod_node Reference to TOD topology (FAPI targets included within) -// -// i_failingTodProc, Pointer to the fapi target, the memory location -// addressed by this parameter will be populated with processor target -// which is not able to recieve proper singals from OSC. -// Caller needs to look at this parameter only when proc_tod_init fails -// and reason code indicates OSC failure. It is defaulted to NULL. -// -// returns: FAPI_RC_SUCCESS if TOD topology is successfully initialized -// else FAPI or ECMD error is sent through -//------------------------------------------------------------------------------ -fapi::ReturnCode init_tod_node(const tod_topology_node* i_tod_node, - fapi::Target* i_failingTodProc) -{ - fapi::ReturnCode rc; - ecmdDataBufferBase data(64); - uint32_t rc_ecmd = 0; - uint32_t tod_init_pending_count = 0; // Timeout counter for bits that are cleared by hardware - fapi::Target* target = i_tod_node->i_target; - - FAPI_INF("init_tod_node: Start: Initializing %s", target->toEcmdString()); - - do - { - const bool is_mdmt = (i_tod_node->i_tod_master && i_tod_node->i_drawer_master); - - if (is_mdmt) - { - FAPI_INF("init_tod_node: Master: Chip TOD step checkers enable"); - rc_ecmd |= data.flushTo0(); - rc_ecmd |= data.setBit(0); - if (rc_ecmd) - { - FAPI_ERR("init_tod_node: Error 0x%08X in ecmdDataBuffer setup for TOD_TX_TTYPE_2_REG_00040013 SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(*target, TOD_TX_TTYPE_2_REG_00040013, data); - if (!rc.ok()) - { - FAPI_ERR("init_tod_node: Could not write TOD_TX_TTYPE_2_REG_00040013."); - break; - } - - FAPI_INF("init_tod_node: Master: switch local Chip TOD to 'Not Set' state"); - rc_ecmd |= data.flushTo0(); - rc_ecmd |= data.setBit(TOD_LOAD_TOD_MOD_REG_FSM_LOAD_TOD_MOD_TRIG); - if (rc_ecmd) - { - FAPI_ERR("init_tod_node: Master: Error 0x%08X in ecmdDataBuffer setup for TOD_LOAD_TOD_MOD_REG_00040018 SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(*target, TOD_LOAD_TOD_MOD_REG_00040018, data); - if (!rc.ok()) - { - FAPI_ERR("init_tod_node: Master: Could not write TOD_LOAD_TOD_MOD_REG_00040018"); - break; - } - FAPI_INF("init_tod_node: Master: switch all Chip TOD in the system to 'Not Set' state"); - rc_ecmd |= data.flushTo0(); - rc_ecmd |= data.setBit(0); - if (rc_ecmd) - { - FAPI_ERR("init_tod_node: Master: Error 0x%08X in ecmdDataBuffer setup for TOD_TX_TTYPE_5_REG_00040016 SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(*target, TOD_TX_TTYPE_5_REG_00040016, data); - if (!rc.ok()) - { - FAPI_ERR("init_tod_node: Master: Could not write TOD_TX_TTYPE_5_REG_00040016"); - break; - } - - FAPI_INF("init_tod_node: Master: Chip TOD load value (move TB to TOD)"); - rc_ecmd |= data.flushTo0(); - rc_ecmd |= data.setWord(0,0x00000000); - rc_ecmd |= data.setWord(1,0x00003FF0); // bits 51:59 must be 1s - if (rc_ecmd) - { - FAPI_ERR("init_tod_node: Master: Error 0x%08X in ecmdDataBuffer setup for TOD_LOAD_TOD_REG_00040021 SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(*target, TOD_LOAD_TOD_REG_00040021, data); - if (!rc.ok()) - { - FAPI_ERR("init_tod_node: Master: Could not write TOD_LOAD_TOD_REG_00040021"); - break; - } - FAPI_INF("init_tod_node: Master: Chip TOD start_tod (switch local Chip TOD to 'Running' state)"); - rc_ecmd |= data.flushTo0(); - rc_ecmd |= data.setBit(TOD_START_TOD_REG_FSM_START_TOD_TRIGGER); - if (rc_ecmd) - { - FAPI_ERR("init_tod_node: Master: Error 0x%08X in ecmdDataBuffer setup for TOD_START_TOD_REG_00040022 SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(*target, TOD_START_TOD_REG_00040022, data); - if (!rc.ok()) - { - FAPI_ERR("init_tod_node: Master: Could not write TOD_START_TOD_REG_00040022"); - break; - } - - FAPI_INF("init_tod_node: Master: Send local Chip TOD value to all Chip TODs"); - rc_ecmd |= data.flushTo0(); - rc_ecmd |= data.setBit(0); - if (rc_ecmd) - { - FAPI_ERR("init_tod_node: Master: Error 0x%08X in ecmdDataBuffer setup for TOD_TX_TTYPE_4_REG_00040015", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(*target, TOD_TX_TTYPE_4_REG_00040015, data); - if (!rc.ok()) - { - FAPI_ERR("init_tod_node: Master: Could not write TOD_TX_TTYPE_4_REG_00040015"); - break; - } - } - - FAPI_INF("init_tod_node: Check TOD is Running"); - tod_init_pending_count = 0; - while (tod_init_pending_count < PROC_TOD_UTIL_TIMEOUT_COUNT) - { - FAPI_DBG("init_tod_node: Waiting for TOD to assert TOD_FSM_REG_TOD_IS_RUNNING..."); - - rc = fapiDelay(PROC_TOD_UTILS_HW_NS_DELAY, - PROC_TOD_UTILS_SIM_CYCLE_DELAY); - if (!rc.ok()) - { - FAPI_ERR("init_tod_node: fapiDelay error"); - break; - } - rc = fapiGetScom(*target, TOD_FSM_REG_00040024, data); - if (!rc.ok()) - { - FAPI_ERR("init_tod_node: Could not retrieve TOD_FSM_REG_00040024"); - break; - } - if (data.isBitSet(TOD_FSM_REG_TOD_IS_RUNNING)) - { - FAPI_INF("init_tod_node: TOD is running!"); - break; - } - ++tod_init_pending_count; - } - if (!rc.ok()) - { - break; // error in above while loop - } - if (tod_init_pending_count>=PROC_TOD_UTIL_TIMEOUT_COUNT) - { - FAPI_ERR("init_tod_node: TOD is not running! (It should be)"); - const fapi::Target & CHIP_TARGET = *target; - FAPI_SET_HWP_ERROR(rc, RC_PROC_TOD_INIT_NOT_RUNNING); - break; - } - - FAPI_INF("init_tod_node: clear TTYPE#2, TTYPE#4, and TTYPE#5 status"); - rc_ecmd |= data.flushTo0(); - rc_ecmd |= data.setBit(TOD_ERROR_REG_RX_TTYPE_2); - rc_ecmd |= data.setBit(TOD_ERROR_REG_RX_TTYPE_4); - rc_ecmd |= data.setBit(TOD_ERROR_REG_RX_TTYPE_5); - if (rc_ecmd) - { - FAPI_ERR("init_tod_node: Error 0x%08X in ecmdDataBuffer setup for TOD_ERROR_REG_00040030.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(*target, TOD_ERROR_REG_00040030, data); - if (!rc.ok()) - { - FAPI_ERR("init_tod_node: Could not write TOD_ERROR_REG_00040030."); - break; - } - - FAPI_INF("init_tod_node: checking for TOD errors"); - rc = fapiGetScom(*target, TOD_ERROR_REG_00040030, data); - if (!rc.ok()) - { - FAPI_ERR("init_tod_node: Could not read TOD_ERROR_REG_00040030."); - break; - } - if (data.getDoubleWord(0) != 0) - { - const fapi::Target & CHIP_TARGET = *target; - const uint64_t TOD_ERROR_REG = data.getDoubleWord(0); - if (data.isBitSet(TOD_ERROR_REG_M_PATH_0_STEP_CHECK_ERROR)) - { - FAPI_ERR("init_tod_node: M_PATH_0_STEP_CHECK_ERROR! (TOD_ERROR_REG = 0x%016llX)",data.getDoubleWord(0)); - FAPI_SET_HWP_ERROR(rc, RC_PROC_TOD_INIT_M_PATH_0_STEP_CHECK_ERROR); - *i_failingTodProc = *target; - } - else if (data.isBitSet(TOD_ERROR_REG_M_PATH_1_STEP_CHECK_ERROR)) - { - FAPI_ERR("init_tod_node: M_PATH_1_STEP_CHECK_ERROR! (TOD_ERROR_REG = 0x%016llX)",data.getDoubleWord(0)); - FAPI_SET_HWP_ERROR(rc, RC_PROC_TOD_INIT_M_PATH_1_STEP_CHECK_ERROR); - *i_failingTodProc = *target; - } - else - { - FAPI_ERR("init_tod_node: FIR bit active! (TOD_ERROR_REG = 0x%016llX)",data.getDoubleWord(0)); - FAPI_SET_HWP_ERROR(rc, RC_PROC_TOD_INIT_ERROR); - } - break; - } - - // TOD_ERROR_MASK_STATUS_REG_00040032 is not writable on some chips - uint8_t chipHasTodErrorMaskBug = 0; - rc = FAPI_ATTR_GET(ATTR_CHIP_EC_FEATURE_HW_BUG_TOD_ERROR_MASK_NOT_WRITABLE, target, chipHasTodErrorMaskBug); - if(rc) - { - FAPI_ERR("init_tod_node: Error querying Chip EC feature: ATTR_CHIP_EC_FEATURE_HW_BUG_TOD_ERROR_MASK_NOT_WRITABLE"); - break; - } - if(!chipHasTodErrorMaskBug) - { - FAPI_INF("init_tod_node: set error mask to runtime configuration"); - rc_ecmd |= data.flushTo0(); - rc_ecmd |= data.setWord(1,0x03F00000); // Mask TTYPE received informational bits 38:43 - if (rc_ecmd) - { - FAPI_ERR("init_tod_node: Error 0x%08X in ecmdDataBuffer setup for TOD_ERROR_MASK_STATUS_REG_00040032 SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(*target, TOD_ERROR_MASK_STATUS_REG_00040032, data); - if (!rc.ok()) - { - FAPI_ERR("init_tod_node: Could not write TOD_ERROR_MASK_STATUS_REG_00040032"); - break; - } - } - else - { - FAPI_INF("init_tod_node: Skipping TOD error mask setup because of chip limitation."); - } - - // Finish configuring downstream nodes - for (std::list<tod_topology_node*>::const_iterator child = (i_tod_node->i_children).begin(); - child != (i_tod_node->i_children).end(); - ++child) - { - tod_topology_node* tod_node = *child; - rc = init_tod_node(tod_node,i_failingTodProc); - if (!rc.ok()) - { - FAPI_ERR("init_tod_node: Failure configuring downstream node!"); - break; - } - } - if (!rc.ok()) - { - break; // error in above for loop - } - - } while(0); - - FAPI_INF("init_tod_node: End"); - return rc; -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/tod_init/proc_tod_init/proc_tod_init.H b/src/usr/hwpf/hwp/tod_init/proc_tod_init/proc_tod_init.H deleted file mode 100644 index 0461dae5f..000000000 --- a/src/usr/hwpf/hwp/tod_init/proc_tod_init/proc_tod_init.H +++ /dev/null @@ -1,117 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/proc_tod_init/proc_tod_init.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2013,2014 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -// $Id: proc_tod_init.H,v 1.5 2014/10/03 18:44:52 thi Exp $ -//------------------------------------------------------------------------------ -// *! (C) Copyright International Business Machines Corp. 2012 -// *! All Rights Reserved -- Property of IBM -// *! *** *** -// *! -// *! TITLE : proc_tod_init.H -// *! -// *! DESCRIPTION : Header for proc_tod_init.C -// *! -// *! OWNER NAME : Nick Klazynski Email: jklazyns@us.ibm.com -// *! BACKUP NAME : Email: -// *! -// *! ADDITIONAL COMMENTS : -// *! -//------------------------------------------------------------------------------ - -#ifndef PROC_TOD_INIT_H_ -#define PROC_TOD_INIT_H_ - -//------------------------------------------------------------------------------ -// Includes -//------------------------------------------------------------------------------ - -#include <fapi.H> -#include "proc_tod_utils.H" - -//------------------------------------------------------------------------------ -// Constant definitions -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// Structure definitions -//------------------------------------------------------------------------------ - -// function pointer typedef definition for HWP call support -typedef fapi::ReturnCode (*proc_tod_init_FP_t) (const tod_topology_node*, - fapi::Target* ); - -//------------------------------------------------------------------------------ -// Function prototypes -//------------------------------------------------------------------------------ - -extern "C" -{ - -/** - * @brief Initializes the TOD to 'running' state - * - * @param[in] i_tod_node Reference to TOD topology (FAPI targets included within) - * - * @param[in] i_failingTodProc, Pointer to the fapi target, the memory location - * addressed by this parameter will be populated with processor target - * which is not able to recieve proper singals from OSC. - * Caller needs to look at this parameter only when proc_tod_init fails - * and reason code indicates OSC failure. It is defaulted to NULL. - * - * @return FAPI_RC_SUCCESS if TOD topology is successfully initialized - * else FAPI or ECMD error is sent through - */ -fapi::ReturnCode proc_tod_init(const tod_topology_node* i_tod_node, - fapi::Target* i_failingTodProc = NULL ); - -/** - * @brief Clears TOD error register - * - * @param[in] i_tod_node Reference to TOD topology (FAPI targets included within) - * - * @return FAPI_RC_SUCCESS if TOD topology is cleared of previous errors - * else FAPI or ECMD error is sent through - */ -fapi::ReturnCode proc_tod_clear_error_reg(const tod_topology_node* i_tod_node); - -/** - * @brief Helper function for proc_tod_init - * - * @param[in] i_tod_node Reference to TOD topology (FAPI targets included within) - * - * @param[in] i_failingTodProc, Pointer to the fapi target, the memory location - * addressed by this parameter will be populated with processor target - * which is not able to recieve proper singals from OSC. - * Caller needs to look at this parameter only when proc_tod_init fails - * and reason code indicates OSC failure. It is defaulted to NULL. - * - * @return FAPI_RC_SUCCESS if TOD topology is successfully initialized - * else FAPI or ECMD error is sent through - */ -fapi::ReturnCode init_tod_node(const tod_topology_node* i_tod_node, - fapi::Target* i_failingTodProc = NULL); - -} // extern "C" - -#endif // PROC_TOD_INIT_H_ diff --git a/src/usr/hwpf/hwp/tod_init/proc_tod_save_config/proc_tod_save_config.C b/src/usr/hwpf/hwp/tod_init/proc_tod_save_config/proc_tod_save_config.C deleted file mode 100644 index b8c1b590d..000000000 --- a/src/usr/hwpf/hwp/tod_init/proc_tod_save_config/proc_tod_save_config.C +++ /dev/null @@ -1,204 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/proc_tod_save_config/proc_tod_save_config.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2013,2014 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -// $Id: proc_tod_save_config.C,v 1.5 2012/12/03 21:00:06 jklazyns Exp $ -//------------------------------------------------------------------------------ -// *! (C) Copyright International Business Machines Corp. 2012 -// *! All Rights Reserved -- Property of IBM -// *! *** *** -// *! -// *! TITLE : proc_tod_save_config.C -// *! -// *! DESCRIPTION : Saves TOD configuration registers to i_tod_node->o_todRegs -// *! -// *! OWNER NAME : Nick Klazynski Email: jklazyns@us.ibm.com -// *! BACKUP NAME : Email: -// *! -// *! ADDITIONAL COMMENTS : -// *! -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// Includes -//------------------------------------------------------------------------------ -#include "proc_tod_save_config.H" -#include "p8_scom_addresses.H" - -extern "C" -{ - -//------------------------------------------------------------------------------ -// Function definitions -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// function: proc_tod_save_config -// -// parameters: i_tod_node Reference to TOD topology (FAPI targets included within) -// -// returns: FAPI_RC_SUCCESS if all registers were read and saved in node structure -// else FAPI or ECMD error is sent through -//------------------------------------------------------------------------------ -fapi::ReturnCode proc_tod_save_config(tod_topology_node* i_tod_node) -{ - fapi::ReturnCode rc; - - FAPI_DBG("proc_tod_save_config: Start"); - do - { - if (i_tod_node == NULL) - { - FAPI_ERR("proc_tod_save_config: null node passed into function!"); - FAPI_SET_HWP_ERROR(rc, RC_PROC_TOD_NULL_NODE); - break; - } - fapi::Target* target = i_tod_node->i_target; - - rc = proc_tod_save_single_reg(*target, TOD_M_PATH_CTRL_REG_00040000, i_tod_node->o_todRegs.tod_m_path_ctrl_reg); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_save_config: Error saving TOD_M_PATH_CTRL_REG_00040000..."); - break; - } - - rc = proc_tod_save_single_reg(*target, TOD_PRI_PORT_0_CTRL_REG_00040001,i_tod_node->o_todRegs.tod_pri_port_0_ctrl_reg); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_save_config: Error saving TOD_PRI_PORT_0_CTRL_REG_00040001..."); - break; - } - - rc = proc_tod_save_single_reg(*target, TOD_PRI_PORT_1_CTRL_REG_00040002,i_tod_node->o_todRegs.tod_pri_port_1_ctrl_reg); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_save_config: Error saving TOD_PRI_PORT_1_CTRL_REG_00040002..."); - break; - } - - rc = proc_tod_save_single_reg(*target, TOD_SEC_PORT_0_CTRL_REG_00040003,i_tod_node->o_todRegs.tod_sec_port_0_ctrl_reg); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_save_config: Error saving TOD_SEC_PORT_0_CTRL_REG_00040003..."); - break; - } - - rc = proc_tod_save_single_reg(*target, TOD_SEC_PORT_1_CTRL_REG_00040004,i_tod_node->o_todRegs.tod_sec_port_1_ctrl_reg); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_save_config: Error saving TOD_SEC_PORT_1_CTRL_REG_00040004..."); - break; - } - - rc = proc_tod_save_single_reg(*target, TOD_S_PATH_CTRL_REG_00040005,i_tod_node->o_todRegs.tod_s_path_ctrl_reg); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_save_config: Error saving TOD_S_PATH_CTRL_REG_00040005..."); - break; - } - - rc = proc_tod_save_single_reg(*target, TOD_I_PATH_CTRL_REG_00040006,i_tod_node->o_todRegs.tod_i_path_ctrl_reg); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_save_config: Error saving TOD_I_PATH_CTRL_REG_00040006..."); - break; - } - - rc = proc_tod_save_single_reg(*target, TOD_PSS_MSS_CTRL_REG_00040007,i_tod_node->o_todRegs.tod_pss_mss_ctrl_reg); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_save_config: Error saving TOD_PSS_MSS_CTRL_REG_00040007..."); - break; - } - - rc = proc_tod_save_single_reg(*target, TOD_CHIP_CTRL_REG_00040010,i_tod_node->o_todRegs.tod_chip_ctrl_reg); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_save_config: Error saving TOD_CHIP_CTRL_REG_00040010..."); - break; - } - - // Recurse to save children configuration - for (std::list<tod_topology_node*>::iterator child = (i_tod_node->i_children).begin(); - child != (i_tod_node->i_children).end(); - ++child) - { - tod_topology_node* tod_node = *child; - rc = proc_tod_save_config(tod_node); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_save_config: Failure saving downstream configurations!"); - break; - } - } - if (!rc.ok()) - { - break; // error in above for loop - } - } while(0); - - FAPI_DBG("proc_tod_save_config: End"); - return rc; -} - -//------------------------------------------------------------------------------ -// function: proc_tod_save_single_reg -// -// parameters: i_target FAPI target -// i_addr SCOM address to read -// o_data Buffer to save register read -// -// returns: FAPI_RC_SUCCESS if the given register was read and saved into buffer -// else FAPI or ECMD error is sent through -//------------------------------------------------------------------------------ -fapi::ReturnCode proc_tod_save_single_reg(const fapi::Target& i_target, - const uint64_t i_addr, - ecmdDataBufferBase& o_data) -{ - fapi::ReturnCode rc; - uint32_t rc_ecmd = 0; - - FAPI_DBG("proc_tod_save_single_reg: Start"); - do - { - rc_ecmd |= o_data.setBitLength(64); - if (rc_ecmd) - { - FAPI_ERR("proc_tod_save_single_reg: Error 0x%08X in ecmdDataBuffer setup for 0x%016llX SCOM.", rc_ecmd, i_addr); - rc.setEcmdError(rc_ecmd); - break; - } - rc=fapiGetScom(i_target,i_addr,o_data); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_save_single_reg: Error from fapiGetScom when retrieving 0x%016llX...", i_addr); - break; - } - FAPI_DBG("proc_tod_save_single_reg: %016llX = %016llX",i_addr, o_data.getDoubleWord(0)); - } while(0); - - FAPI_DBG("proc_tod_save_single_reg: End"); - return rc; -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/tod_init/proc_tod_save_config/proc_tod_save_config.H b/src/usr/hwpf/hwp/tod_init/proc_tod_save_config/proc_tod_save_config.H deleted file mode 100644 index 1a5094fc3..000000000 --- a/src/usr/hwpf/hwp/tod_init/proc_tod_save_config/proc_tod_save_config.H +++ /dev/null @@ -1,97 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/proc_tod_save_config/proc_tod_save_config.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2013,2014 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -// $Id: proc_tod_save_config.H,v 1.1 2012/10/31 21:34:27 jklazyns Exp $ -//------------------------------------------------------------------------------ -// *! (C) Copyright International Business Machines Corp. 2012 -// *! All Rights Reserved -- Property of IBM -// *! *** *** -// *! -// *! TITLE : proc_tod_save_config.H -// *! -// *! DESCRIPTION : Header for proc_tod_save_config.C -// *! -// *! OWNER NAME : Nick Klazynski Email: jklazyns@us.ibm.com -// *! BACKUP NAME : Email: -// *! -// *! ADDITIONAL COMMENTS : -// *! -//------------------------------------------------------------------------------ - -#ifndef PROC_TOD_SAVE_CONFIG_H_ -#define PROC_TOD_SAVE_CONFIG_H_ - -//------------------------------------------------------------------------------ -// Includes -//------------------------------------------------------------------------------ - -#include <fapi.H> -#include "proc_tod_utils.H" - -extern "C" -{ - -//------------------------------------------------------------------------------ -// Constant definitions -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// Structure definitions -//------------------------------------------------------------------------------ - -// function pointer typedef definition for HWP call support -typedef fapi::ReturnCode -(*proc_tod_save_config_FP_t) (tod_topology_node*); - -//------------------------------------------------------------------------------ -// Function prototypes -//------------------------------------------------------------------------------ - -/** - * @brief Saves TOD configuration registers to i_tod_node->o_todRegs - * - * @param[in] i_tod_node Reference to TOD topology (FAPI targets included within) - * - * @return FAPI_RC_SUCCESS if all registers were read and saved in node structure - * else FAPI or ECMD error is sent through - */ -fapi::ReturnCode proc_tod_save_config(tod_topology_node* i_tod_node); - -/** - * @brief Helper function which saves a single register to output buffer - * - * @param[in] i_target FAPI target - * i_addr SCOM address to read - * @param[out] o_data Buffer to save register read - * - * @return FAPI_RC_SUCCESS if the given register was read and saved into buffer - * else FAPI or ECMD error is sent through - */ -fapi::ReturnCode proc_tod_save_single_reg(const fapi::Target& i_target, - const uint64_t i_addr, - ecmdDataBufferBase& o_data); - -} // extern "C" - -#endif // PROC_TOD_SAVE_CONFIG_H_ diff --git a/src/usr/hwpf/hwp/tod_init/proc_tod_setup/proc_tod_check_osc.C b/src/usr/hwpf/hwp/tod_init/proc_tod_setup/proc_tod_check_osc.C deleted file mode 100644 index a6d471281..000000000 --- a/src/usr/hwpf/hwp/tod_init/proc_tod_setup/proc_tod_check_osc.C +++ /dev/null @@ -1,184 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/proc_tod_setup//proc_tod_check_osc.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -// $Id: proc_tod_check_osc.C,v 1.1 2014/12/11 17:01:53 jklazyns Exp $ -//------------------------------------------------------------------------------ -// *! (C) Copyright International Business Machines Corp. 2012 -// *! All Rights Reserved -- Property of IBM -// *! *** *** -// *! -// *! TITLE : proc_tod_check_osc.C -// *! -// *! DESCRIPTION : Checks the validity of TOD oscillators connected to a target -// *! -// *! OWNER NAME : Nick Klazynski Email: jklazyns@us.ibm.com -// *! BACKUP NAME : Email: -// *! -// *! ADDITIONAL COMMENTS : -// *! -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// Includes -//------------------------------------------------------------------------------ -#include "proc_tod_utils.H" -#include "proc_tod_check_osc.H" -#include "p8_scom_addresses.H" - -extern "C" -{ - -//------------------------------------------------------------------------------ -// Function definitions -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// function: proc_tod_check_osc -// parameters: -// i_target FAPI target which will have its oscillator validity checked -// o_osc_stat Oscillator(s) which passed the validity check -// -// returns: FAPI_RC_SUCCESS if the oscillators were successfully tested -// (o_osc_stat will have the check's result) -// else FAPI or ECMD error is sent through -//------------------------------------------------------------------------------ -fapi::ReturnCode proc_tod_check_osc(const fapi::Target* i_target, - proc_tod_setup_osc_sel* o_osc_stat) -{ - fapi::ReturnCode rc; - ecmdDataBufferBase m_path_ctrl_reg_save_data(64); - ecmdDataBufferBase data(64); - uint32_t rc_ecmd = 0; - - FAPI_INF("proc_tod_check_osc: Start"); - do - { - // Read TOD_M_PATH_CTRL_REG_00040000 to be restored at the end of the procedure - rc=fapiGetScom(*i_target,TOD_M_PATH_CTRL_REG_00040000,m_path_ctrl_reg_save_data); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_check_osc: Error from fapiGetScom when retrieving TOD_M_PATH_CTRL_REG_00040000!"); - break; - } - - FAPI_DBG("proc_tod_check_osc: Configuring Master OSC paths in TOD_M_PATH_CTRL_REG_00040000 for oscillator testing."); - - // OSC0 is connected - rc_ecmd |= data.clearBit(TOD_M_PATH_CTRL_REG_M_PATH_0_OSC_NOT_VALID); - - // OSC0 step alignment enabled - rc_ecmd |= data.clearBit(TOD_M_PATH_CTRL_REG_M_PATH_0_STEP_ALIGN_DIS); - - // Set 512 steps per sync for path 0 - rc_ecmd |= data.insertFromRight(TOD_M_PATH_CTRL_REG_M_PATH_SYNC_FREQ_SEL_512, - TOD_M_PATH_CTRL_REG_M_PATH_0_SYNC_FREQ_SEL, - TOD_M_PATH_CTRL_REG_M_PATH_SYNC_FREQ_SEL_LEN); - - // Set step check CPS deviation to 50% - rc_ecmd |= data.insertFromRight(STEP_CHECK_CPS_DEVIATION_50_00_PCENT, - TOD_M_PATH_CTRL_REG_M_PATH_0_STEP_CHECK_CPS_DEVIATION, - STEP_CHECK_CPS_DEVIATION_LEN); - - // 8 valid steps are required before step check is enabled - rc_ecmd |= data.insertFromRight(STEP_CHECK_VALIDITY_COUNT_8, - TOD_M_PATH_CTRL_REG_M_PATH_0_STEP_CHECK_VALIDITY_COUNT, - STEP_CHECK_VALIDITY_COUNT_LEN); - - // OSC1 is connected - rc_ecmd |= data.clearBit(TOD_M_PATH_CTRL_REG_M_PATH_1_OSC_NOT_VALID); - - // OSC1 step alignment enabled - rc_ecmd |= data.clearBit(TOD_M_PATH_CTRL_REG_M_PATH_1_STEP_ALIGN_DIS); - - // Set 512 steps per sync for path 1 - rc_ecmd |= data.insertFromRight(TOD_M_PATH_CTRL_REG_M_PATH_SYNC_FREQ_SEL_512, - TOD_M_PATH_CTRL_REG_M_PATH_1_SYNC_FREQ_SEL, - TOD_M_PATH_CTRL_REG_M_PATH_SYNC_FREQ_SEL_LEN); - - // Set step check CPS deviation to 50% - rc_ecmd |= data.insertFromRight(STEP_CHECK_CPS_DEVIATION_50_00_PCENT, - TOD_M_PATH_CTRL_REG_M_PATH_1_STEP_CHECK_CPS_DEVIATION, - STEP_CHECK_CPS_DEVIATION_LEN); - - // 8 valid steps are required before step check is enabled - rc_ecmd |= data.insertFromRight(STEP_CHECK_VALIDITY_COUNT_8, - TOD_M_PATH_CTRL_REG_M_PATH_1_STEP_CHECK_VALIDITY_COUNT, - STEP_CHECK_VALIDITY_COUNT_LEN); - - // CPS deviation factor configures both path-0 and path-1 - rc_ecmd |= data.insertFromRight(STEP_CHECK_CPS_DEVIATION_FACTOR_1, - TOD_M_PATH_CTRL_REG_M_PATH_STEP_CHECK_DEVIATION_FACTOR, - STEP_CHECK_CPS_DEVIATION_FACTOR_LEN); - - if (rc_ecmd) - { - FAPI_ERR("proc_tod_check_osc: Error 0x%08X in ecmdDataBuffer setup for TOD_M_PATH_CTRL_REG_00040000 SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(*i_target,TOD_M_PATH_CTRL_REG_00040000,data); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_check_osc: fapiPutScom error for TOD_M_PATH_CTRL_REG_00040000 SCOM."); - break; - } - - FAPI_DBG("proc_tod_check_osc: Checking oscillator validity."); - rc=fapiGetScom(*i_target,TOD_PSS_MSS_STATUS_REG_00040008,data); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_check_osc: Error from fapiGetScom when retrieving TOD_PSS_MSS_STATUS_REG_00040008!"); - break; - } - - *o_osc_stat = TOD_OSC_NONE; - if (data.isBitSet(TOD_PSS_MSS_STATUS_REG_M_PATH_0_STEP_CHECK_VALID) && - data.isBitSet(TOD_PSS_MSS_STATUS_REG_M_PATH_1_STEP_CHECK_VALID)) { - FAPI_DBG("proc_tod_check_osc: both master path-0 and path-1 are valid! (TOD_PSS_MSS_STATUS_REG = 0x%016llX)",data.getDoubleWord(0)); - *o_osc_stat = TOD_OSC_0_AND_1; - } - else if (data.isBitSet(TOD_PSS_MSS_STATUS_REG_M_PATH_0_STEP_CHECK_VALID)) { - FAPI_DBG("proc_tod_check_osc: master path-0 is valid; path-1 is not! (TOD_PSS_MSS_STATUS_REG = 0x%016llX)",data.getDoubleWord(0)); - *o_osc_stat = TOD_OSC_0; - } - else if (data.isBitSet(TOD_PSS_MSS_STATUS_REG_M_PATH_1_STEP_CHECK_VALID)) { - FAPI_DBG("proc_tod_check_osc: master path-1 is valid; path-0 is not! (TOD_PSS_MSS_STATUS_REG = 0x%016llX)",data.getDoubleWord(0)); - *o_osc_stat = TOD_OSC_1; - } - - FAPI_DBG("proc_tod_check_osc: Restoring previous TOD_M_PATH_CTRL_REG_00040000 value."); - rc = fapiPutScom(*i_target,TOD_M_PATH_CTRL_REG_00040000,m_path_ctrl_reg_save_data); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_check_osc: fapiPutScom error for TOD_M_PATH_CTRL_REG_00040000 SCOM."); - break; - } - - } while (0); - - FAPI_INF("proc_tod_check_osc: End"); - return rc; -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/tod_init/proc_tod_setup/proc_tod_check_osc.H b/src/usr/hwpf/hwp/tod_init/proc_tod_setup/proc_tod_check_osc.H deleted file mode 100644 index f2aec381e..000000000 --- a/src/usr/hwpf/hwp/tod_init/proc_tod_setup/proc_tod_check_osc.H +++ /dev/null @@ -1,87 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/proc_tod_setup//proc_tod_check_osc.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -// $Id: proc_tod_check_osc.H,v 1.1 2014/12/11 17:01:53 jklazyns Exp $ -//------------------------------------------------------------------------------ -// *! (C) Copyright International Business Machines Corp. 2012 -// *! All Rights Reserved -- Property of IBM -// *! *** *** -// *! -// *! TITLE : proc_tod_check_osc.H -// *! -// *! DESCRIPTION : Header for proc_tod_check_osc.C -// *! -// *! OWNER NAME : Nick Klazynski Email: jklazyns@us.ibm.com -// *! BACKUP NAME : Email: -// *! -// *! ADDITIONAL COMMENTS : -// *! -//------------------------------------------------------------------------------ - -#ifndef PROC_TOD_CHECK_OSC_H_ -#define PROC_TOD_CHECK_OSC_H_ - -//------------------------------------------------------------------------------ -// Includes -//------------------------------------------------------------------------------ -#include <fapi.H> -#include "proc_tod_utils.H" - -//------------------------------------------------------------------------------ -// Constant definitions -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// Structure definitions -//------------------------------------------------------------------------------ - -// function pointer typedef definition for HWP call support -typedef fapi::ReturnCode (*proc_tod_check_osc_FP_t) (const fapi::Target*, - proc_tod_setup_osc_sel*); - -//------------------------------------------------------------------------------ -// Function prototypes -//------------------------------------------------------------------------------ - -extern "C" -{ - -/** - * @brief Checks oscillator validality for a given target - * - * @param[in] i_target FAPI target which will have its oscillator - * validity checked - * - * @param[out] o_osc_stat Oscillator(s) which passed the validity check - * - * @return FAPI_RC_SUCCESS if the oscillators were successfully tested - * (o_osc_stat will have the check's result) - * else FAPI or ECMD error is sent through - */ -fapi::ReturnCode proc_tod_check_osc(const fapi::Target* i_target, - proc_tod_setup_osc_sel* o_osc_stat); - -} // extern "C" - -#endif // PROC_TOD_CHECK_OSC_H_ diff --git a/src/usr/hwpf/hwp/tod_init/proc_tod_setup/proc_tod_setup.C b/src/usr/hwpf/hwp/tod_init/proc_tod_setup/proc_tod_setup.C deleted file mode 100644 index bb1a0c85c..000000000 --- a/src/usr/hwpf/hwp/tod_init/proc_tod_setup/proc_tod_setup.C +++ /dev/null @@ -1,1154 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/proc_tod_setup/proc_tod_setup.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2013,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -// $Id: proc_tod_setup.C,v 1.23 2015/01/08 19:50:38 jklazyns Exp $ -//------------------------------------------------------------------------------ -// *! (C) Copyright International Business Machines Corp. 2012 -// *! All Rights Reserved -- Property of IBM -// *! *** *** -// *! -// *! TITLE : proc_tod_setup.C -// *! -// *! DESCRIPTION : Configures the TOD topology -// *! -// *! OWNER NAME : Nick Klazynski Email: jklazyns@us.ibm.com -// *! BACKUP NAME : Email: -// *! -// *! ADDITIONAL COMMENTS : -// *! Procedure implemented: -// *! - First, configure topology delays -// *! - The longest delay (node furthest away) needs to be found first. This will -// *! be the MDMT's delay and the children will be derived from this. The node -// *! that's furthest away should have a delay of 0 (step as soon as signal is -// *! received -// *! - Next, configure TOD registers based on pervasive workbook (section 17.8) -// *! - Primary and Secondary topologies are configured in a similar manner -// *! with different registers. This code attempts to use common code to -// *! implement this. -// *! - Initialization is required (pervasive workbook 17.8.3.1) in order to verify -// *! the topology is correctly configured -// *! -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// Includes -//------------------------------------------------------------------------------ -#include "proc_tod_setup.H" -#include "p8_scom_addresses.H" - -extern "C" -{ - -//------------------------------------------------------------------------------ -// Function definitions -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// function: proc_tod_setup -// -// parameters: i_tod_node Reference to TOD topology (FAPI targets included within) -// i_tod_sel Specifies the topology to configure -// i_osc_sel Specifies the oscillator to use for the master -// -// returns: FAPI_RC_SUCCESS if TOD topology is successfully configured -// else FAPI or ECMD error is sent through -//------------------------------------------------------------------------------ -fapi::ReturnCode proc_tod_setup(tod_topology_node* i_tod_node, - const proc_tod_setup_tod_sel i_tod_sel, - const proc_tod_setup_osc_sel i_osc_sel) -{ - fapi::ReturnCode rc; - fapi::ATTR_IS_MPIPL_Type is_mpipl = 0x00; - - // Mark HWP entry - FAPI_INF("proc_tod_setup: Start"); - - do - { - if (i_tod_node == NULL || i_tod_node->i_target == NULL) - { - FAPI_ERR("proc_tod_setup: null node or target passed into function!"); - FAPI_SET_HWP_ERROR(rc, RC_PROC_TOD_NULL_NODE); - break; - } - if (!(i_tod_node->i_tod_master && i_tod_node->i_drawer_master)) - { - FAPI_ERR("proc_tod_setup: non-root (slave) node passed into main function!"); - FAPI_SET_HWP_ERROR(rc, RC_PROC_TOD_SETUP_INVALID_TOPOLOGY); - break; - } - - FAPI_INF("proc_tod_setup: Configuring %s topology (OSC0 is %s, OSC1 is %s)", - (i_tod_sel==TOD_PRIMARY)?"Primary":"Secondary", - (i_osc_sel==TOD_OSC_0 || - i_osc_sel==TOD_OSC_0_AND_1 || - i_osc_sel==TOD_OSC_0_AND_1_SEL_0 || - i_osc_sel==TOD_OSC_0_AND_1_SEL_1)?"connected":"not connected", - (i_osc_sel==TOD_OSC_1 || - i_osc_sel==TOD_OSC_0_AND_1 || - i_osc_sel==TOD_OSC_0_AND_1_SEL_0 || - i_osc_sel==TOD_OSC_0_AND_1_SEL_1)?"connected":"not connected"); - - // calculate_node_delays populates o_int_path_delay for each node - rc = calculate_node_delays(i_tod_node); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_setup: Failure calculating TOD delays!"); - break; - } - display_tod_nodes(i_tod_node,0); - - rc = FAPI_ATTR_GET(ATTR_IS_MPIPL, NULL, is_mpipl); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_setup: fapiGetAttribute of ATTR_IS_MPIPL failed!"); - break; - } - - // If there is a previous topology, it needs to be cleared - rc = clear_tod_node(i_tod_node, i_tod_sel, is_mpipl); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_setup: Failure clearing previous TOD configuration!"); - break; - } - - //Start configuring each node; (configure_tod_node will recurse on each child) - rc = configure_tod_node(i_tod_node,i_tod_sel,i_osc_sel); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_setup: Failure configuring TOD!"); - break; - } - - } while (0); - - FAPI_INF("proc_tod_setup: End"); - return rc; -} - -//------------------------------------------------------------------------------ -// function: clear_tod_topology -// -// parameters: i_tod_node Reference to TOD topology (FAPI targets included within) -// i_tod_sel Specifies the topology to clear -// i_is_mpipl if this IPL is an MPIPL, additional setup is needed; -// determined via an attribute -// -// returns: FAPI_RC_SUCCESS if TOD topology is successfully cleared -// else FAPI or ECMD error is sent through -//------------------------------------------------------------------------------ -fapi::ReturnCode clear_tod_node(tod_topology_node* i_tod_node, - const proc_tod_setup_tod_sel i_tod_sel, - const fapi::ATTR_IS_MPIPL_Type i_is_mpipl) -{ - fapi::ReturnCode rc; - uint32_t rc_ecmd = 0; - ecmdDataBufferBase data(64); - fapi::Target* target = i_tod_node->i_target; - uint32_t port_ctrl_reg = 0; - uint32_t port_ctrl_check_reg = 0; - - FAPI_INF("clear_tod_node: Clearing previous %s topology from %s", - (i_tod_sel==TOD_PRIMARY)?"Primary":"Secondary", - target->toEcmdString()); - do - { - if (i_tod_sel==TOD_PRIMARY) - { - FAPI_DBG("clear_tod_node: TOD_PRI_PORT_0_CTRL_REG_00040001 and TOD_SEC_PORT_0_CTRL_REG_00040003 will be cleared."); - port_ctrl_reg = TOD_PRI_PORT_0_CTRL_REG_00040001; - port_ctrl_check_reg = TOD_SEC_PORT_0_CTRL_REG_00040003; - } - else // (i_tod_sel==TOD_SECONDARY) - { - FAPI_DBG("clear_tod_node: TOD_PRI_PORT_1_CTRL_REG_00040002 and TOD_SEC_PORT_1_CTRL_REG_00040004 will be cleared."); - port_ctrl_reg = TOD_SEC_PORT_1_CTRL_REG_00040004; - port_ctrl_check_reg = TOD_PRI_PORT_1_CTRL_REG_00040002; - } - rc = fapiPutScom(*target,port_ctrl_reg,data); - if (!rc.ok()) - { - FAPI_ERR("clear_tod_node: fapiPutScom error for port_ctrl_reg SCOM."); - break; - } - rc = fapiPutScom(*target,port_ctrl_check_reg,data); - if (!rc.ok()) - { - FAPI_ERR("clear_tod_node: fapiPutScom error for port_ctrl_check_reg SCOM."); - break; - } - - if (i_is_mpipl) - { - FAPI_INF("clear_tod_node: MPIPL: switch TOD to 'Not Set' state"); - rc_ecmd |= data.flushTo0(); - rc_ecmd |= data.setBit(0); - if (rc_ecmd) - { - FAPI_ERR("clear_tod_node: Error 0x%08X in ecmdDataBuffer setup for TOD_TX_TTYPE_5_REG_00040016 SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(*target, TOD_TX_TTYPE_5_REG_00040016, data); - if (!rc.ok()) - { - FAPI_ERR("clear_tod_node: Could not write TOD_TX_TTYPE_5_REG_00040016"); - break; - } - } - else - { - FAPI_INF("clear_tod_node: Normal IPL: Bypass TTYPE#5"); - } - - // TOD is cleared for this node; if it has children, start clearing their registers - for (std::list<tod_topology_node*>::iterator child = (i_tod_node->i_children).begin(); - child != (i_tod_node->i_children).end(); - ++child) - { - tod_topology_node* tod_node = *child; - rc = clear_tod_node(tod_node,i_tod_sel,i_is_mpipl); - if (!rc.ok()) - { - FAPI_ERR("clear_tod_node: Failure clearing downstream TOD node!"); - break; - } - } - if (!rc.ok()) - { - break; // error in above for loop - } - } while(0); - - FAPI_INF("clear_tod_node: End"); - return rc; -} - -//------------------------------------------------------------------------------ -// function: configure_tod_node -// -// parameters: i_tod_node Reference to TOD topology (FAPI targets included within) -// i_tod_sel Specifies the topology to configure -// i_osc_sel Specifies the oscillator to use for the master -// -// returns: FAPI_RC_SUCCESS if TOD topology is successfully configured -// else FAPI or ECMD error is sent through -//------------------------------------------------------------------------------ -fapi::ReturnCode configure_tod_node(tod_topology_node* i_tod_node, - const proc_tod_setup_tod_sel i_tod_sel, - const proc_tod_setup_osc_sel i_osc_sel) -{ - fapi::ReturnCode rc; - ecmdDataBufferBase data(64); - ecmdDataBufferBase data2(64); - uint32_t rc_ecmd = 0; - fapi::Target* target = i_tod_node->i_target; - - FAPI_INF("configure_tod_node: Start: Configuring %s", target->toEcmdString()); - - do - { - const bool is_mdmt = (i_tod_node->i_tod_master && i_tod_node->i_drawer_master); - - // Read TOD_PSS_MSS_CTRL_REG_00040007 in order to perserve any prior configuration - rc=fapiGetScom(*target,TOD_PSS_MSS_CTRL_REG_00040007,data); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: Error from fapiGetScom when retrieving TOD_PSS_MSS_CTRL_REG_00040007!"); - break; - } - FAPI_DBG("configure_tod_node: Set Master TOD/Slave TOD and Master Drawer/Slave Drawer"); - if (i_tod_sel==TOD_PRIMARY) - { - if (is_mdmt) - { - rc_ecmd |= data.setBit(TOD_PSS_MSS_CTRL_REG_PRI_M_S_TOD_SEL); - if (i_osc_sel == TOD_OSC_0 || - i_osc_sel == TOD_OSC_0_AND_1 || - i_osc_sel == TOD_OSC_0_AND_1_SEL_0) - { - rc_ecmd |= data.clearBit(TOD_PSS_MSS_CTRL_REG_PRI_M_PATH_SEL); - } - else if (i_osc_sel == TOD_OSC_1 || - i_osc_sel == TOD_OSC_0_AND_1_SEL_1) - { - rc_ecmd |= data.setBit(TOD_PSS_MSS_CTRL_REG_PRI_M_PATH_SEL); - } - else // i_osc_sel == TOD_OSC_NONE - { - FAPI_ERR("configure_tod_node: Invalid oscillator configuration!"); - FAPI_SET_HWP_ERROR(rc, RC_PROC_TOD_SETUP_INVALID_TOPOLOGY); - break; - } - } - else // Slave nodes (Drawer master is still a slave) - { - rc_ecmd |= data.clearBit(TOD_PSS_MSS_CTRL_REG_PRI_M_S_TOD_SEL); - } - if (i_tod_node->i_drawer_master) - { - rc_ecmd |= data.setBit(TOD_PSS_MSS_CTRL_REG_PRI_M_S_DRAWER_SEL); - } - } - else // (i_tod_sel==TOD_SECONDARY) - { - if (is_mdmt) - { - rc_ecmd |= data.setBit(TOD_PSS_MSS_CTRL_REG_SEC_M_S_TOD_SEL); - if (i_osc_sel == TOD_OSC_1 || - i_osc_sel == TOD_OSC_0_AND_1 || - i_osc_sel == TOD_OSC_0_AND_1_SEL_1) - { - rc_ecmd |= data.setBit(TOD_PSS_MSS_CTRL_REG_SEC_M_PATH_SEL); - } - else if (i_osc_sel == TOD_OSC_0 || - i_osc_sel == TOD_OSC_0_AND_1_SEL_0) - { - rc_ecmd |= data.clearBit(TOD_PSS_MSS_CTRL_REG_SEC_M_PATH_SEL); - } - else // i_osc_sel == TOD_OSC_NONE - { - FAPI_ERR("configure_tod_node: Invalid oscillator configuration!"); - FAPI_SET_HWP_ERROR(rc, RC_PROC_TOD_SETUP_INVALID_TOPOLOGY); - break; - } - } - else // Slave nodes (Drawer master is still a slave) - { - rc_ecmd |= data.clearBit(TOD_PSS_MSS_CTRL_REG_SEC_M_S_TOD_SEL); - } - if (i_tod_node->i_drawer_master) - { - rc_ecmd |= data.setBit(TOD_PSS_MSS_CTRL_REG_SEC_M_S_DRAWER_SEL); - } - } - if (rc_ecmd) - { - FAPI_ERR("configure_tod_node: Error 0x%08X in ecmdDataBuffer setup for TOD_PSS_MSS_CTRL_REG_00040007 SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(*target,TOD_PSS_MSS_CTRL_REG_00040007,data); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: fapiPutScom error for TOD_PSS_MSS_CTRL_REG_00040007 SCOM."); - break; - } - - // Read TOD_S_PATH_CTRL_REG_00040005 in order to perserve any prior configuration - rc=fapiGetScom(*target,TOD_S_PATH_CTRL_REG_00040005,data); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: Error from fapiGetScom when retrieving TOD_S_PATH_CTRL_REG_00040005!"); - break; - } - - // Slave TODs are enabled on all but the MDMT - if (!is_mdmt) - { - FAPI_DBG("configure_tod_node: Selection of Slave OSC path"); - if (i_tod_sel==TOD_PRIMARY) - { - rc_ecmd |= data.clearBit(TOD_S_PATH_CTRL_REG_PRI_S_PATH_SEL); // For primary slave, use slave path 0 (path_0_sel=OFF) - - // Set CPS deviation to 75% (CPS deviation bits = 0xC, factor=1), 8 valid steps to enable step check - rc_ecmd |= data.insertFromRight(STEP_CHECK_CPS_DEVIATION_FACTOR_1, - TOD_S_PATH_CTRL_REG_S_PATH_STEP_CHECK_CPS_DEVIATION_FACTOR, - STEP_CHECK_CPS_DEVIATION_FACTOR_LEN); - rc_ecmd |= data.insertFromRight(STEP_CHECK_CPS_DEVIATION_75_00_PCENT, - TOD_S_PATH_CTRL_REG_S_PATH_0_STEP_CHECK_CPS_DEVIATION, - STEP_CHECK_CPS_DEVIATION_LEN); - rc_ecmd |= data.insertFromRight(STEP_CHECK_VALIDITY_COUNT_8, - TOD_S_PATH_CTRL_REG_S_PATH_0_STEP_CHECK_VALIDITY_COUNT, - STEP_CHECK_VALIDITY_COUNT_LEN); - } - else // (i_tod_sel==TOD_SECONDARY) - { - rc_ecmd |= data.setBit(TOD_S_PATH_CTRL_REG_SEC_S_PATH_SEL); // For secondary slave, use slave path 1 (path_1_sel=ON) - - // Set CPS deviation to 75% (CPS deviation bits = 0xC, factor=1), 8 valid steps to enable step check - rc_ecmd |= data.insertFromRight(STEP_CHECK_CPS_DEVIATION_FACTOR_1, - TOD_S_PATH_CTRL_REG_S_PATH_STEP_CHECK_CPS_DEVIATION_FACTOR, - STEP_CHECK_CPS_DEVIATION_FACTOR_LEN); - rc_ecmd |= data.insertFromRight(STEP_CHECK_CPS_DEVIATION_75_00_PCENT, - TOD_S_PATH_CTRL_REG_S_PATH_1_STEP_CHECK_CPS_DEVIATION, - STEP_CHECK_CPS_DEVIATION_LEN); - rc_ecmd |= data.insertFromRight(STEP_CHECK_VALIDITY_COUNT_8, - TOD_S_PATH_CTRL_REG_S_PATH_1_STEP_CHECK_VALIDITY_COUNT, - STEP_CHECK_VALIDITY_COUNT_LEN); - } - if (rc_ecmd) - { - FAPI_ERR("configure_tod_node: Error 0x%08X in ecmdDataBuffer setup for TOD_S_PATH_CTRL_REG_00040005 SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(*target,TOD_S_PATH_CTRL_REG_00040005,data); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: fapiPutScom error for TOD_S_PATH_CTRL_REG_00040005 SCOM."); - break; - } - } - - // TOD_PRI_PORT_0_CTRL_REG_00040001 is only used for Primary configurations - // TOD_SEC_PORT_1_CTRL_REG_00040004 is only used for Secondary configurations - // In order to check primary and secondary networks are working simultaneously... - // - The result of TOD_PRI_PORT_0_CTRL_REG_00040001 are also inserted into TOD_SEC_PORT_0_CTRL_REG_00040003 - // (preserving i_path_delay which can be different between 40001 and 40003) - // - The result of TOD_SEC_PORT_1_CTRL_REG_00040004 are also inserted into TOD_PRI_PORT_1_CTRL_REG_00040002 - uint32_t port_ctrl_reg = 0; - uint32_t port_ctrl_check_reg = 0; - if (i_tod_sel==TOD_PRIMARY) - { - FAPI_DBG("configure_tod_node: TOD_PRI_PORT_0_CTRL_REG_00040001 will be configured for primary topology"); - port_ctrl_reg = TOD_PRI_PORT_0_CTRL_REG_00040001; - port_ctrl_check_reg = TOD_SEC_PORT_0_CTRL_REG_00040003; - } - else // (i_tod_sel==TOD_SECONDARY) - { - FAPI_DBG("configure_tod_node: TOD_SEC_PORT_1_CTRL_REG_00040004 will be configured for secondary topology"); - port_ctrl_reg = TOD_SEC_PORT_1_CTRL_REG_00040004; - port_ctrl_check_reg = TOD_PRI_PORT_1_CTRL_REG_00040002; - } - - // Read port_ctrl_reg in order to perserve any prior configuration - rc = fapiGetScom(*target,port_ctrl_reg,data); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: Error from fapiGetScom when retrieving port_ctrl_reg!"); - break; - } - - // Read port_ctrl_check_reg in order to perserve any prior configuration - rc = fapiGetScom(*target,port_ctrl_check_reg,data2); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: Error from fapiGetScom when retrieving port_ctrl_check_reg!"); - break; - } - - //Determine RX port - uint32_t port_rx_select_val = 0; - switch (i_tod_node->i_bus_rx) - { - case(NONE): break; // MDMT has no rx - case(XBUS0): port_rx_select_val = TOD_PORT_CTRL_REG_RX_X0_SEL; break; - case(XBUS1): port_rx_select_val = TOD_PORT_CTRL_REG_RX_X1_SEL; break; - case(XBUS2): port_rx_select_val = TOD_PORT_CTRL_REG_RX_X2_SEL; break; - case(XBUS3): port_rx_select_val = TOD_PORT_CTRL_REG_RX_X3_SEL; break; - case(ABUS0): port_rx_select_val = TOD_PORT_CTRL_REG_RX_A0_SEL; break; - case(ABUS1): port_rx_select_val = TOD_PORT_CTRL_REG_RX_A1_SEL; break; - case(ABUS2): port_rx_select_val = TOD_PORT_CTRL_REG_RX_A2_SEL; break; - } - rc_ecmd |= data.insertFromRight(port_rx_select_val, - TOD_PORT_CTRL_REG_RX, - TOD_PORT_CTRL_REG_RX_LEN); - rc_ecmd |= data2.insertFromRight(port_rx_select_val, - TOD_PORT_CTRL_REG_RX, - TOD_PORT_CTRL_REG_RX_LEN); - - //Determine which tx path should be selected for all children - uint32_t path_sel = 0; - if (is_mdmt) - { - if (i_tod_sel==TOD_PRIMARY) - { - if (i_osc_sel == TOD_OSC_0 || - i_osc_sel == TOD_OSC_0_AND_1 || - i_osc_sel == TOD_OSC_0_AND_1_SEL_0) - { - path_sel = TOD_PORT_CTRL_REG_M_PATH_0; - } - else if (i_osc_sel == TOD_OSC_1 || - i_osc_sel == TOD_OSC_0_AND_1_SEL_1) - { - path_sel = TOD_PORT_CTRL_REG_M_PATH_1; - } - else // i_osc_sel == TOD_OSC_NONE - { - FAPI_ERR("configure_tod_node: Invalid oscillator configuration!"); - FAPI_SET_HWP_ERROR(rc, RC_PROC_TOD_SETUP_INVALID_TOPOLOGY); - break; - } - } - else // i_tod_sel==TOD_SECONDARY - { - if (i_osc_sel == TOD_OSC_1 || - i_osc_sel == TOD_OSC_0_AND_1 || - i_osc_sel == TOD_OSC_0_AND_1_SEL_1) - { - path_sel = TOD_PORT_CTRL_REG_M_PATH_1; - } - else if (i_osc_sel == TOD_OSC_0 || - i_osc_sel == TOD_OSC_0_AND_1_SEL_0) - { - path_sel = TOD_PORT_CTRL_REG_M_PATH_0; - } - else // i_osc_sel == TOD_OSC_NONE - { - FAPI_ERR("configure_tod_node: Invalid oscillator configuration!"); - FAPI_SET_HWP_ERROR(rc, RC_PROC_TOD_SETUP_INVALID_TOPOLOGY); - break; - } - } - } - else // Chip is not master; slave path selected - { - if (i_tod_sel==TOD_PRIMARY) - { - path_sel = TOD_PORT_CTRL_REG_S_PATH_0; - } - else // (i_tod_sel==TOD_SECONDARY) - { - path_sel = TOD_PORT_CTRL_REG_S_PATH_1; - } - } - - // Loop through all of the out busses, determine which tx buses to enable as senders - uint32_t bus_sel = 0; - uint32_t bus_sel_en = 0; - - for (std::list<tod_topology_node*>::iterator child = (i_tod_node->i_children).begin(); - child != (i_tod_node->i_children).end(); - ++child) - { - tod_topology_node* tod_node = *child; - switch (tod_node->i_bus_tx) - { - case(NONE): FAPI_SET_HWP_ERROR(rc, RC_PROC_TOD_SETUP_INVALID_TOPOLOGY); break; - case(XBUS0): bus_sel = TOD_PORT_CTRL_REG_TX_X0; bus_sel_en = TOD_PORT_CTRL_REG_TX_X0_EN; break; - case(XBUS1): bus_sel = TOD_PORT_CTRL_REG_TX_X1; bus_sel_en = TOD_PORT_CTRL_REG_TX_X1_EN; break; - case(XBUS2): bus_sel = TOD_PORT_CTRL_REG_TX_X2; bus_sel_en = TOD_PORT_CTRL_REG_TX_X2_EN; break; - case(XBUS3): bus_sel = TOD_PORT_CTRL_REG_TX_X3; bus_sel_en = TOD_PORT_CTRL_REG_TX_X3_EN; break; - case(ABUS0): bus_sel = TOD_PORT_CTRL_REG_TX_A0; bus_sel_en = TOD_PORT_CTRL_REG_TX_A0_EN; break; - case(ABUS1): bus_sel = TOD_PORT_CTRL_REG_TX_A1; bus_sel_en = TOD_PORT_CTRL_REG_TX_A1_EN; break; - case(ABUS2): bus_sel = TOD_PORT_CTRL_REG_TX_A2; bus_sel_en = TOD_PORT_CTRL_REG_TX_A2_EN; break; - } - if (!rc.ok()) - { - break; // error in above switch - } - rc_ecmd |= data.insertFromRight(path_sel, bus_sel, TOD_PORT_CTRL_REG_TX_LEN); - rc_ecmd |= data.setBit(bus_sel_en); - rc_ecmd |= data2.insertFromRight(path_sel, bus_sel, TOD_PORT_CTRL_REG_TX_LEN); - rc_ecmd |= data2.setBit(bus_sel_en); - } - if (!rc.ok()) - { - break; // error in above for loop - } - if (rc_ecmd) - { - FAPI_ERR("configure_tod_node: Error 0x%08X in ecmdDataBuffer setup for port_ctrl_reg/port_ctrl_check_reg SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - - // All children have been configured; save both port configurations! - rc = fapiPutScom(*target,port_ctrl_reg,data); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: fapiPutScom error for port_ctrl_reg SCOM."); - break; - } - rc = fapiPutScom(*target,port_ctrl_check_reg,data2); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: fapiPutScom error for port_ctrl_check_reg SCOM."); - break; - } - - // Read TOD_M_PATH_CTRL_REG_00040000 in order to perserve any prior configuration - rc=fapiGetScom(*target,TOD_M_PATH_CTRL_REG_00040000,data); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: Error from fapiGetScom when retrieving TOD_M_PATH_CTRL_REG_00040000!"); - break; - } - - // Configure Master OSC0/OSC1 path - if (is_mdmt) - { - FAPI_DBG("configure_tod_node: Configuring Master OSC path in TOD_M_PATH_CTRL_REG_00040000"); - - if (i_osc_sel == TOD_OSC_0 || - i_osc_sel == TOD_OSC_0_AND_1 || - i_osc_sel == TOD_OSC_0_AND_1_SEL_0 || - i_osc_sel == TOD_OSC_0_AND_1_SEL_1) - { - FAPI_DBG("configure_tod_node: OSC0 is valid; master path-0 will be configured."); - - // OSC0 is connected - rc_ecmd |= data.clearBit(TOD_M_PATH_CTRL_REG_M_PATH_0_OSC_NOT_VALID); - - // OSC0 step alignment enabled - rc_ecmd |= data.clearBit(TOD_M_PATH_CTRL_REG_M_PATH_0_STEP_ALIGN_DIS); - - // Set 512 steps per sync for path 0 - rc_ecmd |= data.insertFromRight(TOD_M_PATH_CTRL_REG_M_PATH_SYNC_FREQ_SEL_512, - TOD_M_PATH_CTRL_REG_M_PATH_0_SYNC_FREQ_SEL, - TOD_M_PATH_CTRL_REG_M_PATH_SYNC_FREQ_SEL_LEN); - - // Set step check CPS deviation to 50% - rc_ecmd |= data.insertFromRight(STEP_CHECK_CPS_DEVIATION_50_00_PCENT, - TOD_M_PATH_CTRL_REG_M_PATH_0_STEP_CHECK_CPS_DEVIATION, - STEP_CHECK_CPS_DEVIATION_LEN); - - // 8 valid steps are required before step check is enabled - rc_ecmd |= data.insertFromRight(STEP_CHECK_VALIDITY_COUNT_8, - TOD_M_PATH_CTRL_REG_M_PATH_0_STEP_CHECK_VALIDITY_COUNT, - STEP_CHECK_VALIDITY_COUNT_LEN); - } - else - { - FAPI_DBG("configure_tod_node: OSC0 is not connected."); - - // OSC0 is not connected; any previous path-0 settings will be ignored - rc_ecmd |= data.setBit(TOD_M_PATH_CTRL_REG_M_PATH_0_OSC_NOT_VALID); - } - if (i_osc_sel == TOD_OSC_1 || - i_osc_sel == TOD_OSC_0_AND_1 || - i_osc_sel == TOD_OSC_0_AND_1_SEL_0 || - i_osc_sel == TOD_OSC_0_AND_1_SEL_1) - { - FAPI_DBG("configure_tod_node: OSC1 is valid; master path-1 will be configured."); - - // OSC1 is connected - rc_ecmd |= data.clearBit(TOD_M_PATH_CTRL_REG_M_PATH_1_OSC_NOT_VALID); - - // OSC1 step alignment enabled - rc_ecmd |= data.clearBit(TOD_M_PATH_CTRL_REG_M_PATH_1_STEP_ALIGN_DIS); - - // Set 512 steps per sync for path 1 - rc_ecmd |= data.insertFromRight(TOD_M_PATH_CTRL_REG_M_PATH_SYNC_FREQ_SEL_512, - TOD_M_PATH_CTRL_REG_M_PATH_1_SYNC_FREQ_SEL, - TOD_M_PATH_CTRL_REG_M_PATH_SYNC_FREQ_SEL_LEN); - - // Set step check CPS deviation to 50% - rc_ecmd |= data.insertFromRight(STEP_CHECK_CPS_DEVIATION_50_00_PCENT, - TOD_M_PATH_CTRL_REG_M_PATH_1_STEP_CHECK_CPS_DEVIATION, - STEP_CHECK_CPS_DEVIATION_LEN); - - // 8 valid steps are required before step check is enabled - rc_ecmd |= data.insertFromRight(STEP_CHECK_VALIDITY_COUNT_8, - TOD_M_PATH_CTRL_REG_M_PATH_1_STEP_CHECK_VALIDITY_COUNT, - STEP_CHECK_VALIDITY_COUNT_LEN); - } - else - { - FAPI_DBG("configure_tod_node: OSC1 is not connected."); - - // OSC1 is not connected; any previous path-1 settings will be ignored - rc_ecmd |= data.setBit(TOD_M_PATH_CTRL_REG_M_PATH_1_OSC_NOT_VALID); - } - - // CPS deviation factor configures both path-0 and path-1 - rc_ecmd |= data.insertFromRight(STEP_CHECK_CPS_DEVIATION_FACTOR_1, - TOD_M_PATH_CTRL_REG_M_PATH_STEP_CHECK_DEVIATION_FACTOR, - STEP_CHECK_CPS_DEVIATION_FACTOR_LEN); - - if (rc_ecmd) - { - FAPI_ERR("configure_tod_node: Error 0x%08X in ecmdDataBuffer setup for TOD_M_PATH_CTRL_REG_00040000 SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(*target,TOD_M_PATH_CTRL_REG_00040000,data); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: fapiPutScom error for TOD_M_PATH_CTRL_REG_00040000 SCOM."); - break; - } - } - - FAPI_DBG("configure_tod_node: Setting internal path delay"); - // This is the number of TOD-grid-cycles to delay the internal path (0-0xFF valid); 1 TOD-grid-cycle = 400ps (default) - if (i_tod_sel==TOD_PRIMARY) - { - // Primary topology internal path delay set TOD_PRI_PORT_0_CTRL_REG_00040001, regardless of master/slave/port - FAPI_DBG("configure_tod_node: TOD_PRI_PORT_0_CTRL_REG_00040001 will be used to set internal delay"); - port_ctrl_reg = TOD_PRI_PORT_0_CTRL_REG_00040001; - } - else // (i_tod_sel==TOD_SECONDARY) - { - // Secondary topology internal path delay set TOD_SEC_PORT_0_CTRL_REG_00040003 regardless of master/slave/port - FAPI_DBG("configure_tod_node: TOD_SEC_PORT_0_CTRL_REG_00040003 will be used to set internal delay"); - port_ctrl_reg = TOD_SEC_PORT_0_CTRL_REG_00040003; - } - rc=fapiGetScom(*target,port_ctrl_reg,data); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: Error from fapiGetScom when retrieving port_ctrl_reg!"); - break; - } - FAPI_DBG("configure_tod_node: configuring an internal delay of %d TOD-grid-cycles", i_tod_node->o_int_path_delay); - rc_ecmd |= data.insertFromRight(i_tod_node->o_int_path_delay, - TOD_PORT_CTRL_REG_I_PATH_DELAY, - TOD_PORT_CTRL_REG_I_PATH_DELAY_LEN); - if (rc_ecmd) - { - FAPI_ERR("configure_tod_node: Error 0x%08X in ecmdDataBuffer setup for port_ctrl_reg SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(*target,port_ctrl_reg,data); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: fapiPutScom error for port_ctrl_reg SCOM."); - break; - } - - FAPI_DBG("configure_tod_node: Enable delay logic in TOD_I_PATH_CTRL_REG_00040006"); - // Read TOD_I_PATH_CTRL_REG_00040006 in order to perserve any prior configuration - rc=fapiGetScom(*target,TOD_I_PATH_CTRL_REG_00040006,data); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: Error from fapiGetScom when retrieving TOD_I_PATH_CTRL_REG_00040006!"); - break; - } - - // Ensure delay is enabled - rc_ecmd |= data.clearBit(TOD_I_PATH_CTRL_REG_DELAY_DIS); - rc_ecmd |= data.clearBit(TOD_I_PATH_CTRL_REG_DELAY_ADJUST_DIS); - - // Deviation for internal OSC should be set to max, allowing backup master TOD to run the active topology, - // when switching from Slave OSC path to Master OSC path - rc_ecmd |= data.insertFromRight(STEP_CHECK_CPS_DEVIATION_93_75_PCENT, - TOD_I_PATH_CTRL_REG_STEP_CHECK_CPS_DEVIATION, - STEP_CHECK_CPS_DEVIATION_LEN); - rc_ecmd |= data.insertFromRight(STEP_CHECK_CPS_DEVIATION_FACTOR_1, - TOD_M_PATH_CTRL_REG_M_PATH_STEP_CHECK_DEVIATION_FACTOR, - STEP_CHECK_CPS_DEVIATION_FACTOR_LEN); - rc_ecmd |= data.insertFromRight(STEP_CHECK_VALIDITY_COUNT_8, - TOD_I_PATH_CTRL_REG_STEP_CHECK_VALIDITY_COUNT, - STEP_CHECK_VALIDITY_COUNT_LEN); - if (rc_ecmd) - { - FAPI_ERR("configure_tod_node: Error 0x%08X in ecmdDataBuffer setup for TOD_I_PATH_CTRL_REG_00040006 SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(*target,TOD_I_PATH_CTRL_REG_00040006,data); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: fapiPutScom error for TOD_I_PATH_CTRL_REG_00040006 SCOM."); - break; - } - - FAPI_DBG("configure_tod_node: Set low order step value to 3F in TOD_CHIP_CTRL_REG_00040010"); - // Read TOD_CHIP_CTRL_REG_00040010 in order to perserve any prior configuration - rc=fapiGetScom(*target,TOD_CHIP_CTRL_REG_00040010,data); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: Error from fapiGetScom when retrieving TOD_CHIP_CTRL_REG_00040010!"); - break; - } - - rc = init_chip_ctrl_reg(data); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: Error from init_chip_ctrl_reg while setting TOD_CHIP_CTRL_REG_00040010"); - break; - } - - rc = fapiPutScom(*target,TOD_CHIP_CTRL_REG_00040010,data); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: fapiPutScom error for TOD_CHIP_CTRL_REG_00040010 SCOM."); - break; - } - - // TOD is configured for this node; if it has children, start their configuration - for (std::list<tod_topology_node*>::iterator child = (i_tod_node->i_children).begin(); - child != (i_tod_node->i_children).end(); - ++child) - { - tod_topology_node* tod_node = *child; - rc = configure_tod_node(tod_node,i_tod_sel,i_osc_sel); - if (!rc.ok()) - { - FAPI_ERR("configure_tod_node: Failure configuring downstream node!"); - break; - } - } - if (!rc.ok()) - { - break; // error in above for loop - } - } while(0); - - FAPI_INF("configure_tod_node: End"); - return rc; -} - -//------------------------------------------------------------------------------ -// function: display_tod_node -// -// parameters: i_tod_node Reference to TOD topology -// -// returns: nothing (display-only helper function) -//------------------------------------------------------------------------------ -void display_tod_nodes(const tod_topology_node* i_tod_node, const uint32_t i_depth) -{ - - do - { - if (i_tod_node == NULL || i_tod_node->i_target == NULL) - { - FAPI_ERR("display_tod_nodes: NULL tod_node or target passed to display_tod_nodes()!"); - break; - } - FAPI_INF("display_tod_nodes: %s (Delay = %d)",i_tod_node->i_target->toEcmdString(), - i_tod_node->o_int_path_delay); - - for (std::list<tod_topology_node*>::const_iterator child = (i_tod_node->i_children).begin(); - child != (i_tod_node->i_children).end(); - ++child) - { - display_tod_nodes(*child,i_depth+1); - } - } while(0); -} - -//------------------------------------------------------------------------------ -// function: calculate_node_delays -// -// parameters: i_tod_node Reference to TOD topology -// -// returns: FAPI_RC_SUCCESS if TOD topology is successfully configured with delays -// else FAPI or ECMD error is sent through -//------------------------------------------------------------------------------ -fapi::ReturnCode calculate_node_delays(tod_topology_node* i_tod_node) -{ - fapi::ReturnCode rc; - ecmdDataBufferBase data(64); - - FAPI_INF("calculate_node_delays: Start"); - do - { - // retrieve X-bus and A-bus frequencies - uint32_t freq_x = 0; - uint32_t freq_a = 0; - rc = FAPI_ATTR_GET(ATTR_FREQ_X, NULL, freq_x); - if (!rc.ok()) - { - FAPI_ERR("calculate_node_delays: Failure reading XBUS frequency attribute!"); - break; - } - rc = FAPI_ATTR_GET(ATTR_FREQ_A, NULL, freq_a); - if (!rc.ok()) - { - FAPI_ERR("calculate_node_delays: Failure reading ABUS frequency attribute!"); - break; - } - - // Bus frequencies are global for the system (i.e. A0 and A1 will always run with the same frequency) - FAPI_DBG("calculate_node_delays: XBUS=%dMHz ABUS=%dMHz", freq_x, freq_a); - - // Find the most-delayed path in the topology; this is the MDMT's delay - uint32_t longest_delay = 0; - rc = calculate_longest_topolopy_delay(i_tod_node, freq_x, freq_a, &longest_delay); - if (!rc.ok()) - { - FAPI_ERR("calculate_node_delays: Failure calculating longest topology delay!"); - break; - } - FAPI_DBG("calculate_node_delays: the longest delay is %d TOD-grid-cycles.", longest_delay); - - rc = set_topology_delays(i_tod_node, freq_x, freq_a, longest_delay); - if (!rc.ok()) - { - FAPI_ERR("calculate_node_delays: Unable to set topology delays!"); - break; - } - - // Finally, the MDMT delay must include additional TOD-grid-cycles to account for staging latches in slaves - i_tod_node->o_int_path_delay += MDMT_TOD_GRID_CYCLE_STAGING_DELAY; - } while(0); - - FAPI_INF("calculate_node_delays: End"); - return rc; -} - -//------------------------------------------------------------------------------ -// function: calculate_longest_topolopy_delay -// -// parameters: i_tod_node Reference to TOD topology -// i_freq_x XBUS frequency in MHz -// i_freq_a ABUS frequency in MHz -// o_longest_delay Contains the longest delay for the topology in TOD-grid-cycles -// (This is the delay of MDMT; children are derived from this) -// -// returns: FAPI_RC_SUCCESS if a longest TOD delay was found in topology -// else FAPI or ECMD error is sent through -//------------------------------------------------------------------------------ -fapi::ReturnCode calculate_longest_topolopy_delay(tod_topology_node* i_tod_node, - const uint32_t i_freq_x, - const uint32_t i_freq_a, - uint32_t* o_longest_delay) -{ - fapi::ReturnCode rc; - - FAPI_INF("calculate_longest_topolopy_delay: Start"); - - do - { - uint32_t node_delay = 0; - - rc = calculate_node_link_delay(i_tod_node, i_freq_x, i_freq_a, &node_delay); - if (!rc.ok()) - { - FAPI_ERR("calculate_longest_topolopy_delay: Failure calculating single node delay!"); - break; - } - *o_longest_delay = node_delay; - - uint32_t current_longest_delay = 0; - for (std::list<tod_topology_node*>::const_iterator child = (i_tod_node->i_children).begin(); - child != (i_tod_node->i_children).end(); - ++child) - { - tod_topology_node* tod_node = *child; - rc = calculate_longest_topolopy_delay(tod_node, i_freq_x, i_freq_a, &node_delay); - if (!rc.ok()) - { - FAPI_ERR("calculate_longest_topolopy_delay: Failure calculating topology delay!"); - break; - } - if (node_delay>current_longest_delay) - { - current_longest_delay=node_delay; - } - } - if (!rc.ok()) - { - break; // error in above for loop - } - *o_longest_delay += current_longest_delay; - } while(0); - - FAPI_INF("calculate_longest_topolopy_delay: End"); - return rc; -} - -//------------------------------------------------------------------------------ -// function: calculate_node_link_delay -// -// parameters: i_tod_node Reference to TOD topology -// i_freq_x XBUS frequency in MHz -// i_freq_a ABUS frequency in MHz -// o_node_delay Delay of a single node in TOD-grid-cycles -// (Does not include upstream or downstream delays) -// -// returns: FAPI_RC_SUCCESS if TOD node delay is successfully calculated -// else FAPI or ECMD error is sent through -//------------------------------------------------------------------------------ -fapi::ReturnCode calculate_node_link_delay(tod_topology_node* i_tod_node, - const uint32_t i_freq_x, - const uint32_t i_freq_a, - uint32_t* o_node_delay) -{ - fapi::ReturnCode rc; - ecmdDataBufferBase data(64); - uint32_t rc_ecmd = 0; - fapi::Target* target = i_tod_node->i_target; - - FAPI_INF("calculate_node_link_delay: Start"); - - do - { - // MDMT is originator and therefore has no node delay - if (i_tod_node->i_tod_master && i_tod_node->i_drawer_master) - { - *o_node_delay = 0; - } - else // slave node - { - uint32_t bus_mode_addr = 0; - uint32_t bus_mode_sel = 0; - uint32_t bus_freq = 0; - uint8_t bus_delay = 0; - switch (i_tod_node->i_bus_rx) - { - case(NONE): FAPI_SET_HWP_ERROR(rc, RC_PROC_TOD_SETUP_INVALID_TOPOLOGY); break; - case(XBUS0): bus_freq = i_freq_x; bus_mode_addr = PB_X_MODE_0x04010C0A; bus_mode_sel = PB_X_MODE_LINK_X0_ROUND_TRIP_DELAY; break; - case(XBUS1): bus_freq = i_freq_x; bus_mode_addr = PB_X_MODE_0x04010C0A; bus_mode_sel = PB_X_MODE_LINK_X1_ROUND_TRIP_DELAY; break; - case(XBUS2): bus_freq = i_freq_x; bus_mode_addr = PB_X_MODE_0x04010C0A; bus_mode_sel = PB_X_MODE_LINK_X2_ROUND_TRIP_DELAY; break; - case(XBUS3): bus_freq = i_freq_x; bus_mode_addr = PB_X_MODE_0x04010C0A; bus_mode_sel = PB_X_MODE_LINK_X3_ROUND_TRIP_DELAY; break; - case(ABUS0): bus_freq = i_freq_a; bus_mode_addr = PB_A_MODE_0x0801080A; bus_mode_sel = PB_A_MODE_LINK_A0_ROUND_TRIP_DELAY; break; - case(ABUS1): bus_freq = i_freq_a; bus_mode_addr = PB_A_MODE_0x0801080A; bus_mode_sel = PB_A_MODE_LINK_A1_ROUND_TRIP_DELAY; break; - case(ABUS2): bus_freq = i_freq_a; bus_mode_addr = PB_A_MODE_0x0801080A; bus_mode_sel = PB_A_MODE_LINK_A2_ROUND_TRIP_DELAY; break; - } - if (!rc.ok()) - { - break; // error in above switch - } - rc=fapiGetScom(*target,bus_mode_addr,data); - if (!rc.ok()) - { - FAPI_ERR("calculate_node_link_delay: Error from fapiGetScom when retrieving bus_mode_addr!"); - break; - } - rc_ecmd = data.extract(&bus_delay, bus_mode_sel, LINK_ROUND_TRIP_DELAY_LEN); - if (rc_ecmd) - { - FAPI_ERR("calculate_node_link_delay: Error 0x%08X in ecmdDataBuffer extract.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - - // By default, the TOD grid runs at 400ps; TOD counts its delay based on this - // Example: Bus round trip delay is 35 cycles and the bus is running at 4800MHz - // - Divide by 2 to get one-way delay time - // - Divide by 4800 * 10^6 to get delay in seconds - // - Multiply by 10^12 to get delay in picoseconds - // - Divide by 400ps to get TOD-grid-cycles - // - (To avoid including math.h) Add 1 and cast to uint32_t to round up to nearest TOD-grid-cycle - // - (To avoid including math.h) 10^12/10^6=1000000 - // - (uint32_t)(( 35 / 2 / (4800 * 10^6) * 10^12 / 400 ) + 1) = 10 TOD-grid-cycles - *o_node_delay = (uint32_t)(((double)bus_delay / 2 / (double)bus_freq * 1000000 / TOD_GRID_PS) + 1); - } - // This is not the final internal path delay, only saved so two calls aren't needed to calculate_node_link_delay - i_tod_node->o_int_path_delay = *o_node_delay; - - FAPI_DBG("calculate_node_link_delay: TOD-grid-cycles for single link: %d", *o_node_delay); - } while(0); - - FAPI_INF("calculate_node_link_delay: End"); - return rc; -} - -//------------------------------------------------------------------------------ -// function: set_topology_delays -// -// parameters: i_tod_node Reference to TOD topology -// i_freq_x XBUS frequency in MHz -// i_freq_a ABUS frequency in MHz -// i_longest_delay Longest topology delay; sub-delays are computed from it -// -// returns: FAPI_RC_SUCCESS if o_int_path_delay was set for every node in the topology -// else FAPI or ECMD error is sent through -//------------------------------------------------------------------------------ -fapi::ReturnCode set_topology_delays(tod_topology_node* i_tod_node, - const uint32_t i_freq_x, - const uint32_t i_freq_a, - const uint32_t i_longest_delay) -{ - fapi::ReturnCode rc; - FAPI_INF("set_topology_delays: Start"); - - do - { - // Retreive saved node_delay from calculate_node_link_delay instead of making a second call - i_tod_node->o_int_path_delay=i_longest_delay-(i_tod_node->o_int_path_delay); - - // Verify the delay is between 0 and 255 inclusive. - if (i_tod_node->o_int_path_delay<MIN_TOD_DELAY || - i_tod_node->o_int_path_delay>MAX_TOD_DELAY) - { - FAPI_ERR("set_topology_delays: Invalid delay of %d calculated!", i_tod_node->o_int_path_delay); - FAPI_SET_HWP_ERROR(rc, RC_PROC_TOD_SETUP_INVALID_NODE_DELAY); - break; - } - - // Recurse on downstream nodes - for (std::list<tod_topology_node*>::const_iterator child = (i_tod_node->i_children).begin(); - child != (i_tod_node->i_children).end(); - ++child) - { - tod_topology_node* tod_node = *child; - rc = set_topology_delays(tod_node,i_freq_x,i_freq_a,i_tod_node->o_int_path_delay); - if (!rc.ok()) - { - FAPI_ERR("set_topology_delays: Failure calculating topology delay!"); - break; - } - } - } while(0); - - FAPI_INF("set_topology_delays: End"); - return rc; -} - -//------------------------------------------------------------------------------ -// function: init_chip_ctrl_reg -// -// parameters: o_chic_ctrlReg_val => ecmdDataBuffer containing the -// Chip Control Status Register configuration -// -// returns: FAPI_RC_SUCCESS if TOD_CHIP_CTRL_REG_00040010's value was successfully -// calculated else ECMD error is sent back -// -//------------------------------------------------------------------------------ -fapi::ReturnCode init_chip_ctrl_reg (ecmdDataBufferBase& o_chic_ctrlReg_val) -{ - fapi::ReturnCode rc; - FAPI_INF("init_chip_ctrl_reg: Start"); - - do - { - uint32_t rc_ecmd = 0; - - // Default core sync period is 8us - rc_ecmd |= o_chic_ctrlReg_val.insertFromRight(TOD_CHIP_CTRL_REG_I_PATH_CORE_SYNC_PERIOD_SEL_8, - TOD_CHIP_CTRL_REG_I_PATH_CORE_SYNC_PERIOD_SEL, - TOD_CHIP_CTRL_REG_I_PATH_CORE_SYNC_PERIOD_SEL_LEN); - - // Enable internal path sync check - rc_ecmd |= o_chic_ctrlReg_val.clearBit(TOD_CHIP_CTRL_REG_I_PATH_SYNC_CHECK_DIS); - - // 1x sync boundaries for Move-TOD-To-Timebase - rc_ecmd |= o_chic_ctrlReg_val.clearBit(TOD_CHIP_CTRL_REG_MOVE_TOD_TO_TB_ON_2X_SYNC_EN); - - // Use eclipz sync mechanism - rc_ecmd |= o_chic_ctrlReg_val.clearBit(TOD_CHIP_CTRL_REG_USE_TB_SYNC_MECHANISM); - - // Use timebase step sync from internal path - rc_ecmd |= o_chic_ctrlReg_val.clearBit(TOD_CHIP_CTRL_REG_USE_TB_STEP_SYNC); - - // Chip TOD WOF incrementer ratio (eclipz mode) - // 4-bit WOF counter is incremented with each 200MHz clock cycle - rc_ecmd |= o_chic_ctrlReg_val.insertFromRight(TOD_CHIP_CTRL_REG_LOW_ORDER_STEP_VAL_3F, - TOD_CHIP_CTRL_REG_LOW_ORDER_STEP_VAL, - TOD_CHIP_CTRL_REG_LOW_ORDER_STEP_VAL_LEN); - - // Stop TOD when system checkstop occurs - rc_ecmd |= o_chic_ctrlReg_val.clearBit(TOD_CHIP_CTRL_REG_XSTOP_GATE); - - if (rc_ecmd) - { - FAPI_ERR("init_chip_ctrl_reg: Error 0x%08X in ecmdDataBuffer", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - - } while(0); - - FAPI_INF("init_chip_ctrl_reg: End"); - return rc; -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/tod_init/proc_tod_setup/proc_tod_setup.H b/src/usr/hwpf/hwp/tod_init/proc_tod_setup/proc_tod_setup.H deleted file mode 100644 index ee553ab1d..000000000 --- a/src/usr/hwpf/hwp/tod_init/proc_tod_setup/proc_tod_setup.H +++ /dev/null @@ -1,202 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/proc_tod_setup/proc_tod_setup.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2013,2014 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -// $Id: proc_tod_setup.H,v 1.9 2014/10/22 17:11:13 jklazyns Exp $ -//------------------------------------------------------------------------------ -// *! (C) Copyright International Business Machines Corp. 2012 -// *! All Rights Reserved -- Property of IBM -// *! *** *** -// *! -// *! TITLE : proc_tod_setup.H -// *! -// *! DESCRIPTION : Header for proc_tod_setup.C -// *! -// *! OWNER NAME : Nick Klazynski Email: jklazyns@us.ibm.com -// *! BACKUP NAME : Email: -// *! -// *! ADDITIONAL COMMENTS : -// *! -//------------------------------------------------------------------------------ - -#ifndef PROC_TOD_SETUP_H_ -#define PROC_TOD_SETUP_H_ - -//------------------------------------------------------------------------------ -// Includes -//------------------------------------------------------------------------------ - -#include "proc_tod_utils.H" - -//------------------------------------------------------------------------------ -// Constant definitions -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// Structure definitions -//------------------------------------------------------------------------------ - -// function pointer typedef definition for HWP call support -typedef fapi::ReturnCode -(*proc_tod_setup_FP_t) (tod_topology_node*, - const proc_tod_setup_tod_sel, - const proc_tod_setup_osc_sel); - -// function pointer which allows HWSV to calculate TOD_CHIP_CTRL_REG_00040010's value -// (Does not set the register) -typedef fapi::ReturnCode -(*init_chip_ctrl_reg_FP_t) (ecmdDataBufferBase&); - -//------------------------------------------------------------------------------ -// Function prototypes -//------------------------------------------------------------------------------ - -extern "C" -{ - -/** - * @brief Configures the TOD topology - * - * @param[in] i_tod_node Reference to TOD topology (FAPI targets included within) - * i_tod_sel Specifies the topology to configure - * i_osc_sel Specifies the oscillator to use for the master - * - * @return FAPI_RC_SUCCESS if TOD topology is successfully configured - * else FAPI or ECMD error is sent through - */ -fapi::ReturnCode proc_tod_setup(tod_topology_node* i_tod_node, - const proc_tod_setup_tod_sel i_tod_sel, - const proc_tod_setup_osc_sel i_osc_sel); - -/** - * @brief Helper function for proc_tod_setup - * - * @param[in] i_tod_node Reference to TOD topology (FAPI targets included within) - * i_tod_sel Specifies the topology to configure - * i_osc_sel Specifies the oscillator to use for the master - * - * @return FAPI_RC_SUCCESS if TOD topology is successfully configured - * else FAPI or ECMD error is sent through - */ -fapi::ReturnCode configure_tod_node(tod_topology_node* i_tod_node, - const proc_tod_setup_tod_sel i_tod_sel, - const proc_tod_setup_osc_sel i_osc_sel); - -/** - * @brief Helper function for proc_tod_setup - * - * @param[in] i_tod_node Reference to TOD topology (FAPI targets included within) - * i_tod_sel Specifies the topology to clear - * i_is_mpipl if this IPL is an MPIPL, additional setup is needed; - * determined via an attribute - * - * @return FAPI_RC_SUCCESS if TOD topology is successfully cleared - * else FAPI or ECMD error is sent through - */ -fapi::ReturnCode clear_tod_node(tod_topology_node* i_tod_node, - const proc_tod_setup_tod_sel i_tod_sel, - const fapi::ATTR_IS_MPIPL_Type i_is_mpipl); - -/** - * @brief Calculates TOD_CHIP_CTRL_REG_00040010 value; will be called - * while configuring the TOD node - * - * @param[out] o_chic_ctrlReg_val => ecmdDataBuffer containing the - * Chip Control Status Register configuration - * - * @return FAPI_RC_SUCCESS if TOD_CHIP_CTRL_REG_00040010's value was successfully - * calculated else ECMD error is sent back - */ -fapi::ReturnCode init_chip_ctrl_reg(ecmdDataBufferBase& o_chic_ctrlReg_val); - -/** - * @brief Displays the TOD topology - * - * @param[in] i_tod_node Reference to TOD topology - * - * @return void - */ -void display_tod_nodes(const tod_topology_node* i_tod_node, const uint32_t depth); - -/** - * @brief Calculates and populates the topology delays - * - * @param[in] i_tod_node Reference to TOD topology - * - * @return FAPI_RC_SUCCESS if TOD topology is successfully configured with delays - * else FAPI or ECMD error is sent through - */ -fapi::ReturnCode calculate_node_delays(tod_topology_node* i_tod_node); - -/** - * @brief Finds the longest delay in the topology (additionally sets each node delay) - * - * @param[in] i_tod_node Reference to TOD topology - * @param[in] i_freq_x XBUS frequency in MHz - * @param[in] i_freq_a ABUS frequency in MHz - * - * @param[out] o_longest_delay Longest delay in TOD-grid-cycles - * - * @return FAPI_RC_SUCCESS if a longest TOD delay was found in topology - * else FAPI or ECMD error is sent through - */ -fapi::ReturnCode calculate_longest_topolopy_delay(tod_topology_node* i_tod_node, - const uint32_t i_freq_x, - const uint32_t i_freq_a, - uint32_t* o_longest_delay); - -/** - * @brief Calculates the delay for a node in TOD-grid-cycles - * - * @param[in] i_tod_node Reference to TOD topology - * @param[in] i_freq_x XBUS frequency in MHz - * @param[in] i_freq_a ABUS frequency in MHz - * - * @param[out] o_node_delay Delay of a single node in TOD-grid-cycles - * - * @return FAPI_RC_SUCCESS if TOD node delay is successfully calculated - * else FAPI or ECMD error is sent through - */ -fapi::ReturnCode calculate_node_link_delay(tod_topology_node* i_tod_node, - const uint32_t i_freq_x, - const uint32_t i_freq_a, - uint32_t* o_node_delay); - -/** - * @brief Updates the topology struct with the final delay values - * - * @param[in] i_tod_node Reference to TOD topology - * @param[in] i_freq_x XBUS frequency in MHz - * @param[in] i_freq_a ABUS frequency in MHz - * @param[in] i_longest_delay Longest delay in the topology - * - * @return FAPI_RC_SUCCESS if o_int_path_delay was set for every node in the topology - * else FAPI or ECMD error is sent through - */ -fapi::ReturnCode set_topology_delays(tod_topology_node* i_tod_node, - const uint32_t i_freq_x, - const uint32_t i_freq_a, - const uint32_t i_longest_delay); -} // extern "C" - -#endif // PROC_TOD_SETUP_H_ diff --git a/src/usr/hwpf/hwp/tod_init/proc_tod_utils/proc_tod_utils.C b/src/usr/hwpf/hwp/tod_init/proc_tod_utils/proc_tod_utils.C deleted file mode 100644 index 63db742bd..000000000 --- a/src/usr/hwpf/hwp/tod_init/proc_tod_utils/proc_tod_utils.C +++ /dev/null @@ -1,190 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/proc_tod_utils/proc_tod_utils.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2013,2014 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -// $Id: proc_tod_utils.C,v 1.4 2012/10/23 19:17:00 jklazyns Exp $ -//------------------------------------------------------------------------------ -// *! (C) Copyright International Business Machines Corp. 2012 -// *! All Rights Reserved -- Property of IBM -// *! *** *** -// *! -// *! TITLE : proc_tod_utils.C -// *! -// *! DESCRIPTION : TOD helper functions; not called directly, but used by other -// *! FAPI procedures -// *! -// *! OWNER NAME : Nick Klazynski Email: jklazyns@us.ibm.com -// *! BACKUP NAME : Email: -// *! -// *! ADDITIONAL COMMENTS : -// *! -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// Includes -//------------------------------------------------------------------------------ -#include "proc_tod_utils.H" -#include "p8_scom_addresses.H" - -//------------------------------------------------------------------------------ -// Function definitions -//------------------------------------------------------------------------------ - -extern "C" -{ - -//------------------------------------------------------------------------------ -// function: proc_tod_utils_get_tfmr_reg -// -// parameters: i_target => chip target -// o_tfmr_val => TFMR value read -// returns: FAPI_RC_SUCCESS if TFMR read is successful -// else FAPI or ECMD error is sent through -// -//------------------------------------------------------------------------------ -fapi::ReturnCode proc_tod_utils_get_tfmr_reg( - const fapi::Target& i_target, - ecmdDataBufferBase& o_tfmr_val) -{ - fapi::ReturnCode rc; - ecmdDataBufferBase data(64); - uint32_t rc_ecmd = 0; - - FAPI_INF("proc_tod_utils_get_tfmr_reg: Start"); - - do - { - //FAPI_DBG("proc_tod_utils_get_tfmr_reg: Setting SPR_MODE to LPAR0/T0"); - rc_ecmd |= data.flushTo0(); - rc_ecmd |= data.setBit(SPR_MODE_REG_MODE_SPRC_WR_EN); - rc_ecmd |= data.setBit(SPR_MODE_REG_MODE_SPRC0_SEL); - rc_ecmd |= data.setBit(SPR_MODE_REG_MODE_SPRC_T0_SEL); - if (rc_ecmd) - { - FAPI_ERR("proc_tod_utils_get_tfmr_reg: Error 0x%08X in ecmdDataBuffer setup for EX_PERV_SPR_MODE_10013281 SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(i_target, EX_PERV_SPR_MODE_10013281, data); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_utils_get_tfmr_reg: fapiPutScom error for EX_PERV_SPR_MODE_10013281 SCOM."); - break; - } - //FAPI_DBG("proc_tod_utils_get_tfmr_reg: Setting SPRC to T0's TMFR"); - rc_ecmd |= data.flushTo0(); - rc_ecmd |= data.insertFromRight(SPRC_REG_SEL_TFMR_T0,SPRC_REG_SEL,SPRC_REG_SEL_LEN); - if (rc_ecmd) - { - FAPI_ERR("proc_tod_utils_get_tfmr_reg: Error 0x%08X in ecmdDataBuffer setup for EX_PERV_L0_SCOM_SPRC_10013280 SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(i_target, EX_PERV_L0_SCOM_SPRC_10013280, data); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_utils_get_tfmr_reg: fapiPutScom error for EX_PERV_L0_SCOM_SPRC_10013280 SCOM."); - break; - } - - //FAPI_DBG("proc_tod_utils_get_tfmr_reg: Reading SPRD for T0's TMFR"); - rc = fapiGetScom(i_target, EX_PERV_SPRD_L0_100132A3, o_tfmr_val); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_utils_get_tfmr_reg: fapiGetScom error for EX_PERV_SPRD_L0_100132A3 SCOM."); - break; - } - - } while(0); - - FAPI_INF("proc_tod_utils_get_tfmr_reg: End"); - return rc; -} - -//------------------------------------------------------------------------------ -// function: proc_tod_utils_set_tfmr_reg -// -// parameters: i_target => chip target -// i_tfmr_val => TFMR value to write -// returns: FAPI_RC_SUCCESS if TFMR write is successful -// else FAPI or ECMD error is sent through -// -//------------------------------------------------------------------------------ -fapi::ReturnCode proc_tod_utils_set_tfmr_reg( - const fapi::Target& i_target, - ecmdDataBufferBase& i_tfmr_val) -{ - fapi::ReturnCode rc; - ecmdDataBufferBase data(64); - uint32_t rc_ecmd = 0; - - FAPI_INF("proc_tod_utils_set_tfmr_reg: Start"); - - do - { - //FAPI_DBG("proc_tod_utils_set_tfmr_reg: Setting SPR_MODE to LPAR0/T0"); - rc_ecmd |= data.flushTo0(); - rc_ecmd |= data.setBit(SPR_MODE_REG_MODE_SPRC_WR_EN); - rc_ecmd |= data.setBit(SPR_MODE_REG_MODE_SPRC0_SEL); - rc_ecmd |= data.setBit(SPR_MODE_REG_MODE_SPRC_T0_SEL); - if (rc_ecmd) - { - FAPI_ERR("proc_tod_utils_set_tfmr_reg: Error 0x%08X in ecmdDataBuffer setup for EX_PERV_SPR_MODE_10013281 SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(i_target, EX_PERV_SPR_MODE_10013281, data); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_utils_set_tfmr_reg: fapiPutScom error for EX_PERV_SPR_MODE_10013281 SCOM."); - break; - } - //FAPI_DBG("proc_tod_utils_set_tfmr_reg: Setting SPRC to T0's TMFR"); - rc_ecmd |= data.flushTo0(); - rc_ecmd |= data.insertFromRight(SPRC_REG_SEL_TFMR_T0,SPRC_REG_SEL,SPRC_REG_SEL_LEN); - if (rc_ecmd) - { - FAPI_ERR("proc_tod_utils_set_tfmr_reg: Error 0x%08X in ecmdDataBuffer setup for EX_PERV_L0_SCOM_SPRC_10013280 SCOM.", rc_ecmd); - rc.setEcmdError(rc_ecmd); - break; - } - rc = fapiPutScom(i_target, EX_PERV_L0_SCOM_SPRC_10013280, data); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_utils_set_tfmr_reg: fapiPutScom error for EX_PERV_L0_SCOM_SPRC_10013280 SCOM."); - break; - } - //FAPI_DBG("proc_tod_utils_set_tfmr_reg: Writing SPRD to set T0's TMFR"); - rc = fapiPutScom(i_target, EX_PERV_SPRD_L0_100132A3, i_tfmr_val); - if (!rc.ok()) - { - FAPI_ERR("proc_tod_utils_set_tfmr_reg: fapiGetScom error for EX_PERV_SPRD_L0_100132A3 SCOM."); - break; - } - } while(0); - - FAPI_INF("proc_tod_utils_set_tfmr_reg: End"); - return rc; -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/tod_init/proc_tod_utils/proc_tod_utils.H b/src/usr/hwpf/hwp/tod_init/proc_tod_utils/proc_tod_utils.H deleted file mode 100644 index 464136f9a..000000000 --- a/src/usr/hwpf/hwp/tod_init/proc_tod_utils/proc_tod_utils.H +++ /dev/null @@ -1,500 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/proc_tod_utils/proc_tod_utils.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2013,2015 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -// $Id: proc_tod_utils.H,v 1.17 2015/01/08 19:50:37 jklazyns Exp $ -//------------------------------------------------------------------------------ -// *! (C) Copyright International Business Machines Corp. 2012 -// *! All Rights Reserved -- Property of IBM -// *! *** *** -// *! -// *! TITLE : proc_tod_utils.H -// *! -// *! DESCRIPTION : Header for proc_tod_utils.C -// *! -// *! OWNER NAME : Nick Klazynski Email: jklazyns@us.ibm.com -// *! BACKUP NAME : Email: -// *! -// *! ADDITIONAL COMMENTS : -// *! -//------------------------------------------------------------------------------ - -#ifndef PROC_TOD_UTILS_H_ -#define PROC_TOD_UTILS_H_ - -//------------------------------------------------------------------------------ -// Includes -//------------------------------------------------------------------------------ - -#include <fapi.H> -#include <list> // Required by firmware for std::list use - -//------------------------------------------------------------------------------ -// Constant definitions -//------------------------------------------------------------------------------ - -// TOD-grid-cycles added to MDMT delay to account for slave staging -const uint32_t MDMT_TOD_GRID_CYCLE_STAGING_DELAY = 6; - -// Duration of TOD GRID cycle in picoseconds -const uint32_t TOD_GRID_PS = 400; - -// Minimum/Maximum allowable delay for any node -const uint32_t MIN_TOD_DELAY = 0; -const uint32_t MAX_TOD_DELAY = 0xFF; - -// TOD operation delay times for HW/sim -const uint32_t PROC_TOD_UTILS_HW_NS_DELAY = 50000; -const uint32_t PROC_TOD_UTILS_SIM_CYCLE_DELAY = 50000; - -// TOD retry count for hardware-cleared bits -const uint32_t PROC_TOD_UTIL_TIMEOUT_COUNT = 20; - -// HANG_PULSE_4_REG is needed for TB[60:63] -const uint32_t HANG_PULSE_4_REG_VAL = 0; -const uint32_t HANG_PULSE_4_REG_VAL_LEN = 6; - -//Bit definitions for SPRC_REG -const uint32_t SPRC_REG_SEL = 52; -const uint32_t SPRC_REG_SEL_LEN = 9; -const uint32_t SPRC_REG_SEL_TFMR_T0 = 0; - -//Bit definitions for SPR_MODE_REG -const uint32_t SPR_MODE_REG_MODE_SPRC_WR_EN = 3; -const uint32_t SPR_MODE_REG_MODE_SPRC0_SEL = 16; -const uint32_t SPR_MODE_REG_MODE_SPRC_T0_SEL = 20; - -//Bit definitions for TOD_M_PATH_CTRL_REG -const uint32_t TOD_M_PATH_CTRL_REG_M_PATH_0_OSC_NOT_VALID = 0; -const uint32_t TOD_M_PATH_CTRL_REG_M_PATH_1_OSC_NOT_VALID = 1; -const uint32_t TOD_M_PATH_CTRL_REG_M_PATH_0_STEP_ALIGN_DIS = 2; -const uint32_t TOD_M_PATH_CTRL_REG_M_PATH_1_STEP_ALIGN_DIS = 3; -const uint32_t TOD_M_PATH_CTRL_REG_M_PATH_0_SYNC_FREQ_SEL = 4; -const uint32_t TOD_M_PATH_CTRL_REG_M_PATH_1_SYNC_FREQ_SEL = 6; -const uint32_t TOD_M_PATH_CTRL_REG_M_PATH_0_STEP_CHECK_CPS_DEVIATION = 8; -const uint32_t TOD_M_PATH_CTRL_REG_M_PATH_0_STEP_CHECK_VALIDITY_COUNT = 13; -const uint32_t TOD_M_PATH_CTRL_REG_M_PATH_1_STEP_CHECK_CPS_DEVIATION = 16; -const uint32_t TOD_M_PATH_CTRL_REG_M_PATH_1_STEP_CHECK_VALIDITY_COUNT = 21; -const uint32_t TOD_M_PATH_CTRL_REG_M_PATH_STEP_CHECK_DEVIATION_FACTOR = 24; - -const uint32_t TOD_M_PATH_CTRL_REG_M_PATH_SYNC_FREQ_SEL_LEN = 2; - -const uint32_t TOD_M_PATH_CTRL_REG_M_PATH_SYNC_FREQ_SEL_512 = 0; -const uint32_t TOD_M_PATH_CTRL_REG_M_PATH_SYNC_FREQ_SEL_2048 = 1; -const uint32_t TOD_M_PATH_CTRL_REG_M_PATH_SYNC_FREQ_SEL_1024 = 2; -const uint32_t TOD_M_PATH_CTRL_REG_M_PATH_SYNC_FREQ_SEL_256 = 3; - -//Bit definitions for TOD_I_PATH_CTRL_REG -const uint32_t TOD_I_PATH_CTRL_REG_DELAY_DIS = 0; -const uint32_t TOD_I_PATH_CTRL_REG_DELAY_ADJUST_DIS = 1; -const uint32_t TOD_I_PATH_CTRL_REG_STEP_CHECK_CPS_DEVIATION_FACTOR = 6; -const uint32_t TOD_I_PATH_CTRL_REG_STEP_CHECK_CPS_DEVIATION = 8; -const uint32_t TOD_I_PATH_CTRL_REG_STEP_CHECK_VALIDITY_COUNT = 13; - -//Bit definitions for TOD_START_TOD_REG -const uint32_t TOD_START_TOD_REG_FSM_START_TOD_TRIGGER = 0; // Write-only -const uint32_t TOD_START_TOD_REG_FSM_START_TOD_DATA02 = 2; // Write-only - -//Bit definitions for TOD_LOAD_TOD_REG -const uint32_t TOD_LOAD_TOD_REG_LOAD_TOD_VAL = 0; -const uint32_t TOD_LOAD_TOD_REG_WOF = 60; - -const uint32_t TOD_LOAD_TOD_REG_LOAD_TOD_VAL_LEN = 60; -const uint32_t TOD_LOAD_TOD_REG_WOF_LEN = 4; - -//Bit definitions for TOD_VALUE_REG -const uint32_t TOD_VALUE_REG_TOD_VAL = 0; -const uint32_t TOD_VALUE_REG_WOF_COUNTER_VAL = 60; - -const uint32_t TOD_VALUE_REG_TOD_VAL_LEN = 60; -const uint32_t TOD_VALUE_REG_WOF_COUNTER_VAL_LEN = 4; - -//Bit definitions for TOD_LOAD_TOD_MOD_REG -const uint32_t TOD_LOAD_TOD_MOD_REG_FSM_LOAD_TOD_MOD_TRIG = 0; //Write-only - -//Bit definitions for TOD_TX_TTYPE_CTRL_REG -const uint32_t TOD_TX_TTYPE_CTRL_REG_TX_TTYPE_PIB_MST_ADDR_CFG = 24; -const uint32_t TOD_TX_TTYPE_CTRL_REG_TX_TTYPE_PIB_MST_ADDR_CFG_C5 = 0x15; -const uint32_t TOD_TX_TTYPE_CTRL_REG_TX_TTYPE_PIB_MST_ADDR_CFG_LEN = 8; - -//Bit definitions for TOD_CHIP_CTRL_REG -const uint32_t TOD_CHIP_CTRL_REG_TIMEBASE_EN = 0; -const uint32_t TOD_CHIP_CTRL_REG_I_PATH_CORE_SYNC_PERIOD_SEL = 1; -const uint32_t TOD_CHIP_CTRL_REG_I_PATH_SYNC_CHECK_DIS = 4; -const uint32_t TOD_CHIP_CTRL_REG_TX_TTYPE_PIB_MST_FSM_STATE_DIS = 5; -const uint32_t TOD_CHIP_CTRL_REG_MOVE_TOD_TO_TB_ON_2X_SYNC_EN = 7; -const uint32_t TOD_CHIP_CTRL_REG_USE_TB_SYNC_MECHANISM = 8; -const uint32_t TOD_CHIP_CTRL_REG_USE_TB_STEP_SYNC = 9; -const uint32_t TOD_CHIP_CTRL_REG_LOW_ORDER_STEP_VAL = 10; -const uint32_t TOD_CHIP_CTRL_REG_TX_TTYPE_PIB_MST_IF_RESET = 26; -const uint32_t TOD_CHIP_CTRL_REG_XSTOP_GATE = 30; -const uint32_t TOD_CHIP_CTRL_STICKY_ERROR_INJECT_EN = 31; - -const uint32_t TOD_CHIP_CTRL_REG_I_PATH_CORE_SYNC_PERIOD_SEL_LEN = 3; -const uint32_t TOD_CHIP_CTRL_REG_LOW_ORDER_STEP_VAL_LEN = 6; - -const uint32_t TOD_CHIP_CTRL_REG_I_PATH_CORE_SYNC_PERIOD_SEL_8 = 0; -const uint32_t TOD_CHIP_CTRL_REG_I_PATH_CORE_SYNC_PERIOD_SEL_4 = 1; -const uint32_t TOD_CHIP_CTRL_REG_I_PATH_CORE_SYNC_PERIOD_SEL_2 = 2; -const uint32_t TOD_CHIP_CTRL_REG_I_PATH_CORE_SYNC_PERIOD_SEL_1 = 3; -const uint32_t TOD_CHIP_CTRL_REG_I_PATH_CORE_SYNC_PERIOD_SEL_128 = 4; -const uint32_t TOD_CHIP_CTRL_REG_I_PATH_CORE_SYNC_PERIOD_SEL_64 = 5; -const uint32_t TOD_CHIP_CTRL_REG_I_PATH_CORE_SYNC_PERIOD_SEL_32 = 6; -const uint32_t TOD_CHIP_CTRL_REG_I_PATH_CORE_SYNC_PERIOD_SEL_16 = 7; - -const uint32_t TOD_CHIP_CTRL_REG_LOW_ORDER_STEP_VAL_1 = 0x1; -const uint32_t TOD_CHIP_CTRL_REG_LOW_ORDER_STEP_VAL_2 = 0x2; -const uint32_t TOD_CHIP_CTRL_REG_LOW_ORDER_STEP_VAL_3 = 0x3; -const uint32_t TOD_CHIP_CTRL_REG_LOW_ORDER_STEP_VAL_4 = 0x4; -const uint32_t TOD_CHIP_CTRL_REG_LOW_ORDER_STEP_VAL_3F = 0x3F; - -//Bit definitions for TOD_FSM_REG -const uint32_t TOD_FSM_REG_I_FSM_STATE = 0; -const uint32_t TOD_FSM_REG_TOD_IS_RUNNING = 4; - -const uint32_t TOD_FSM_REG_I_FSM_STATE_LEN = 4; - -const uint32_t TOD_FSM_REG_I_FSM_STATE_ERROR = 0x0; -const uint32_t TOD_FSM_REG_I_FSM_STATE_NOT_SET = 0x7; -const uint32_t TOD_FSM_REG_I_FSM_STATE_STOPPED = 0x1; -const uint32_t TOD_FSM_REG_I_FSM_STATE_WAIT_FOR_SYNC = 0xD; -const uint32_t TOD_FSM_REG_I_FSM_STATE_RUNNING_2 = 0x2; -const uint32_t TOD_FSM_REG_I_FSM_STATE_RUNNING_A = 0xA; -const uint32_t TOD_FSM_REG_I_FSM_STATE_RUNNING_E = 0xE; - -//Bit definitions for TOD_PSS_MSS_CTRL_REG -const uint32_t TOD_PSS_MSS_CTRL_REG_PRI_M_PATH_SEL = 0; -const uint32_t TOD_PSS_MSS_CTRL_REG_PRI_M_S_TOD_SEL = 1; -const uint32_t TOD_PSS_MSS_CTRL_REG_PRI_M_S_DRAWER_SEL = 2; -const uint32_t TOD_PSS_MSS_CTRL_REG_PRI_S_PATH1_STEP_CHECK_EN = 3; -const uint32_t TOD_PSS_MSS_CTRL_REG_PRI_M_PATH0_STEP_CHECK_EN = 4; -const uint32_t TOD_PSS_MSS_CTRL_REG_PRI_M_PATH1_STEP_CHECK_EN = 5; -const uint32_t TOD_PSS_MSS_CTRL_REG_PRI_S_PATH0_STEP_CHECK_EN = 6; -const uint32_t TOD_PSS_MSS_CTRL_REG_PRI_I_PATH_STEP_CHECK_EN = 7; -const uint32_t TOD_PSS_MSS_CTRL_REG_SEC_M_PATH_SEL = 8; -const uint32_t TOD_PSS_MSS_CTRL_REG_SEC_M_S_TOD_SEL = 9; -const uint32_t TOD_PSS_MSS_CTRL_REG_SEC_M_S_DRAWER_SEL = 10; -const uint32_t TOD_PSS_MSS_CTRL_REG_SEC_S_PATH1_STEP_CHECK_EN = 11; -const uint32_t TOD_PSS_MSS_CTRL_REG_SEC_M_PATH0_STEP_CHECK_EN = 12; -const uint32_t TOD_PSS_MSS_CTRL_REG_SEC_M_PATH1_STEP_CHECK_EN = 13; -const uint32_t TOD_PSS_MSS_CTRL_REG_SEC_S_PATH0_STEP_CHECK_EN = 14; -const uint32_t TOD_PSS_MSS_CTRL_REG_SEC_I_PATH_STEP_CHECK_EN = 15; -const uint32_t TOD_PSS_MSS_CTRL_REG_PSS_SWITCH_SYNC_ERR_DISABLE = 16; -const uint32_t TOD_PSS_MSS_CTRL_REG_I_PATH_STEP_CHECK_CPS_DEVIATION_X_DISABLE = 17; -const uint32_t TOD_PSS_MSS_CTRL_REG_STEP_CHECK_ENABLE_CHICKENSWITCH = 18; -const uint32_t TOD_PSS_MSS_CTRL_REG_MISC_RESYNC_OSC_FROM_TOD = 21; - -//Bit definitions for TOD_S_PATH_CTRL_REG -const uint32_t TOD_S_PATH_CTRL_REG_PRI_S_PATH_SEL = 0; -const uint32_t TOD_S_PATH_CTRL_REG_SEC_S_PATH_SEL = 4; -const uint32_t TOD_S_PATH_CTRL_REG_S_PATH_STEP_CHECK_CPS_DEVIATION_FACTOR = 6; -const uint32_t TOD_S_PATH_CTRL_REG_S_PATH_0_STEP_CHECK_CPS_DEVIATION = 8; -const uint32_t TOD_S_PATH_CTRL_REG_S_PATH_0_STEP_CHECK_VALIDITY_COUNT = 13; -const uint32_t TOD_S_PATH_CTRL_REG_S_PATH_1_STEP_CHECK_CPS_DEVIATION = 16; -const uint32_t TOD_S_PATH_CTRL_REG_S_PATH_1_STEP_CHECK_VALIDITY_COUNT = 21; - -const uint32_t STEP_CHECK_CPS_DEVIATION_FACTOR_LEN = 2; -const uint32_t STEP_CHECK_CPS_DEVIATION_FACTOR_1 = 0; -const uint32_t STEP_CHECK_CPS_DEVIATION_FACTOR_2 = 1; -const uint32_t STEP_CHECK_CPS_DEVIATION_FACTOR_4 = 2; -const uint32_t STEP_CHECK_CPS_DEVIATION_FACTOR_8 = 3; - -const uint32_t STEP_CHECK_CPS_DEVIATION_LEN = 4; -const uint32_t STEP_CHECK_CPS_DEVIATION_00_00_PCENT = 0x0; -const uint32_t STEP_CHECK_CPS_DEVIATION_06_25_PCENT = 0x1; -const uint32_t STEP_CHECK_CPS_DEVIATION_12_50_PCENT = 0x2; -const uint32_t STEP_CHECK_CPS_DEVIATION_18_75_PCENT = 0x3; -const uint32_t STEP_CHECK_CPS_DEVIATION_25_00_PCENT = 0x4; -const uint32_t STEP_CHECK_CPS_DEVIATION_31_25_PCENT = 0x5; -const uint32_t STEP_CHECK_CPS_DEVIATION_37_50_PCENT = 0x6; -const uint32_t STEP_CHECK_CPS_DEVIATION_43_75_PCENT = 0x7; -const uint32_t STEP_CHECK_CPS_DEVIATION_50_00_PCENT = 0x8; -const uint32_t STEP_CHECK_CPS_DEVIATION_56_25_PCENT = 0x9; -const uint32_t STEP_CHECK_CPS_DEVIATION_62_50_PCENT = 0xA; -const uint32_t STEP_CHECK_CPS_DEVIATION_68_75_PCENT = 0xB; -const uint32_t STEP_CHECK_CPS_DEVIATION_75_00_PCENT = 0xC; -const uint32_t STEP_CHECK_CPS_DEVIATION_81_25_PCENT = 0xD; -const uint32_t STEP_CHECK_CPS_DEVIATION_87_50_PCENT = 0xE; -const uint32_t STEP_CHECK_CPS_DEVIATION_93_75_PCENT = 0xF; - -const uint32_t STEP_CHECK_VALIDITY_COUNT_LEN = 3; -const uint32_t STEP_CHECK_VALIDITY_COUNT_1 = 0; -const uint32_t STEP_CHECK_VALIDITY_COUNT_2 = 1; -const uint32_t STEP_CHECK_VALIDITY_COUNT_4 = 2; -const uint32_t STEP_CHECK_VALIDITY_COUNT_8 = 3; -const uint32_t STEP_CHECK_VALIDITY_COUNT_16 = 4; -const uint32_t STEP_CHECK_VALIDITY_COUNT_32 = 5; -const uint32_t STEP_CHECK_VALIDITY_COUNT_64 = 6; -const uint32_t STEP_CHECK_VALIDITY_COUNT_128 = 7; - -//Bit definitions for TOD_{PRI,SEC}_PORT_{0,1}_CTRL_REG (40001, 40002, 40003, 40004) -const uint32_t TOD_PORT_CTRL_REG_RX = 0; -const uint32_t TOD_PORT_CTRL_REG_TX_A0 = 4; -const uint32_t TOD_PORT_CTRL_REG_TX_A1 = 6; -const uint32_t TOD_PORT_CTRL_REG_TX_A2 = 8; -const uint32_t TOD_PORT_CTRL_REG_TX_X0 = 10; -const uint32_t TOD_PORT_CTRL_REG_TX_X1 = 12; -const uint32_t TOD_PORT_CTRL_REG_TX_X2 = 14; -const uint32_t TOD_PORT_CTRL_REG_TX_X3 = 16; -const uint32_t TOD_PORT_CTRL_REG_TX_X4 = 18; -const uint32_t TOD_PORT_CTRL_REG_TX_A0_EN = 20; // 0->Receiver 1->Sender -const uint32_t TOD_PORT_CTRL_REG_TX_A1_EN = 21; // 0->Receiver 1->Sender -const uint32_t TOD_PORT_CTRL_REG_TX_A2_EN = 22; // 0->Receiver 1->Sender -const uint32_t TOD_PORT_CTRL_REG_TX_X0_EN = 23; // 0->Receiver 1->Sender -const uint32_t TOD_PORT_CTRL_REG_TX_X1_EN = 24; // 0->Receiver 1->Sender -const uint32_t TOD_PORT_CTRL_REG_TX_X2_EN = 25; // 0->Receiver 1->Sender -const uint32_t TOD_PORT_CTRL_REG_TX_X3_EN = 26; // 0->Receiver 1->Sender -const uint32_t TOD_PORT_CTRL_REG_TX_X4_EN = 27; // 0->Receiver 1->Sender -const uint32_t TOD_PORT_CTRL_REG_I_PATH_DELAY = 32; // 40001 40003 (port 0) setting only! - -const uint32_t TOD_PORT_CTRL_REG_RX_LEN = 3; -const uint32_t TOD_PORT_CTRL_REG_TX_LEN = 2; -const uint32_t TOD_PORT_CTRL_REG_I_PATH_DELAY_LEN = 8; - -const uint32_t TOD_PORT_CTRL_REG_RX_A0_SEL = 0x0; -const uint32_t TOD_PORT_CTRL_REG_RX_A1_SEL = 0x1; -const uint32_t TOD_PORT_CTRL_REG_RX_A2_SEL = 0x2; -const uint32_t TOD_PORT_CTRL_REG_RX_X0_SEL = 0x3; -const uint32_t TOD_PORT_CTRL_REG_RX_X1_SEL = 0x4; -const uint32_t TOD_PORT_CTRL_REG_RX_X2_SEL = 0x5; -const uint32_t TOD_PORT_CTRL_REG_RX_X3_SEL = 0x6; -const uint32_t TOD_PORT_CTRL_REG_RX_X4_SEL = 0x7; - -const uint32_t TOD_PORT_CTRL_REG_S_PATH_0 = 0x0; -const uint32_t TOD_PORT_CTRL_REG_S_PATH_1 = 0x1; -const uint32_t TOD_PORT_CTRL_REG_M_PATH_0 = 0x2; -const uint32_t TOD_PORT_CTRL_REG_M_PATH_1 = 0x3; - -//Bit definitions for TOD_PSS_MSS_STATUS_REG -const uint32_t TOD_PSS_MSS_STATUS_REG_M_PATH_0_STEP_CHECK_VALID = 6; -const uint32_t TOD_PSS_MSS_STATUS_REG_M_PATH_1_STEP_CHECK_VALID = 7; - -//Bit definitions for PB_X_MODE_0x04010C0A -const uint32_t PB_X_MODE_LINK_X0_ROUND_TRIP_DELAY = 24; -const uint32_t PB_X_MODE_LINK_X1_ROUND_TRIP_DELAY = 32; -const uint32_t PB_X_MODE_LINK_X2_ROUND_TRIP_DELAY = 40; -const uint32_t PB_X_MODE_LINK_X3_ROUND_TRIP_DELAY = 48; - -//Bit definitions for PB_A_MODE_0x0801080A -const uint32_t PB_A_MODE_LINK_A0_ROUND_TRIP_DELAY = 40; -const uint32_t PB_A_MODE_LINK_A1_ROUND_TRIP_DELAY = 48; -const uint32_t PB_A_MODE_LINK_A2_ROUND_TRIP_DELAY = 56; - -const uint32_t LINK_ROUND_TRIP_DELAY_LEN = 8; - -//Bit definitions for TOD_ERROR_REG -const uint32_t TOD_ERROR_REG_M_PATH_0_STEP_CHECK_ERROR = 14; -const uint32_t TOD_ERROR_REG_M_PATH_1_STEP_CHECK_ERROR = 15; -const uint32_t TOD_ERROR_REG_RX_TTYPE_0 = 38; -const uint32_t TOD_ERROR_REG_RX_TTYPE_1 = 39; -const uint32_t TOD_ERROR_REG_RX_TTYPE_2 = 40; -const uint32_t TOD_ERROR_REG_RX_TTYPE_3 = 41; -const uint32_t TOD_ERROR_REG_RX_TTYPE_4 = 42; -const uint32_t TOD_ERROR_REG_RX_TTYPE_5 = 43; - -//Bit definitions for TOD_ERROR_MASK_REG -const uint32_t TOD_ERROR_MASK_REG_M_PATH_0_STEP_CHECK_ERROR = 14; -const uint32_t TOD_ERROR_MASK_REG_M_PATH_1_STEP_CHECK_ERROR = 15; - -//Bit definitions for TFMR -const uint32_t TFMR_MAX_CYC_BET_STEPS = 0; -const uint32_t TFMR_N_CLKS_PER_STEP = 8; -const uint32_t TFMR_MASK_HMI = 10; -const uint32_t TFMR_SYNC_BIT_SEL = 11; -const uint32_t TFMR_TB_ECLIPZ = 14; -const uint32_t TFMR_LOAD_TOD_MOD = 16; -const uint32_t TFMR_MOVE_CHIP_TOD_TO_TB = 18; -const uint32_t TFMR_CLEAR_TB_ERRORS = 24; -const uint32_t TFMR_HDEC_PARITY_ERROR = 26; -const uint32_t TFMR_TBST_CORRUPT = 27; -const uint32_t TFMR_TBST_ENCODED = 28; -const uint32_t TFMR_TBST_LAST = 32; -const uint32_t TFMR_TB_ENABLED = 40; -const uint32_t TFMR_TB_VALID = 41; -const uint32_t TFMR_TB_SYNC_OCCURED = 42; -const uint32_t TFMR_TB_MISSING_SYNC = 43; -const uint32_t TFMR_TB_MISSING_STEP = 44; -const uint32_t TFMR_TB_RESIDUE_ERR = 45; -const uint32_t TFMR_FIRMWARE_CONTROL_ERROR = 46; -const uint32_t TFMR_CHIP_TOD_STATUS = 47; -const uint32_t TFMR_CHIP_TOD_INTERRUPT = 51; -const uint32_t TFMR_CHIP_TOD_PARITY_ERROR = 56; -const uint32_t TFMR_TX_PURR_PARITY_ERROR = 57; -const uint32_t TFMR_TX_SPURR_PARITY_ERROR = 58; -const uint32_t TFMR_TX_DEC_PARITY_ERROR = 59; -const uint32_t TFMR_TX_TFMR_CORRUPT = 60; -const uint32_t TFMR_TX_PURR_OVERFLOW_ERROR = 61; -const uint32_t TFMR_TX_SPURR_OVERFLOW_ERROR = 62; - -const uint32_t TFMR_MAX_CYC_BET_STEPS_LEN = 8; -const uint32_t TFMR_N_CLKS_PER_STEP_LEN = 2; -const uint32_t TFMR_SYNC_BIT_SEL_LEN = 3; -const uint32_t TFMR_TBST_ENCODED_LEN = 4; -const uint32_t TFMR_TBST_LAST_LEN = 4; -const uint32_t TFMR_CHIP_TOD_STATUS_LEN = 4; - -const uint32_t TFMR_N_CLKS_PER_STEP_1CLK = 0; -const uint32_t TFMR_N_CLKS_PER_STEP_2CLK = 1; -const uint32_t TFMR_N_CLKS_PER_STEP_3CLK = 2; -const uint32_t TFMR_N_CLKS_PER_STEP_4CLK = 3; - -const uint32_t TFMR_SYNC_BIT_SEL_1US = 0; -const uint32_t TFMR_SYNC_BIT_SEL_2US = 1; -const uint32_t TFMR_SYNC_BIT_SEL_4US = 2; -const uint32_t TFMR_SYNC_BIT_SEL_8US = 3; -const uint32_t TFMR_SYNC_BIT_SEL_16US = 4; -const uint32_t TFMR_SYNC_BIT_SEL_32US = 5; -const uint32_t TFMR_SYNC_BIT_SEL_64US = 6; - -// For TFMR_TBST_ENCODED and TFMR_TBST_LAST -const uint32_t TFMR_TBST_ENCODED_TB_RESET = 0; -const uint32_t TFMR_TBST_ENCODED_TB_SEND_TOD_MOD = 1; -const uint32_t TFMR_TBST_ENCODED_TB_NOT_SET = 2; -const uint32_t TFMR_TBST_ENCODED_TB_SYNC_WAIT = 6; -const uint32_t TFMR_TBST_ENCODED_TB_GET_TOD = 7; -const uint32_t TFMR_TBST_ENCODED_TB_RUNNING = 8; -const uint32_t TFMR_TBST_ENCODED_TB_ERROR = 9; - -const uint32_t NUM_A_BUSES = 3; -const uint32_t NUM_X_BUSES = 5; - -//------------------------------------------------------------------------------ -// Structure definitions -//------------------------------------------------------------------------------ - -extern "C" -{ - -// Used by wrapper to determine which FAPI procedure to call -enum tod_action -{ - TOD_SETUP, - TOD_INIT, - TOD_STATUS, - TOD_CLEANUP, - TOD_CHECK_OSC -}; - -// Input which determines the topology being configured -enum proc_tod_setup_tod_sel -{ - TOD_PRIMARY, // configure primary TOD - TOD_SECONDARY // configure secondary TOD -}; - -// Input which determines the master oscillator to use -enum proc_tod_setup_osc_sel -{ - TOD_OSC_0, // oscillator connected to OSC0 and not OSC1 - TOD_OSC_1, // oscillator connected to OSC1 and not OSC0 - TOD_OSC_0_AND_1, // oscillators connected to both OSC0 and OSC1 - TOD_OSC_0_AND_1_SEL_0, // oscillators connected to both OSC0 and OSC1, but OSC0 will always be selected - TOD_OSC_0_AND_1_SEL_1, // oscillators connected to both OSC0 and OSC1, but OSC1 will always be selected - TOD_OSC_NONE // No oscillators connected -}; - -// Defines the upstream connection for the given node -enum proc_tod_setup_bus -{ - NONE, // MDMT has no bus_in - XBUS0, - XBUS1, - XBUS2, - XBUS3, - ABUS0, - ABUS1, - ABUS2 -}; - -// Saves the final configuration (register values) for each node -// Port 0 will always be used for Primary, 1 will always be used for Secondary -struct proc_tod_setup_conf_regs -{ - ecmdDataBufferBase tod_m_path_ctrl_reg; - ecmdDataBufferBase tod_pri_port_0_ctrl_reg; - ecmdDataBufferBase tod_pri_port_1_ctrl_reg; - ecmdDataBufferBase tod_sec_port_0_ctrl_reg; - ecmdDataBufferBase tod_sec_port_1_ctrl_reg; - ecmdDataBufferBase tod_s_path_ctrl_reg; - ecmdDataBufferBase tod_i_path_ctrl_reg; - ecmdDataBufferBase tod_pss_mss_ctrl_reg; - ecmdDataBufferBase tod_chip_ctrl_reg; -}; - -// i_bus_rx and i_bus_tx can differ, based on system configuration (see *'d lines) -// Example (croquery eiinfo) -// Drive Chip, Drive Port, Bus, Receive Port, Receive Chip, Depth, Bus Flags, Group Id -// s1.xbus:k0:n0:s0:p00:c1, PRT_EI4_X1, BUS_EI4_X, PRT_EI4_X1, s1.xbus:k0:n0:s0:p01:c1, 00, 0x80000000, 0000 -// s1.xbus:k0:n0:s0:p01:c1, PRT_EI4_X1, BUS_EI4_X, PRT_EI4_X1, s1.xbus:k0:n0:s0:p00:c1, 10, 0x80000000, 0001 -// s1.xbus:k0:n2:s0:p00:c1, PRT_EI4_X1, BUS_EI4_X, PRT_EI4_X1, s1.xbus:k0:n2:s0:p01:c1, 00, 0x80000000, 0200 -// s1.xbus:k0:n2:s0:p01:c1, PRT_EI4_X1, BUS_EI4_X, PRT_EI4_X1, s1.xbus:k0:n2:s0:p00:c1, 10, 0x80000000, 0201 -// * s1.abus:k0:n0:s0:p00:c1, PRT_EDI_A1, BUS_EDI_A, PRT_EDI_A0, s1.abus:k0:n2:s0:p00:c0, 00, 0x80000000, 0000 -// * s1.abus:k0:n2:s0:p00:c0, PRT_EDI_A0, BUS_EDI_A, PRT_EDI_A1, s1.abus:k0:n0:s0:p00:c1, 10, 0x80000000, 0200 -// * s1.abus:k0:n0:s0:p01:c1, PRT_EDI_A1, BUS_EDI_A, PRT_EDI_A0, s1.abus:k0:n2:s0:p01:c0, 00, 0x80000000, 0001 -// * s1.abus:k0:n2:s0:p01:c0, PRT_EDI_A0, BUS_EDI_A, PRT_EDI_A1, s1.abus:k0:n0:s0:p01:c1, 10, 0x80000000, 0201 - -// TOD Topology node definition -struct tod_topology_node -{ - fapi::Target* i_target; - bool i_tod_master; - bool i_drawer_master; - proc_tod_setup_bus i_bus_rx; // Current node's bus from which step/sync is received ("Receive Port" in eiinfo) - proc_tod_setup_bus i_bus_tx; // Upstream node's bus from which step/sync is transmitted ("Drive Port" in eiinfo) - std::list<tod_topology_node*> i_children; - proc_tod_setup_conf_regs o_todRegs; - uint32_t o_int_path_delay; -}; - -// no function pointer; direct access not needed - -/** - * @brief Retrieves TFMR using indirect SPRC/SPRD method - * - * @param[in] i_target => chip target - * - * @param[out] o_tfmr_val => TFMR value read - * - * @return FAPI_RC_SUCCESS if TFMR read is successful - * else FAPI or ECMD error is sent through - */ -fapi::ReturnCode proc_tod_utils_get_tfmr_reg( - const fapi::Target& i_target, - ecmdDataBufferBase& o_tfmr_val); - -/** - * @brief Sets TFMR using indirect SPRC/SPRD method - * - * @param[in] i_target => chip target - * i_tfmr_val => TFMR value to write - * - * @return FAPI_RC_SUCCESS if TFMR write is successful - * else FAPI or ECMD error is sent through - */ -fapi::ReturnCode proc_tod_utils_set_tfmr_reg( - const fapi::Target& i_target, - ecmdDataBufferBase& i_tfmr_val); - -} // extern "C" - -#endif // PROC_TOD_UTILS_H_ diff --git a/src/usr/hwpf/hwp/tod_init/proc_tod_utils/proc_tod_utils.xml b/src/usr/hwpf/hwp/tod_init/proc_tod_utils/proc_tod_utils.xml deleted file mode 100644 index d572a1bdd..000000000 --- a/src/usr/hwpf/hwp/tod_init/proc_tod_utils/proc_tod_utils.xml +++ /dev/null @@ -1,136 +0,0 @@ -<!-- IBM_PROLOG_BEGIN_TAG --> -<!-- This is an automatically generated prolog. --> -<!-- --> -<!-- $Source: src/usr/hwpf/hwp/tod_init/proc_tod_utils/proc_tod_utils.xml $ --> -<!-- --> -<!-- OpenPOWER HostBoot Project --> -<!-- --> -<!-- Contributors Listed Below - COPYRIGHT 2013,2014 --> -<!-- [+] International Business Machines Corp. --> -<!-- --> -<!-- --> -<!-- Licensed under the Apache License, Version 2.0 (the "License"); --> -<!-- you may not use this file except in compliance with the License. --> -<!-- You may obtain a copy of the License at --> -<!-- --> -<!-- http://www.apache.org/licenses/LICENSE-2.0 --> -<!-- --> -<!-- Unless required by applicable law or agreed to in writing, software --> -<!-- distributed under the License is distributed on an "AS IS" BASIS, --> -<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or --> -<!-- implied. See the License for the specific language governing --> -<!-- permissions and limitations under the License. --> -<!-- --> -<!-- IBM_PROLOG_END_TAG --> -<!-- $Id: proc_tod_utils.xml,v 1.12 2014/10/16 15:32:24 jklazyns Exp $ --> -<!-- Error codes for proc_tod_utils (used by setup, init, status) --> -<hwpErrors> - <!-- ******************************************************************** --> - <hwpError> - <rc>RC_PROC_TOD_SETUP_INVALID_TOPOLOGY</rc> - <description>The TOD topology includes an invalid configuration</description> - <callout> - <procedure>CODE</procedure> - <priority>HIGH</priority> - </callout> - </hwpError> - <!-- ******************************************************************** --> - <hwpError> - <rc>RC_PROC_TOD_SETUP_INVALID_NODE_DELAY</rc> - <description>Node delay must be between 0 and 0xFF inclusive.</description> - <callout> - <procedure>CODE</procedure> - <priority>HIGH</priority> - </callout> - </hwpError> - <!-- ******************************************************************** --> - <hwpError> - <rc>RC_PROC_TOD_INIT_NOT_RUNNING</rc> - <description>TOD is expected to be running, but is not.</description> - <ffdc>CHIP_TARGET</ffdc> - <callout> - <procedure>CODE</procedure> - <priority>HIGH</priority> - </callout> - <callout> - <target>CHIP_TARGET</target> - <priority>MEDIUM</priority> - </callout> - <deconfigure> - <target>CHIP_TARGET</target> - </deconfigure> - </hwpError> - <!-- ******************************************************************** --> - <hwpError> - <rc>RC_PROC_TOD_INIT_ERROR</rc> - <description>A FIR bit is active after starting the TOD topology</description> - <ffdc>CHIP_TARGET</ffdc> - <ffdc>TOD_ERROR_REG</ffdc> - <callout> - <procedure>CODE</procedure> - <priority>HIGH</priority> - </callout> - <callout> - <target>CHIP_TARGET</target> - <priority>MEDIUM</priority> - </callout> - <deconfigure> - <target>CHIP_TARGET</target> - </deconfigure> - </hwpError> - <!-- ******************************************************************** --> - <hwpError> - <rc>RC_PROC_TOD_INIT_M_PATH_0_STEP_CHECK_ERROR</rc> - <description>Master Path 0 step check error is active after starting the TOD topology</description> - <ffdc>CHIP_TARGET</ffdc> - <ffdc>TOD_ERROR_REG</ffdc> - </hwpError> - <!-- ******************************************************************** --> - <hwpError> - <rc>RC_PROC_TOD_INIT_M_PATH_1_STEP_CHECK_ERROR</rc> - <description>Master Path 1 step check error is active after starting the TOD topology</description> - <ffdc>CHIP_TARGET</ffdc> - <ffdc>TOD_ERROR_REG</ffdc> - </hwpError> - <!-- ******************************************************************** --> - <hwpError> - <rc>RC_PROC_TOD_NULL_NODE</rc> - <description>An null node has been passed into the procedure</description> - <callout> - <procedure>CODE</procedure> - <priority>HIGH</priority> - </callout> - </hwpError> - <!-- ******************************************************************** --> - <registerFfdc> - <id>REG_FFDC_TOD_REGISTERS</id> - <scomRegister>TOD_M_PATH_CTRL_REG_00040000</scomRegister> - <scomRegister>TOD_PRI_PORT_0_CTRL_REG_00040001</scomRegister> - <scomRegister>TOD_PRI_PORT_1_CTRL_REG_00040002</scomRegister> - <scomRegister>TOD_SEC_PORT_0_CTRL_REG_00040003</scomRegister> - <scomRegister>TOD_SEC_PORT_1_CTRL_REG_00040004</scomRegister> - <scomRegister>TOD_S_PATH_CTRL_REG_00040005</scomRegister> - <scomRegister>TOD_I_PATH_CTRL_REG_00040006</scomRegister> - <scomRegister>TOD_PSS_MSS_CTRL_REG_00040007</scomRegister> - <scomRegister>TOD_PSS_MSS_STATUS_REG_00040008</scomRegister> - <scomRegister>TOD_M_PATH_STATUS_REG_00040009</scomRegister> - <scomRegister>TOD_S_PATH_STATUS_REG_0004000A</scomRegister> - <scomRegister>TOD_MISC_RESET_REG_0004000B</scomRegister> - <scomRegister>TOD_PROBE_SELECT_REG_0004000C</scomRegister> - <scomRegister>TOD_CHIP_CTRL_REG_00040010</scomRegister> - <scomRegister>TOD_TRACE_DATA_1_REG_0004001D</scomRegister> - <scomRegister>TOD_TRACE_DATA_2_REG_0004001E</scomRegister> - <scomRegister>TOD_TRACE_DATA_3_REG_0004001F</scomRegister> - <scomRegister>TOD_VALUE_REG_00040020</scomRegister> - <scomRegister>TOD_LOAD_TOD_REG_00040021</scomRegister> - <scomRegister>TOD_START_TOD_REG_00040022</scomRegister> - <scomRegister>TOD_LOW_ORDER_STEP_REG_00040023</scomRegister> - <scomRegister>TOD_FSM_REG_00040024</scomRegister> - <scomRegister>TOD_TX_TTYPE_CTRL_REG_00040027</scomRegister> - <scomRegister>TOD_RX_TTYPE_CTRL_REG_00040029</scomRegister> - <scomRegister>TOD_ERROR_REG_00040030</scomRegister> - <scomRegister>TOD_ERROR_MASK_STATUS_REG_00040032</scomRegister> - <scomRegister>TOD_ERROR_ROUTING_REG_00040033</scomRegister> - </registerFfdc> - <!-- ******************************************************************** --> -</hwpErrors> diff --git a/src/usr/hwpf/hwp/tod_init/tod_init.C b/src/usr/hwpf/hwp/tod_init/tod_init.C deleted file mode 100644 index 8eeb14446..000000000 --- a/src/usr/hwpf/hwp/tod_init/tod_init.C +++ /dev/null @@ -1,87 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/tod_init.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -/** - * @file tod_init.C - * - * HWP_IGNORE_VERSION_CHECK - * - */ - -/******************************************************************************/ -// Includes -/******************************************************************************/ - -#include <trace/interface.H> -#include <errl/errlentry.H> -#include <errl/errlmanager.H> -#include <targeting/common/targetservice.H> -#include <initservice/initserviceif.H> -#include "TodTrace.H" -#include "tod_init.H" -#include "TodSvc.H" - -namespace TOD -{ - -const char TOD_TRACE_NAME[] = "TOD"; -trace_desc_t* g_trac_tod = NULL; -TRAC_INIT(&g_trac_tod, TOD_TRACE_NAME, KILOBYTE, TRACE::BUFFER_SLOW); - -void * call_tod_setup(void *dummy) -{ - errlHndl_t l_errl; - - if (!INITSERVICE::spBaseServicesEnabled()) - { - l_errl = TodSvc::getTheInstance().todSetup(); - - if (l_errl) - { - TOD_ERR("todSetup() return errl handle %p", l_errl); - errlCommit( l_errl, TOD_COMP_ID ); - } - } - - return NULL; -} - -void * call_tod_init(void *dummy) -{ - errlHndl_t l_errl; - - if (!INITSERVICE::spBaseServicesEnabled()) - { - l_errl = TodSvc::getTheInstance().todInit(); - - if (l_errl) - { - TOD_ERR("todInit() return errl handle %p", l_errl); - errlCommit( l_errl, TOD_COMP_ID ); - } - } - - return NULL; -} - -}; // end namespace diff --git a/src/usr/hwpf/hwp/tod_init/tod_init.H b/src/usr/hwpf/hwp/tod_init/tod_init.H deleted file mode 100644 index 98b5bbea9..000000000 --- a/src/usr/hwpf/hwp/tod_init/tod_init.H +++ /dev/null @@ -1,32 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/tod_init/tod_init.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -#ifndef TOD_INIT_H -#define TOD_INIT_H - -namespace TOD -{ - void * call_tod_setup(void *dummy); - void * call_tod_init(void *dummy); -}; - -#endif |