diff options
Diffstat (limited to 'src/usr/fapi2/test')
-rw-r--r-- | src/usr/fapi2/test/fapi2DdimmGetEfdTest.C | 3 | ||||
-rw-r--r-- | src/usr/fapi2/test/fapi2GetChildrenTest.H | 135 | ||||
-rw-r--r-- | src/usr/fapi2/test/fapi2GetVpdTest.H | 6 | ||||
-rw-r--r-- | src/usr/fapi2/test/fapi2MmioAccessTest.H | 70 | ||||
-rw-r--r-- | src/usr/fapi2/test/fapi2MvpdTestCxx.H | 6 | ||||
-rw-r--r-- | src/usr/fapi2/test/fapi2SpdTestCxx.H | 194 | ||||
-rw-r--r-- | src/usr/fapi2/test/fapi2Test.mk | 2 | ||||
-rw-r--r-- | src/usr/fapi2/test/fapi2TestUtils.H | 3 | ||||
-rw-r--r-- | src/usr/fapi2/test/p9_mmiotests.C | 31 |
9 files changed, 274 insertions, 176 deletions
diff --git a/src/usr/fapi2/test/fapi2DdimmGetEfdTest.C b/src/usr/fapi2/test/fapi2DdimmGetEfdTest.C index 13f0ed87b..400ca2a59 100644 --- a/src/usr/fapi2/test/fapi2DdimmGetEfdTest.C +++ b/src/usr/fapi2/test/fapi2DdimmGetEfdTest.C @@ -111,7 +111,8 @@ fapi2DdimmGetEfdTest::fapi2DdimmGetEfdTest() { FAPI_INF(">> fapi2DdimmGetEfdTest"); - if(TARGETING::MODEL_AXONE != TARGETING::targetService().getProcessorModel()) + iv_attrModel = TARGETING::targetService().getProcessorModel(); + if(TARGETING::MODEL_AXONE != iv_attrModel) { FAPI_INF("<< fapi2DdimmGetEfdTest: This is not AXONE. " "Skipping AXONE tests."); diff --git a/src/usr/fapi2/test/fapi2GetChildrenTest.H b/src/usr/fapi2/test/fapi2GetChildrenTest.H index 3971c1270..961579e1f 100644 --- a/src/usr/fapi2/test/fapi2GetChildrenTest.H +++ b/src/usr/fapi2/test/fapi2GetChildrenTest.H @@ -32,7 +32,6 @@ #include <functional> #include <plat_utils.H> #include <error_scope.H> -#include <config.h> namespace fapi2 { @@ -66,7 +65,6 @@ void test_fapi2GetChildren() uint32_t l_targetHuid = 0xFFFFFFFF; uint32_t l_actualSize = 0; uint32_t l_expectedSize = 0; - errlHndl_t l_err = nullptr; int numTests = 0; int numFails = 0; @@ -225,7 +223,7 @@ void test_fapi2GetChildren() numTests++; if(l_actualSize != l_expectedSize) { - TS_FAIL("test_fapi2GetChildren:: OMIs per proc mismatch"); + TS_FAIL("test_fapi2GetChildren:: OMIs per proc mismatch. Actual size: %d, Expected size: %d", l_actualSize, l_expectedSize); numFails++; break; } @@ -611,17 +609,25 @@ void test_fapi2GetChildren() TARGET_STATE_PRESENT).size(); } }, // CAPP pervasive has 1 CAPP child - {PERV_CAPP_CUMULUS_CHILDREN, + {PERV_CAPP_AXONE_CHILDREN, [](TARGETING::ATTR_CHIP_UNIT_type i_unit) { return ((i_unit == CAPP0_RANGE) || (i_unit == CAPP1_RANGE));}, [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) { return i_perv.getChildren<fapi2::TARGET_TYPE_CAPP>( TARGET_STATE_PRESENT).size(); } }, - // OBUS pervasive has 3 OBUS BRICK children - {PERV_OBUS_BRICK_CHILDREN, + // OBUS0,3 pervasive has 2 OBUS BRICK children + {PERV_OBUS_BRICK03_AXONE_CHILDREN, [](TARGETING::ATTR_CHIP_UNIT_type i_unit) - { return ((i_unit >= OBUS_LOW) && (i_unit <= OBUS_HIGH)); }, + { return ((i_unit == OBUS_LOW+0) || (i_unit == OBUS_LOW+3)); }, + [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) + { return i_perv.getChildren<fapi2::TARGET_TYPE_OBUS_BRICK>( + TARGET_STATE_PRESENT).size(); } }, + + // OBUS1,2 pervasive has 1 OBUS BRICK child + {PERV_OBUS_BRICK12_AXONE_CHILDREN, + [](TARGETING::ATTR_CHIP_UNIT_type i_unit) + { return ((i_unit == OBUS_LOW+1) || (i_unit == OBUS_LOW+2)); }, [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) { return i_perv.getChildren<fapi2::TARGET_TYPE_OBUS_BRICK>( TARGET_STATE_PRESENT).size(); } }, @@ -699,7 +705,7 @@ void test_fapi2GetChildren() TARGET_STATE_PRESENT).size(); } }, }; - pervasiveChildTestRec* ptr; + pervasiveChildTestRec* ptr = nullptr; int numPervTests = 0; TARGETING::ATTR_MODEL_type l_model = l_proc->getAttr<TARGETING::ATTR_MODEL>(); if (l_model == TARGETING::MODEL_NIMBUS) @@ -750,9 +756,9 @@ void test_fapi2GetChildren() if(candidateTarget == nullptr) { - TS_FAIL("test_fapi2GetChildren:: candidateTarget not found"); + TS_FAIL("test_fapi2GetChildren:: candidateTarget not found - test %d", i); numFails++; - break; + continue; } l_targetHuid = TARGETING::get_huid(candidateTarget); @@ -764,9 +770,9 @@ void test_fapi2GetChildren() if(l_actualSize != l_expectedSize) { - TS_FAIL("test_fapi2GetChildren:: children of pervasive mismatch"); + TS_FAIL("test_fapi2GetChildren:: children of pervasive mismatch for %.8X (exp=%d,act=%d)", + l_targetHuid,l_expectedSize,l_actualSize); numFails++; - break; } } @@ -780,31 +786,6 @@ void test_fapi2GetChildren() }while(0); - if(l_actualSize != l_expectedSize) - { - /*@ - * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE - * @moduleid fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_TEST - * @reasoncode fapi2::RC_INVALID_CHILD_COUNT - * @userdata1[0:31] Expected Child Count - * @userdata1[32:63] Actual Child Count - * @userdata2 Parent HUID - * @devdesc Invalid amount of child cores found - * on a proc - */ - l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, - fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_TEST, - fapi2::RC_INVALID_CHILD_COUNT, - TWO_UINT32_TO_UINT64( - TO_UINT32( - l_expectedSize), - TO_UINT32( - l_actualSize)), - l_targetHuid, - true/*SW Error*/); - errlCommit(l_err,HWPF_COMP_ID); - TS_FAIL("test_fapi2GetChildren Fail, for HUID: %d , expected %d children , found %d ", l_targetHuid,l_expectedSize,l_actualSize ); - } FAPI_INF("fapi2GetChildrenTest:: Test Complete. %d/%d fails", numFails , numTests); } @@ -818,7 +799,6 @@ void test_fapi2GetChildrenFilter() uint32_t l_targetHuid = 0xFFFFFFFF; uint32_t l_actualSize = 0; uint32_t l_expectedSize = 0; - errlHndl_t l_err = nullptr; TARGETING::Target * l_proc = nullptr; TARGETING::TargetHandleList l_chipList; do @@ -835,7 +815,7 @@ void test_fapi2GetChildrenFilter() } else { - TS_FAIL("test_fapi2GetChildren Fail: could not find any proc, skipping tests"); + TS_FAIL("test_fapi2GetChildrenFilter Fail: could not find any proc, skipping tests"); numFails++; break; } @@ -876,7 +856,7 @@ void test_fapi2GetChildrenFilter() if(l_actualSize != l_expectedSize) { numFails++; - break; + TS_FAIL("test_fapi2GetChildrenFilter Fail on PERV/ALL_CORES, for HUID: 0x%.8X , expected %d children , found %d ", l_targetHuid,l_expectedSize,l_actualSize ); } // PERV - TARGET_FILTER_CORE1 @@ -890,7 +870,7 @@ void test_fapi2GetChildrenFilter() if(l_actualSize != l_expectedSize) { numFails++; - break; + TS_FAIL("test_fapi2GetChildrenFilter Fail on PERV/CORE1, for HUID: 0x%.8X , expected %d children , found %d ", l_targetHuid,l_expectedSize,l_actualSize ); } if (isHwValid(l_proc, MY_MC)) @@ -906,13 +886,26 @@ void test_fapi2GetChildrenFilter() if(l_actualSize != l_expectedSize) { numFails++; - break; + TS_FAIL("test_fapi2GetChildrenFilter Fail on PERV/ALL_MC, for HUID: 0x%.8X , expected %d children , found %d ", l_targetHuid,l_expectedSize,l_actualSize ); } } // PERV - SYNC_MODE_ALL_IO_EXCEPT_NEST - // NOTE: 2 of 4 OBUS are Cumulus only, so expect 8 instead of 10 returned - l_expectedSize = 8; + l_expectedSize = 0; + TARGETING::ATTR_MODEL_type l_model = l_proc->getAttr<TARGETING::ATTR_MODEL>(); + if (l_model == TARGETING::MODEL_NIMBUS) + { + // NOTE: 2 of 4 OBUS are Cumulus only, so expect 8 instead of 10 returned + l_expectedSize = 8; + } + else if (l_model == TARGETING::MODEL_CUMULUS) + { + l_expectedSize = 10; + } + else if (l_model == TARGETING::MODEL_AXONE) + { + l_expectedSize = 10; + } l_childPERVs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_PERV>( TARGET_FILTER_SYNC_MODE_ALL_IO_EXCEPT_NEST, TARGET_STATE_PRESENT); @@ -922,37 +915,11 @@ void test_fapi2GetChildrenFilter() if(l_actualSize != l_expectedSize) { numFails++; - break; + TS_FAIL("test_fapi2GetChildrenFilter Fail on PERV/ALL_IO_EXCEPT_NEST, for HUID: 0x%.8X , expected %d children , found %d ", l_targetHuid,l_expectedSize,l_actualSize ); } }while(0); - if(l_actualSize != l_expectedSize) - { - /*@ - * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE - * @moduleid fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_FILTER_TEST - * @reasoncode fapi2::RC_INVALID_CHILD_COUNT - * @userdata1[0:31] Expected Child Count - * @userdata1[32:63] Actual Child Count - * @userdata2 Parent HUID - * @devdesc Invalid amount of child cores found - * on a proc - */ - l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, - fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_FILTER_TEST, - fapi2::RC_INVALID_CHILD_COUNT, - TWO_UINT32_TO_UINT64( - TO_UINT32( - l_expectedSize), - TO_UINT32( - l_actualSize)), - l_targetHuid, - true/*SW Error*/); - errlCommit(l_err,HWPF_COMP_ID); - TS_FAIL("test_fapi2GetChildrenFilter Fail, for HUID: 0x%X , expected %d children , found %d ", l_targetHuid,l_expectedSize,l_actualSize ); - } - FAPI_INF("test_fapi2GetChildrenFilter: Test Complete. %d/%d fails", numFails , numTests); } @@ -966,10 +933,12 @@ void test_fapi2getChildTargetsForCDG() int numFails = 0; TARGETING::Target * l_proc = nullptr; size_t l_expectedDimms = 0; + TARGETING::TargetHandleList l_chipList; +// These port and socket arguments are not valid for Axone targets +#ifndef CONFIG_AXONE size_t l_expectedDimmsUnderPort0 = 0; size_t l_expectedDimmsUnderPort1 = 0; - TARGETING::TargetHandleList l_chipList; - +#endif do { FAPI_DBG("start of test_fapi2getChildTargetsForCDG()"); @@ -992,20 +961,24 @@ void test_fapi2getChildTargetsForCDG() if (l_proc->getAttr<TARGETING::ATTR_MODEL>() == TARGETING::MODEL_NIMBUS) { l_expectedDimms = 16; +// These port and socket arguments are not valid for Axone targets +#ifndef CONFIG_AXONE l_expectedDimmsUnderPort0 = l_expectedDimms; l_expectedDimmsUnderPort1 = 0; +#endif } else if (l_proc->getAttr<TARGETING::ATTR_MODEL>() == TARGETING::MODEL_CUMULUS) { l_expectedDimms = 8; +// These port and socket arguments are not valid for Axone targets +#ifndef CONFIG_AXONE l_expectedDimmsUnderPort0 = l_expectedDimms/2; l_expectedDimmsUnderPort1 = l_expectedDimms/2; +#endif } else if (l_proc->getAttr<TARGETING::ATTR_MODEL>() == TARGETING::MODEL_AXONE) { l_expectedDimms = 9; - l_expectedDimmsUnderPort0 = 0xFF; //wrong - l_expectedDimmsUnderPort1 = 0xFF; //wrong } else //both are nullptr { @@ -1035,6 +1008,9 @@ void test_fapi2getChildTargetsForCDG() numFails++; } +// These port and socket arguments are not valid for Axone targets +// so skip testing them +#ifndef CONFIG_AXONE // All dimms under port 0 fapi2::getChildTargetsForCDG(fapi2_procTarget, fapi2::TARGET_TYPE_DIMM, @@ -1047,11 +1023,9 @@ void test_fapi2getChildTargetsForCDG() if(l_dimmList.size() != l_expectedDimmsUnderPort0) { -#ifndef CONFIG_AXONE_BRING_UP TS_FAIL("test_fapi2getChildTargetsForCDG: Dimm count %d under port 0 not equal expected %d", l_dimmList.size(),l_expectedDimmsUnderPort0); numFails++; -#endif } // All dimms under port 1 @@ -1066,11 +1040,9 @@ void test_fapi2getChildTargetsForCDG() if(l_dimmList.size() != l_expectedDimmsUnderPort1) { -#ifndef CONFIG_AXONE_BRING_UP TS_FAIL("test_fapi2getChildTargetsForCDG: Dimm count %d under port 1 not equal expected %d", l_dimmList.size(),l_expectedDimmsUnderPort1); numFails++; -#endif } // All dimms under socket 0 @@ -1084,11 +1056,9 @@ void test_fapi2getChildTargetsForCDG() numTests++; if(l_dimmList.size() != l_expectedDimms) { -#ifndef CONFIG_AXONE_BRING_UP - TS_FAIL("test_fapi2getChildTargetsForCDG: Dimm count %d under socket 0 not equal expected %d", + TS_FAIL("test_fapi2getChildTargetsForCDG: Dimm count %d under socket 0x0, all ports, not equal expected %d", l_dimmList.size(),l_expectedDimms); numFails++; -#endif } // All dimms under socket 1 @@ -1106,6 +1076,7 @@ void test_fapi2getChildTargetsForCDG() l_dimmList.size(),0); numFails++; } +#endif }while(0); diff --git a/src/usr/fapi2/test/fapi2GetVpdTest.H b/src/usr/fapi2/test/fapi2GetVpdTest.H index 8a8dc0849..8f86430a0 100644 --- a/src/usr/fapi2/test/fapi2GetVpdTest.H +++ b/src/usr/fapi2/test/fapi2GetVpdTest.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016,2017 */ +/* Contributors Listed Below - COPYRIGHT 2016,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -46,7 +46,7 @@ public: void testGetVPD(void) { -#ifdef CONFIG_SECUREBOOT +#if (defined CONFIG_SECUREBOOT && ! defined CONFIG_AXONE) errlHndl_t pError=NULL; do { @@ -71,7 +71,7 @@ void testGetVPD(void) testGetVPD_DQ(); testGetVPD_CK(); -#ifdef CONFIG_SECUREBOOT +#if (defined CONFIG_SECUREBOOT && ! defined CONFIG_AXONE) pError = PNOR::unloadSecureSection(PNOR::MEMD); if(pError) { diff --git a/src/usr/fapi2/test/fapi2MmioAccessTest.H b/src/usr/fapi2/test/fapi2MmioAccessTest.H index 3ba0f31c0..fffec22e8 100644 --- a/src/usr/fapi2/test/fapi2MmioAccessTest.H +++ b/src/usr/fapi2/test/fapi2MmioAccessTest.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ +/* Contributors Listed Below - COPYRIGHT 2018,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -38,7 +38,7 @@ #include <fapi2TestUtils.H> #include <p9_mmiotests.H> #include <plat_hwp_invoker.H> -#include <config.h> +#include <test/exptest_utils.H> using namespace fapi2; @@ -110,10 +110,22 @@ void test_fapi2MmioInvalidSizes() // Get a list of all of the OCMB chips TARGETING::getAllChips(l_ocmbTargetList, TARGETING::TYPE_OCMB_CHIP, true); + if (!iv_serializeTestMutex) + { + TS_FAIL("test_fapi2MmioInvalidSizes(): unable to get test mutex"); + return; + } + mutex_lock(iv_serializeTestMutex); + for (auto & l_ocmb: l_ocmbTargetList) { Target<fapi2::TARGET_TYPE_OCMB_CHIP> fapi2_ocmbTarget( l_ocmb ); - + auto first_ocmb_info = l_ocmb->getAttr<TARGETING::ATTR_SCOM_SWITCHES>(); + if (!first_ocmb_info.useInbandScom) + { + TS_FAIL("test_fapi2MmioInvalidSizes() - scom access is not using inband"); + continue; + } numTests++; FAPI_INVOKE_HWP(l_errl, p9_mmiotest_indivisible_by_section_size, fapi2_ocmbTarget); if(l_errl != nullptr) @@ -126,6 +138,12 @@ void test_fapi2MmioInvalidSizes() TS_FAIL("No error from p9_mmiotest_indivisible_by_section_size !!"); numFails++; } + auto second_ocmb_info = l_ocmb->getAttr<TARGETING::ATTR_SCOM_SWITCHES>(); + if (!second_ocmb_info.useInbandScom) + { + TS_FAIL("p9_mmiotest_indivisible_by_section_size turned off mmio operations"); + l_ocmb->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(first_ocmb_info); + } numTests++; FAPI_INVOKE_HWP(l_errl, p9_mmiotest_invalid_section_size, fapi2_ocmbTarget); @@ -139,7 +157,14 @@ void test_fapi2MmioInvalidSizes() TS_FAIL("No error from p9_mmiotest_invalid_section_size !!"); numFails++; } + auto third_ocmb_info = l_ocmb->getAttr<TARGETING::ATTR_SCOM_SWITCHES>(); + if (!third_ocmb_info.useInbandScom) + { + TS_FAIL("p9_mmiotest_invalid_section_size turned off mmio operations"); + l_ocmb->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(first_ocmb_info); + } } + mutex_unlock(iv_serializeTestMutex); FAPI_INF("test_fapi2MmioInvalidSizes Test Complete. %d/%d fails", numFails, numTests); } @@ -152,7 +177,6 @@ void test_fapi2MmioAccess() int numTests = 0; int numFails = 0; -#ifndef CONFIG_AXONE_BRING_UP errlHndl_t l_errl = nullptr; // Create a vector of TARGETING::Target pointers @@ -161,6 +185,12 @@ void test_fapi2MmioAccess() // Get a list of all of the OCMB chips TARGETING::getAllChips(l_chipList, TARGETING::TYPE_OCMB_CHIP, true); + if (!iv_serializeTestMutex) + { + TS_FAIL("test_fapi2MmioAccess(): unable to get test mutex"); + return; + } + mutex_lock(iv_serializeTestMutex); for (auto & l_ocmb: l_chipList) { Target<fapi2::TARGET_TYPE_OCMB_CHIP> l_fapi2_target( l_ocmb ); @@ -213,11 +243,41 @@ void test_fapi2MmioAccess() l_errl = nullptr; } } -#endif + mutex_unlock(iv_serializeTestMutex); FAPI_INF("fapi2MmioAccessTest Test Complete. %d/%d fails", numFails, numTests); } +/** + * @brief Constructor + */ +Fapi2MmioAccessTest() : CxxTest::TestSuite() +{ + // All modules are loaded by runtime, + // so testcase loading of modules is not required +#ifndef __HOSTBOOT_RUNTIME + errlHndl_t err = nullptr; + err = exptest::loadModule(exptest::MSS_LIBRARY_NAME); + if(err) + { + TS_FAIL("Fapi2MmioAccessTest() - Constuctor: failed to load MSS module"); + errlCommit( err, TARG_COMP_ID ); + } +#endif + iv_serializeTestMutex = exptest::getTestMutex(); +}; + +/** + * @brief Deconstructor + */ +~Fapi2MmioAccessTest() +{ +} + + +private: + // This is used for tests that need to not run operations at the same time + TARGETING::HB_MUTEX_SERIALIZE_TEST_LOCK_ATTR iv_serializeTestMutex; }; diff --git a/src/usr/fapi2/test/fapi2MvpdTestCxx.H b/src/usr/fapi2/test/fapi2MvpdTestCxx.H index 224879070..92d791908 100644 --- a/src/usr/fapi2/test/fapi2MvpdTestCxx.H +++ b/src/usr/fapi2/test/fapi2MvpdTestCxx.H @@ -326,7 +326,8 @@ public: #ifdef CONFIG_EARLY_TESTCASES // Requires some prereqs of step7 - FAPI_INF("Skipping poundv tests"); + FAPI_INF("Skipping poundv tests due to CONFIG_EARLY_TESTCASES"); + #else fapi2::ReturnCode l_rc; @@ -421,7 +422,8 @@ public: #ifdef CONFIG_EARLY_TESTCASES // Requires some prereqs of step7 - FAPI_INF("Skipping poundv tests"); + FAPI_INF("Skipping poundw tests due to CONFIG_EARLY_TESTCASES"); + #else fapi2::ReturnCode l_rc; diff --git a/src/usr/fapi2/test/fapi2SpdTestCxx.H b/src/usr/fapi2/test/fapi2SpdTestCxx.H index 2ccd457dc..d033401e8 100644 --- a/src/usr/fapi2/test/fapi2SpdTestCxx.H +++ b/src/usr/fapi2/test/fapi2SpdTestCxx.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ +/* Contributors Listed Below - COPYRIGHT 2016,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -37,6 +37,7 @@ #include <errl/errlentry.H> #include <devicefw/driverif.H> #include <fapi2_spd_access.H> +#include <vpd/spdenums.H> using namespace TARGETING; @@ -52,76 +53,127 @@ class SPDTest: public CxxTest::TestSuite { public: - /** - * @brief Test SPD get Interface DIMMs. - */ - void testGetSPD ( void ) - { - fapi2::ReturnCode l_rc; - size_t l_size = 0; - uint8_t * l_blobData = NULL; - - FAPI_INF( "testGetSPD - Enter" ); - - do - { - TARGETING::Target * i_pTarget = NULL; - - // Get DIMM Targets - TargetHandleList dimmList; - getDIMMTargets( dimmList ); - - // Should get atleast one - if( ( 0 == dimmList.size() ) || - ( NULL == dimmList[0] ) ) - { - FAPI_INF( "testGetSPD- No DIMMs found!"); - break; - } - - // Work on the first DIMM target - i_pTarget = dimmList[0]; - - // convert to fapi2 target - fapi2::Target<fapi2::TARGET_TYPE_DIMM> fapi2_Target(i_pTarget); - - // SPD interface call with NULL blob to get size data - l_rc = fapi2::getSPD(fapi2_Target, NULL, l_size); - - // Expect to return the size or non failure - if( !l_size || (l_rc != fapi2::FAPI2_RC_SUCCESS) ) - { - TS_FAIL("testGetSPD: Failed getting the size of the mem buffer"); - break; - } - - // allocate the blob data of mem size length to hold data - l_blobData = reinterpret_cast<uint8_t *>(malloc(l_size)); - memset(l_blobData,0,l_size); - - l_rc = fapi2::getSPD(fapi2_Target,l_blobData, l_size); - if ( l_rc != fapi2::FAPI2_RC_SUCCESS ) - { - TS_FAIL( "testGetSPD- Failed to read data from DIMM with HUID= 0x%x", - TARGETING::get_huid(i_pTarget)); - break; - } - - FAPI_DBG("getSPD: SPD data for DIMM with HUID=0x%.8X Size %d Blob %d", - TARGETING::get_huid(i_pTarget), - l_size, - l_blobData); - - } while(0); - - if( NULL != l_blobData ) - { - free( l_blobData ); - l_blobData = NULL; - } - - FAPI_INF( "testGetSPD - Exit" ); - } + /** + * @brief Test SPD get Interface DIMMs. + */ + void testGetSPD ( void ) + { + fapi2::ReturnCode l_rc; + size_t l_spdSize = 0; + uint8_t * l_blobData = NULL; + + FAPI_INF( "testGetSPD - Enter" ); + + // Get DIMM Targets + TargetHandleList dimmList; + getDIMMTargets( dimmList ); + + // Should get atleast one + if( ( 0 == dimmList.size() ) || + ( NULL == dimmList[0] ) ) + { + TS_FAIL( "testGetSPD- No DIMMs found!"); + } + + for( auto l_tDimm : dimmList ) + { + + // convert to fapi2 target + fapi2::Target<fapi2::TARGET_TYPE_DIMM> l_fDimm(l_tDimm); + + // SPD interface call with NULL blob to get size data + l_rc = fapi2::getSPD(l_fDimm, NULL, l_spdSize); + + // Expect to return the size or non failure + if( !l_spdSize || (l_rc != fapi2::FAPI2_RC_SUCCESS) ) + { + TS_FAIL("testGetSPD: Failed getting the size of the mem buffer - Dimm %.8X", TARGETING::get_huid(l_tDimm)); + continue; + } + + // allocate the blob data of mem size length to hold data + l_blobData = reinterpret_cast<uint8_t *>(malloc(l_spdSize)); + memset(l_blobData,0,l_spdSize); + + l_rc = fapi2::getSPD(l_fDimm,l_blobData, l_spdSize); + if ( l_rc != fapi2::FAPI2_RC_SUCCESS ) + { + TS_FAIL( "testGetSPD- Failed to read data from DIMM with HUID= 0x%x", + TARGETING::get_huid(l_tDimm)); + continue; + } + + uint8_t l_memModule = 0x0; + size_t l_memSize = sizeof(uint8_t); + + auto l_errl = deviceRead(l_tDimm, + (void *)&l_memModule, + l_memSize, + DEVICE_SPD_ADDRESS(SPD::MODULE_TYPE)); + + if ( l_errl ) + { + TS_FAIL( "testGetSPD- Failed to deviceRead with HUID= 0x%x", + TARGETING::get_huid(l_tDimm)); + continue; + } + + uint8_t l_memGen = 0x0; + l_errl = deviceRead(l_tDimm, + (void *)&l_memGen, + l_memSize, + DEVICE_SPD_ADDRESS(SPD::BASIC_MEMORY_TYPE)); + + if ( l_errl ) + { + TS_FAIL( "testGetSPD- Failed to deviceRead with HUID= 0x%x", + TARGETING::get_huid(l_tDimm)); + continue; + } + + // figure out the expected size based on the memory type + size_t l_compareSize = 0; + if( (l_memModule == SPD::MEM_DDIMM) && (l_memGen == SPD::MEM_DDR4) ) + { + l_compareSize = SPD::OCMB_SPD_EFD_COMBINED_SIZE; + } + else if( (l_memModule != SPD::MEM_DDIMM) && (l_memGen == SPD::MEM_DDR4) ) + { + l_compareSize = SPD::DDR4_SPD_SIZE; + } + else if( l_memGen == SPD::MEM_DDR3 ) + { + l_compareSize = SPD::DDR3_SPD_SIZE; + } + else + { + TS_FAIL( "testGetSPD - Unknown memory type for %.8X : module=0x%X, gen=0x%X", + TARGETING::get_huid(l_tDimm), l_memModule, l_memGen ); + continue; + } + + if( l_compareSize != l_spdSize ) + { + TS_FAIL( "testGetSPD - Wrong SPD size for %.8X : module=0x%X, gen=0x%X, exp=%d, act=%d", + TARGETING::get_huid(l_tDimm), l_memModule, l_memGen, + l_compareSize, l_spdSize); + continue; + } + + FAPI_DBG("getSPD: SPD data for DIMM with HUID=0x%.8X Size %d Blob %d", + TARGETING::get_huid(l_tDimm), + l_spdSize, + l_blobData); + } + + if( NULL != l_blobData ) + { + free( l_blobData ); + l_blobData = NULL; + } + + FAPI_INF( "testGetSPD - Exit" ); + } }; diff --git a/src/usr/fapi2/test/fapi2Test.mk b/src/usr/fapi2/test/fapi2Test.mk index f7dc4d002..074e4e45d 100644 --- a/src/usr/fapi2/test/fapi2Test.mk +++ b/src/usr/fapi2/test/fapi2Test.mk @@ -72,6 +72,8 @@ else ## All hostboot IPL time tests TESTS += ${shell ls ${ROOTPATH}/src/usr/fapi2/test/*Test.H | \ sort | xargs} +EXTRAINCDIR += ${ROOTPATH}/src/usr/expaccess/ + OBJS += p9_i2ctests.o OBJS += p9_mmiotests.o diff --git a/src/usr/fapi2/test/fapi2TestUtils.H b/src/usr/fapi2/test/fapi2TestUtils.H index 7b724a094..011538c63 100644 --- a/src/usr/fapi2/test/fapi2TestUtils.H +++ b/src/usr/fapi2/test/fapi2TestUtils.H @@ -225,7 +225,10 @@ enum PERVASIVE_CHILDREN { PERV_OBUS_CHILDREN = 1, PERV_CAPP_NIMBUS_CHILDREN = 1, PERV_CAPP_CUMULUS_CHILDREN = 2, + PERV_CAPP_AXONE_CHILDREN = 1, PERV_OBUS_BRICK_CHILDREN = 3, + PERV_OBUS_BRICK03_AXONE_CHILDREN = 2, + PERV_OBUS_BRICK12_AXONE_CHILDREN = 1, PERV_MCBIST_CHILDREN = 1, PERV_MCS_CHILDREN = 2, PERV_MCA_CHILDREN = 4, diff --git a/src/usr/fapi2/test/p9_mmiotests.C b/src/usr/fapi2/test/p9_mmiotests.C index 264e88117..1214e20fb 100644 --- a/src/usr/fapi2/test/p9_mmiotests.C +++ b/src/usr/fapi2/test/p9_mmiotests.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ +/* Contributors Listed Below - COPYRIGHT 2018,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -37,6 +37,13 @@ #include <sbe/sbe_common.H> +// Write/Read from the inband response address (shouldn't hurt anything) +// Constants from #include <lib/inband/exp_inband.H> +static const uint64_t EXPLR_IB_MMIO_OFFSET = 0x0000000100000000ull; // 4GB +static const uint64_t EXPLR_IB_SRAM_BASE = 0x01000000; // MSCCRNGE 01000000 020FFFFF +static const uint64_t EXPLR_IB_RSP_SRAM_ADDR = EXPLR_IB_SRAM_BASE | 0x03FF00; +static const uint64_t EXPLR_IB_RSP_ADDR = EXPLR_IB_MMIO_OFFSET | EXPLR_IB_RSP_SRAM_ADDR; + fapi2::ReturnCode p9_mmiotest_getmmio_invalid_target( fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) { @@ -48,7 +55,7 @@ fapi2::ReturnCode p9_mmiotest_getmmio_invalid_target( FAPI_INF("Do getMMIO on a proc target for 8 bytes"); FAPI_TRY(fapi2::getMMIO(i_target, - 0x1000, // mmio address relative to target + EXPLR_IB_RSP_ADDR, // mmio address relative to target 8, // mmio transaction size l_mmiodata)); fapi_try_exit: @@ -75,7 +82,7 @@ fapi2::ReturnCode p9_mmiotest_putmmio_invalid_target( FAPI_INF( "Do putMMIO on proc target" ); FAPI_TRY(fapi2::putMMIO(i_target, - 0x1000, + EXPLR_IB_RSP_ADDR, 4, l_mmiodata)); @@ -100,7 +107,7 @@ fapi2::ReturnCode p9_mmiotest_indivisible_by_section_size( FAPI_INF("Do getMMIO on a target for 10 bytes"); FAPI_TRY(fapi2::getMMIO(i_target, - 0x1000, // mmio address relative to target + EXPLR_IB_RSP_ADDR, // mmio address relative to target 8, // mmio transaction size l_mmiodata)); fapi_try_exit: @@ -123,7 +130,7 @@ fapi2::ReturnCode p9_mmiotest_invalid_section_size( FAPI_INF("Do getMMIO on a target for 12 bytes"); FAPI_TRY(fapi2::getMMIO(i_target, - 0x1000, // mmio address relative to target + EXPLR_IB_RSP_ADDR, // mmio address relative to target 12, // mmio transaction size l_mmiodata)); fapi_try_exit: @@ -149,7 +156,7 @@ fapi2::ReturnCode p9_mmiotest_getmmio_pass( FAPI_INF("Do single-read transaction getMMIO on an OCMB target"); FAPI_TRY(fapi2::getMMIO(i_target, - 0x1000, + EXPLR_IB_RSP_ADDR, l_mmiodataSize, l_mmiodata) ); @@ -157,7 +164,7 @@ fapi2::ReturnCode p9_mmiotest_getmmio_pass( l_mmiodata.resize(l_mmiodataSize*2); // do a double mmio transaction FAPI_INF("Do double-read transaction getMMIO on an OCMB target"); FAPI_TRY(fapi2::getMMIO(i_target, - 0x1000, + EXPLR_IB_RSP_ADDR, l_mmiodataSize, l_mmiodata) ); @@ -183,7 +190,7 @@ fapi2::ReturnCode p9_mmiotest_double_read_pass( FAPI_INF("Do first getMMIO on an ocmb target"); FAPI_TRY(fapi2::getMMIO(i_target, - 0x1000, + EXPLR_IB_RSP_ADDR, l_mmioTransactionSize, l_1st_read) ); @@ -195,7 +202,7 @@ fapi2::ReturnCode p9_mmiotest_double_read_pass( FAPI_INF("Do second getMMIO on an ocmb target"); FAPI_TRY(fapi2::getMMIO(i_target, - 0x1000, + EXPLR_IB_RSP_ADDR, l_mmioTransactionSize, l_2nd_read) ); @@ -237,7 +244,7 @@ fapi2::ReturnCode p9_mmiotest_putmmio_pass( FAPI_INF("Do putMMIO on OCMB target"); FAPI_TRY(fapi2::putMMIO(i_target, - 0x1000, + EXPLR_IB_RSP_ADDR, 4, l_mmiodata)); fapi_try_exit: @@ -266,14 +273,14 @@ fapi2::ReturnCode p9_mmiotest_write_read_pass( // Write out a known value (name of this test) FAPI_INF("Calling putMMIO on the target (size: %d)", l_data_size); - FAPI_TRY(fapi2::putMMIO(i_target, 0x1000, + FAPI_TRY(fapi2::putMMIO(i_target, EXPLR_IB_RSP_ADDR, l_mmioTransactionSize, l_mmio_data)); // now read it out and verify it was written correctly FAPI_INF("Now read the just written data"); l_read_mmio_data.resize(l_data_size); FAPI_TRY(fapi2::getMMIO(i_target, - 0x1000, + EXPLR_IB_RSP_ADDR, l_mmioTransactionSize, l_read_mmio_data)); |