summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDean Sanner <dsanner@us.ibm.com>2013-06-19 12:15:05 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-07-02 10:52:52 -0500
commit102dafda92c9a4ae71d461e54ab7d76c74f371ce (patch)
tree935dcaa56009901d3c71ce8c667830f4dfc33e4b /src
parent872b09dc527e6e75e4d08e819e74e28157b1283a (diff)
downloadtalos-hostboot-102dafda92c9a4ae71d461e54ab7d76c74f371ce.tar.gz
talos-hostboot-102dafda92c9a4ae71d461e54ab7d76c74f371ce.zip
Update hdat services to use mm_block_map
Change-Id: I14a307a5ff54685e2ade2e58a45f5134f6782942 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/5088 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/usr/dump/dumpCollect.C87
-rw-r--r--src/usr/dump/dumpCollect.H9
-rw-r--r--src/usr/dump/test/dumptest.H197
-rw-r--r--src/usr/runtime/hdatservice.C169
-rw-r--r--src/usr/runtime/hdatservice.H133
5 files changed, 371 insertions, 224 deletions
diff --git a/src/usr/dump/dumpCollect.C b/src/usr/dump/dumpCollect.C
index 7f704faef..d7b8014a2 100644
--- a/src/usr/dump/dumpCollect.C
+++ b/src/usr/dump/dumpCollect.C
@@ -51,52 +51,52 @@ namespace DUMP
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
- errlHndl_t doDumpCollect(void)
- {
- TRACFCOMP(g_trac_dump, "doDumpCollect - start ");
+errlHndl_t doDumpCollect(void)
+{
+ TRACFCOMP(g_trac_dump, "doDumpCollect - start ");
- errlHndl_t l_err = NULL;
+ errlHndl_t l_err = NULL;
- // Table Sizes
- uint64_t srcTableSize = 0;
- uint64_t destTableSize = 0;
- uint64_t resultsTableSize = 0;
+ // Table Sizes
+ uint64_t srcTableSize = 0;
+ uint64_t destTableSize = 0;
+ uint64_t resultsTableSize = 0;
- // Dump table struct pointers
- dumpEntry *srcTableEntry = NULL;
- dumpEntry *destTableEntry = NULL;
- resultsEntry *resultsTableEntry = NULL;
+ // Dump table struct pointers
+ dumpEntry *srcTableEntry = NULL;
+ dumpEntry *destTableEntry = NULL;
+ resultsEntry *resultsTableEntry = NULL;
- do
+ 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)
{
- // 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;
- }
+ TRACFCOMP(g_trac_dump, "doDumpCollect: Got an error back from getHostDataPtrs");
+ break;
+ }
- l_err = copySrcToDest(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 copySrcToDest");
- break;
- }
+ if (l_err)
+ {
+ TRACFCOMP(g_trac_dump, "doDumpCollect: Got an error back from copySrcToDest");
+ break;
+ }
- }while (0);
+ }while (0);
- return (l_err);
- }
+ return (l_err);
+}
///////////////////////////////////////////////////////////////////////////////
@@ -423,7 +423,7 @@ namespace DUMP
// Determine how much to copy..
- sizeToCopy = std::min(bytesLeftInSrc, bytesLeftInDest);
+ sizeToCopy = std::min(bytesLeftInSrc, bytesLeftInDest);
// Do the copy of the data from the source to the destination
mm_tolerate_ue(1);
@@ -537,9 +537,12 @@ namespace DUMP
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
- errlHndl_t getHostDataPtrs(dumpEntry *srcTableEntry, uint64_t &srcTableSize,
- dumpEntry *destTableEntry, uint64_t &destTableSize,
- resultsEntry *resultsTableEntry,uint64_t &resultsTableSize)
+ errlHndl_t getHostDataPtrs(dumpEntry *&srcTableEntry,
+ uint64_t &srcTableSize,
+ dumpEntry *&destTableEntry,
+ uint64_t &destTableSize,
+ resultsEntry *&resultsTableEntry,
+ uint64_t &resultsTableSize)
{
@@ -655,7 +658,7 @@ namespace DUMP
TRACFCOMP(g_trac_dump,
"gethostDataPtrs SrcTableAddr = %.16x, DestTableAddr = %.16X, resultTableAddr = %.16X",
- srcTableAddr, destTableAddr, resultsTableAddr);
+ srcTableAddr, destTableAddr, resultsTableAddr);
}while(0);
diff --git a/src/usr/dump/dumpCollect.H b/src/usr/dump/dumpCollect.H
index 3272c401d..09816848b 100644
--- a/src/usr/dump/dumpCollect.H
+++ b/src/usr/dump/dumpCollect.H
@@ -48,9 +48,12 @@ namespace DUMP
* @return errlHndl_t
*/
- errlHndl_t getHostDataPtrs(dumpEntry *srcTableEntry, uint64_t &srcTableSize,
- dumpEntry *destTableEntry, uint64_t &destTableSize,
- resultsEntry *resultsTableEntry,uint64_t &resultsTableSize);
+ errlHndl_t getHostDataPtrs(dumpEntry *&srcTableEntry,
+ uint64_t &srcTableSize,
+ dumpEntry *&destTableEntry,
+ uint64_t &destTableSize,
+ resultsEntry *&resultsTableEntry,
+ uint64_t &resultsTableSize);
}; // end of namespace
diff --git a/src/usr/dump/test/dumptest.H b/src/usr/dump/test/dumptest.H
index b38f45b0d..58568b8a2 100644
--- a/src/usr/dump/test/dumptest.H
+++ b/src/usr/dump/test/dumptest.H
@@ -41,6 +41,7 @@
#include <sys/mm.h>
#include <dump/dumpif.H>
#include <vfs/vfs.H>
+#include "../dumpCollect.H"
extern trace_desc_t* g_trac_dump;
@@ -91,28 +92,33 @@ class DumpTest: public CxxTest::TestSuite
errlHndl_t l_err = NULL;
- uint64_t srcTableAddr = 0;
uint64_t srcTableSize = 0;
-
- uint64_t dstTableAddr = 0;
uint64_t dstTableSize = 0;
-
- uint64_t resultsTableAddr = 0;
uint64_t resultsTableSize = 0;
- DUMP::dumpEntry *srcTableEntry = NULL;
- DUMP::dumpEntry *destTableEntry = NULL;
- DUMP::resultsEntry *resultsTableEntry = NULL;
+ DUMP::dumpEntry *srcTable = NULL;
+ DUMP::dumpEntry *destTable = NULL;
+ DUMP::resultsEntry *resultsTable = NULL;
// For testing I am using my own data pointers and setting it up
// to look like PHYP would have to test the copy function.
- srcTableAddr = DUMP_TEST_SRC_MEM_ADDR;
- srcTableSize = DUMP_TEST_SRC_MEM_SIZE;
- dstTableAddr = DUMP_TEST_DST_MEM_ADDR;
- dstTableSize = DUMP_TEST_DST_MEM_SIZE;
- resultsTableAddr = DUMP_TEST_RESULTS_MEM_ADDR;
- resultsTableSize = DUMP_TEST_RESULTS_MEM_SIZE;
+ l_err = DUMP::getHostDataPtrs(srcTable, srcTableSize,
+ destTable, dstTableSize,
+ resultsTable, resultsTableSize);
+ if(l_err)
+ {
+ TRACFCOMP(g_trac_dump, "DumpTest:test_DumpCollect> error getting getHostDataPtrs: RC=%X"
+ ,l_err->reasonCode() );
+ TS_FAIL( "DumpTest::CollectDump ERROR : Failed getHostDataPtrs" );
+ errlCommit(l_err,DUMP_COMP_ID);
+ return;
+ }
+ // Point to the location of the src Data pointer.
+ // Point to the location of the dest Data pointer.
+ uint64_t *srcTablePtr = reinterpret_cast<uint64_t *>(srcTable);
+ uint64_t *dstTablePtr = reinterpret_cast<uint64_t *>(destTable);
+ uint64_t *resultTablePtr = reinterpret_cast<uint64_t *>(resultsTable);
uint64_t src_data[8] = {DUMP_TEST_SRC_DATA_AREA, 64, // 450000
DUMP_TEST_SRC_DATA_AREA + 64, 64,
@@ -126,14 +132,6 @@ class DumpTest: public CxxTest::TestSuite
DUMP_TEST_DST_DATA_AREA + 192, 64};
- // Point to the location of the src Data pointer.
- uint64_t *srcTablePtr = reinterpret_cast<uint64_t *>(srcTableAddr);
-
- // Point to the location of the dest Data pointer.
- uint64_t *dstTablePtr = reinterpret_cast<uint64_t *>(dstTableAddr);
-
- uint64_t *resultTablePtr = reinterpret_cast<uint64_t *>(resultsTableAddr);
-
// Put the src addresses defined above into the MDST
memcpy(srcTablePtr, src_data, sizeof(src_data));
@@ -210,15 +208,7 @@ class DumpTest: public CxxTest::TestSuite
index+=2;
}
-
- 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);
+ l_err = DUMP::doDumpCollect();
if( l_err )
{
@@ -309,25 +299,31 @@ class DumpTest: public CxxTest::TestSuite
TRACFCOMP( g_trac_dump, "DumpTest::DumpCollectUnevenDest START" );
errlHndl_t l_err = NULL;
- uint64_t srcTableAddr = 0;
uint64_t srcTableSize = 0;
- uint64_t dstTableAddr = 0;
uint64_t dstTableSize = 0;
- uint64_t resultsTableAddr = 0;
uint64_t resultsTableSize = 0;
- DUMP::dumpEntry *srcTableEntry = NULL;
- DUMP::dumpEntry *destTableEntry = NULL;
- DUMP::resultsEntry *resultsTableEntry = NULL;
+ DUMP::dumpEntry *srcTable = NULL;
+ DUMP::dumpEntry *destTable = NULL;
+ DUMP::resultsEntry *resultsTable = NULL;
- // Setting up TESt version of the MDST, MDDT and MDRT.
- srcTableAddr = DUMP_TEST_SRC_MEM_ADDR;
- srcTableSize = DUMP_TEST_SRC_MEM_SIZE;
- dstTableAddr = DUMP_TEST_DST_MEM_ADDR;
- dstTableSize = DUMP_TEST_DST_MEM_SIZE;
- resultsTableAddr = DUMP_TEST_RESULTS_MEM_ADDR;
- resultsTableSize = DUMP_TEST_RESULTS_MEM_SIZE;
+ // For testing I am using my own data pointers and setting it up
+ // to look like PHYP would have to test the copy function.
+ l_err = DUMP::getHostDataPtrs(srcTable, srcTableSize,
+ destTable, dstTableSize,
+ resultsTable, resultsTableSize);
+ if(l_err)
+ {
+ TRACFCOMP(g_trac_dump, "DumpTest:test_DumpCollect> error getting getHostDataPtrs: RC=%X"
+ ,l_err->reasonCode() );
+ TS_FAIL( "DumpTest::CollectDump ERROR : Failed getHostDataPtrs" );
+ errlCommit(l_err,DUMP_COMP_ID);
+ return;
+ }
+ uint64_t *srcTablePtr = reinterpret_cast<uint64_t *>(srcTable);
+ uint64_t *dstTablePtr = reinterpret_cast<uint64_t *>(destTable);
+ uint64_t *resultTablePtr = reinterpret_cast<uint64_t *>(resultsTable);
uint64_t src_data[8] = {DUMP_TEST_SRC_DATA_AREA+256, 64, // 4500100
DUMP_TEST_SRC_DATA_AREA+256 + 64,64, // 4500140
@@ -339,10 +335,6 @@ class DumpTest: public CxxTest::TestSuite
DUMP_TEST_DST_DATA_AREA+1024 + 96, 32, // 4600480
DUMP_TEST_DST_DATA_AREA+1024+ 128, 128}; // 46004C0
- uint64_t *srcTablePtr = reinterpret_cast<uint64_t *>(srcTableAddr);
- uint64_t *dstTablePtr = reinterpret_cast<uint64_t *>(dstTableAddr);
- uint64_t *resultTablePtr = reinterpret_cast<uint64_t *>(resultsTableAddr);
-
memcpy(srcTablePtr, src_data, sizeof(src_data));
memcpy(dstTablePtr, dst_data, sizeof(dst_data));
@@ -417,15 +409,7 @@ class DumpTest: public CxxTest::TestSuite
index+=2;
}
- 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);
-
+ l_err = DUMP::doDumpCollect();
if( l_err )
{
@@ -612,28 +596,32 @@ class DumpTest: public CxxTest::TestSuite
errlHndl_t l_err = NULL;
- uint64_t srcTableAddr = 0;
uint64_t srcTableSize = 0;
-
- uint64_t dstTableAddr = 0;
uint64_t dstTableSize = 0;
-
- uint64_t resultsTableAddr = 0;
uint64_t resultsTableSize = 0;
-
uint64_t offset = 0;
- DUMP::dumpEntry *srcTableEntry = NULL;
- DUMP::dumpEntry *destTableEntry = NULL;
- DUMP::resultsEntry *resultsTableEntry = NULL;
+ DUMP::dumpEntry *srcTable = NULL;
+ DUMP::dumpEntry *destTable = NULL;
+ DUMP::resultsEntry *resultsTable = NULL;
+
+ // For testing I am using my own data pointers and setting it up
+ // to look like PHYP would have to test the copy function.
+ l_err = DUMP::getHostDataPtrs(srcTable, srcTableSize,
+ destTable, dstTableSize,
+ resultsTable, resultsTableSize);
+ if(l_err)
+ {
+ TRACFCOMP(g_trac_dump, "DumpTest:test_DumpCollect> error getting getHostDataPtrs: RC=%X"
+ ,l_err->reasonCode() );
+ TS_FAIL( "DumpTest::CollectDump ERROR : Failed getHostDataPtrs" );
+ errlCommit(l_err,DUMP_COMP_ID);
+ return;
+ }
- // Setting up TESt version of the MDST, MDDT and MDRT.
- srcTableAddr = DUMP_TEST_SRC_MEM_ADDR;
- srcTableSize = DUMP_TEST_SRC_MEM_SIZE;
- dstTableAddr = DUMP_TEST_DST_MEM_ADDR;
- dstTableSize = DUMP_TEST_DST_MEM_SIZE;
- resultsTableAddr = DUMP_TEST_RESULTS_MEM_ADDR;
- resultsTableSize = DUMP_TEST_RESULTS_MEM_SIZE;
+ uint64_t *srcTablePtr = reinterpret_cast<uint64_t *>(srcTable);
+ uint64_t *dstTablePtr = reinterpret_cast<uint64_t *>(destTable);
+ uint64_t *resultTablePtr = reinterpret_cast<uint64_t *>(resultsTable);
uint64_t src_data[8] = {DUMP_TEST_SRC_DATA_AREA+1024, 16, // 4500400
DUMP_TEST_SRC_DATA_AREA+2048, 48, // 4500800
@@ -646,11 +634,6 @@ class DumpTest: public CxxTest::TestSuite
DUMP_TEST_DST_DATA_AREA+3072, 32, // 4600C00
DUMP_TEST_DST_DATA_AREA+3072+64, 128}; // 4600C40
-
- uint64_t *srcTablePtr = reinterpret_cast<uint64_t *>(srcTableAddr);
- uint64_t *dstTablePtr = reinterpret_cast<uint64_t *>(dstTableAddr);
- uint64_t *resultTablePtr = reinterpret_cast<uint64_t *>(resultsTableAddr);
-
memcpy(srcTablePtr, src_data, sizeof(src_data));
memcpy(dstTablePtr, dst_data, sizeof(dst_data));
@@ -797,15 +780,7 @@ class DumpTest: public CxxTest::TestSuite
}
}while(0);
-
- 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);
+ l_err = DUMP::doDumpCollect();
if( l_err )
{
@@ -1106,26 +1081,30 @@ class DumpTest: public CxxTest::TestSuite
errlHndl_t l_err = NULL;
- uint64_t srcTableAddr = 0;
uint64_t srcTableSize = 0;
-
- uint64_t dstTableAddr = 0;
uint64_t dstTableSize = 0;
-
- uint64_t resultsTableAddr = 0;
uint64_t resultsTableSize = 0;
- DUMP::dumpEntry *srcTableEntry = NULL;
- DUMP::dumpEntry *destTableEntry = NULL;
- DUMP::resultsEntry *resultsTableEntry = NULL;
+ DUMP::dumpEntry *srcTable = NULL;
+ DUMP::dumpEntry *destTable = NULL;
+ DUMP::resultsEntry *resultsTable = NULL;
+
+ // For testing I am using my own data pointers and setting it up
+ // to look like PHYP would have to test the copy function.
+ l_err = DUMP::getHostDataPtrs(srcTable, srcTableSize,
+ destTable, dstTableSize,
+ resultsTable, resultsTableSize);
+ if(l_err)
+ {
+ TRACFCOMP(g_trac_dump, "DumpTest:test_DumpCollect> error getting getHostDataPtrs: RC=%X"
+ ,l_err->reasonCode() );
+ TS_FAIL( "DumpTest::CollectDump ERROR : Failed getHostDataPtrs" );
+ errlCommit(l_err,DUMP_COMP_ID);
+ return;
+ }
- // Test locations of the MDST, MDDT, MDRT
- srcTableAddr = DUMP_TEST_SRC_MEM_ADDR;
- srcTableSize = DUMP_TEST_SRC_MEM_SIZE;
- dstTableAddr = DUMP_TEST_DST_MEM_ADDR;
- dstTableSize = DUMP_TEST_DST_MEM_SIZE;
- resultsTableAddr = DUMP_TEST_RESULTS_MEM_ADDR;
- resultsTableSize = DUMP_TEST_RESULTS_MEM_SIZE;
+ uint64_t *srcTablePtr = reinterpret_cast<uint64_t *>(srcTable);
+ uint64_t *dstTablePtr = reinterpret_cast<uint64_t *>(destTable);
uint64_t src_data[8] = {DUMP_TEST_SRC_DATA_AREA, 64, // 450000
DUMP_TEST_SRC_DATA_AREA + 64, 64,
@@ -1139,12 +1118,6 @@ class DumpTest: public CxxTest::TestSuite
DUMP_TEST_DST_DATA_AREA + 4096 + 192, 32}; // NOTE>> TOO SMALL of a space..
- // Point to the location of the src Data pointer.
- uint64_t *srcTablePtr = reinterpret_cast<uint64_t *>(srcTableAddr);
-
- // Point to the location of the dest Data pointer.
- uint64_t *dstTablePtr = reinterpret_cast<uint64_t *>(dstTableAddr);
-
// Put the src addresses defined above into the MDST
memcpy(srcTablePtr, src_data, sizeof(src_data));
@@ -1224,13 +1197,7 @@ class DumpTest: public CxxTest::TestSuite
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);
+ l_err = DUMP::doDumpCollect();
// this testcase expects an error returned.
if( l_err )
diff --git a/src/usr/runtime/hdatservice.C b/src/usr/runtime/hdatservice.C
index e67abc3f3..e60927b37 100644
--- a/src/usr/runtime/hdatservice.C
+++ b/src/usr/runtime/hdatservice.C
@@ -32,11 +32,14 @@
#include "hdatstructs.H"
#include "fakepayload.H"
#include <dump/dumpif.H>
+#include "hdatservice.H"
extern trace_desc_t* g_trac_runtime;
#define TRACUCOMP TRACDCOMP
+namespace RUNTIME
+{
/********************
Local Constants used for sanity checks
@@ -225,49 +228,40 @@ errlHndl_t check_tuple( uint64_t i_base,
}
-/**
- * @brief Retrieve hardcoded section addresses for standalone mode
- *
- * This is here to allow us to manually generate attribute data for
- * the HostServices code without requiring a full FipS/PHYP boot.
- *
- * @param[in] i_section Chunk of data to find
- * @param[in] i_instance Instance of section when there are multiple entries
- * @param[out] o_dataAddr Physical memory address of data
- * @param[out] o_dataSize Size of data in bytes, 0 on error, DATA_SIZE_UNKNOWN if unknown
- *
- * @return errlHndl_t NULL on success
- */
-errlHndl_t get_standalone_section( RUNTIME::SectionId i_section,
- uint64_t i_instance,
- uint64_t& o_dataAddr,
- size_t& o_dataSize )
+errlHndl_t hdatService::get_standalone_section(
+ RUNTIME::SectionId i_section,
+ uint64_t i_instance,
+ uint64_t& o_dataAddr,
+ size_t& o_dataSize )
{
errlHndl_t errhdl = NULL;
+ uint64_t v_baseAddr = reinterpret_cast<uint64_t>(iv_payload_addr);
+ uint64_t v_dumpAddr = reinterpret_cast<uint64_t>(iv_dumptest_addr);
if( RUNTIME::HSVC_SYSTEM_DATA == i_section )
{
- o_dataAddr = HSVC_TEST_MEMORY_ADDR;
+ o_dataAddr = v_baseAddr;
o_dataSize = 512*KILOBYTE;
}
else if( RUNTIME::HSVC_NODE_DATA == i_section )
{
- o_dataAddr = HSVC_TEST_MEMORY_ADDR + 512*KILOBYTE;
+ o_dataAddr = v_baseAddr + 512*KILOBYTE;
o_dataSize = HSVC_TEST_MEMORY_SIZE - 512*KILOBYTE;
}
else if( RUNTIME::MS_DUMP_SRC_TBL == i_section )
{
- o_dataAddr = DUMP_TEST_SRC_MEM_ADDR;
+ o_dataAddr = v_dumpAddr;
o_dataSize = DUMP_TEST_SRC_MEM_SIZE;
}
else if( RUNTIME::MS_DUMP_DST_TBL == i_section )
{
- o_dataAddr = DUMP_TEST_DST_MEM_ADDR;
+ o_dataAddr = v_dumpAddr + DUMP_TEST_SRC_MEM_SIZE;
o_dataSize = DUMP_TEST_DST_MEM_SIZE;
}
else if( RUNTIME::MS_DUMP_RESULTS_TBL == i_section )
{
- o_dataAddr = DUMP_TEST_RESULTS_MEM_ADDR;
+ o_dataAddr = v_dumpAddr + DUMP_TEST_SRC_MEM_SIZE +
+ DUMP_TEST_DST_MEM_SIZE;
o_dataSize = DUMP_TEST_RESULTS_MEM_SIZE;
}
else
@@ -292,20 +286,38 @@ errlHndl_t get_standalone_section( RUNTIME::SectionId i_section,
return errhdl;
}
+hdatService::hdatService(void)
+:iv_payload_addr(NULL), iv_dumptest_addr(NULL)
+{
+}
-/********************
- Public Methods
- ********************/
+hdatService::~hdatService(void)
+{
+ if(iv_payload_addr)
+ {
+ mm_block_unmap(iv_payload_addr);
+ iv_payload_addr = NULL;
+ }
-/**
- * @brief Add the host data mainstore location to VMM
- */
-errlHndl_t RUNTIME::load_host_data( void )
+ if(iv_dumptest_addr)
+ {
+ mm_block_unmap(iv_dumptest_addr);
+ iv_dumptest_addr = NULL;
+ }
+}
+
+errlHndl_t hdatService::loadHostData(void)
{
errlHndl_t errhdl = NULL;
do
{
+ //Check to see if already mapped, if so just return
+ if (iv_payload_addr != NULL)
+ {
+ break;
+ }
+
TARGETING::Target * sys = NULL;
TARGETING::targetService().getTopLevelTarget( sys );
assert(sys != NULL);
@@ -346,11 +358,12 @@ errlHndl_t RUNTIME::load_host_data( void )
hdat_size = ALIGN_PAGE(hdat_size); //round up
TRACFCOMP( g_trac_runtime, "load_host_data> PHYP: Mapping in 0x%X-0x%X (%d MB)", hdat_start, hdat_start+hdat_size, hdat_size );
- int rc = mm_linear_map( reinterpret_cast<void*>(hdat_start),
+ iv_payload_addr = mm_block_map( reinterpret_cast<void*>(hdat_start),
hdat_size );
- if (rc != 0)
+ if (NULL == iv_payload_addr)
{
- TRACFCOMP( g_trac_runtime, "Failure calling mm_linear_map : rc=%d", rc );
+ TRACFCOMP( g_trac_runtime, "Failure calling mm_block_map : iv_payload_addr=%p",
+ iv_payload_addr );
/*@
* @errortype
* @moduleid RUNTIME::MOD_HDATSERVICE_LOAD_HOST_DATA
@@ -375,13 +388,15 @@ errlHndl_t RUNTIME::load_host_data( void )
FakePayload::load();
// Map in some arbitrary memory for the HostServices code to use
- TRACFCOMP( g_trac_runtime, "load_host_data> STANDALONE: Mapping in 0x%X-0x%X (%d MB)", HSVC_TEST_MEMORY_ADDR, HSVC_TEST_MEMORY_ADDR+HSVC_TEST_MEMORY_SIZE, HSVC_TEST_MEMORY_SIZE );
- int rc = mm_linear_map(
- reinterpret_cast<void*>(HSVC_TEST_MEMORY_ADDR),
- HSVC_TEST_MEMORY_SIZE );
- if (rc != 0)
+ TRACFCOMP( g_trac_runtime, "load_host_data> STANDALONE: Mapping in 0x%X-0x%X (%d MB)", HSVC_TEST_MEMORY_ADDR, HSVC_TEST_MEMORY_ADDR+HSVC_TEST_MEMORY_SIZE,
+ HSVC_TEST_MEMORY_SIZE);
+ iv_payload_addr = mm_block_map(
+ reinterpret_cast<void*>(HSVC_TEST_MEMORY_ADDR),
+ HSVC_TEST_MEMORY_SIZE);
+ if (NULL == iv_payload_addr)
{
- TRACFCOMP( g_trac_runtime, "Failure calling mm_linear_map : rc=%d", rc );
+ TRACFCOMP( g_trac_runtime, "Failure calling mm_block_map : iv_payload_addr=%p",
+ iv_payload_addr );
/*@
* @errortype
* @moduleid RUNTIME::MOD_HDATSERVICE_LOAD_HOST_DATA
@@ -400,36 +415,34 @@ errlHndl_t RUNTIME::load_host_data( void )
break;
}
- // Map in some memory for the DumpCollect code to use
- TRACFCOMP( g_trac_runtime,
- "load_host_data> STANDALONE: Mapping in 0x%X-0x%X (%d MB)", DUMP_TEST_TABLE_START, DUMP_TEST_TABLE_END, DUMP_TEST_TABLE_SIZE);
-
- rc = mm_linear_map(
- reinterpret_cast<void*>(DUMP_TEST_SRC_MEM_ADDR),
-
- DUMP_TEST_SRC_MEM_SIZE+DUMP_TEST_DST_MEM_SIZE+DUMP_TEST_RESULTS_MEM_SIZE);
-
- if (rc != 0)
+ // Map in some arbitrary memory for the DumpTest code to use
+ TRACFCOMP( g_trac_runtime, "load_host_data> STANDALONE: Mapping in 0x%X-0x%X (%d MB)", DUMP_TEST_MEMORY_ADDR,
+ DUMP_TEST_MEMORY_ADDR+DUMP_TEST_MEMORY_SIZE,
+ DUMP_TEST_MEMORY_SIZE);
+ iv_dumptest_addr = mm_block_map(
+ reinterpret_cast<void*>(DUMP_TEST_MEMORY_ADDR),
+ DUMP_TEST_MEMORY_SIZE );
+ if (NULL == iv_dumptest_addr)
{
- TRACFCOMP( g_trac_runtime, "Failure calling mm_linear_map : rc=%d", rc );
+ TRACFCOMP( g_trac_runtime, "Failure calling mm_block_map : iv_dumptest_addr=%p",
+ iv_dumptest_addr );
/*@
* @errortype
* @moduleid RUNTIME::MOD_HDATSERVICE_LOAD_HOST_DATA
* @reasoncode RUNTIME::RC_CANNOT_MAP_MEMORY3
* @userdata1 Starting Address
* @userdata2 Size
- * @devdesc Error mapping in standalone DUMP memory
+ * @devdesc Error mapping in standalone memory
*/
errhdl = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
RUNTIME::MOD_HDATSERVICE_LOAD_HOST_DATA,
RUNTIME::RC_CANNOT_MAP_MEMORY3,
- DUMP_TEST_SRC_MEM_ADDR,
- DUMP_TEST_TABLE_SIZE);
+ DUMP_TEST_MEMORY_ADDR,
+ DUMP_TEST_MEMORY_SIZE );
errhdl->collectTrace("RUNTIME",1024);
break;
}
-
}
else
{
@@ -443,14 +456,10 @@ errlHndl_t RUNTIME::load_host_data( void )
return errhdl;
}
-/**
- * @brief Get a pointer to the beginning of a particular section of
- * the host data memory.
- */
-errlHndl_t RUNTIME::get_host_data_section( SectionId i_section,
- uint64_t i_instance,
- uint64_t& o_dataAddr,
- size_t& o_dataSize )
+errlHndl_t hdatService::getHostDataSection( SectionId i_section,
+ uint64_t i_instance,
+ uint64_t& o_dataAddr,
+ size_t& o_dataSize )
{
errlHndl_t errhdl = NULL;
TRACFCOMP( g_trac_runtime, "RUNTIME::get_host_data_section( i_section=%d, i_instance=%d )", i_section, i_instance );
@@ -460,6 +469,13 @@ errlHndl_t RUNTIME::get_host_data_section( SectionId i_section,
// Force the answer to zero in case of failure
o_dataAddr = 0;
+ //Always force a load (mapping)
+ errhdl = loadHostData();
+ if(errhdl)
+ {
+ break;
+ }
+
TARGETING::Target * sys = NULL;
TARGETING::targetService().getTopLevelTarget( sys );
assert(sys != NULL);
@@ -498,9 +514,7 @@ errlHndl_t RUNTIME::get_host_data_section( SectionId i_section,
}
// Go fetch the relative zero address that PHYP uses
- TARGETING::ATTR_PAYLOAD_BASE_type payload_base
- = sys->getAttr<TARGETING::ATTR_PAYLOAD_BASE>();
- payload_base = payload_base*MEGABYTE;
+ uint64_t payload_base = reinterpret_cast<uint64_t>(iv_payload_addr);
// Everything starts at the NACA
// The NACA is part of the platform dependent LID which
@@ -823,6 +837,33 @@ errlHndl_t RUNTIME::get_host_data_section( SectionId i_section,
return errhdl;
}
+/********************
+ Public Methods
+ ********************/
+
+/**
+ * @brief Add the host data mainstore location to VMM
+ */
+errlHndl_t load_host_data( void )
+{
+ return Singleton<hdatService>::instance().loadHostData();
+}
+
+
+/**
+ * @brief Get a pointer to the beginning of a particular section of
+ * the host data memory.
+ */
+errlHndl_t get_host_data_section( SectionId i_section,
+ uint64_t i_instance,
+ uint64_t& o_dataAddr,
+ size_t& o_dataSize )
+{
+ return Singleton<hdatService>::instance().
+ getHostDataSection(i_section,i_instance, o_dataAddr, o_dataSize);
+}
+
+};
/********************
Private/Protected Methods
diff --git a/src/usr/runtime/hdatservice.H b/src/usr/runtime/hdatservice.H
new file mode 100644
index 000000000..f5e3bf8ae
--- /dev/null
+++ b/src/usr/runtime/hdatservice.H
@@ -0,0 +1,133 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/runtime/hdatservice.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2013 */
+/* */
+/* 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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __RUNTIME_HDATSERVICE_H
+#define __RUNTIME_HDATSERVICE_H
+
+#include <sys/sync.h>
+#include <util/locked/list.H>
+#include <list>
+#include <errl/errlentry.H>
+#include <usr/devicefw/driverif.H>
+#include <attributestructs.H>
+#include <sys/task.h>
+#include <usr/fsi/fsiif.H>
+
+namespace RUNTIME
+{
+ /** @file hdatservice.H
+ * @brief Provides the definition of the HDAT Service class
+ */
+
+ /**
+ * Class to service HDAT data
+ * there will be a single instance within hostboot
+ */
+ class hdatService
+ {
+ public:
+
+ /**
+ * @brief Add the host data mainstore location to VMM
+ *
+ * @description If running with the standard PHYP payload this function
+ * will map all supported HDAT sections into the VMM to allow access
+ * from user space. When running in standalone (no payload) mode,
+ * some reserved memory will be mapped in for testcases. If AVPs are
+ * enabled, no memory will be mapped and the PAYLOAD_KIND attribute
+ * will be set appropriately.
+ *
+ * @return errlHndl_t NULL on success
+ */
+ errlHndl_t loadHostData( void );
+
+ /**
+ * @brief Get a pointer to the beginning of a particular section of
+ * the host data memory.
+ *
+ * @description The returned pointer will not include any hdat header
+ * information.
+ *
+ * @param[in] i_section Chunk of data to find
+ * @param[in] i_instance Instance of section when there are multiple
+ * entries
+ * @param[out] o_dataAddr Virtual memory address of data
+ * @param[out] o_dataSize Size of data in bytes, 0 on error,
+ * DATA_SIZE_UNKNOWN if unknown
+ *
+ * @return errlHndl_t NULL on success
+ */
+ errlHndl_t getHostDataSection( SectionId i_section,
+ uint64_t i_instance,
+ uint64_t& o_dataAddr,
+ size_t& o_dataSize );
+
+
+ protected:
+ /**
+ * @brief Constructor
+ */
+ hdatService();
+
+
+ /**
+ * @brief Destructor
+ */
+ ~hdatService();
+
+ /**
+ * @brief Retrieve hardcoded section addresses for standalone mode
+ *
+ * This is here to allow us to manually generate attribute data for
+ * the HostServices code without requiring a full FipS/PHYP boot.
+ *
+ * @param[in] i_section Chunk of data to find
+ * @param[in] i_instance Instance of section when there are multiple
+ * entries
+ * @param[out] o_dataAddr Virtual memory address of data
+ * @param[out] o_dataSize Size of data in bytes, 0 on error,
+ * DATA_SIZE_UNKNOWN if unknown
+ *
+ * @return errlHndl_t NULL on success
+ */
+ errlHndl_t get_standalone_section( RUNTIME::SectionId i_section,
+ uint64_t i_instance,
+ uint64_t& o_dataAddr,
+ size_t& o_dataSize );
+
+ private:
+
+ /********************************************
+ * VARIABLES
+ ********************************************/
+
+ /**
+ * Virtual address to payload base addr
+ (HDAT area is offset from there)
+ */
+ void * iv_payload_addr;
+ void * iv_dumptest_addr;
+
+ };
+
+};
+#endif
OpenPOWER on IntegriCloud