diff options
Diffstat (limited to 'src')
21 files changed, 779 insertions, 215 deletions
diff --git a/src/include/usr/hbotcompid.H b/src/include/usr/hbotcompid.H index 0e15cb6ba..8f9f8daff 100644 --- a/src/include/usr/hbotcompid.H +++ b/src/include/usr/hbotcompid.H @@ -226,6 +226,14 @@ const compId_t UTIL_COMP_ID = 0x1600; const char UTIL_COMP_NAME[] = "util"; //@} +/** @name ISTEP + * Istep component + */ +//@{ +const compId_t ISTEP_COMP_ID = 0x1700; +const char ISTEP_COMP_NAME[] = "istep"; +//@} + /** @name RESERVED * Reserved component ID. x3100 is the component ID * of FipS ERRL component. Due to our use of diff --git a/src/include/usr/hwpf/istepreasoncodes.H b/src/include/usr/hwpf/istepreasoncodes.H new file mode 100644 index 000000000..fc44b2c87 --- /dev/null +++ b/src/include/usr/hwpf/istepreasoncodes.H @@ -0,0 +1,71 @@ +/* IBM_PROLOG_BEGIN_TAG + * This is an automatically generated prolog. + * + * $Source: src/include/usr/hwpf/istepreasoncodes.H $ + * + * IBM CONFIDENTIAL + * + * COPYRIGHT International Business Machines Corp. 2012 + * + * p1 + * + * Object Code Only (OCO) source materials + * Licensed Internal Code Source Materials + * IBM HostBoot Licensed Internal Code + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + * + * Origin: 30 + * + * IBM_PROLOG_END_TAG + */ +/** + * @file istepreasoncodes.H + * + * @brief Reason codes and module ids for the isteps + * + */ +#ifndef __ISTEPREASONCODES_H +#define __ISTEPREASONCODES_H +// ----------------------------------------------- +// Includes +// ----------------------------------------------- +#include <hbotcompid.H> + +namespace ISTEP +{ + +/** +* @enum istepModuleid +* +* @brief Module Ids used in created errorlogs. Indicates which +* functions an error log was created in. +* +*/ +enum istepModuleId +{ + ISTEP_INVALID_MODULE = 0x00, + ISTEP_STARTPAYLOAD_EXECUTE_UNIT_TESTS = 0x01, + ISTEP_START_PAYLOAD_CALL_SHUTDOWN = 0x02, + ISTEP_START_PAYLOAD_NOTIFY_FSP = 0x03, +}; + +/** + * @enum istepReasonCode + * + * @brief Reasoncodes used to describe what errors are being indicated. + * + */ +enum istepReasonCode +{ + ISTEP_INVALID_REASONCODE = ISTEP_COMP_ID | 0x00, + ISTEP_CXXTEST_FAILED_TEST = ISTEP_COMP_ID | 0x01, + ISTEP_TARGET_NULL = ISTEP_COMP_ID | 0x02, + ISTEP_MBOX_MSG_NULL = ISTEP_COMP_ID | 0x03, +}; + +}; // end ISTEP + +#endif diff --git a/src/include/usr/initservice/extinitserviceif.H b/src/include/usr/initservice/extinitserviceif.H new file mode 100644 index 000000000..b8ba61980 --- /dev/null +++ b/src/include/usr/initservice/extinitserviceif.H @@ -0,0 +1,41 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/initservice/extinitserviceif.H $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2012 +// +// p1 +// +// Object Code Only (OCO) source materials +// Licensed Internal Code Source Materials +// IBM HostBoot Licensed Internal Code +// +// The source code for this program is not published or other- +// wise divested of its trade secrets, irrespective of what has +// been deposited with the U.S. Copyright Office. +// +// Origin: 30 +// +// IBM_PROLOG_END +#ifndef __INITSERVICE_EXTINITSERVICEIF_H +#define __INITSERVICE_EXTINITSERVICEIF_H + +namespace INITSERVICE +{ + +/** + * @brief This function will execute the Cxx Unit tests for Hostboot. It is + * to be done here, instead of in Initservice, because when this istep + * completes the Payload will be started. + * + * @return errlHndl_t - NULL if successfule, otherwise a pointer to the error + * log. + */ +errlHndl_t executeUnitTests ( void ); + +} + +#endif diff --git a/src/include/usr/initservice/initserviceif.H b/src/include/usr/initservice/initserviceif.H index 44a9c8961..aac8885aa 100644 --- a/src/include/usr/initservice/initserviceif.H +++ b/src/include/usr/initservice/initserviceif.H @@ -68,7 +68,7 @@ bool registerShutdownEvent(msg_q_t i_msgQ, /** * @brief Un register a service for a Shutdown event - * + * * @param[in] i_msgQ, The message queue to be removed. * * @return true - i_msgQ was removed from the event notification list. | @@ -76,6 +76,21 @@ bool registerShutdownEvent(msg_q_t i_msgQ, */ bool unregisterShutdownEvent(msg_q_t i_msgQ); +/** + * @brief Perform necessary steps, such as FLUSHing, to registered blocks. + * + * @param[in] i_status - Shutdown status to be passed along on shutdown + * @param[in] i_payload_base - The base address (target HRMOR) of the + * payload. + * @param[in] i_payload_entry - The offset from base address of the + * payload entry-point. + * + * @return Nothing + */ +void doShutdown ( uint64_t i_status, + uint64_t i_payload_base = 0, + uint64_t i_payload_entry = 0 ); + } #endif diff --git a/src/include/usr/initservice/istepdispatcherif.H b/src/include/usr/initservice/istepdispatcherif.H new file mode 100644 index 000000000..77705086b --- /dev/null +++ b/src/include/usr/initservice/istepdispatcherif.H @@ -0,0 +1,54 @@ +/* IBM_PROLOG_BEGIN_TAG + * This is an automatically generated prolog. + * + * $Source: src/include/usr/initservice/istepdispatcherif.H $ + * + * IBM CONFIDENTIAL + * + * COPYRIGHT International Business Machines Corp. 2012 + * + * p1 + * + * Object Code Only (OCO) source materials + * Licensed Internal Code Source Materials + * IBM HostBoot Licensed Internal Code + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + * + * Origin: 30 + * + * IBM_PROLOG_END_TAG + */ +#ifndef __INITSERVICE_ISTEPDISPATCHERIF_H +#define __INITSERVICE_ISTEPDISPATCHERIF_H + +#include <sys/msg.h> + +namespace INITSERVICE +{ + +/** +* @brief This function returns the MBOX Message Queue used by the istep +* dispatcher. +* +* @param[out] o_msgQ - The message queue. +* +* @return NONE. +*/ +void getIstepMsgQ ( msg_q_t & o_msgQ ); + +/** + * @brief This function returns the current MBOX Message used by the istep + * dispatcher. + * + * @param[out] o_msg - The message. + * + * @return NONE. + */ +void getIstepMsg ( msg_t * o_msg ); + +} + +#endif diff --git a/src/include/usr/mbox/mbox_queues.H b/src/include/usr/mbox/mbox_queues.H index dbe1369b0..bd11f09a0 100644 --- a/src/include/usr/mbox/mbox_queues.H +++ b/src/include/usr/mbox/mbox_queues.H @@ -1,38 +1,39 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/usr/mbox/mbox_queues.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2012 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG + * This is an automatically generated prolog. + * + * $Source: src/include/usr/mbox/mbox_queues.H $ + * + * IBM CONFIDENTIAL + * + * COPYRIGHT International Business Machines Corp. 2012 + * + * p1 + * + * Object Code Only (OCO) source materials + * Licensed Internal Code Source Materials + * IBM HostBoot Licensed Internal Code + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + * + * Origin: 30 + * + * IBM_PROLOG_END_TAG + */ #ifndef __MBOX_QUEUES_H #define __MBOX_QUEUES_H /** * @file mbox_queues.H - * @brief Mailbox queue identifiers. This file is shared between + * @brief Mailbox queue identifiers. This file is shared between * Hostboot and FSP. */ namespace MBOX { /** - * message queue IDs + * message queue IDs * FSP msg_queue range 0x80000000 - 0xFFFFFFFF * Hostboot msg_queue range 0x00000001 - 0x7FFFFFFF */ @@ -51,6 +52,7 @@ namespace MBOX FSP_PROGRESS_CODES_MSGQ, FSP_TRACE_MSGQ, FSP_ERRL_MSGQ, + IPL_SERVICE_QUEUE = 0x80000008, // Defined by Fsp team // Add FSP services here: FSP_ECHO_MSGQ = 0xFFFFFFFF, // Fake FSP for test }; diff --git a/src/usr/hwpf/hwp/start_payload/start_payload.C b/src/usr/hwpf/hwp/start_payload/start_payload.C index ecc2ba3e9..15b514949 100644 --- a/src/usr/hwpf/hwp/start_payload/start_payload.C +++ b/src/usr/hwpf/hwp/start_payload/start_payload.C @@ -1,36 +1,32 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/usr/hwpf/hwp/start_payload/start_payload.C $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2012 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END - +/* IBM_PROLOG_BEGIN_TAG + * This is an automatically generated prolog. + * + * $Source: src/usr/hwpf/hwp/start_payload/start_payload.C $ + * + * IBM CONFIDENTIAL + * + * COPYRIGHT International Business Machines Corp. 2012 + * + * p1 + * + * Object Code Only (OCO) source materials + * Licensed Internal Code Source Materials + * IBM HostBoot Licensed Internal Code + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + * + * Origin: 30 + * + * IBM_PROLOG_END_TAG + */ /** * @file start_payload.C * * Support file for IStep: start_payload * Start Payload * - * ***************************************************************** - * THIS FILE WAS GENERATED ON 2012-04-11:1613 - * ***************************************************************** - * */ /******************************************************************************/ @@ -38,9 +34,20 @@ /******************************************************************************/ #include <stdint.h> +#include <kernel/console.H> // printk status +#include <sys/misc.h> #include <trace/interface.H> #include <initservice/taskargs.H> #include <errl/errlentry.H> +#include <vfs/vfs.H> +#include <initservice/initserviceif.H> +#include <initservice/extinitserviceif.H> +#include <initservice/istepdispatcherif.H> +#include <usr/cxxtest/TestSuite.H> +#include <hwpf/istepreasoncodes.H> +#include <sys/time.h> +#include <mbox/mbox_queues.H> +#include <mbox/mboxif.H> #include <initservice/isteps_trace.H> @@ -61,7 +68,31 @@ namespace START_PAYLOAD using namespace TARGETING; using namespace fapi; +using namespace ISTEP; +/** + * @brief This function will call the Initservice interface to shutdown + * Hostboot. This function will call shutdown, passing in system + * attribute variables for the Payload base and Payload offset. + * + * @return errlHndl_t - NULL if succesful, otherwise a pointer to the error + * log. + */ +errlHndl_t callShutdown ( void ); + +/** + * @brief This function will check the Istep mode and send the appropriate + * mailbox message to the Fsp to indicate what we're doing. + * + * @param[in] i_istepModeFlag - Whether or not Isteps is enabled. + * + * @param[in] i_spFuncs - The SpFuncs system attribute. + * + * @return errlHndl_t - NULL if successful, otherwise a pointer to the error + * log. + */ +errlHndl_t notifyFsp ( bool i_istepModeFlag, + TARGETING::SpFunctions i_spFuncs ); // @@ -72,48 +103,257 @@ void call_host_start_payload( void *io_pArgs ) { errlHndl_t l_errl = NULL; - TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_start_payload entry" ); -#if 0 - // @@@@@ CUSTOM BLOCK: @@@@@ - // figure out what targets we need - // customize any other inputs - // set up loops to go through all targets (if parallel, spin off a task) - - // dump physical path to targets - EntityPath l_path; - l_path = l_@targetN_target->getAttr<ATTR_PHYS_PATH>(); - l_path.dump(); - - // cast OUR type of target to a FAPI type of target. - const fapi::Target l_fapi_@targetN_target( - TARGET_TYPE_MEMBUF_CHIP, - reinterpret_cast<void *> - (const_cast<TARGETING::Target*>(l_@targetN_target)) ); - - // call the HWP with each fapi::Target - FAPI_INVOKE_HWP( l_errl, host_start_payload, _args_...); - if ( l_errl ) - { - TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, - "ERROR : .........." ); - errlCommit( l_errl, HWPF_COMP_ID ); - } - else + do { - TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - "SUCCESS : .........." ); - } - // @@@@@ END CUSTOM BLOCK: @@@@@ -#endif + // Host Start Payload procedure, per documentation from Patrick. + // - Verify target image + // - TODO - Done via call to Secure Boot ROM. + // - Will be done in future sprints - TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + // - Update HDAT with updated SLW images + // - TODO - Once we know where they go in the HDAT + + // - Run CXX testcases + l_errl = INITSERVICE::executeUnitTests(); + + if( l_errl ) + { + break; + } + + // - Call shutdown using payload base, and payload entry. + // - base/entry will be from system attributes + // - this will start the payload (Phyp) + // NOTE: this call will not return if successful. + l_errl = callShutdown(); + + if( l_errl ) + { + break; + } + } while( 0 ); + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_start_payload exit" ); - // end task, returning any errorlogs to IStepDisp + // end task, returning any errorlogs to IStepDisp task_end2( l_errl ); } +// +// Call shutdown +// +errlHndl_t callShutdown ( void ) +{ + errlHndl_t err = NULL; + uint64_t payloadBase = 0x0; + uint64_t payloadEntry = 0x0; + bool istepModeFlag = false; + uint64_t status = SHUTDOWN_STATUS_GOOD; + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ENTER_MRK"callShutdown()" ); + + do + { + // Get Target Service, and the system target. + TargetService& tS = targetService(); + TARGETING::Target* sys = NULL; + (void) tS.getTopLevelTarget( sys ); + + if( NULL == sys ) + { + // Error getting system target to get payload related values. We + // will create an error to be passed back. This will cause the + // istep to fail. + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ERR_MRK"System Target was NULL!" ); + + /*@ + * @errortype + * @reasoncode ISTEP_TARGET_NULL + * @severity ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM + * @moduleid ISTEP_START_PAYLOAD_CALL_SHUTDOWN + * @userdata1 <UNUSED> + * @userdata2 <UNUSED> + * @devdesc System target was NULL! + */ + err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, + ISTEP_START_PAYLOAD_CALL_SHUTDOWN, + ISTEP_TARGET_NULL, + 0x0, + 0x0 ); + + break; + } + + // Get Payload base/entry from attributes + payloadBase = sys->getAttr<TARGETING::ATTR_PAYLOAD_BASE>(); + payloadEntry = sys->getAttr<TARGETING::ATTR_PAYLOAD_ENTRY>(); + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + INFO_MRK"Payload Base: 0x%08x, Entry: 0x%08x", + payloadBase, payloadEntry ); + payloadBase = (payloadBase * MEGABYTE); + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + INFO_MRK" base: 0x%08x", + payloadBase ); + + // Get Istep Mode flag + istepModeFlag = sys->getAttr<ATTR_ISTEP_MODE>(); + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + INFO_MRK"Istep mode flag: %s", + ((istepModeFlag) ? "Enabled" : "Disabled") ); + + // Get the Service Processor Functions + TARGETING::SpFunctions spFuncs = + sys->getAttr<TARGETING::ATTR_SP_FUNCTIONS>(); + + // Notify Fsp with appropriate mailbox message. + err = notifyFsp( istepModeFlag, + spFuncs ); + + if( err ) + { + break; + } + + // do the shutdown. + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "call_host_start_payload finished, shutdown = 0x%x.", + status ); + INITSERVICE::doShutdown( status, + payloadBase, + payloadEntry ); + + // Hang out here until shutdown happens + int status = 0x0; + while( 1 ) + { + task_wait( &status, + NULL ); + } + } while( 0 ); + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + EXIT_MRK"callShutdown()" ); + + return err; +} + +// +// Notify the Fsp via Mailbox Message +// +errlHndl_t notifyFsp ( bool i_istepModeFlag, + TARGETING::SpFunctions i_spFuncs ) +{ + errlHndl_t err = NULL; + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ENTER_MRK"notifyFsp()" ); + + do + { + // Get the Istep msgQ + msg_q_t msgQ; + INITSERVICE::getIstepMsgQ( msgQ ); + + // Get the Istep Msg to respond to. + msg_t * myMsg = NULL; + INITSERVICE::getIstepMsg( myMsg ); + + if( NULL == myMsg ) + { + if( i_istepModeFlag ) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ERR_MRK"Istep message was NULL in Istep Mode!" ); + + /*@ + * @errortype + * @reasoncode ISTEP_MBOX_MSG_NULL + * @severity ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM + * @moduleid ISTEP_START_PAYLOAD_NOTIFY_FSP + * @userdata1 <UNUSED> + * @userdata2 <UNUSED> + * @devdesc Istep Mailbox Message returned was NULL! + */ + err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, + ISTEP_START_PAYLOAD_NOTIFY_FSP, + ISTEP_MBOX_MSG_NULL, + 0x0, + 0x0 ); + + break; + } + else + { + myMsg = msg_allocate(); + } + } + + // TODO - All of the following mailbox interactions really should be + // done within the Istep Dispatcher. But, it needs to be reorganized + // to do that. Issue 42491 should be used for this discussion and + // when it is determined what needs to be reorganized, this should be + // addressed. + myMsg->data[1] = 0x0; + myMsg->extra_data = NULL; + if( i_istepModeFlag ) + { + // Istep Mode send istep complete + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + INFO_MRK"Isteps enabled, send istep complete msg" ); + + // TODO - I cannot use this unless I completely mess around the + // headers for the istepdispatcher. I have Issue 42491 open now + // to discuss doing that. For now, I'm hard coding the msg type + // to be equivalent to this value +// myMsg->type = INITSERVICE::SINGLE_STEP_TYPE; + myMsg->type = MBOX::FIRST_SECURE_MSG | 0x00; + myMsg->data[0] = 0x0; // Fsp expects 0x0 (SUCCESS) in istep mode + + // Respond to the Msg + msg_respond( msgQ, + myMsg ); + } + else + { + // Non-Istep mode send SYNC_POINT_REACHED + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + INFO_MRK"Isteps disabled, send SYNC_POINT_REACHED msg" ); + + // TODO - This really needs to be in istep_mbox_msgs.H, but that + // isn't in a place that I can use it right now, and it can't be + // moved because its using Enums from a header (splesscommon.H) + // that shouldn't be moved. + // I've opened Issue 42491 to discuss changes. + const uint64_t SYNC_POINT_REACHED = MBOX::FIRST_UNSECURE_MSG | 0x10; + myMsg->type = SYNC_POINT_REACHED; + + // Hardcode steps in data[0] until issue 42491 is resolved. + // Step 21, substep 1 + myMsg->data[0] = ((((uint64_t)21) << 32) | 1 ); + + // Send the async msg. + MBOX::send( MBOX::IPL_SERVICE_QUEUE, + myMsg ); + } + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + INFO_MRK"Sent MBOX Msg (0x%08x), msg: 0x%016llx.%016llx", + myMsg->type, + myMsg->data[0], + myMsg->data[1] ); + } while( 0 ); + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + EXIT_MRK"notifyFsp()" ); + + return err; +} + }; // end namespace diff --git a/src/usr/hwpf/hwp/start_payload/start_payload.H b/src/usr/hwpf/hwp/start_payload/start_payload.H index 0428dd6d5..52317399f 100644 --- a/src/usr/hwpf/hwp/start_payload/start_payload.H +++ b/src/usr/hwpf/hwp/start_payload/start_payload.H @@ -32,10 +32,6 @@ * All of the following routines are "named isteps" - they are invoked as * tasks by the @ref IStepDispatcher. * - * ***************************************************************** - * THIS FILE WAS GENERATED ON 2012-04-11:1613 - * ***************************************************************** - * */ /* @tag isteplist diff --git a/src/usr/initservice/baseinitsvc/initservice.C b/src/usr/initservice/baseinitsvc/initservice.C index 6c3b6179d..c5c802c9b 100644 --- a/src/usr/initservice/baseinitsvc/initservice.C +++ b/src/usr/initservice/baseinitsvc/initservice.C @@ -610,6 +610,15 @@ void InitService::registerBlock(void* i_vaddr, uint64_t i_size, } } +void doShutdown ( uint64_t i_status, + uint64_t i_payload_base, + uint64_t i_payload_entry ) +{ + Singleton<InitService>::instance().doShutdown( i_status, + i_payload_base, + i_payload_entry ); +} + void InitService::doShutdown(uint64_t i_status, uint64_t i_payload_base, uint64_t i_payload_entry) diff --git a/src/usr/initservice/baseinitsvc/initservice.H b/src/usr/initservice/baseinitsvc/initservice.H index 5a3820d36..1457dc48d 100644 --- a/src/usr/initservice/baseinitsvc/initservice.H +++ b/src/usr/initservice/baseinitsvc/initservice.H @@ -212,9 +212,9 @@ public: * @note This calls registered services to notify them of shutdown and it * flushes the virtual memory. */ - void doShutdown(uint64_t i_status, - uint64_t i_payload_base = 0, - uint64_t i_payload_entry = 0); + void doShutdown ( uint64_t i_status, + uint64_t i_payload_base = 0, + uint64_t i_payload_entry = 0 ); protected: diff --git a/src/usr/initservice/extinitsvc/extinitsvc.C b/src/usr/initservice/extinitsvc/extinitsvc.C index 0c42e9678..f90e97651 100644 --- a/src/usr/initservice/extinitsvc/extinitsvc.C +++ b/src/usr/initservice/extinitsvc/extinitsvc.C @@ -133,102 +133,6 @@ void ExtInitSvc::init( errlHndl_t &io_rtaskRetErrl ) task_end2( l_errl ); } - TRACFCOMP( g_trac_initsvc, - "ExtInitSvc finished OK."); - - - // ===================================================================== - // ----- Unit Tests ------------------------------------------------- - // ===================================================================== - /** - * @note run all of the unit tests after we finish the rest - * There are 2 images generated in the build: - * hbicore.bin (HostBoot shippable image) - * hbicore_test.bin (runs all unit tests) - * Only hbicore_test.bin has the libcxxtest.so module, so that's - * how we test whether to run this. - */ - - // If the test task does not exist then don't run it. - if ( VFS::module_exists( cxxTestTask.taskname ) ) - { - printk( "CxxTest entry.\n" ); - - // Pass it a set of args so we can wait on the barrier - errlHndl_t l_cxxerrl = NULL; - const TaskInfo *l_pcxxtask = &cxxTestTask; - - TRACDCOMP( g_trac_initsvc, - "Run CxxTest Unit Tests: %s", - l_pcxxtask->taskname ); - - l_cxxerrl = InitService::getTheInstance().startTask( l_pcxxtask, - NULL ); - // process any errorlogs from cxxtestexec (not sure there are any...) - if ( l_cxxerrl ) - { -#if 0 - // @todo detach this task and just do task_end() - // First commit the errorlog... - TRACFCOMP( g_trac_initsvc, - "Committing errorlog %p from cxxtask", - l_cxxerrl ); - errlCommit( l_cxxerrl, INITSVC_COMP_ID ); - - // Tell the kernel to shut down. This will not actually - // happen until the last thread has ended. - InitService::getTheInstance().doShutdown( SHUTDOWN_STATUS_UT_FAILED); - - // end the task. - end_task(); -#endif - - // end the task and pass the errorlog to initservice to be committed. - // initservice should do the shutdown. - TRACFCOMP( g_trac_initsvc, - "CxxTest: ERROR: return to initsvc with errlog %p", - l_cxxerrl ); - - task_end2( l_cxxerrl ); - } // endif l_cxxerrl - - - // make up and post an errorlog if any tests failed. - if ( CxxTest::g_FailedTests ) - { - // some unit tests failed, post an errorlog - /*@ errorlog tag - * @errortype ERRL_SEV_CRITICAL_SYS_TERM - * @moduleid CXXTEST_MOD_ID - * @reasoncode CXXTEST_FAILED_TEST - * @userdata1 number of failed tests - * @userdata2 0 - * - * @devdesc One or more CxxTest Unit Tests failed. - * - */ - l_cxxerrl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, - INITSERVICE::CXXTEST_MOD_ID, - INITSERVICE::CXXTEST_FAILED_TEST, - CxxTest::g_FailedTests, - 0 ); - TRACFCOMP( g_trac_initsvc, - "CxxTest ERROR: %d failed tests, build errlog %p.", - CxxTest::g_FailedTests, - l_cxxerrl ); - - // end the task and pass the errorlog to initservice to be committed. - // initservice should do the shutdown. - TRACFCOMP( g_trac_initsvc, "CxxTest: return to initsvc with errlog" ); - - task_end2( l_cxxerrl ); - } // endif g_FailedTest - - printk( "CxxTest exit.\n" ); - - } // endif cxxtest module exists. - // finish things up, return to initservice with goodness. TRACFCOMP( g_trac_initsvc, "ExtInitSvc finished OK, return to initsvc with NULL."); @@ -253,4 +157,109 @@ ExtInitSvc::~ExtInitSvc() { } +// +// Execute CXX Unit Tests +// NOTE: This should be done right before doShutDown is called. +// +errlHndl_t executeUnitTests ( void ) +{ + return Singleton<ExtInitSvc>::instance().executeUnitTests(); +} + +errlHndl_t ExtInitSvc::executeUnitTests ( void ) +{ + errlHndl_t err = NULL; + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ENTER_MRK"executeUnitTests()" ); + + do + { + // --------------------------------------------------------------------- + // ----- Unit Tests ------------------------------------------------- + // --------------------------------------------------------------------- + /** + * @note run all of the unit tests after we finish the rest + * There are 2 images generated in the build: + * hbicore.bin (HostBoot shippable image) + * hbicore_test.bin (runs all unit tests) + * Only hbicore_test.bin has the libcxxtest.so module, so that's + * how we test whether to run this. + */ + // If the test task does not exist then don't run it. + if ( VFS::module_exists( cxxTestTask.taskname ) ) + { + printk( "CxxTest entry.\n" ); + + // Pass it a set of args so we can wait on the barrier + errlHndl_t l_cxxerrl = NULL; + const INITSERVICE::TaskInfo *l_pcxxtask = &cxxTestTask; + + TRACFCOMP( g_trac_initsvc, + "Run CxxTest Unit Tests: %s", + l_pcxxtask->taskname ); + + INITSERVICE::InitService &is + = INITSERVICE::InitService::getTheInstance(); + l_cxxerrl = is.startTask( l_pcxxtask, + NULL ); + + // process any errorlogs from cxxtestexec (not sure there are any...) + if ( l_cxxerrl ) + { + // end the task and pass the errorlog to initservice to be + // committed. initservice should do the shutdown. + TRACFCOMP( g_trac_initsvc, + "CxxTest: ERROR: return to host_start_payload istep " + "with errlog %p", + l_cxxerrl ); + + err = l_cxxerrl; + break; + } // endif l_cxxerrl + + + // make up and post an errorlog if any tests failed. + if ( CxxTest::g_FailedTests ) + { + // some unit tests failed, post an errorlog + /*@ errorlog tag + * @errortype ERRL_SEV_CRITICAL_SYS_TERM + * @moduleid CXXTEST_MOD_ID + * @reasoncode CXXTEST_FAILED_TEST + * @userdata1 number of failed tests + * @userdata2 <UNUSED> + * @devdesc One or more CxxTest Unit Tests failed. + */ + l_cxxerrl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, + INITSERVICE::CXXTEST_MOD_ID, + INITSERVICE::CXXTEST_FAILED_TEST, + CxxTest::g_FailedTests, + 0 ); + + TRACFCOMP( g_trac_initsvc, + "CxxTest ERROR: %d failed tests, build errlog %p.", + CxxTest::g_FailedTests, + l_cxxerrl ); + + // end the task and pass the errorlog to initservice to be + // committed. initservice should do the shutdown. + TRACFCOMP( g_trac_initsvc, + "CxxTest: return to host_start_payload with errlog!" ); + + err = l_cxxerrl; + break; + } // endif g_FailedTest + + printk( "CxxTest exit.\n" ); + } // endif cxxtest module exists. + } while( 0 ); + + TRACDCOMP( g_trac_initsvc, + EXIT_MRK"executeUnitTests()" ); + + return err; +} + } // namespace diff --git a/src/usr/initservice/extinitsvc/extinitsvc.H b/src/usr/initservice/extinitsvc/extinitsvc.H index 7c6acec1b..f2643812a 100644 --- a/src/usr/initservice/extinitsvc/extinitsvc.H +++ b/src/usr/initservice/extinitsvc/extinitsvc.H @@ -91,6 +91,17 @@ public: void init( errlHndl_t &io_rtaskRetErrl ); + /** + * @brief This function will execute the Cxx Unit tests for Hostboot. It is + * to be done here, instead of in Initservice, because when this istep + * completes the Payload will be started. + * + * @return errlHndl_t - NULL if successfule, otherwise a pointer to the error + * log. + */ + errlHndl_t executeUnitTests ( void ); + + protected: /** * @brief Constructor for the InitService object. diff --git a/src/usr/initservice/extinitsvc/extinitsvctasks.H b/src/usr/initservice/extinitsvc/extinitsvctasks.H index 7b4da54c7..f9cbb9ff8 100644 --- a/src/usr/initservice/extinitsvc/extinitsvctasks.H +++ b/src/usr/initservice/extinitsvc/extinitsvctasks.H @@ -84,7 +84,7 @@ const TaskInfo g_exttaskinfolist[] = { "libmbox.so", // taskname NULL, // no ptr to fnct { - + START_TASK, // task type EXT_IMAGE, // Extended Module } diff --git a/src/usr/initservice/istepdispatcher/istep_mbox_msgs.H b/src/usr/initservice/istepdispatcher/istep_mbox_msgs.H index 6799db5fb..ae3ca45ff 100644 --- a/src/usr/initservice/istepdispatcher/istep_mbox_msgs.H +++ b/src/usr/initservice/istepdispatcher/istep_mbox_msgs.H @@ -37,6 +37,18 @@ namespace INITSERVICE enum { + // TODO - I'm not changing this file, but I would really like to put the + // SYNC_POINT_REACHED message here. Since its related to Isteps and + // syncing Hostboot and Fsp. But to do that, this needs to be in the + // src/include/usr side of things. + // + // Plus, I think its weird that this file uses definitions from + // splesscommon.H. It should be the other way around. Define them here + // and use them from splesscommon. Issue 42491 has been opened to + // discuss this further. + // + // I am going to define my own message in the code that I'm writing until + // we get something figured out. SINGLE_STEP_TYPE = MBOX::FIRST_SECURE_MSG | SPLESS::SPLESS_SINGLE_ISTEP_CMD, CLEAR_TRACE_TYPE = MBOX::FIRST_SECURE_MSG | diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C index a628cc3b0..feb683968 100644 --- a/src/usr/initservice/istepdispatcher/istepdispatcher.C +++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C @@ -5,7 +5,7 @@ * * IBM CONFIDENTIAL * - * COPYRIGHT International Business Machines Corp. 2011 - 2012 + * COPYRIGHT International Business Machines Corp. 2011-2012 * * p1 * @@ -807,6 +807,25 @@ void iStepBreakPoint(uint32_t i_info) } +void getIstepMsgQ ( msg_q_t & o_msgQ ) +{ + Singleton<IStepDispatcher>::instance().getIstepMsgQ( o_msgQ ); +} +void IStepDispatcher::getIstepMsgQ ( msg_q_t & o_msgQ ) +{ + o_msgQ = iv_msgQ; +} + +void getIstepMsg ( msg_t * o_msg ) +{ + Singleton<IStepDispatcher>::instance().getIstepMsg( o_msg ); +} +void IStepDispatcher::getIstepMsg ( msg_t * o_msg ) +{ + o_msg = iv_pMsg; +} + + IStepDispatcher::IStepDispatcher() : iv_sts() { diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.H b/src/usr/initservice/istepdispatcher/istepdispatcher.H index e05660bd9..c0e14a530 100644 --- a/src/usr/initservice/istepdispatcher/istepdispatcher.H +++ b/src/usr/initservice/istepdispatcher/istepdispatcher.H @@ -1,26 +1,26 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/usr/initservice/istepdispatcher/istepdispatcher.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2011 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END - +/* IBM_PROLOG_BEGIN_TAG + * This is an automatically generated prolog. + * + * $Source: src/usr/initservice/istepdispatcher/istepdispatcher.H $ + * + * IBM CONFIDENTIAL + * + * COPYRIGHT International Business Machines Corp. 2011-2012 + * + * p1 + * + * Object Code Only (OCO) source materials + * Licensed Internal Code Source Materials + * IBM HostBoot Licensed Internal Code + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + * + * Origin: 30 + * + * IBM_PROLOG_END_TAG + */ #ifndef __ISTEPDISPATCHER_ISTEPDISPATCHER_H #define __ISTEPDISPATCHER_ISTEPDISPATCHER_H /** @@ -133,6 +133,27 @@ public: */ void handleSPlessBreakPoint( uint32_t info); + /** + * @brief This function returns the MBOX Message Queue used by the istep + * dispatcher. + * + * @param[out] o_msgQ - The message queue. + * + * @return NONE. + */ + void getIstepMsgQ ( msg_q_t & o_msgQ ); + + /** + * @brief This function returns the current MBOX Message used by the istep + * dispatcher. + * + * @param[out] o_msg - The message. + * + * @return NONE. + */ + void getIstepMsg ( msg_t * o_msg ); + + protected: /** @@ -253,7 +274,6 @@ private: uint32_t &o_rSts ); - // ----- internal vars ----------------------------- mutex_t iv_poll_mutex; //!< protect who's polling istep cmds diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml index 10d3c7486..6af371c14 100644 --- a/src/usr/targeting/common/xmltohb/attribute_types.xml +++ b/src/usr/targeting/common/xmltohb/attribute_types.xml @@ -3431,4 +3431,31 @@ <readable/> </attribute> +<attribute> + <id>PAYLOAD_BASE</id> + <description>Base address (target HRMOR) of the payload. Value is in MB.</description> + <simpleType> + <uint64_t> + <default>256</default> + </uint64_t> + </simpleType> + <persistency>volatile</persistency> + <readable/> + <writeable/> +</attribute> + +<attribute> + <id>PAYLOAD_ENTRY</id> + <description>The offset from base address of the payload entry-point. + Current default is 0x180</description> + <simpleType> + <uint64_t> + <default>0x180</default> + </uint64_t> + </simpleType> + <persistency>volatile</persistency> + <readable/> + <writeable/> +</attribute> + </attributes> diff --git a/src/usr/targeting/common/xmltohb/simics_MURANO.system.xml b/src/usr/targeting/common/xmltohb/simics_MURANO.system.xml index e82125a6d..504258d20 100644 --- a/src/usr/targeting/common/xmltohb/simics_MURANO.system.xml +++ b/src/usr/targeting/common/xmltohb/simics_MURANO.system.xml @@ -91,6 +91,16 @@ <field><id>reserved</id><value>0</value></field> </default> </attribute> + <attribute> + <id>PAYLOAD_BASE</id> + <!-- Value of 0x0 for standalone systems, no payload to start --> + <default>0x0</default> + </attribute> + <attribute> + <id>PAYLOAD_ENTRY</id> + <!-- Value of 0x0 for standalone systems, no payload to start --> + <default>0x0</default> + </attribute> </targetInstance> <!-- System node 0 --> diff --git a/src/usr/targeting/common/xmltohb/simics_VENICE.system.xml b/src/usr/targeting/common/xmltohb/simics_VENICE.system.xml index ba85e1814..f25bc43c5 100644 --- a/src/usr/targeting/common/xmltohb/simics_VENICE.system.xml +++ b/src/usr/targeting/common/xmltohb/simics_VENICE.system.xml @@ -96,6 +96,16 @@ <field><id>reserved</id><value>0</value></field> </default> </attribute> + <attribute> + <id>PAYLOAD_BASE</id> + <!-- Value of 0x0 for standalone systems, no payload to start --> + <default>0x0</default> + </attribute> + <attribute> + <id>PAYLOAD_ENTRY</id> + <!-- Value of 0x0 for standalone systems, no payload to start --> + <default>0x0</default> + </attribute> </targetInstance> <!-- System node 0 --> diff --git a/src/usr/targeting/common/xmltohb/target_types.xml b/src/usr/targeting/common/xmltohb/target_types.xml index cb31c7014..e37cb3390 100644 --- a/src/usr/targeting/common/xmltohb/target_types.xml +++ b/src/usr/targeting/common/xmltohb/target_types.xml @@ -98,6 +98,8 @@ <attribute><id>FREQ_A</id></attribute> <attribute><id>FREQ_X</id></attribute> <attribute><id>SP_FUNCTIONS</id></attribute> + <attribute><id>PAYLOAD_BASE</id></attribute> + <attribute><id>PAYLOAD_ENTRY</id></attribute> </targetType> <targetType> diff --git a/src/usr/targeting/common/xmltohb/vbu.system.xml b/src/usr/targeting/common/xmltohb/vbu.system.xml index 9d72f3df4..7204ed1cc 100644 --- a/src/usr/targeting/common/xmltohb/vbu.system.xml +++ b/src/usr/targeting/common/xmltohb/vbu.system.xml @@ -84,6 +84,14 @@ <field><id>reserved</id><value>0</value></field> </default> </attribute> + <attribute> + <id>PAYLOAD_BASE</id> + <default>0x0</default> + </attribute> + <attribute> + <id>PAYLOAD_ENTRY</id> + <default>0x0</default> + </attribute> </targetInstance> <targetInstance> |