diff options
author | Corey Swenson <cswenson@us.ibm.com> | 2017-08-10 13:47:10 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-09-08 11:24:12 -0400 |
commit | 889247ed964f90a3b0defb826f334cfda423c07e (patch) | |
tree | 742fdc0462a73785c050913971a4df7bd38dc8e1 /src/usr/scom | |
parent | 680115135876c549c308d7dd6597dedf9a344834 (diff) | |
download | talos-hostboot-889247ed964f90a3b0defb826f334cfda423c07e.tar.gz talos-hostboot-889247ed964f90a3b0defb826f334cfda423c07e.zip |
Add SCOM translation support for Centaur
Change-Id: Ia665e29771106501d04ce9184c36f677f4e40d97
RTC:139953
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/44671
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: SWATHI M. BHATTIPROLU <bhmadhur@in.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/scom')
-rw-r--r-- | src/usr/scom/scom.mk | 5 | ||||
-rw-r--r-- | src/usr/scom/scomtrans.C | 361 | ||||
-rw-r--r-- | src/usr/scom/scomtrans.H | 36 | ||||
-rw-r--r-- | src/usr/scom/test/scomtest.H | 123 |
4 files changed, 462 insertions, 63 deletions
diff --git a/src/usr/scom/scom.mk b/src/usr/scom/scom.mk index 9012f325e..94854eba0 100644 --- a/src/usr/scom/scom.mk +++ b/src/usr/scom/scom.mk @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2013,2016 +# Contributors Listed Below - COPYRIGHT 2013,2017 # [+] International Business Machines Corp. # # @@ -25,7 +25,9 @@ VPATH += ${ROOTPATH}/src/import/chips/p9/common/scominfo/ +VPATH += ${ROOTPATH}/src/import/chips/centaur/common/scominfo/ EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/common/scominfo/ +EXTRAINCDIR += ${ROOTPATH}/src/import/chips/centaur/common/scominfo/ EXTRAINCDIR += ${ROOTPATH}/src/import/hwpf/fapi2/include/ # Local Objects OBJS += scom.o @@ -34,3 +36,4 @@ OBJS += errlud_pib.o # Objects From Import Directory OBJS += p9_scominfo.o +OBJS += centaur_scominfo.o diff --git a/src/usr/scom/scomtrans.C b/src/usr/scom/scomtrans.C index d9b500ad9..c4e0d5d0d 100644 --- a/src/usr/scom/scomtrans.C +++ b/src/usr/scom/scomtrans.C @@ -33,7 +33,7 @@ //Flow of the file: //Call startScomProcess --which calls--> scomTranslate -// --which calls--> p9 translate --which returns to--> +// --which calls--> p9/centaur translate --which returns to--> //startScomProcces --which then calls--> SCOM::checkIndirectAndDoScom /****************************************************************************/ @@ -169,7 +169,6 @@ DEVICE_REGISTER_ROUTE(DeviceFW::WILDCARD, ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// - errlHndl_t startScomProcess(DeviceFW::OperationType i_opType, TARGETING::Target* i_target, void* io_buffer, @@ -274,14 +273,24 @@ errlHndl_t scomTranslate(TARGETING::Target * &i_target, // Get the type attribute. TARGETING::TYPE l_type = i_target->getAttr<TARGETING::ATTR_TYPE>(); - //Need to support centaur still @TODO RTC: 139953 - - l_err = p9_translation(i_target, - l_type, - io_addr, - o_needsWakeup, - i_opMode); + centaurChipUnits_t l_chipUnit = CENTAUR_CHIP; + if(false == getChipUnitCentaur(l_type,l_chipUnit)) + { + l_err = centaur_translation(i_target, + l_type, + io_addr, + i_opMode); + o_needsWakeup = false; + } + else + { + l_err = p9_translation(i_target, + l_type, + io_addr, + o_needsWakeup, + i_opMode); + } return l_err; } @@ -415,10 +424,10 @@ errlHndl_t p9_translation (TARGETING::Target * &i_target, break; } - if(getChipUnit (i_type, l_chipUnit)) + if(getChipUnitP9 (i_type, l_chipUnit)) { //Send an errorlog because we are targeting an unsupported type. - TRACFCOMP(g_trac_scom, "SCOM_TRANSLATE.. Invalid target type=0x%X", i_type); + TRACFCOMP(g_trac_scom, "SCOM_TRANSLATE.. Invalid P9 target type=0x%X", i_type); /*@ * @errortype @@ -443,7 +452,9 @@ errlHndl_t p9_translation (TARGETING::Target * &i_target, break; } - //check each scom pairing to make sure we have a match + //Check that the target_type that the scom was requested + //for matches up with one of the possible targets allowed + //for this particular scom. for(uint32_t i = 0; i < l_scomPairings.size(); i++) { if( (l_scomPairings[i].chipUnitType == l_chipUnit) && @@ -558,8 +569,260 @@ errlHndl_t p9_translation (TARGETING::Target * &i_target, ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -bool getChipUnit (TARGETING::TYPE i_type, - p9ChipUnits_t &o_chipUnit) +errlHndl_t centaur_translation (TARGETING::Target * &i_target, + TARGETING::TYPE i_type, + uint64_t &io_addr, + uint64_t i_opMode) +{ + errlHndl_t l_err = NULL; + do { + uint64_t l_original_addr = io_addr; + uint32_t l_chip_mode = STANDARD_MODE; + bool l_scomAddrIsRelatedToUnit = false; + bool l_scomAddrAndTargetTypeMatch = false; + + uint16_t l_instance = 0; + centaurChipUnits_t l_chipUnit = CENTAUR_CHIP; + std::vector<centaur_chipUnitPairing_t> l_scomPairings; + + //Make sure that scom addr is related to a chip unit + uint32_t isChipUnitScomRC = centaur_scominfo_isChipUnitScom( + io_addr, + l_scomAddrIsRelatedToUnit, + l_scomPairings, + l_chip_mode); + + if(isChipUnitScomRC) + { + /*@ + * @errortype + * @moduleid SCOM::SCOM_TRANSLATE_CENTAUR + * @reasoncode SCOM::SCOM_ISCHIPUNITSCOM_INVALID + * @userdata1 Input address + * @userdata2[0:31] Target huid + * @userdata2[32:63] Target Type + * @devdesc EKB code has detected and error in the scom + * @custdesc Firmware error during system IPL + */ + l_err = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + SCOM_TRANSLATE_CENTAUR, + SCOM_ISCHIPUNITSCOM_INVALID, + l_original_addr, + TWO_UINT32_TO_UINT64( + i_target->getAttr<TARGETING::ATTR_HUID>(), + i_type), + true/*SW Error*/); + //Add this target to the FFDC + ERRORLOG::ErrlUserDetailsTarget(i_target,"SCOM Target") + .addToLog(l_err); + l_err->collectTrace(SCOM_COMP_NAME,1024); + break; + } + + + if(!l_scomAddrIsRelatedToUnit) + { + TRACFCOMP(g_trac_scom, "Address provided does not match any Centaur targets."); + TRACFCOMP(g_trac_scom, "centaur_translation-Invalid Address io_addr=0x%X, Type 0x%.8X, HUID 0x%.8X", + io_addr, i_type, TARGETING::get_huid(i_target)); + + + uint32_t userdata32_1 = TWO_UINT16_TO_UINT32( + i_type, + l_instance); + uint16_t userdata16_1 = TWO_UINT8_TO_UINT16( + l_scomAddrIsRelatedToUnit, + l_scomAddrAndTargetTypeMatch); + uint16_t userdata16_2 = TWO_UINT8_TO_UINT16( + l_chipUnit, + TARGETING::MODEL_CENTAUR); + uint32_t userdata32_2 = TWO_UINT16_TO_UINT32( + userdata16_1, + userdata16_2); + uint64_t userdata64_1 = TWO_UINT32_TO_UINT64( + userdata32_1, + userdata32_2); + /*@ + * @errortype + * @moduleid SCOM::SCOM_TRANSLATE_CENTAUR + * @reasoncode SCOM::SCOM_INVALID_ADDR + * @userdata1 Address + * @userdata2[0:15] Target's Type + * @userdata2[16:31] Instance of this type + * @userdata2[32:39] Is this SCOM addr related to a chip unit? + * @userdata2[40:47] Does the target type and addr type match? + * @userdata2[48:55] Chip unit of the target + * @userdata2[56:63] Model of the target (ex: POWER9) + * @devdesc The scom address provided was invalid, check + * to see if the address matches a target in the + * scomdef file. + * @custdesc Firmware error during system IPL + */ + l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + SCOM_TRANSLATE_CENTAUR, + SCOM_INVALID_ADDR, + io_addr, + userdata64_1, + true/*SW Error*/); + //Add this target to the FFDC + ERRORLOG::ErrlUserDetailsTarget(i_target,"SCOM Target") + .addToLog(l_err); + l_err->collectTrace(SCOM_COMP_NAME,1024); + break; + } + + if(getChipUnitCentaur (i_type, l_chipUnit)) + { + //Send an errorlog because we are targeting an unsupported type. + TRACFCOMP(g_trac_scom, "SCOM_TRANSLATE.. Invalid Centaur target type=0x%X", i_type); + + /*@ + * @errortype + * @moduleid SCOM::SCOM_TRANSLATE_CENTAUR + * @reasoncode SCOM::SCOM_CEN_TRANS_INVALID_TYPE + * @userdata1 Address + * @userdata2[0:31] Target's Type + * @userdata2[32:63] Target's Huid + * @devdesc Scom Translate not supported for this type + */ + l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + SCOM_TRANSLATE_CENTAUR, + SCOM_CEN_TRANS_INVALID_TYPE, + io_addr, + TWO_UINT32_TO_UINT64(i_type, + TARGETING::get_huid(i_target)), + true/*SW Error*/); + //Add this target to the FFDC + ERRORLOG::ErrlUserDetailsTarget(i_target,"SCOM Target") + .addToLog(l_err); + l_err->collectTrace(SCOM_COMP_NAME,1024); + break; + } + + //Check that the target_type that the scom was requested + //for matches up with one of the possible targets allowed + //for this particular scom. + for(uint32_t i = 0; i < l_scomPairings.size(); i++) + { + if( (l_scomPairings[i].chipUnitType == l_chipUnit) && + (l_scomPairings[i].chipUnitNum == 0)) + { + l_scomAddrAndTargetTypeMatch = true; + break; + } + + } + + if(!l_scomAddrAndTargetTypeMatch) + { + TRACFCOMP(g_trac_scom, "Target type and scom Addr do not match."); + TRACFCOMP(g_trac_scom, "scomTranslate-Invalid Address io_addr=0x%X, Type 0x%.8X, HUID 0x%.8X", + io_addr, i_type, TARGETING::get_huid(i_target)); + + + uint32_t userdata32_1 = TWO_UINT16_TO_UINT32( + i_type, + l_instance); + uint16_t userdata16_1 = TWO_UINT8_TO_UINT16( + l_scomAddrIsRelatedToUnit, + l_scomAddrAndTargetTypeMatch); + uint16_t userdata16_2 = TWO_UINT8_TO_UINT16( + l_chipUnit, + TARGETING::MODEL_CENTAUR); + uint32_t userdata32_2 = TWO_UINT16_TO_UINT32( + userdata16_1, + userdata16_2); + uint64_t userdata64_1 = TWO_UINT32_TO_UINT64( + userdata32_1, + userdata32_2); + /*@ + * @errortype + * @moduleid SCOM::SCOM_TRANSLATE_CENTAUR + * @reasoncode SCOM::SCOM_TARGET_ADDR_MISMATCH + * @userdata1 Address + * @userdata2[0:15] Target's Type + * @userdata2[16:31] Instance of this type + * @userdata2[32:39] Is this SCOM addr related to a chip unit? + * @userdata2[40:47] Does the target type and addr type match? + * @userdata2[48:55] Chip unit of the target + * @userdata2[56:63] Model of the target (ex: POWER9) + * @devdesc The scom target did not match the provided + * address + * @custdesc Firmware error during system IPL + */ + l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + SCOM_TRANSLATE_CENTAUR, + SCOM_TARGET_ADDR_MISMATCH, + io_addr, + userdata64_1, + true/*SW Error*/); + //Add this target to the FFDC + ERRORLOG::ErrlUserDetailsTarget(i_target,"SCOM Target") + .addToLog(l_err); + l_err->collectTrace(SCOM_COMP_NAME,1024); + break; + } + + l_instance = i_target->getAttr<TARGETING::ATTR_CHIP_UNIT>(); + io_addr = centaur_scominfo_createChipUnitScomAddr( + l_chipUnit, + l_instance, + io_addr, + l_chip_mode); + + if(io_addr == FAILED_TRANSLATION) + { + TRACFCOMP(g_trac_scom, "Address failed to translate."); + TRACFCOMP(g_trac_scom, "Scom Target HUID: 0x%x", TARGETING::get_huid(i_target)); + TRACFCOMP(g_trac_scom, "Scom Address: 0x%lx", io_addr); + TRACFCOMP(g_trac_scom, "Scom Target Type: 0x%x", i_type); + for(uint32_t i = 0; i < l_scomPairings.size(); i++) + { + TRACFCOMP(g_trac_scom, "Scom Pairing %d: %d", + i, l_scomPairings[i].chipUnitType); + } + uint32_t userdata32 = TWO_UINT16_TO_UINT32( + l_chipUnit, + l_instance); + uint64_t userdata64 = TWO_UINT32_TO_UINT64( + userdata32, + TARGETING::get_huid(i_target)); + /*@ + * @errortype + * @moduleid SCOM::SCOM_TRANSLATE_CENTAUR + * @reasoncode SCOM::SCOM_INVALID_TRANSLATION + * @userdata1 Original Address + * @userdata2[0:15] l_chipUnit + * @userdata2[16:31] instance of target + * @userdata2[32:63] HUID of target + * @devdesc Scom Translation did not modify the address + */ + l_err = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + SCOM_TRANSLATE_CENTAUR, + SCOM_INVALID_TRANSLATION, + l_original_addr, + userdata64, + true/*SW Error*/); + //Add this target to the FFDC + ERRORLOG::ErrlUserDetailsTarget(i_target,"SCOM Target") + .addToLog(l_err); + l_err->collectTrace(SCOM_COMP_NAME,1024); + break; + } + + } while (0); + return l_err; +} + +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +/** + * @brief Gets p9 chip unit for this target type + */ +bool getChipUnitP9 (TARGETING::TYPE i_type, + p9ChipUnits_t &o_chipUnit) { bool l_isError = false; switch(i_type) @@ -649,8 +912,38 @@ bool getChipUnit (TARGETING::TYPE i_type, o_chipUnit = PU_CAPP_CHIPUNIT; break; } - //Need to add centaur support for Cumulus - //@TODO RTC: 139953 + default: + { + l_isError = true; + break; + } + } + + return l_isError; +} + + +////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +/** + * @brief Gets centaur chip unit for this target type + */ +bool getChipUnitCentaur (TARGETING::TYPE i_type, + centaurChipUnits_t &o_chipUnit) +{ + bool l_isError = false; + switch(i_type) + { + case(TARGETING::TYPE_MEMBUF) : + { + o_chipUnit = CENTAUR_CHIP; + break; + } + case(TARGETING::TYPE_MBA) : + { + o_chipUnit = MBA_CHIPUNIT; + break; + } default: { l_isError = true; @@ -738,39 +1031,3 @@ uint32_t getChipLevel (TARGETING::Target* i_target) } // end namespace -//@TODO RTC: 139953 -//Need to support centaur chip translations -// MBA -// SCOM_TRANS_MBA_MASK = 0xFFFFFFFF7FFFFC00, -// SCOM_TRANS_MBA_BASEADDR = 0x0000000003010400, -// -// SCOM_TRANS_TCM_MBA_MASK = 0xFFFFFFFFFFFFFC00 -// SCOM_TRANS_TCM_MBA_BASEADDR = 0x0000000003010800 -// -// In the XML.. the -// <default>physical:sys-0/node-0/membuf-10/mbs-0/mba-1</default> -// -// Assuming the MBA we are accessing is under the Centaur -// not the processor.. for now. -// -// 0x00000000_03010400 MBA 0 # MBA01 -// 0x00000000_03010C00 MBA 1 # MBA23 - -// 0x00000000_03010880 MBA 0 # Trace for MBA01 -// 0x00000000_030110C0 MBA 1 # Trace for MBA23 - -// 0x00000000_03011400 MBA 0 # DPHY01 (indirect addressing) -// 0x00000000_03011800 MBA 1 # DPHY23 (indirect addressing) - -// 0x80000000_0301143f MBA 0 # DPHY01 (indirect addressing) -// 0x80000000_0301183f MBA 1 # DPHY23 (indirect addressing) - -// 0x80000000_0701143f MBA 0 # DPHY01 (indirect addressing) -// 0x80000000_0701183f MBA 1 # DPHY23 (indirect addressing) -// - -// SCOM_TRANS_IND_MBA_MASK = 0x80000000FFFFFFFF, -// SCOM_TRANS_IND_MBA_BASEADDR = 0x800000000301143f, - -// check to see that the Address is in the correct direct -// scom MBA address range. diff --git a/src/usr/scom/scomtrans.H b/src/usr/scom/scomtrans.H index f78249daf..aa8c4dd82 100644 --- a/src/usr/scom/scomtrans.H +++ b/src/usr/scom/scomtrans.H @@ -27,6 +27,7 @@ #include <devicefw/driverif.H> #include <p9_cu.H> +#include <centaur_scominfo.H> /** @file scomtrans.H * @brief Provides the interfaces to perform a SCom @@ -61,7 +62,7 @@ errlHndl_t startScomProcess(DeviceFW::OperationType i_opType, va_list i_args); /** - * @brief This function translates a scom address using the + * @brief This function translates a p9 scom address using * the interface that the HW team provided. * * @param[in] i_target SCom target is passed in @@ -72,22 +73,47 @@ errlHndl_t startScomProcess(DeviceFW::OperationType i_opType, * @return errlHndl_t */ errlHndl_t p9_translation (TARGETING::Target * &i_target, - TARGETING::TYPE i_type, + TARGETING::TYPE i_type, uint64_t &io_addr, bool & o_needsWakeup, uint64_t i_opMode = 0); /** - * @brief This function translates a scom address using the + * @brief This function translates a centaur scom address using * 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] i_opMode Defaults to 0 (Standard) + * @return errlHndl_t + */ +errlHndl_t centaur_translation (TARGETING::Target * &i_target, + TARGETING::TYPE i_type, + uint64_t &io_addr, + uint64_t i_opMode = 0); + +/** + * @brief This function gets the p9 chip unit for this target type. + * + * @param[in] i_type Type of the target + * @param[out] o_chipUnit Chip unit related to target type + * @return bool True if there was an error trying to find + * a chipUnit related to the inputed target type + */ +bool getChipUnitP9 (TARGETING::TYPE i_type, + p9ChipUnits_t &o_chipUnit); + +/** + * @brief This function gets the centaur chip unit for this target type. + * * @param[in] i_type Type of the target * @param[out] o_chipUnit Chip unit related to target type * @return bool True if there was an error trying to find * a chipUnit related to the inputed target type */ -bool getChipUnit (TARGETING::TYPE i_type, - p9ChipUnits_t &o_chipUnit); +bool getChipUnitCentaur (TARGETING::TYPE i_type, + centaurChipUnits_t &o_chipUnit); /** * @brief Computes the chip/ddlevel value to be passed into translator diff --git a/src/usr/scom/test/scomtest.H b/src/usr/scom/test/scomtest.H index a9a7ca97a..c4f5f882e 100644 --- a/src/usr/scom/test/scomtest.H +++ b/src/usr/scom/test/scomtest.H @@ -192,8 +192,8 @@ public: void test_FSISCOMreadWrite_centaur(void) { TRACFCOMP( g_trac_scom, "ScomTest::test_FSISCOMreadWrite_centaur> Start" ); - //FIXME: RTC 129630 -/* uint64_t fails = 0; + + uint64_t fails = 0; uint64_t total = 0; errlHndl_t l_err = NULL; @@ -370,7 +370,6 @@ public: } TRACFCOMP( g_trac_scom, "ScomTest::test_FSISCOMreadWrite_centaur> %d/%d fails", fails, total ); -*/ } @@ -755,7 +754,7 @@ public: void test_P9_ScomTranslations(void) -{ + { TRACFCOMP( g_trac_scom, "ScomTest::test_P9_ScomTranslations> Start" ); uint64_t fails = 0; @@ -1146,7 +1145,121 @@ public: } } TRACFCOMP( g_trac_scom, "ScomTest::test_P9_translateScom_SBE> %d/%d fails", fails, total ); -} + } + + + void test_Centaur_ScomTranslations(void) + { + TRACFCOMP( g_trac_scom, "ScomTest::test_Centaur_ScomTranslations> Start" ); + + uint64_t fails = 0; + uint64_t total = 0; + errlHndl_t l_err = NULL; + + // Setup some targets to use + enum { + myMembuf0, + myMBA0, + myMBA1, + NUM_TARGETS + }; + + TARGETING::Target* scom_targets[NUM_TARGETS]; + for( uint64_t x = 0; x < NUM_TARGETS; x++ ) + { + scom_targets[x] = NULL; + } + + ///////////////////////////////////////////////////////////////// + // Set up targets + ///////////////////////////////////////////////////////////////// + + // Centaur0 - the local centaur + TARGETING::EntityPath epath(TARGETING::EntityPath::PATH_PHYSICAL); + epath.addLast(TARGETING::TYPE_SYS,0); + epath.addLast(TARGETING::TYPE_NODE,0); + epath.addLast(TARGETING::TYPE_MEMBUF,0); + scom_targets[myMembuf0] = TARGETING::targetService().toTarget(epath); + + if(scom_targets[myMembuf0] != NULL) + { + // Add MBA0 target. + epath.addLast(TARGETING::TYPE_MBA,0); + scom_targets[myMBA0] = TARGETING::targetService().toTarget(epath); + + // Add MBA1 target + epath.removeLast(); + epath.addLast(TARGETING::TYPE_MBA,1); + scom_targets[myMBA1] = TARGETING::targetService().toTarget(epath); + } + + struct { + TARGETING::Target* target; + uint64_t initAddr; + uint64_t expectedAddr; + bool expectError; + } test_data[] = { + //Target Address Expected error + { scom_targets[myMBA0], 0x03010655 ,0x111111111111DDDD,false}, + { scom_targets[myMBA1], 0x03010655, 0x333333334444EEEE,false}, + { scom_targets[myMBA0], 0x8000C0140301143F,0x1111111111111212,false}, + { scom_targets[myMBA1], 0x8000C0140301143F, 0x333333334444abcd,false}, + { scom_targets[myMBA0], 0x8000C0140301183F,0x111111111111ccee,true}, // invalid non zero indirect address + { scom_targets[myMBA0], 0x03010E55, 0x010101010101CCCC,true}, // invalid passing in a non-0 unit address + }; + + int numOfAddr = sizeof test_data / sizeof(test_data[0]); + + for (int i = 0; i < numOfAddr; i++) + { + if(test_data[i].target != NULL) + { + total++; + uint64_t tempAddr = test_data[i].initAddr; + bool needsWakeup = false; + l_err = SCOM::scomTranslate(test_data[i].target, + tempAddr, + needsWakeup); + + if( l_err && !test_data[i].expectError) + { + TRACFCOMP(g_trac_scom, "ScomTest::test_Centaur_translate_scom> Write: Error from device : addr=0x%X, HUID 0x%X, RC=%X", + test_data[i].initAddr, + TARGETING::get_huid(test_data[i].target), + l_err->reasonCode() ); + TS_FAIL( "ScomTest::test_Centaur_translate> ERROR : Unexpected error log from write1" ); + fails++; + errlCommit(l_err,SCOM_COMP_ID); + } + else if(l_err == NULL && test_data[i].expectError) + { + TRACFCOMP(g_trac_scom, "ScomTest::test_Centaur_translate> ERROR : Expected an error and did not recieve one for : addr=0x%X, HUID 0x%X", + test_data[i].initAddr, + TARGETING::get_huid(test_data[i].target)) + TS_FAIL( "ScomTest::test_Centaur_translate> ERROR : Expected an error and did not recieve one" ); + fails++; + } + else if(tempAddr!= test_data[i].expectedAddr && + l_err == NULL && !test_data[i].expectError) + { + TRACFCOMP(g_trac_scom, "ScomTest::test_Centaur_translate_scom> Incorrect translation of: 0x%X produced: 0x%X expected: 0x%X", + test_data[i].initAddr, tempAddr, test_data[i].expectedAddr); + TS_FAIL( "ScomTest::test_Centaur_translate> ERROR : Unexpected error log from write1" ); + fails++; + } + else if(l_err && test_data[i].expectError) + { + delete l_err; + TRACFCOMP(g_trac_scom, "ScomTest::test_Centaur_translate_scom> Previous error expected"); + } + } + else + { + TRACFCOMP(g_trac_scom, "ScomTest::test_Centaur_translate_scom> Target %d in the list of targets does not exist in the system", i); + } + } + TRACFCOMP( g_trac_scom, "ScomTest::test_Centaur_translateScom_SBE> %d/%d fails", fails, total ); + } /** |