summaryrefslogtreecommitdiffstats
path: root/src/usr/runtime/test
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2012-10-19 13:24:04 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-12-13 15:11:25 -0600
commitca661f64019de70c4e18060d8bf67b143f6b7376 (patch)
tree5481c8e3d17969c3d837f2e44d70447b556e7a75 /src/usr/runtime/test
parent219b91a0ae64a987471cfe07e669bb55d70cf594 (diff)
downloadtalos-hostboot-ca661f64019de70c4e18060d8bf67b143f6b7376.tar.gz
talos-hostboot-ca661f64019de70c4e18060d8bf67b143f6b7376.zip
Host Data Service
Implemented functions to load the Host Interface Data into memory and retrieve pointers to specific pieces of data therein. Verified in Murano and Tuleta configs. RTC: 49509 Change-Id: I18b44cd53f2cab91b83ecad283b998783e275d4f Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2367 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: Terry J. Opie <opiet@us.ibm.com> Reviewed-by: Melissa J. Connell <missyc@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/runtime/test')
-rw-r--r--src/usr/runtime/test/hdatservicetest.H308
-rw-r--r--src/usr/runtime/test/runtimeattrstest.H31
2 files changed, 330 insertions, 9 deletions
diff --git a/src/usr/runtime/test/hdatservicetest.H b/src/usr/runtime/test/hdatservicetest.H
new file mode 100644
index 000000000..8d5dd72de
--- /dev/null
+++ b/src/usr/runtime/test/hdatservicetest.H
@@ -0,0 +1,308 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/runtime/test/hdatservicetest.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 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 __TEST_HDATSERVICETEST_H
+#define __TEST_HDATSERVICETEST_H
+
+/**
+ * @file runtimetest.H
+ *
+ */
+
+#include <cxxtest/TestSuite.H>
+
+#include <arch/ppc.H> //for MAGIC
+#include <errl/errlmanager.H>
+#include <runtime/runtime.H>
+#include <targeting/common/commontargeting.H>
+#include <attributeenums.H>
+#include "../hdatstructs.H"
+
+extern trace_desc_t* g_trac_runtime;
+
+class HdatServiceTest: public CxxTest::TestSuite
+{
+ public:
+ void testHdat(void)
+ {
+ TRACFCOMP( g_trac_runtime, "testHdat> start" );
+ errlHndl_t errhdl = NULL;
+
+ // Figure out if we expect to have this data or not
+ TARGETING::Target * sys = NULL;
+ TARGETING::targetService().getTopLevelTarget( sys );
+ assert(sys != NULL);
+ TARGETING::ATTR_PAYLOAD_KIND_type payload_kind =
+ sys->getAttr<TARGETING::ATTR_PAYLOAD_KIND>();
+
+ // Verify something in the system parms
+ uint64_t sys_parms_addr = 0;
+ size_t sys_parms_size = 0;
+ errhdl = RUNTIME::get_host_data_section(
+ RUNTIME::IPLPARMS_SYSTEM,
+ 0,
+ sys_parms_addr,
+ sys_parms_size );
+ if( payload_kind == TARGETING::PAYLOAD_KIND_PHYP )
+ {
+ if( errhdl )
+ {
+ TS_FAIL("testHdat> Error trying to locate IPLPARMS_SYSTEM");
+ errlCommit(errhdl,RUNTIME_COMP_ID);
+ }
+ else if( sys_parms_addr == 0 )
+ {
+ TS_FAIL("testHdat> NULL returned for get_host_data_section(IPLPARMS_SYSTEM)");
+ }
+ else if( (sys_parms_size < sizeof(hdatSysParms_t))
+ || (sys_parms_size == RUNTIME::DATA_SIZE_UNKNOWN) )
+ {
+ TS_FAIL("testHdat> Size of IPLPARMS_SYSTEM data too small");
+ }
+ else
+ {
+ hdatSysParms_t* sys_parms = reinterpret_cast<hdatSysParms_t*>(sys_parms_addr);
+
+ uint32_t pvr = sys_parms->hdatEffectivePvr;
+ TRACFCOMP( g_trac_runtime, "PVR=%.8X", pvr );
+
+ TARGETING::Target* procmaster = NULL;
+ TARGETING::targetService().masterProcChipTargetHandle( procmaster );
+ assert( procmaster != NULL );
+ TARGETING::ATTR_MODEL_type model =
+ procmaster->getAttr<TARGETING::ATTR_MODEL>();
+
+ if( (model == TARGETING::MODEL_MURANO)
+ && !((pvr & 0x00FF0000) == 0x004B0000) )
+ {
+ TS_FAIL("testHdat> PVR model != 4B for Murano");
+ }
+ else if( (model == TARGETING::MODEL_VENICE)
+ && !((pvr & 0x00FF0000) == 0x004D0000) )
+ {
+ TS_FAIL("testHdat> PVR model != 4D for Venice");
+ }
+ }
+ }
+ else
+ {
+ if( !errhdl )
+ {
+ TS_FAIL("testHdat> Did not get expected error trying to locate IPLPARMS_SYSTEM for non-PHYP Payload");
+ }
+ else
+ {
+ delete errhdl;
+ }
+ }
+
+
+
+ // Verify the HostServices Node Data
+ uint64_t node_data_addr = 0;
+ size_t node_data_size = 0;
+ errhdl = RUNTIME::get_host_data_section(
+ RUNTIME::HSVC_NODE_DATA,
+ 0,
+ node_data_addr,
+ node_data_size );
+ if( errhdl
+ && ((payload_kind == TARGETING::PAYLOAD_KIND_PHYP)
+ || (payload_kind == TARGETING::PAYLOAD_KIND_NONE)) )
+ {
+ TS_FAIL("testHdat> Error trying to locate HSVC_NODE_DATA");
+ errlCommit(errhdl,RUNTIME_COMP_ID);
+ }
+ else if( !errhdl
+ && (payload_kind != TARGETING::PAYLOAD_KIND_PHYP)
+ && (payload_kind != TARGETING::PAYLOAD_KIND_NONE) )
+ {
+ TS_FAIL("testHdat> Did not get expected error trying to locate HSVC_NODE_DATA for non-PHYP/Standalone Payload");
+ }
+ else if( (node_data_addr == 0)
+ && (payload_kind != TARGETING::PAYLOAD_KIND_PHYP)
+ && (payload_kind != TARGETING::PAYLOAD_KIND_NONE) )
+ {
+ TS_FAIL("testHdat> NULL or zero size returned for get_host_data_section(HSVC_NODE_DATA)");
+ }
+ else if( (node_data_size == 0)
+ || (node_data_size == RUNTIME::DATA_SIZE_UNKNOWN) )
+ {
+ TS_FAIL("testHdat> Size of HSVC_NODE_DATA is unexpected");
+ }
+ if( errhdl )
+ {
+ delete errhdl;
+ }
+
+
+ // Verify the HostServices System Data
+ uint64_t sys_data_addr = 0;
+ size_t sys_data_size = 0;
+ errhdl = RUNTIME::get_host_data_section(
+ RUNTIME::HSVC_SYSTEM_DATA,
+ 0,
+ sys_data_addr,
+ sys_data_size );
+ if( errhdl
+ && ((payload_kind == TARGETING::PAYLOAD_KIND_PHYP)
+ || (payload_kind == TARGETING::PAYLOAD_KIND_NONE)) )
+ {
+ TS_FAIL("testHdat> Error trying to locate HSVC_SYSTEM_DATA");
+ errlCommit(errhdl,RUNTIME_COMP_ID);
+ }
+ else if( !errhdl
+ && (payload_kind != TARGETING::PAYLOAD_KIND_PHYP)
+ && (payload_kind != TARGETING::PAYLOAD_KIND_NONE) )
+ {
+ TS_FAIL("testHdat> Did not get expected error trying to locate HSVC_SYSTEM_DATA for non-PHYP/Standalone Payload");
+ }
+ else if( ((sys_data_addr == 0) || (sys_data_size == 0))
+ && (payload_kind != TARGETING::PAYLOAD_KIND_PHYP)
+ && (payload_kind != TARGETING::PAYLOAD_KIND_NONE) )
+ {
+ TS_FAIL("testHdat> NULL or zero size returned for get_host_data_section(HSVC_SYSTEM_DATA)");
+ }
+ else if( (sys_data_size == 0)
+ || (sys_data_size == RUNTIME::DATA_SIZE_UNKNOWN) )
+ {
+ TS_FAIL("testHdat> Size of HSVC_SYSTEM_DATA is unexpected");
+ }
+ if( errhdl )
+ {
+ delete errhdl;
+ }
+
+ // Verify the Dump Tables
+ uint64_t dump_addr = 0;
+ size_t dump_size = 0;
+ errhdl = RUNTIME::get_host_data_section(
+ RUNTIME::MS_DUMP_SRC_TBL,
+ 0,
+ dump_addr,
+ dump_size );
+ if( errhdl && (payload_kind == TARGETING::PAYLOAD_KIND_PHYP) )
+ {
+ if( errhdl )
+ {
+ TS_FAIL("testHdat> Error trying to locate MS_DUMP_SRC_TBL");
+ errlCommit(errhdl,RUNTIME_COMP_ID);
+ }
+ else if( dump_addr == 0 )
+ {
+ TS_FAIL("testHdat> NULL returned for get_host_data_section(MS_DUMP_SRC_TBL)");
+ }
+ else if( dump_size < 16 ) //1 entry is 16 bytes
+ {
+ TRACFCOMP( g_trac_runtime, "testHdat> dump_size=%d", dump_size );
+ TS_FAIL("testHdat> Size of MS_DUMP_SRC_TBL data too small");
+ }
+ }
+ else
+ {
+ if( !errhdl )
+ {
+ TS_FAIL("testHdat> Did not get expected error trying to locate MS_DUMP_SRC_TBL for non-PHYP Payload");
+ }
+ else
+ {
+ delete errhdl;
+ }
+ }
+
+ errhdl = RUNTIME::get_host_data_section(
+ RUNTIME::MS_DUMP_DST_TBL,
+ 0,
+ dump_addr,
+ dump_size );
+ if( errhdl && (payload_kind == TARGETING::PAYLOAD_KIND_PHYP) )
+ {
+ if( errhdl )
+ {
+ TS_FAIL("testHdat> Error trying to locate MS_DUMP_DST_TBL");
+ errlCommit(errhdl,RUNTIME_COMP_ID);
+ }
+ else if( dump_addr == 0 )
+ {
+ TS_FAIL("testHdat> NULL returned for get_host_data_section(MS_DUMP_DST_TBL)");
+ }
+ else if( dump_size < 16 ) //1 entry is 16 bytes
+ {
+ TRACFCOMP( g_trac_runtime, "testHdat> dump_size=%d", dump_size );
+ TS_FAIL("testHdat> Size of MS_DUMP_DST_TBL data too small");
+ }
+ }
+ else
+ {
+ if( !errhdl )
+ {
+ TS_FAIL("testHdat> Did not get expected error trying to locate MS_DUMP_DST_TBL for non-PHYP Payload");
+ }
+ else
+ {
+ delete errhdl;
+ }
+ }
+
+ errhdl = RUNTIME::get_host_data_section(
+ RUNTIME::MS_DUMP_RESULTS_TBL,
+ 0,
+ dump_addr,
+ dump_size );
+ if( errhdl && (payload_kind == TARGETING::PAYLOAD_KIND_PHYP) )
+ {
+ if( errhdl )
+ {
+ TS_FAIL("testHdat> Error trying to locate MS_DUMP_RESULTS_TBL");
+ errlCommit(errhdl,RUNTIME_COMP_ID);
+ }
+ else if( dump_addr == 0 )
+ {
+ TS_FAIL("testHdat> NULL returned for get_host_data_section(MS_DUMP_RESULTS_TBL)");
+ }
+ else if( dump_size < 16 ) //1 entry is 16 bytes
+ {
+ TRACFCOMP( g_trac_runtime, "testHdat> dump_size=%d", dump_size );
+ TS_FAIL("testHdat> Size of MS_DUMP_RESULTS_TBL data too small");
+ }
+ }
+ else
+ {
+ if( !errhdl )
+ {
+ TS_FAIL("testHdat> Did not get expected error trying to locate MS_DUMP_RESULTS_TBL for non-PHYP Payload");
+ }
+ else
+ {
+ delete errhdl;
+ }
+ }
+
+
+ TRACFCOMP( g_trac_runtime, "testHdat> finish" );
+ }
+
+};
+
+
+#endif
+
diff --git a/src/usr/runtime/test/runtimeattrstest.H b/src/usr/runtime/test/runtimeattrstest.H
index 435c6bee6..76ccbac01 100644
--- a/src/usr/runtime/test/runtimeattrstest.H
+++ b/src/usr/runtime/test/runtimeattrstest.H
@@ -20,11 +20,11 @@
/* Origin: 30 */
/* */
/* IBM_PROLOG_END_TAG */
-#ifndef __TEST_RUNTIMETEST_H
-#define __TEST_RUNTIMETEST_H
+#ifndef __TEST_RUNTIMEATTRSTEST_H
+#define __TEST_RUNTIMEATTRSTEST_H
/**
- * @file runtimetest.H
+ * @file runtimeattrstest.H
*
*/
@@ -45,7 +45,7 @@ extern trace_desc_t* g_trac_runtime;
using namespace fapi;
-class RuntimeTest: public CxxTest::TestSuite
+class RuntimeAttrsTest: public CxxTest::TestSuite
{
public:
void testVerifySystemAttributes(void)
@@ -302,7 +302,7 @@ class RuntimeTest: public CxxTest::TestSuite
{
TS_FAIL("Error getting fapi::ATTR_CHIP_UNIT_POS");
errlHndl_t errhdl = fapiRcToErrl(l_rc);
- errlCommit(errhdl,CXXTEST_COMP_ID);
+ errlCommit(errhdl,RUNTIME_COMP_ID);
}
fapi::ATTR_FUNCTIONAL_Type tmp2 = 0;
@@ -311,7 +311,7 @@ class RuntimeTest: public CxxTest::TestSuite
{
TS_FAIL("Error getting fapi::ATTR_FUNCTIONAL");
errlHndl_t errhdl = fapiRcToErrl(l_rc);
- errlCommit(errhdl,CXXTEST_COMP_ID);
+ errlCommit(errhdl,RUNTIME_COMP_ID);
}
uint64_t attr = 0;
@@ -373,14 +373,27 @@ class RuntimeTest: public CxxTest::TestSuite
}
private:
- //@fixme RTC:49509
hsvc_system_data_t* getSysPtr(void)
{
- return( (hsvc_system_data_t*)(64*MEGABYTE) );
+ errlHndl_t errhdl = NULL;
+ uint64_t sys_data_addr = 0;
+ size_t sys_data_size = 0;
+ errhdl = RUNTIME::get_host_data_section(RUNTIME::HSVC_SYSTEM_DATA,
+ 0,
+ sys_data_addr,
+ sys_data_size );
+ return( (hsvc_system_data_t*)(sys_data_addr) );
};
hsvc_node_data_t* getNodePtr(void)
{
- return( (hsvc_node_data_t*)(64*MEGABYTE+512*KILOBYTE) );
+ errlHndl_t errhdl = NULL;
+ uint64_t node_data_addr = 0;
+ size_t node_data_size = 0;
+ errhdl = RUNTIME::get_host_data_section(RUNTIME::HSVC_NODE_DATA,
+ 0,
+ node_data_addr,
+ node_data_size );
+ return( (hsvc_node_data_t*)(node_data_addr) );
};
//utility to fetch a proc target based on a procid
OpenPOWER on IntegriCloud