diff options
author | Missy Connell <missyc@us.ibm.com> | 2013-02-20 16:30:51 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2013-04-09 14:33:13 -0500 |
commit | 63b344dd0fcbd2318a8fd46978970a08f3eb9ca9 (patch) | |
tree | ac68337341709cee0a5ccc54936c0557b2238170 /src/usr/dump | |
parent | 84d81bdda49213dcde23c604a2d6ab7ace90f1d6 (diff) | |
download | talos-hostboot-63b344dd0fcbd2318a8fd46978970a08f3eb9ca9.tar.gz talos-hostboot-63b344dd0fcbd2318a8fd46978970a08f3eb9ca9.zip |
Call Dump Collect from call_host_mpipl_service
Change-Id: I4c449177618f00d64b90b81403144649d0df756f
RTC:46996
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/3339
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/dump')
-rw-r--r-- | src/usr/dump/dumpCollect.C | 230 | ||||
-rw-r--r-- | src/usr/dump/dumpCollect.H | 58 | ||||
-rw-r--r-- | src/usr/dump/test/dumptest.H | 78 |
3 files changed, 272 insertions, 94 deletions
diff --git a/src/usr/dump/dumpCollect.C b/src/usr/dump/dumpCollect.C index 1a23a9757..4af04ec71 100644 --- a/src/usr/dump/dumpCollect.C +++ b/src/usr/dump/dumpCollect.C @@ -34,7 +34,10 @@ #include <runtime/runtime.H> #include <util/align.H> #include <sys/mm.h> +#include <dump/dumpif.H> +#include <sys/msg.h> // message Q's +#include <mbox/mbox_queues.H> // // Trace definition trace_desc_t* g_trac_dump = NULL; @@ -45,7 +48,6 @@ namespace DUMP { - /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// @@ -67,29 +69,29 @@ namespace DUMP do { - // Get the Data pointers to the locations we need from HDAT - // MS_DUMP_SRC_TBL, < MDST: Memory Dump Source Table - // MS_DUMP_DST_TBL, < MDDT: Memory Dump Destination Table - // MS_DUMP_RESULTS_TBL, <MDRT:Memory Dump Results Table - l_err = getHostDataPtrs(srcTableEntry, srcTableSize, - destTableEntry, destTableSize, - resultsTableEntry, resultsTableSize); - - if (l_err) - { - TRACFCOMP(g_trac_dump, "doDumpCollect: Got an error back from getHostDataPtrs"); - break; - } + // Get the Data pointers to the locations we need from HDAT + // MS_DUMP_SRC_TBL, < MDST: Memory Dump Source Table + // MS_DUMP_DST_TBL, < MDDT: Memory Dump Destination Table + // MS_DUMP_RESULTS_TBL, <MDRT:Memory Dump Results Table + l_err = getHostDataPtrs(srcTableEntry, srcTableSize, + destTableEntry, destTableSize, + resultsTableEntry, resultsTableSize); - l_err = copySrcToDest(srcTableEntry,srcTableSize, - destTableEntry,destTableSize, - resultsTableEntry,resultsTableSize); + if (l_err) + { + TRACFCOMP(g_trac_dump, "doDumpCollect: Got an error back from getHostDataPtrs"); + break; + } - if (l_err) - { - TRACFCOMP(g_trac_dump, "doDumpCollect: Got an error back from copySrcToDest"); - break; - } + l_err = copySrcToDest(srcTableEntry,srcTableSize, + destTableEntry,destTableSize, + resultsTableEntry,resultsTableSize); + + if (l_err) + { + TRACFCOMP(g_trac_dump, "doDumpCollect: Got an error back from copySrcToDest"); + break; + } }while (0); @@ -97,8 +99,8 @@ namespace DUMP } -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////// errlHndl_t copySrcToDest(dumpEntry *srcTableEntry, uint64_t srcTableSize, dumpEntry *destTableEntry, uint64_t destTableSize, @@ -188,13 +190,13 @@ namespace DUMP vaMapSrcTableAddr = (static_cast<uint64_t*>(mmio_dev_map(reinterpret_cast<void*>(ALIGN_PAGE_DOWN(curSrcTableAddr)), - THIRTYTWO_GB))); + THIRTYTWO_GB))); vaSrcTableAddr = vaMapSrcTableAddr; vaMapDestTableAddr = (static_cast<uint64_t*>(mmio_dev_map(reinterpret_cast<void*>(ALIGN_PAGE_DOWN(curDestTableAddr)), - THIRTYTWO_GB))); + THIRTYTWO_GB))); vaDestTableAddr = vaMapDestTableAddr; @@ -271,9 +273,9 @@ namespace DUMP // map the MDST entry to a device such that we can read and write from that memory // address - vaMapSrcTableAddr = - (static_cast<uint64_t*>(mmio_dev_map(reinterpret_cast<void*>(ALIGN_PAGE_DOWN(curSrcTableAddr)), - THIRTYTWO_GB))); + vaMapSrcTableAddr = + (static_cast<uint64_t*>(mmio_dev_map(reinterpret_cast<void*>(ALIGN_PAGE_DOWN(curSrcTableAddr)), + THIRTYTWO_GB))); vaSrcTableAddr = vaMapSrcTableAddr; @@ -392,7 +394,7 @@ namespace DUMP // size.. Perhaps put the bad destination entry // there as well } - + break; } @@ -603,7 +605,7 @@ namespace DUMP // Invalid size or address TRACFCOMP(g_trac_dump, "HBDumpGetHostData address or size invalie for MDDT: addr =0x%X, size =0x%X," , - destTableAddr, destTableSize); + destTableAddr, destTableSize); l_section = RUNTIME::MS_DUMP_DST_TBL; l_addr = destTableAddr; @@ -636,7 +638,7 @@ namespace DUMP // Invalid size or address TRACFCOMP(g_trac_dump, "HBDumpGetHostData address or size invalid for MDRT: addr =0x%X, size =0x%X," , - resultsTableAddr, resultsTableSize); + resultsTableAddr, resultsTableSize); l_section = RUNTIME::MS_DUMP_RESULTS_TBL; l_addr = resultsTableAddr; @@ -678,4 +680,166 @@ namespace DUMP } -} + // ------------------------------------------------------------------ + // sendMboxMsg + // ------------------------------------------------------------------ + errlHndl_t sendMboxMsg(DUMP_MSG_TYPE i_type) + + { + errlHndl_t l_err = NULL; + msg_t* msg = NULL; + TRACFCOMP( g_trac_dump, + ENTER_MRK"sendMboxMsg()" ); + + do + { + + //Create a mailbox message to send to FSP + msg = msg_allocate(); + msg->type = i_type; + + // If this is not a dump start message, need to collect the + // Results table and size as well as the results table itself. + if (i_type != DUMP_MSG_START_MSG_TYPE) + { + uint64_t resultsTableAddr = 0; + uint64_t resultsTableSize = 0; + + // Get the Results Table Address + l_err = + RUNTIME::get_host_data_section(RUNTIME::MS_DUMP_RESULTS_TBL, + 0, + resultsTableAddr, + resultsTableSize); + + + if (l_err) + { + // Got an errorlog back from get_host_data_sections + TRACFCOMP(g_trac_dump, "HBDumpGetHostData get_host_data_sections for MDDT failed rc=0x%X", l_err->reasonCode()); + } + // If the address or size is zero - error out + else if ((resultsTableSize == 0) || (resultsTableAddr == 0)) + { + // Invalid size or address + TRACFCOMP(g_trac_dump, + "HBDumpGetHostData address or size invalid for MDRT: addr =0x%X, size =0x%X," , + resultsTableAddr, resultsTableSize); + + + // Create an errorlog and change the type to error and add + // the plid to the data section. + + /*@ + * @errortype + * @moduleid DUMP::DUMP_SEND_MBOX_MSG + * @reasoncode DUMP::DUMP_NO_HDAT_ADDR + * @userdata1 Address returned + * @userdata2 Table type Requested + * @devdesc Invalid address and size returned from HDAT + */ + l_err = + new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + DUMP_SEND_MBOX_MSG, + DUMP_NO_HDAT_ADDR, + resultsTableAddr, + i_type); + + } + + // if no error then collect as expected. + if (!l_err) + { + + // TODO: Issue RTC 67082 - fix sending the MDRT + // to FSP once we have a design that can send the + // entire table.. Max size is 512K - truncating to + // 32K for the time being. + uint64_t l_resultsTableSize = resultsTableSize; + + // If the results table is greater than 32K truncate it. + if (resultsTableSize > (32*KILOBYTE)) + { + // Set the results table size to only include up to + // 32K + l_resultsTableSize = (32*KILOBYTE); + + TRACFCOMP( g_trac_dump, + INFO_MRK"Truncating the RESULTS table to 32K for dump msg type =. %.8X,", + i_type); + + } + + // TODO: RTC 67082 - Need to make sure we put the physical + // Address here. + + // Address of the results table + msg->data[0] = resultsTableAddr; + + // Number of bytes in the results table + msg->data[1] = l_resultsTableSize; + + //Copy the Results table into the message + msg->extra_data = malloc( l_resultsTableSize ); + + memcpy( msg->extra_data, + reinterpret_cast<uint64_t*>(resultsTableAddr), + l_resultsTableSize); + + + } + else + { + TRACFCOMP( g_trac_dump, + INFO_MRK"Got an error trying to send msg. %.8X,", + i_type); + + // change the msg type to be error type + i_type = DUMP_MSG_ERROR_MSG_TYPE; + + l_err->collectTrace("DUMP",1024); + + // Put a default value into the data[0] indicating plid to in data[1] + msg->data[0] = 0xFFFF; + + msg->data[1] = l_err->plid(); // plid + + // just commit the log from failure on Read.. and + // send an error msg to FSP. + errlCommit( l_err, DUMP_COMP_ID ); + l_err = NULL; + + } + } + + + TRACFCOMP( g_trac_dump, + INFO_MRK"Send msg to FSP about DUMP %.8X,", + i_type); + + // Send the message + l_err = MBOX::send( MBOX::FSP_DUMP_MSGQ_ID, msg ); + + // got an error.. Free the msg space allocated above. + if( l_err ) + { + TRACFCOMP(g_trac_dump, + ERR_MRK "Failed sending DUMP to FSP for %.8X",i_type); + + l_err->collectTrace("DUMP",1024); + + free( msg->extra_data ); + msg->extra_data = NULL; + msg_free( msg ); + } + } while( 0 ); + + + TRACFCOMP( g_trac_dump, + EXIT_MRK"sendMboxMsg()" ); + + return l_err; + } + + +}; // end of namespace diff --git a/src/usr/dump/dumpCollect.H b/src/usr/dump/dumpCollect.H index 282a13886..3272c401d 100644 --- a/src/usr/dump/dumpCollect.H +++ b/src/usr/dump/dumpCollect.H @@ -24,65 +24,15 @@ #define __DUMPCOLLECT_H #include <errl/errlentry.H> - +#include <dump/dumpif.H> /** @file dumpCollect.H - * @brief Provides the interfaces to copy dump data from src to destination + * @brief Provides the interfaces to get the host data pointers for the + * dump tables. */ namespace DUMP { - //These structures are defined in the HDAT spec - //The MDST and MDDT have this format. - struct dumpEntry - { - uint64_t dataAddr; - uint64_t dataSize; - }; - - - //The MDRT has this format. - struct resultsEntry - { - uint64_t srcAddr; - uint64_t destAddr; - uint64_t dataSize; - }; - - - /** - * @brief This function is a wrapper function that calls - * getHostDataPtrs to get the MDDT, MDST, MDRT pointers - * and then passes those values to the copySrcToDest - * routine that performs the copy - * - * @param[in] void - * - * @return errlHndl_t - */ - errlHndl_t doDumpCollect(void); - - /** - * @brief This function copies the data and sizes retrieved from the - * MDST(source table) to the addresses indicated by the MDDT(destination - * table). Each write is then logged in the MDRT (results table) with - * source addr, destination addr and size - * - * @param[in] srcTableEntry Ptr to the first MDST entry - * @param[in] srcTableSize Size of the entire MDST - * - * @param[in] destTableAddr Ptr to the first MDDT entry - * @param[in] destTableSize Size of the entire MDDT - * - * @param[in] resultsTableAddr Ptr to the first MDRT entry - * @param[in] resultsTableSize Size of the entire MDRT - * - * @return errlHndl_t - */ - errlHndl_t copySrcToDest(dumpEntry *srcTableEntry, uint64_t srcTableSize, - dumpEntry *destTableEntry, uint64_t destTableSize, - resultsEntry *resultsTableEntry, uint64_t resultsTableSize); - /** * @brief This routine retrieves first entry of the MDST, MDDT and * MDRT and the size of each of those tables. @@ -103,7 +53,7 @@ namespace DUMP resultsEntry *resultsTableEntry,uint64_t &resultsTableSize); -} +}; // end of namespace #endif diff --git a/src/usr/dump/test/dumptest.H b/src/usr/dump/test/dumptest.H index a0fa852d1..7b9d16385 100644 --- a/src/usr/dump/test/dumptest.H +++ b/src/usr/dump/test/dumptest.H @@ -35,13 +35,12 @@ #include <errl/errlentry.H> #include <devicefw/userif.H> #include <targeting/common/util.H> -#include "../dumpCollect.H" #include <runtime/runtime.H> -#include <usr/vmmconst.h> #include <sys/mmio.h> #include <util/align.H> #include <sys/mm.h> - +#include <dump/dumpif.H> +#include <vfs/vfs.H> extern trace_desc_t* g_trac_dump; @@ -49,6 +48,35 @@ class DumpTest: public CxxTest::TestSuite { public: + // Load the dump module as it is loaded on demand + DumpTest(): CxxTest::TestSuite() + { + errlHndl_t l_err = VFS::module_load( "libdump.so" ); + + if (l_err) + { + TRACFCOMP(g_trac_dump, "DumpTest:DumpTest> got an error back from moduleLoad : RC=%X",l_err->reasonCode() ); + TS_FAIL( "DumpTest::DumpTest ERROR : Unexpected error log from moduleLoad" ); + errlCommit(l_err,DUMP_COMP_ID); + + } + }; + + // unload the dump module + ~DumpTest() + { + // Need to unload the dump module regardless of whether we have + // an error or not. + errlHndl_t l_err = VFS::module_unload( "libdump.so" ); + + if (l_err) + { + TRACFCOMP(g_trac_dump, "DumpTest:~DumpTest> got an error back from moduleUnLoad : RC=%X",l_err->reasonCode() ); + TS_FAIL( "DumpTest::DumpTest ERROR : Unexpected error log from moduleUnLoad" ); + errlCommit(l_err,DUMP_COMP_ID); + + } + }; /** * @brief Basic dump test that has sequential src addresses to @@ -1041,7 +1069,7 @@ class DumpTest: public CxxTest::TestSuite TRACFCOMP(g_trac_dump, "DumpTest::DumpCollectUnevenSRC:1 : Results Data mismatch rc = %d", result_rc); TS_FAIL( "DumpTest::DumpCollectUnevenSrc ERROR : Unexpected error data mismatch in results table" ); } - + TRACFCOMP( g_trac_dump, "dumpTest::test_dumpCollectUnevenSrc COMPLETE" ); } @@ -1049,7 +1077,9 @@ class DumpTest: public CxxTest::TestSuite /** * @brief Basic dump test that forces an error condition that does not have - * enough destination space to hold the src size + * enough destination space to hold the src size. + * This testcase also verifies that we can send a mbox message with + * dump status to the FSP. * */ @@ -1164,23 +1194,42 @@ class DumpTest: public CxxTest::TestSuite index+=2; } + l_err = DUMP::sendMboxMsg(DUMP::DUMP_MSG_START_MSG_TYPE); + // On the end message queue we need to add the results talble.. + if (l_err) + { + TRACFCOMP(g_trac_dump, + "DumpTest::DumpCollectNotEnoughDest ERROR : Got an errorlog back from sendMboxMsg-start"); + TS_FAIL( + "DumpTest::DumpCollectNotEnoughDest ERROR : Got an errorlog back from sendMboxMsg-start" ); + errlCommit(l_err,DUMP_COMP_ID); + } srcTableEntry = reinterpret_cast<DUMP::dumpEntry *>(srcTableAddr); destTableEntry = reinterpret_cast<DUMP::dumpEntry *>(dstTableAddr); resultsTableEntry = reinterpret_cast<DUMP::resultsEntry *>(resultsTableAddr); - l_err = DUMP::copySrcToDest(srcTableEntry,srcTableSize, destTableEntry,dstTableSize, resultsTableEntry,resultsTableSize); - // this testcase expects an error returned. if( l_err ) { + TRACFCOMP(g_trac_dump, "DumpTest::DumpCollectNotEnoughDest got an EXPECTED error back from copySrcToDest : RC=%X",l_err->reasonCode() ); delete l_err; + + // Send an Error mbox msg to FSP that we got an error + l_err = DUMP::sendMboxMsg(DUMP::DUMP_MSG_ERROR_MSG_TYPE); + + if (l_err) + { + TRACFCOMP(g_trac_dump, + "DumpTest::DumpCollectNotEnoughDest ERROR : Got an errorlog back from sendMboxMsg-error"); + TS_FAIL( "DumpTest::DumpCollectNotEnoughDest ERROR : Got an errorlog back from sendMboxMsg-error" ); + } } else { @@ -1190,6 +1239,21 @@ class DumpTest: public CxxTest::TestSuite } + // This call is just to verify we can call MSG_END .. even though with + // this flow we already sent a msg ERROR. + + + // Successful so send mbox message indicating the dump is complete and successful + l_err = DUMP::sendMboxMsg(DUMP::DUMP_MSG_END_MSG_TYPE); + + if (l_err) + { + TRACFCOMP(g_trac_dump, + "DumpTest::DumpCollectNotEnoughDest ERROR : Got an errorlog back from sendMboxMsg-END"); + TS_FAIL( "DumpTest::DumpCollectNotEnoughDest ERROR : Got an errorlog back from sendMboxMsg-END" ); + } + + TRACFCOMP( g_trac_dump, "dumpTest::test_dumpCollectNotEnoughDest COMPLETE" ); } |