diff options
-rw-r--r-- | src/include/usr/initservice/initsvcreasoncodes.H | 2 | ||||
-rw-r--r-- | src/usr/initservice/istepdispatcher/HBconfig | 4 | ||||
-rw-r--r-- | src/usr/initservice/istepdispatcher/istepdispatcher.C | 142 | ||||
-rw-r--r-- | src/usr/initservice/istepdispatcher/istepdispatcher.H | 63 | ||||
-rw-r--r-- | src/usr/targeting/common/xmltohb/attribute_types.xml | 30 | ||||
-rw-r--r-- | src/usr/targeting/common/xmltohb/target_types.xml | 2 |
6 files changed, 241 insertions, 2 deletions
diff --git a/src/include/usr/initservice/initsvcreasoncodes.H b/src/include/usr/initservice/initsvcreasoncodes.H index 39c944c7c..d11824e80 100644 --- a/src/include/usr/initservice/initsvcreasoncodes.H +++ b/src/include/usr/initservice/initsvcreasoncodes.H @@ -49,6 +49,7 @@ enum InitServiceModuleID EXT_INITSVC_MOD_ID = 0x02, ISTEP_INITSVC_MOD_ID = 0x03, CXXTEST_MOD_ID = 0x04, + RECONFIG_LOOP_TEST_ID = 0x05, }; @@ -72,6 +73,7 @@ enum InitServiceReasonCode ISTEP_NON_MASTER_NODE_MSG = INITSVC_COMP_ID | 0x0d, //termination_rc SBE_EXTRACT_RC_REQUEST_REIPL = INITSVC_COMP_ID | 0x0e, + RECONFIG_LOOP_TEST_RC = INITSVC_COMP_ID | 0x0f, }; enum InitServiceUserDetailDataSubSection diff --git a/src/usr/initservice/istepdispatcher/HBconfig b/src/usr/initservice/istepdispatcher/HBconfig index 3f0240918..c012bd17e 100644 --- a/src/usr/initservice/istepdispatcher/HBconfig +++ b/src/usr/initservice/istepdispatcher/HBconfig @@ -3,3 +3,7 @@ config CONSOLE_OUTPUT_PROGRESS depends on CONSOLE help Display boot progress to console. +config RECONFIG_LOOP_TESTS_ENABLE + default y + help + Include functions for enabling reconfig loop testing. diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C index 7c3393c33..3ab4e0b8a 100644 --- a/src/usr/initservice/istepdispatcher/istepdispatcher.C +++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C @@ -63,6 +63,7 @@ #include <hwas/hwasPlat.H> #include <targeting/attrPlatOverride.H> #include <console/consoleif.H> +#include <hwpisteperror.H> namespace ISTEPS_TRACE { @@ -593,6 +594,21 @@ errlHndl_t IStepDispatcher::doIstep(uint32_t i_istep, } } +#ifdef CONFIG_RECONFIG_LOOP_TESTS_ENABLE + // Read ATTR_RECONFIG_LOOP_TESTS_ENABLE attribute + TARGETING::ATTR_RECONFIG_LOOP_TESTS_ENABLE_type l_reconfigAttrTestsEn = + l_pTopLevel->getAttr<TARGETING::ATTR_RECONFIG_LOOP_TESTS_ENABLE>(); + + // If ATTR_RECONFIG_LOOP_TESTS_ENABLE is non-zero and if there is no + // previous error then call the reconfig loop test runner + if ((l_reconfigAttrTestsEn) && (!err)) + { + TRACFCOMP(g_trac_initsvc, INFO_MRK"doIstep: " + "Reconfig Loop Tests Enabled"); + reconfigLoopTestRunner(i_istep, i_substep, err); + } +#endif // CONFIG_RECONFIG_LOOP_TESTS_ENABLE + // now that HWP and PRD have run, check for deferred deconfig work. // Check for Power Line Disturbance (PLD) @@ -1844,4 +1860,130 @@ errlHndl_t IStepDispatcher::failedDueToDeconfig( return err; } +#ifdef CONFIG_RECONFIG_LOOP_TESTS_ENABLE +// ---------------------------------------------------------------------------- +// IStepDispatcher::reconfigLoopTestRunner() +// ---------------------------------------------------------------------------- +void IStepDispatcher::reconfigLoopTestRunner( uint8_t i_step, + uint8_t i_substep, + errlHndl_t & o_err ) +{ + // Acquire top level handle + TARGETING::Target* l_pTopLevel = NULL; + TARGETING::targetService().getTopLevelTarget(l_pTopLevel); + + // Local target pointer + TARGETING::Target* l_pTarget = NULL; + + // Method for checking whether a target is functional + TARGETING::PredicateIsFunctional l_functional; + + // Read reconfig loop (RL) tests attribute data and only run tests + // if ATTR_RECONFIG_LOOP_TESTS is read successfully otherwise + // print an error message and return + TARGETING::ATTR_RECONFIG_LOOP_TESTS_type l_RLTests = {0}; + if(l_pTopLevel->tryGetAttr<TARGETING::ATTR_RECONFIG_LOOP_TESTS>(l_RLTests)) + { + + // Create pointer to reconfig loop tests data and point to data obtained + // from test attribute + reconfigLoopTests_t *l_p_reconfigLoopTests = + reinterpret_cast<reconfigLoopTests_t *>(&l_RLTests); + + // Loop through all the tests until we find a valid matching test + for (uint64_t i = 0 ; i < MAX_RCL_TESTS ; i++) + { + if ( (l_p_reconfigLoopTests->test[i].majorStep == i_step) && + (l_p_reconfigLoopTests->test[i].minorStep == i_substep) ) + { + // Acquire target handle for requested HUID + l_pTarget = l_pTopLevel->getTargetFromHuid( + l_p_reconfigLoopTests->test[i].deconfigTargetHuid); + + // If the target associated with the test is functional + // then induce the reconfig loop otherwise skip since the target + // may have been deconfigured by a previous test. + // This way we don't run the same test again. + if(l_functional(l_pTarget)) + { + reconfigLoopInduce (l_pTarget, o_err); + TRACFCOMP(g_trac_initsvc, INFO_MRK"reconfigLoopTestRunner: " + "Inducing Reconfig Loop. Step: %d.%d, HUID: 0x%08X", + i_step, i_substep, + l_p_reconfigLoopTests->test[i].deconfigTargetHuid); + } + else + { + TRACFCOMP(g_trac_initsvc, INFO_MRK"reconfigLoopTestRunner: " + "Step: %d.%d, " + "Target HUID: 0x%08X not functional, skipping test.", + i_step, i_substep, + l_p_reconfigLoopTests->test[i].deconfigTargetHuid); + } + + // Stop looking for another test and return to istepdispatcher + // code + break; + } + + // Stop looking for tests if the last test is found + if (l_p_reconfigLoopTests->test[i].lastTest) + { + break; + } + } + } + else + { + TRACFCOMP(g_trac_initsvc, ERR_MRK"reconfigLoopTestRunner: " + "Failed to read ATTR_RECONFIG_LOOP_TESTS attribute data. " + "SKIPPING TEST!"); + } + + return; +} + +// ---------------------------------------------------------------------------- +// IStepDispatcher::reconfigLoopInduce() +// ---------------------------------------------------------------------------- +void IStepDispatcher::reconfigLoopInduce(TARGETING::Target* i_pDeconfigTarget, + errlHndl_t & o_err) +{ + + // Create an error log to induce reconfig loop + ISTEP_ERROR::IStepError l_StepError; + + /*@ + * @errortype + * @reasoncode RECONFIG_LOOP_TEST_RC + * @severity ERRL_SEV_UNRECOVERABLE + * @moduleid RECONFIG_LOOP_TEST_ID + * @devdesc This error log was intentionally created in order to + * induce a reconfigure loop for testing purposes. + * @custdesc A reconfigure loop is being induced for testing + * purposes. + */ + errlHndl_t l_err = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + RECONFIG_LOOP_TEST_ID, + RECONFIG_LOOP_TEST_RC); + + // Using DELAYED_DECONFIG in the HW callout allows registering the target + // for deferred deconfiguration. The actual deconfiguration must be + // handled externally, specifically by IStepDispatcher::doIstep(). + l_err->addHwCallout(i_pDeconfigTarget, + HWAS::SRCI_PRIORITY_LOW, + HWAS::DELAYED_DECONFIG, + HWAS::GARD_Fatal); + l_StepError.addErrorDetails(l_err); + errlCommit(l_err, ISTEP_COMP_ID); + o_err = l_StepError.getErrorHandle(); + + TRACFCOMP(g_trac_initsvc, INFO_MRK"reconfigLoopInduce: " + "Created reconfig loop induce errorlog"); + + return; +} +#endif // CONFIG_RECONFIG_LOOP_TESTS_ENABLE + } // namespace diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.H b/src/usr/initservice/istepdispatcher/istepdispatcher.H index 5996cbdc6..f481b4e40 100644 --- a/src/usr/initservice/istepdispatcher/istepdispatcher.H +++ b/src/usr/initservice/istepdispatcher/istepdispatcher.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,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. */ @@ -41,6 +43,7 @@ #include <initservice/taskargs.H> #include <initservice/initsvcreasoncodes.H> #include <initservice/initsvcstructs.H> +#include <config.h> #include "../baseinitsvc/initservice.H" #include "splesscommon.H" #include "istep_mbox_msgs.H" @@ -59,6 +62,16 @@ namespace INITSERVICE */ const uint64_t MAX_WAIT_TIME_SEC = 10; +#ifdef CONFIG_RECONFIG_LOOP_TESTS_ENABLE +/** + * @brief The Maximum number of elements in the ATTR_RECONFIG_LOOP_TESTS + * attribute array. This number MUST be the same as the length of + * the ATTR_RECONFIG_LOOP_TESTS attritute array defined in the + * attribute_types.xml file. + */ +const uint64_t MAX_RCL_TESTS = 5; +#endif //CONFIG_RECONFIG_LOOP_TESTS_ENABLE + /******************************************************************************/ // Typedef/Enumerations /******************************************************************************/ @@ -398,8 +411,54 @@ private: // Message Queue for receiving message from SP or SPless user console msg_q_t iv_msgQ; -}; +#ifdef CONFIG_RECONFIG_LOOP_TESTS_ENABLE + // Reconfigure Loop Test data structure for accessing the + // ATTR_RECONFIG_LOOP_TESTS attribute array elements (64-bit elements) + typedef struct + { + struct + { + uint8_t reserved; // Reserved for future use + uint8_t majorStep; // Major step that corresponds to the test + uint8_t minorStep; // Sub step that corresponds to the test + uint8_t lastTest; // Indicates that this is the last test in the + // array. This allows the tester to run n number + // of tests where n can be less than + // MAX_RCL_TESTS + uint32_t deconfigTargetHuid; // The HUID of the target that will be + // deconfigured as part of the test in + // order to induce a reconfig loop + } test[MAX_RCL_TESTS]; + } reconfigLoopTests_t; + + /** + * @brief Decodes and executes the tests in the ATTR_RECONFIG_LOOP_TESTS + * test attribute. The data in ATTR_RECONFIG_LOOP_TESTS is populated + * via attribute overrides. If no data is present or if the attribute is + * missing the tests will be not be executed. + * + * @param[i] i_step - Current istep + * @param[i] i_substep - Current substep + * @param[o] o_err - Returned error handle + */ + void reconfigLoopTestRunner(uint8_t i_step, + uint8_t i_substep, + errlHndl_t & o_err); + + /** + * @brief Induces a Reconfig loop by generating an error log. + * The error log contains a HW callout with a pointer to a target handle + * that is to be deconfigured. + * + * @param[i] i_pDeconfigTarget - Pointer to handle of target that is to be + * deconfigured + * @param[o] o_err - Returned error handle + */ + void reconfigLoopInduce(TARGETING::Target* i_pDeconfigTarget, + errlHndl_t & o_err); +#endif // CONFIG_RECONFIG_LOOP_TESTS_ENABLE +}; } // namespace #endif diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml index c887a25b8..80e6da4df 100644 --- a/src/usr/targeting/common/xmltohb/attribute_types.xml +++ b/src/usr/targeting/common/xmltohb/attribute_types.xml @@ -13618,6 +13618,36 @@ firmware notes: Platforms should initialize this attribute to AUTO (0)</descript <macro>DIRECT</macro> </hwpfToHbAttrMap> </attribute> +<!-- For reconfig loop testing --> +<attribute> + <id>RECONFIG_LOOP_TESTS</id> + <description> System attribute array that defines the reconfig loop test cases + consumer: istep dispatcher reconfigLoopTestRunner function + This array is loaded with data via attribute override. The attribute is + then read and then overlayed onto a test case structure. + </description> + <simpleType> + <uint64_t></uint64_t> + <array>5</array> + </simpleType> + <persistency>volatile-zeroed</persistency> + <readable/> + <writeable/> +</attribute> + +<attribute> + <id>RECONFIG_LOOP_TESTS_ENABLE</id> + <description> + Indicates whether reconfigure loop tests are enabled. + This attribute is set via attribute override + </description> + <simpleType> + <uint8_t></uint8_t> + </simpleType> + <persistency>volatile-zeroed</persistency> + <readable/> + <writeable/> +</attribute> <attribute> <id>MEM_VDD_OFFSET_MILLIVOLTS</id> diff --git a/src/usr/targeting/common/xmltohb/target_types.xml b/src/usr/targeting/common/xmltohb/target_types.xml index 6c488d7f9..9a36516d1 100644 --- a/src/usr/targeting/common/xmltohb/target_types.xml +++ b/src/usr/targeting/common/xmltohb/target_types.xml @@ -280,6 +280,8 @@ <attribute><id>MSS_DRAMINIT_RESET_DISABLE</id></attribute> <attribute><id>ISDIMM_POWER_CURVE_ALGORITHM_VERSION</id></attribute> <attribute><id>MSS_POWER_CONTROL_REQUESTED</id></attribute> + <attribute><id>RECONFIG_LOOP_TESTS</id></attribute> + <attribute><id>RECONFIG_LOOP_TESTS_ENABLE</id></attribute> </targetType> <targetType> |