diff options
Diffstat (limited to 'src/usr/scom')
-rw-r--r-- | src/usr/scom/scomtrans.C | 148 | ||||
-rw-r--r-- | src/usr/scom/scomtrans.H | 22 | ||||
-rw-r--r-- | src/usr/scom/test/scomtest.H | 14 |
3 files changed, 87 insertions, 97 deletions
diff --git a/src/usr/scom/scomtrans.C b/src/usr/scom/scomtrans.C index 2c8bcc6e7..089b74ec2 100644 --- a/src/usr/scom/scomtrans.C +++ b/src/usr/scom/scomtrans.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2016 */ +/* Contributors Listed Below - COPYRIGHT 2012,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -47,6 +47,7 @@ #include <errl/errlmanager.H> #include "scom.H" #include "scomtrans.H" +#include <scom/scomif.H> #include <scom/scomreasoncodes.H> #include <errl/errludtarget.H> #include <initservice/initserviceif.H> @@ -177,67 +178,96 @@ errlHndl_t startScomProcess(DeviceFW::OperationType i_opType, va_list i_args) { errlHndl_t l_err = NULL; - TARGETING::Target* l_target_SW = NULL; - //will hold the value of parent chip for indirect scom - TARGETING::Target* l_parentChip = - const_cast<TARGETING::Target *>(TARGETING::getParentChip(i_target)); - uint64_t l_addr = va_arg(i_args,uint64_t); - //if opMode is not specified as an argument va_arg will return NULL which is 0 - uint64_t l_opMode = va_arg(i_args,uint64_t); + do { + //will hold the value of parent chip for indirect scom + TARGETING::Target* l_parentChip = const_cast<TARGETING::Target *> + (TARGETING::getParentChip(i_target)); + uint64_t l_addr = va_arg(i_args,uint64_t); + // if opMode is not specified as an argument + // va_arg will return NULL which=0 + uint64_t l_opMode = va_arg(i_args,uint64_t); + bool l_needsWakeup = false; + + l_err = scomTranslate(i_target, + l_addr, + l_needsWakeup, + l_opMode); + if(l_err) + { + break; + } - l_err = scomTranslate(i_target, l_addr, l_target_SW, l_opMode); +#if __HOSTBOOT_RUNTIME + if(l_needsWakeup) + { + TRACDCOMP(g_trac_scom,"Special wakeup required, starting now.."); + g_wakeupInProgress = true; + l_err = handleSpecialWakeup(i_target,true); + if(l_err) + { + TRACFCOMP(g_trac_scom, "startScomProcess: " + "handleSpecialWakeup enable ERROR"); + + //capture the target data in the elog + ERRORLOG::ErrlUserDetailsTarget(i_target,"SCOM Target") + .addToLog(l_err); + l_err->collectTrace(SCOM_COMP_NAME,1024); + break; + } + + g_wakeupInProgress = false; + } +#endif - if (l_err == NULL) - { // call the routine that will do the indirect scom // and then call the correct device driver. l_err = SCOM::checkIndirectAndDoScom(i_opType, - l_parentChip, - io_buffer, - io_buflen, - i_accessType, - l_addr); - } - - // @todo RTC:124196 need to move this to a more general location so that - // the disable occurs after the HBRT is complete. + l_parentChip, + io_buffer, + io_buflen, + i_accessType, + l_addr); + + // @todo RTC:124196 need to move this to a more general location so that + // the disable occurs after the HBRT is complete. #if __HOSTBOOT_RUNTIME - if(!(l_opMode & fapi2::DO_NOT_DO_WAKEUP) && - (l_target_SW != NULL) && - !g_wakeupInProgress) - { - g_wakeupInProgress = true; - errlHndl_t l_errSW = NULL; + if(l_needsWakeup && !g_wakeupInProgress) + { + g_wakeupInProgress = true; + errlHndl_t l_errSW = NULL; - l_errSW = handleSpecialWakeup(l_target_SW,false); + l_errSW = handleSpecialWakeup(i_target,false); - if(l_err != NULL && l_errSW) - { - TRACFCOMP(g_trac_scom,"Disable p9_cpu_special_wakeup ERROR"); + if(l_err != NULL && l_errSW) + { + TRACFCOMP(g_trac_scom, "startScomProcess: " + "handleSpecialWakeup disable ERROR"); - // capture the target data in the elog - ERRORLOG::ErrlUserDetailsTarget(l_target_SW).addToLog(l_errSW); - errlCommit(l_errSW,RUNTIME_COMP_ID); - } - else if(l_errSW) - { - l_err = l_errSW; + // capture the target data in the elog + ERRORLOG::ErrlUserDetailsTarget(i_target).addToLog(l_errSW); + errlCommit(l_errSW,RUNTIME_COMP_ID); + } + else if(l_errSW) + { + l_err = l_errSW; + } + g_wakeupInProgress = false; } - g_wakeupInProgress = false; - } #endif + } while (0); + return l_err; } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// errlHndl_t scomTranslate(TARGETING::Target * &i_target, - uint64_t & io_addr, - TARGETING::Target * io_target_SW, - uint64_t i_opMode) + uint64_t & io_addr, + bool & o_needsWakeup, + uint64_t i_opMode) { errlHndl_t l_err = NULL; @@ -247,10 +277,10 @@ errlHndl_t scomTranslate(TARGETING::Target * &i_target, //Need to support centaur still @TODO RTC: 139953 l_err = p9_translation(i_target, - l_type, - io_addr, - io_target_SW, - i_opMode); + l_type, + io_addr, + o_needsWakeup, + i_opMode); return l_err; } @@ -260,7 +290,7 @@ errlHndl_t scomTranslate(TARGETING::Target * &i_target, errlHndl_t p9_translation (TARGETING::Target * &i_target, TARGETING::TYPE i_type, uint64_t &io_addr, - TARGETING::Target * io_target_SW, + bool & o_needsWakeup, uint64_t i_opMode) { errlHndl_t l_err = NULL; @@ -317,35 +347,15 @@ errlHndl_t p9_translation (TARGETING::Target * &i_target, !(i_opMode & fapi2::DO_NOT_DO_WAKEUP) ) { TRACDCOMP(g_trac_scom,"Determining if Special Wakeup is needed.."); - bool l_needsWakeup = true; + o_needsWakeup = true; for(uint16_t i = 0; i < l_scomPairings.size(); i++) { if( l_scomPairings[i].chipUnitType == PU_PERV_CHIPUNIT) { - l_needsWakeup = false; + o_needsWakeup = false; break; } } - if(l_needsWakeup) - { - TRACDCOMP(g_trac_scom,"Special wakeup required, starting now.."); - g_wakeupInProgress = true; - - l_err = handleSpecialWakeup(i_target,true); - if(l_err) - { - TRACFCOMP(g_trac_scom, - "Enable handleSpecialWakeup ERROR"); - - //capture the target data in the elog - ERRORLOG::ErrlUserDetailsTarget(i_target,"SCOM Target") - .addToLog(l_err); - l_err->collectTrace(SCOM_COMP_NAME,1024); - break; - } - io_target_SW = i_target; - g_wakeupInProgress = false; - } } #endif diff --git a/src/usr/scom/scomtrans.H b/src/usr/scom/scomtrans.H index 4e63b9453..5b1d8e90b 100644 --- a/src/usr/scom/scomtrans.H +++ b/src/usr/scom/scomtrans.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2016 */ +/* Contributors Listed Below - COPYRIGHT 2012,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -61,36 +61,20 @@ errlHndl_t startScomProcess(DeviceFW::OperationType i_opType, va_list i_args); /** - * @brief Performs a SCom Translation of the scom address - * This function performs the translation and gets the - * correct target. - * - * @param[in] i_target SCom target - * @param[in|out] io_addr SCom address - * @param[in|out] io_target_SW target for SW - * @param[in] i_opMode Defaults to 0 (Standard) - * @return errlHndl_t - */ -errlHndl_t scomTranslate(TARGETING::Target * &i_target, - uint64_t & io_addr, - TARGETING::Target * io_target_SW, - uint64_t i_opMode = 0); - -/** * @brief This function translates a scom address using the * the interface that the HW team provided. * * @param[in] i_target SCom target is passed in * @param[in] i_type Type of the target * @param[in|out] io_addr Address to be translated - * @param[in|out] io_target_SW SW target for HBRT + * @param[out] o_needsWakeup Enable SW before scom * @param[in] i_opMode Defaults to 0 (Standard) * @return errlHndl_t */ errlHndl_t p9_translation (TARGETING::Target * &i_target, TARGETING::TYPE i_type, uint64_t &io_addr, - TARGETING::Target * io_target_SW, + bool & o_needsWakeup, uint64_t i_opMode = 0); /** diff --git a/src/usr/scom/test/scomtest.H b/src/usr/scom/test/scomtest.H index edfa21260..1358a5f4a 100644 --- a/src/usr/scom/test/scomtest.H +++ b/src/usr/scom/test/scomtest.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2016 */ +/* Contributors Listed Below - COPYRIGHT 2011,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -38,19 +38,14 @@ #include <fsi/fsiif.H> #include <targeting/common/util.H> #include <targeting/common/utilFilter.H> +#include <scom/scomif.H> #include <devicefw/driverif.H> extern trace_desc_t* g_trac_scom; -namespace SCOM -{ -extern errlHndl_t scomTranslate(TARGETING::Target* &i_target, - uint64_t &io_addr, - TARGETING::Target* io_target_SW, - uint64_t i_opMode = 0); -} + class ScomTest: public CxxTest::TestSuite { public: @@ -1108,9 +1103,10 @@ public: { total++; uint64_t tempAddr = test_data[i].initAddr; + bool needsWakeup = false; l_err = SCOM::scomTranslate(test_data[i].target, tempAddr, - NULL); + needsWakeup); if( l_err && !test_data[i].expectError) { |