summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarty Gloff <mgloff@us.ibm.com>2017-03-14 16:49:25 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-04-30 00:07:49 -0400
commit4dfeb42e05752fb81b699cb7022677d5511f664b (patch)
treebd8ed6d0cf493bb8669e02e9372d130ef1a808e8
parent75d116c859dfac3cf279fb99c35a8e18fb44c2db (diff)
downloadblackbird-hostboot-4dfeb42e05752fb81b699cb7022677d5511f664b.tar.gz
blackbird-hostboot-4dfeb42e05752fb81b699cb7022677d5511f664b.zip
SBE message passing interface - Testing
Create testcase to test SBE message passing. Change-Id: I596115d96d989dbee41070c4b9e419d2043494ae RTC: 170764 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38170 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r--src/makefile1
-rw-r--r--src/usr/runtime/populate_hbruntime.C7
-rw-r--r--src/usr/sbeio/runtime/makefile2
-rw-r--r--src/usr/sbeio/runtime/rt_sbeio.C6
-rw-r--r--src/usr/sbeio/runtime/test/makefile36
-rw-r--r--src/usr/sbeio/runtime/test/sbeiotestRt.H1307
-rw-r--r--src/usr/testcore/rtloader/loader.H61
7 files changed, 1417 insertions, 3 deletions
diff --git a/src/makefile b/src/makefile
index 92c578055..bfa05ca9b 100644
--- a/src/makefile
+++ b/src/makefile
@@ -313,6 +313,7 @@ RUNTIME_TESTCASE_MODULES += testpnor_rt
RUNTIME_TESTCASE_MODULES += testfapi2_rt
RUNTIME_TESTCASE_MODULES += testsecureboot_rt
RUNTIME_TESTCASE_MODULES += testtargeting_rt
+RUNTIME_TESTCASE_MODULES += testsbeio_rt
RELOCATABLE_IMAGE_LDFLAGS = -pie --export-dynamic
diff --git a/src/usr/runtime/populate_hbruntime.C b/src/usr/runtime/populate_hbruntime.C
index 93ed6e4ee..56c320193 100644
--- a/src/usr/runtime/populate_hbruntime.C
+++ b/src/usr/runtime/populate_hbruntime.C
@@ -1042,6 +1042,13 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId)
traceHbRsvMemRange(l_rngPtr);
+ // Loop through all functional Procs
+ for (const auto & l_procChip: l_procChips)
+ {
+ l_procChip->setAttr<TARGETING::ATTR_SBE_COMM_ADDR>(l_sbeCommAddr);
+
+ }
+
// SBE FFDC entry
uint64_t l_sbeffdcAddr = 0x0;
diff --git a/src/usr/sbeio/runtime/makefile b/src/usr/sbeio/runtime/makefile
index 08661336f..aa5251764 100644
--- a/src/usr/sbeio/runtime/makefile
+++ b/src/usr/sbeio/runtime/makefile
@@ -33,4 +33,6 @@ MODULE = sbeio_rt
## Objects unique to HBRT
OBJS += rt_sbeio.o
+SUBDIRS += test.d
+
include ${ROOTPATH}/config.mk
diff --git a/src/usr/sbeio/runtime/rt_sbeio.C b/src/usr/sbeio/runtime/rt_sbeio.C
index b8423f3a3..949b3c5d8 100644
--- a/src/usr/sbeio/runtime/rt_sbeio.C
+++ b/src/usr/sbeio/runtime/rt_sbeio.C
@@ -243,7 +243,7 @@ namespace RT_SBEIO
* @reasoncode SBEIO::SBEIO_RT_DATA_OFFSET_TOO_SMALL
* @userdata1[0:31] Processor HUID
* @userdata1[32:63] Data Offset
- * @userdata2 Reserved
+ * @userdata2 Minimum Data Offset
*
* @devdesc SBEIO RT Read Pass-through command data offset
* is too small.
@@ -255,7 +255,7 @@ namespace RT_SBEIO
TWO_UINT32_TO_UINT64(
get_huid(i_proc),
i_sbeMessage.cmdHdr.dataOffset),
- 0);
+ sizeof(cmdHeader_t));
errl->addFFDC( SBE_COMP_ID,
&(i_sbeMessage),
@@ -424,7 +424,7 @@ namespace RT_SBEIO
HWAS::SRCI_PRIORITY_HIGH);
errl->collectTrace(SBEIO_COMP_NAME);
}
- else if(o_response.cmdHdr.dataSize > SBE_MSG_MAX_DATA)
+ else if(o_response.cmdHdr.dataSize > SBE_MSG_MAX_DATA)
{
TRACFCOMP(g_trac_sbeio, ERR_MRK"process_sbe_msg: process "
"command, response data size 0x%08x too large",
diff --git a/src/usr/sbeio/runtime/test/makefile b/src/usr/sbeio/runtime/test/makefile
new file mode 100644
index 000000000..e6219b414
--- /dev/null
+++ b/src/usr/sbeio/runtime/test/makefile
@@ -0,0 +1,36 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/sbeio/runtime/test/makefile $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2017
+# [+] 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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+# IBM_PROLOG_END_TAG
+
+HOSTBOOT_RUNTIME = 1
+
+ROOTPATH = ../../../../..
+
+MODULE = testsbeio_rt
+
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/common/include/
+
+TESTS = *.H
+
+include ${ROOTPATH}/config.mk
diff --git a/src/usr/sbeio/runtime/test/sbeiotestRt.H b/src/usr/sbeio/runtime/test/sbeiotestRt.H
new file mode 100644
index 000000000..dcb5ddfeb
--- /dev/null
+++ b/src/usr/sbeio/runtime/test/sbeiotestRt.H
@@ -0,0 +1,1307 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/sbeio/runtime/test/sbeiotestRt.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2017 */
+/* [+] 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. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __TEST_SBEIOTESTRT_H
+#define __TEST_SBEIOTESTRT_H
+
+/**
+ * @file SbeiotestRt.H
+ *
+ * @brief Unit test for runtime process SBE messages.
+ */
+
+#include <cxxtest/TestSuite.H>
+#include <runtime/interface.h>
+#include <sbeio/runtime/sbe_msg_passing.H>
+#include <sbeio/sbeioreasoncodes.H>
+#include <runtime/rt_targeting.H>
+#include <targeting/common/utilFilter.H>
+#include <errl/errlmanager.H>
+#include <devicefw/userif.H>
+
+//trace
+extern trace_desc_t* g_trac_sbeio;
+
+//#define cmpSbeHdr and cmpCmdHdr
+#define cmpSbeHdr(actMsg, expMsg) \
+ (((actMsg).sbeHdr.version != (expMsg).sbeHdr.version) || \
+ ((actMsg).sbeHdr.msgSize != (expMsg).sbeHdr.msgSize) || \
+ ((actMsg).sbeHdr.seqId != (expMsg).sbeHdr.seqId))
+
+#define cmpCmdHdr(actMsg, expMsg) \
+ (((actMsg).cmdHdr.version != (expMsg).cmdHdr.version) || \
+ ((actMsg).cmdHdr.command != (expMsg).cmdHdr.command) || \
+ ((actMsg).cmdHdr.dataOffset != (expMsg).cmdHdr.dataOffset) || \
+ ((actMsg).cmdHdr.dataSize != (expMsg).cmdHdr.dataSize) || \
+ ((actMsg).cmdHdr.status != (expMsg).cmdHdr.status))
+
+
+using namespace TARGETING;
+using namespace SBE_MSG;
+using namespace CxxTest;
+
+// Constants for SBE Message bits in SCOM_ADDR_5003B
+const uint32_t SCOM_ADDR_5003B = 0x0005003B; // CFAM Reg 0x283B
+const uint32_t SBE_MSG_IN_PROGRESS = 0x40000000;
+const uint32_t SBE_MSG_COMPLETE = 0x80000000;
+const uint32_t SBE_MSG_MASK = SBE_MSG_COMPLETE | SBE_MSG_IN_PROGRESS;
+
+/**
+ * @brief SbeMessagePassingRtTest Unit test for runtime SBE message passing.
+ */
+class SbeMessagePassingRtTest : public CxxTest::TestSuite
+{
+ public:
+ uint32_t iv_seqId = 0;
+
+ /**
+ * @brief initSbeMessagePassing.
+ *
+ * @param[out] o_request Pass-through command request
+ * @param[out] o_expected_response Expected pass-through cmd response
+ * @param[out] o_chipId Processor target chip ID
+ * @param[out] o_sbeCommAddr Address of SBE Communication buffer
+ * @param[out] o_rt_intf Pointer to runtime interfaces
+ *
+ * @return Return Code O if Successful, otherwise not 0.
+ */
+ int initSbeMessagePassing(sbeMessage_t& o_request,
+ sbeMessage_t& o_expected_response,
+ RT_TARG::rtChipId_t& o_chipId,
+ uint64_t& o_sbeCommAddr,
+ runtimeInterfaces_t **o_rt_intf)
+ {
+ // Test init entry
+ TRACDCOMP(g_trac_sbeio, ENTER_MRK "SbeMessagePassingRtTest::"
+ "initSbeMessagePassing");
+
+ int rc = 0;
+
+ const uint32_t l_req_dataSize = 0xC;
+ o_request.sbeHdr.version = SBEHDRVER_LATEST;
+ o_request.sbeHdr.msgSize =
+ sizeof(sbeHeader_t) + sizeof(cmdHeader_t) + l_req_dataSize;
+ o_request.sbeHdr.seqId = ++iv_seqId;
+ o_request.cmdHdr.version = CMDHDRVER_LATEST;
+ o_request.cmdHdr.status = 0; // Gets used as test option
+ o_request.cmdHdr.dataOffset =
+ reinterpret_cast<uint64_t>(&(o_request.data))
+ - reinterpret_cast<uint64_t>(&(o_request.cmdHdr));
+ o_request.cmdHdr.dataSize = l_req_dataSize;
+ o_request.cmdHdr.command = PASSTHRU_SET_OCC_STATE;
+ // Set pointer to request data as words
+ uint32_t *o_req_data =
+ reinterpret_cast<uint32_t*>(&o_request.data[0]);
+ o_request.data[0] = 0;
+ o_request.data[1] = 0xE0; // Command class = HTMGT Messages
+ o_request.data[2] = 0;
+ o_request.data[3] = 0x01; // Command = Generic HTMGT Message
+ o_req_data[1] = iv_seqId;
+ o_req_data[2] = 0;
+
+
+ const uint32_t l_rsp_dataSize = 0;
+ o_expected_response.sbeHdr.version = o_request.sbeHdr.version;
+ o_expected_response.sbeHdr.msgSize =
+ sizeof(sbeHeader_t) + sizeof(cmdHeader_t) + l_rsp_dataSize;
+ o_expected_response.sbeHdr.seqId = o_request.sbeHdr.seqId;
+ o_expected_response.cmdHdr.version = o_request.cmdHdr.version;
+ o_expected_response.cmdHdr.status = 0;
+ o_expected_response.cmdHdr.dataOffset =
+ reinterpret_cast<uint64_t>(&(o_expected_response.data))
+ - reinterpret_cast<uint64_t>(&(o_expected_response.cmdHdr));
+ o_expected_response.cmdHdr.dataSize = l_rsp_dataSize;
+ o_expected_response.cmdHdr.command = o_request.cmdHdr.command;
+
+ do
+ {
+ TargetHandleList procList;
+ getAllChips( procList, TYPE_PROC, true );
+
+ // Get the first functional proc
+ if(0 == procList.size())
+ {
+ rc = -1;
+ TS_FAIL("Not able to get Functional proc");
+ break;
+ }
+ TargetHandle_t proc = procList[0];
+
+ // Get the chip ID for the proc
+ RT_TARG::rtChipId_t o_chipId = 0;
+ errlHndl_t err = RT_TARG::getRtTarget(proc, o_chipId);
+ if(nullptr != err)
+ {
+ rc = -1;
+ TS_FAIL("getRtTarget() failed for 0x%08X",
+ get_huid(proc));
+ errlCommit(err, SBEIO_COMP_ID);
+ break;
+ }
+
+ // Get the address of the SBE Communication area
+ o_sbeCommAddr = proc->getAttr<TARGETING::ATTR_SBE_COMM_ADDR>();
+ if(NULL == o_sbeCommAddr)
+ {
+ TS_INFO("SBE Communication area not available from "
+ "SBE_COMM_ADDR attribute");
+ uint64_t l_instance = proc->getAttr<ATTR_POSITION>();
+ o_sbeCommAddr =
+ g_hostInterfaces->get_reserved_mem("ibm,sbe-comm",
+ l_instance);
+ if(NULL == o_sbeCommAddr)
+ {
+ rc = -1;
+ TS_FAIL("Not able to get SBE Communication area");
+ break;
+ }
+ }
+
+ // Get the runtime interface object
+ *o_rt_intf = getRuntimeInterfaces();
+ if(nullptr == *o_rt_intf)
+ {
+ rc = -1;
+ TS_FAIL("Not able to get run time interface object");
+ break;
+ }
+ }while (0);
+
+ // Test init exit
+ TRACDCOMP(g_trac_sbeio, EXIT_MRK "SbeMessagePassingRtTest::"
+ "initSbeMessagePassing");
+
+ return rc;
+ }
+
+ /**
+ * @brief Function to process Set OCC State pass-through command
+ *
+ * @param[in] i_procTgt HB processor target
+ * @param[in] i_reqDataSize Pass-through command request data size
+ * @param[in] i_reqData Pass-through command request data
+ * @param[out] o_rspStatus Pass-through command response status
+ * @param[out] o_rspDataSize Pass-through command response data size
+ * @param[out] o_rspData Pass-through command response data
+ *
+ * @return errlHndl_t Error log handle on failure.
+ */
+ static
+ errlHndl_t processSetOCCState(TARGETING::TargetHandle_t i_procTgt,
+ uint32_t i_reqDataSize,
+ uint8_t *i_reqData,
+ uint32_t *o_rspStatus,
+ uint32_t *o_rspDataSize,
+ uint8_t *o_rspData)
+ {
+ errlHndl_t l_errl = nullptr;
+
+ // Get pointers to full request and response buffers
+ sbeMessage_t *l_request =
+ reinterpret_cast<sbeMessage_t*>(i_reqData - sizeof(sbeHeader_t)
+ - sizeof(cmdHeader_t));
+ sbeMessage_t *l_response =
+ reinterpret_cast<sbeMessage_t*>(o_rspData - sizeof(sbeHeader_t)
+ - sizeof(cmdHeader_t));
+
+ // Get status field from request and use as a test option
+ uint32_t l_testOption = l_request->cmdHdr.status;
+ if(l_testOption)
+ {
+ TRACDCOMP(g_trac_sbeio,
+ "processSetOCCState: l_testOption %d",
+ l_testOption);
+
+ TRACDBIN( g_trac_sbeio,
+ "processSetOCCState: request",
+ l_request,
+ l_request->sbeHdr.msgSize);
+ }
+
+ // Set default returns
+ *o_rspStatus = 0;
+ *o_rspDataSize = 0;
+
+ switch(l_testOption)
+ {
+ // Return with excess response data size
+ case 1:
+ *o_rspDataSize = SBE_MSG_SIZE;
+ break;
+
+ // Return with an error log
+ case 2:
+ l_errl = new
+ ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ SBEIO::SBEIO_RUNTIME,
+ SBEIO::SBEIO_INVALID_REASONCODE,
+ 0,
+ 0);
+ break;
+
+ // Return with generic failure status
+ case 3:
+ *o_rspStatus = 0xFE;
+ break;
+
+ // Return with altered SBE Header version
+ case 4:
+ l_response->sbeHdr.version = 0x11110000;
+ break;
+
+ // Return with altered SBE Header sequence ID
+ case 5:
+ l_response->sbeHdr.seqId += 1;
+ break;
+
+ // Return with altered Command Header version
+ case 6:
+ l_response->cmdHdr.version += 1;
+ break;
+
+ // Return with altered Command Header command
+ case 7:
+ l_response->cmdHdr.command = PASSTHRU_GET_PSTATE;
+ break;
+
+ // Normal processing
+ case 0:
+ default:
+ // Just use default returns
+ break;
+ }
+
+ if(l_testOption)
+ {
+ TRACDCOMP(g_trac_sbeio,
+ "processSetOCCState: response %p",
+ l_response);
+
+ TRACDBIN( g_trac_sbeio,
+ "processSetOCCState: response",
+ l_response,
+ l_response->sbeHdr.msgSize);
+ }
+
+ return l_errl;
+ }
+
+ /**
+ * @brief checkResetSbeMessagePassingCFAM.
+ *
+ * @param[in] i_procChipId Processor target chip ID
+ * @param[in] i_checkMask Mask to check CFAM register against
+ * defaults to 0xC0000000
+ *
+ * @return Return Code O if Successful, otherwise not 0.
+ */
+ int checkResetSbeMessagePassingCFAM(RT_TARG::rtChipId_t i_procChipId,
+ uint32_t i_checkMask = SBE_MSG_MASK)
+ {
+ // Test check / reset CFAM entry
+ TRACDCOMP(g_trac_sbeio, ENTER_MRK "SbeMessagePassingRtTest::"
+ "checkResetSbeMessagePassingCFAM");
+
+ int rc = 0;
+ errlHndl_t errl = nullptr;
+
+ TARGETING::Target *l_proc;
+
+ uint32_t l_read_reg;
+ size_t l_size = sizeof(uint64_t);
+ // CFAM register SBE Message Passing bits
+ // bit 0 - Pass-through command complete
+ // bit 1 - Pass-through command in progress
+ const uint32_t l_mask = SBE_MSG_MASK;
+
+ do{
+ // Get TARGETING::Target for runtime chip_id (target)
+ errl = RT_TARG::getHbTarget(i_procChipId,
+ l_proc);
+
+ // Read SCOM_ADDR_5003B for target proc
+ errl = deviceRead(l_proc,
+ &l_read_reg,
+ l_size,
+ DEVICE_SCOM_ADDRESS(SCOM_ADDR_5003B));
+
+ if(errl)
+ {
+ TS_FAIL("Not able to read CFAM SCOM_ADDR_5003B");
+
+ break;
+ }
+
+ // Check CFAM register
+ if((l_read_reg & l_mask) != i_checkMask)
+ {
+ TS_FAIL("CFAM SCOM_ADDR_5003B set incorrectly, expected "
+ "0x%08x, but read 0x%08x",
+ (l_read_reg & ~l_mask) | i_checkMask,
+ l_read_reg);
+
+ break;
+ }
+
+ // Clear mask bit(s) in CFAM reg SCOM_ADDR_5003B
+ l_read_reg &= ~l_mask;
+
+ // Write SCOM_ADDR_5003B for target proc
+ errl = deviceWrite(l_proc,
+ &l_read_reg,
+ l_size,
+ DEVICE_SCOM_ADDRESS(SCOM_ADDR_5003B));
+
+ if(errl)
+ {
+ TS_FAIL("Not able to write CFAM SCOM_ADDR_5003B");
+
+ break;
+ }
+ }while(0);
+
+ // Test check / reset CFAM exit
+ TRACDCOMP(g_trac_sbeio, EXIT_MRK "SbeMessagePassingRtTest::"
+ "checkResetSbeMessagePassingCFAM");
+
+ return rc;
+ }
+
+ /**
+ * @brief testSbeMessagePassing Unit test for the
+ * SBE message passing versions.
+ */
+ void testSbeMessagePassingVersions(void)
+ {
+ // Test entry
+ TRACFCOMP(g_trac_sbeio, ENTER_MRK "SbeMessagePassingRtTest::"
+ "testSbeMessagePassingVersions");
+
+ sbeMessage_t l_request;
+ sbeMessage_t l_expected_response;
+ RT_TARG::rtChipId_t chipId = 0;
+ uint64_t l_sbeCommAddr = 0;
+ runtimeInterfaces_t *rt_intf = nullptr;
+
+ int rc = 0;
+
+ do
+ {
+ // Do initializations for SBE Message passing
+ rc = initSbeMessagePassing(l_request,
+ l_expected_response,
+ chipId,
+ l_sbeCommAddr,
+ &rt_intf);
+
+ // Change SBE Header version
+ l_request.sbeHdr.version += 1;
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0x2833 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "Testing SBE Header version for chipID: 0x%08X",
+ chipId);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId,
+ SBE_MSG_IN_PROGRESS);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected 0 for "
+ "CFAM register checking",
+ chipId, rc);
+ break;
+ }
+
+ // Restore SBE Header version
+ l_request.sbeHdr.version = SBEHDRVER_LATEST;
+
+ // Increment Total Tests
+ g_TotalTests++;
+
+ // Change SBE Header version
+ l_request.cmdHdr.version -= 1;
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0x2833 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "Testing Command Header version for chipID: 0x%08X",
+ chipId);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId,
+ SBE_MSG_IN_PROGRESS);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected 0 for "
+ "CFAM register checking",
+ chipId, rc);
+ break;
+ }
+ }while (0);
+
+ // Test exit
+ TRACFCOMP(g_trac_sbeio, EXIT_MRK "SbeMessagePassingRtTest::"
+ "testSbeMessagePassingVersions");
+ }
+
+ /**
+ * @brief testSbeMessagePassing Unit test for the
+ * SBE message passing message size.
+ */
+ void testSbeMessagePassingMsgSize(void)
+ {
+ // Test entry
+ TRACFCOMP(g_trac_sbeio, ENTER_MRK "SbeMessagePassingRtTest::"
+ "testSbeMessagePassingMsgSize");
+
+ sbeMessage_t l_request;
+ sbeMessage_t l_expected_response;
+ RT_TARG::rtChipId_t chipId = 0;
+ uint64_t l_sbeCommAddr = 0;
+ runtimeInterfaces_t *rt_intf = nullptr;
+
+ int rc = 0;
+
+ do
+ {
+ // Do initializations for SBE Message passing
+ rc = initSbeMessagePassing(l_request,
+ l_expected_response,
+ chipId,
+ l_sbeCommAddr,
+ &rt_intf);
+
+ // Change SBE Header message size
+ l_request.sbeHdr.msgSize = SBE_MSG_SIZE + 128;
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0x2834 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "Testing message size too large for chipID: 0x%08X",
+ chipId);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId,
+ SBE_MSG_IN_PROGRESS);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected 0 for "
+ "CFAM register checking",
+ chipId, rc);
+ break;
+ }
+ }while (0);
+
+ // Test exit
+ TRACFCOMP(g_trac_sbeio, EXIT_MRK "SbeMessagePassingRtTest::"
+ "testSbeMessagePassingMsgSize");
+ }
+
+ /**
+ * @brief testSbeMessagePassing Unit test for the
+ * SBE message passing data offset.
+ */
+ void testSbeMessagePassingDataOffset(void)
+ {
+ // Test entry
+ TRACFCOMP(g_trac_sbeio, ENTER_MRK "SbeMessagePassingRtTest::"
+ "testSbeMessagePassingDataOffset");
+
+ sbeMessage_t l_request;
+ sbeMessage_t l_expected_response;
+ RT_TARG::rtChipId_t chipId = 0;
+ uint64_t l_sbeCommAddr = 0;
+ runtimeInterfaces_t *rt_intf = nullptr;
+
+ int rc = 0;
+
+ do
+ {
+ // Do initializations for SBE Message passing
+ rc = initSbeMessagePassing(l_request,
+ l_expected_response,
+ chipId,
+ l_sbeCommAddr,
+ &rt_intf);
+
+ // Change Command Header data offset to be too small
+ l_request.cmdHdr.dataOffset = sizeof(cmdHeader_t) -
+ sizeof(l_request.cmdHdr.status);
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0x2835 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "Testing data offset too small for chipID: 0x%08X",
+ chipId);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId,
+ SBE_MSG_IN_PROGRESS);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected 0 for "
+ "CFAM register checking",
+ chipId, rc);
+ break;
+ }
+
+ // Increment Total Tests
+ g_TotalTests++;
+
+ // Change Command Header data offset to be too large
+ l_request.cmdHdr.dataOffset = sizeof(cmdHeader_t) + 1;
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0x2836 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "Testing data offset too large for chipID: 0x%08X,",
+ chipId);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId,
+ SBE_MSG_IN_PROGRESS);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected 0 for "
+ "CFAM register checking",
+ chipId, rc);
+ break;
+ }
+
+ // Restore Command Header data offset
+ l_request.cmdHdr.dataOffset = sizeof(cmdHeader_t);
+
+ // Increment Total Tests
+ g_TotalTests++;
+
+ // Change Command Header data size
+ l_request.cmdHdr.dataSize += 1;
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0x2836 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "Testing data size too large for chipID: 0x%08X",
+ chipId);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId,
+ SBE_MSG_IN_PROGRESS);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected 0 for "
+ "CFAM register checking",
+ chipId, rc);
+ break;
+ }
+
+ // Restore Command Header data size
+ l_request.cmdHdr.dataSize -= 1;
+
+ // Increment Total Tests
+ g_TotalTests++;
+
+ // Change SBE Header message size
+ l_request.sbeHdr.msgSize -= 1;
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0x2836 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected "
+ "-104 (0xFF98) SBEIO_RT_DATA_TOO_LARGE",
+ chipId, rc);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId,
+ SBE_MSG_IN_PROGRESS);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "Testing message size too small / data size too "
+ "large for chipID",
+ chipId);
+ break;
+ }
+ }while (0);
+
+ // Test exit
+ TRACFCOMP(g_trac_sbeio, EXIT_MRK "SbeMessagePassingRtTest::"
+ "testSbeMessagePassingDataOffset");
+ }
+
+ /**
+ * @brief testSbeMessagePassing Unit test for the
+ * SBE message passing function.
+ */
+ void testSbeMessagePassingFunction(void)
+ {
+ // Test entry
+ TRACFCOMP(g_trac_sbeio, ENTER_MRK "SbeMessagePassingRtTest::"
+ "testSbeMessagePassingFunction");
+
+ sbeMessage_t l_request;
+ sbeMessage_t l_expected_response;
+ RT_TARG::rtChipId_t chipId = 0;
+ uint64_t l_sbeCommAddr = 0;
+ runtimeInterfaces_t *rt_intf = nullptr;
+
+ int rc = 0;
+
+ do
+ {
+ // Do initializations for SBE Message passing
+ rc = initSbeMessagePassing(l_request,
+ l_expected_response,
+ chipId,
+ l_sbeCommAddr,
+ &rt_intf);
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0x2831 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "Testing function not set for chipID: 0x%08X",
+ chipId);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId,
+ SBE_MSG_IN_PROGRESS);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected 0 for "
+ "CFAM register checking",
+ chipId, rc);
+ break;
+ }
+ }while (0);
+
+ // Test exit
+ TRACFCOMP(g_trac_sbeio, EXIT_MRK "SbeMessagePassingRtTest::"
+ "testSbeMessagePassingFunction");
+ }
+
+ /**
+ * @brief testSbeMessagePassing Unit test for the
+ * SBE message passing set function.
+ */
+ void testSbeMessagePassingSetFunction(void)
+ {
+ // Test entry
+ TRACFCOMP(g_trac_sbeio, ENTER_MRK "SbeMessagePassingRtTest::"
+ "testSbeMessagePassingSetFunction");
+
+ int rc = 0;
+
+ do
+ {
+ // Call Set Process Command Function
+ rc = setProcessCmdFunction(PASSTHRU_SET_OCC_STATE,
+ processSetOCCState);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "rc: 0x%08x, but expected 0 from "
+ "setProcessCmdFunction()",
+ rc);
+ break;
+ }
+ }while (0);
+
+ // Test exit
+ TRACFCOMP(g_trac_sbeio, EXIT_MRK "SbeMessagePassingRtTest::"
+ "testSbeMessagePassingSetFunction");
+ }
+
+ /**
+ * @brief testSbeMessagePassing Unit test for the
+ * SBE message passing good path.
+ */
+ void testSbeMessagePassingGoodPath(void)
+ {
+ // Test entry
+ TRACFCOMP(g_trac_sbeio, ENTER_MRK "SbeMessagePassingRtTest::"
+ "testSbeMessagePassingGoodPath");
+
+ sbeMessage_t l_request;
+ sbeMessage_t l_expected_response;
+ RT_TARG::rtChipId_t chipId = 0;
+ uint64_t l_sbeCommAddr = 0;
+ runtimeInterfaces_t *rt_intf = nullptr;
+
+ int rc = 0;
+
+ do
+ {
+ // Do initializations for SBE Message passing
+ rc = initSbeMessagePassing(l_request,
+ l_expected_response,
+ chipId,
+ l_sbeCommAddr,
+ &rt_intf);
+
+ // Get the response address in the SBE Communication area
+ sbeMessage_t *l_sbeCommAddr_rsp =
+ reinterpret_cast<sbeMessage_t*>(l_sbeCommAddr);
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call Set Process Command Function
+ rc = setProcessCmdFunction(PASSTHRU_SET_OCC_STATE,
+ processSetOCCState);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "rc: 0x%08x, but expected 0 from "
+ "setProcessCmdFunction() for good path test",
+ rc);
+ break;
+ }
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "Testing good path for chipID: 0x%08X, rc: 0x%08x, "
+ "but expected 0",
+ chipId, rc);
+ break;
+ }
+
+ // Compare test response from SBE Communication area
+ if(cmpSbeHdr(*l_sbeCommAddr_rsp, l_expected_response) ||
+ cmpCmdHdr(*l_sbeCommAddr_rsp, l_expected_response))
+ {
+ TRACFBIN( g_trac_sbeio,
+ "testSbeMessagePassingGoodPath: expected rsp",
+ &l_expected_response,
+ l_expected_response.sbeHdr.msgSize);
+ TRACFBIN( g_trac_sbeio,
+ "testSbeMessagePassingGoodPath: actual rsp",
+ l_sbeCommAddr_rsp,
+ l_sbeCommAddr_rsp->sbeHdr.msgSize);
+ TS_FAIL("Unexpected response from RT SBE message passing. "
+ "Testing good path for chipID: 0x%08X",
+ chipId);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected 0 for "
+ "CFAM register checking",
+ chipId, rc);
+ break;
+ }
+
+ // Increment Total Tests
+ g_TotalTests++;
+
+ // Increase data offset and message size and shift data
+ // to verify that the data payload does not have to be
+ // immediately after the Command Header
+ l_request.cmdHdr.dataSize += 4;
+ l_request.sbeHdr.msgSize += 4;
+ uint32_t *l_req_data =
+ reinterpret_cast<uint32_t*>(&l_request.data[0]);
+ l_req_data[3] = l_req_data[2];
+ l_req_data[2] = l_req_data[1];
+ l_req_data[1] = l_req_data[0];
+ l_req_data[0] = 0;
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "Testing good path with data shifted for chipID: "
+ "0x%08X, rc: 0x%08x, but expected 0",
+ chipId, rc);
+ break;
+ }
+
+ // Compare test response from SBE Communication area
+ if(cmpSbeHdr(*l_sbeCommAddr_rsp, l_expected_response) ||
+ cmpCmdHdr(*l_sbeCommAddr_rsp, l_expected_response))
+ {
+ TRACFBIN( g_trac_sbeio,
+ "testSbeMessagePassingGoodPath: expected rsp",
+ &l_expected_response,
+ l_expected_response.sbeHdr.msgSize);
+ TRACFBIN( g_trac_sbeio,
+ "testSbeMessagePassingGoodPath: actual rsp",
+ l_sbeCommAddr_rsp,
+ l_sbeCommAddr_rsp->sbeHdr.msgSize);
+ TS_FAIL("Unexpected response from RT SBE message passing. "
+ "Testing good path with data shifted for chipID: "
+ "0x%08X",
+ chipId);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected 0 for "
+ "CFAM register checking",
+ chipId, rc);
+ break;
+ }
+ }while (0);
+
+ // Test exit
+ TRACFCOMP(g_trac_sbeio, EXIT_MRK "SbeMessagePassingRtTest::"
+ "testSbeMessagePassingGoodPath");
+ }
+
+ /**
+ * @brief testSbeMessagePassing Unit test for the
+ * SBE message passing error paths.
+ */
+ void testSbeMessagePassingErrorPaths(void)
+ {
+ // Test entry
+ TRACFCOMP(g_trac_sbeio, ENTER_MRK "SbeMessagePassingRtTest::"
+ "testSbeMessagePassingErrorPaths");
+
+ sbeMessage_t l_request;
+ sbeMessage_t l_expected_response;
+ uint32_t l_hdrsSize = sizeof(sbeHeader_t) + sizeof(cmdHeader_t);
+ RT_TARG::rtChipId_t chipId = 0;
+ uint64_t l_sbeCommAddr = 0;
+ runtimeInterfaces_t *rt_intf = nullptr;
+
+ int rc = 0;
+
+ do
+ {
+ // Do initializations for SBE Message passing
+ rc = initSbeMessagePassing(l_request,
+ l_expected_response,
+ chipId,
+ l_sbeCommAddr,
+ &rt_intf);
+
+ // Get the response address in the SBE Communication area
+ sbeMessage_t *l_sbeCommAddr_rsp =
+ reinterpret_cast<sbeMessage_t*>(l_sbeCommAddr);
+
+ // Set the test option to excess response data size
+ l_request.cmdHdr.status = 0x1;
+
+ // Change sizes in expected response
+ l_expected_response.sbeHdr.msgSize = SBE_MSG_SIZE;
+ l_expected_response.cmdHdr.dataSize = SBE_MSG_SIZE;
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call Set Process Command Function
+ rc = setProcessCmdFunction(PASSTHRU_SET_OCC_STATE,
+ processSetOCCState);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "rc: 0x%08x, but expected 0 from "
+ "setProcessCmdFunction() for error path test",
+ rc);
+ break;
+ }
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0x2832 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "Testing excess response data size error path for "
+ "chipID: 0x%08X",
+ chipId);
+ break;
+ }
+
+ // Compare test response from SBE Communication area
+ if(cmpSbeHdr(*l_sbeCommAddr_rsp, l_expected_response) ||
+ cmpCmdHdr(*l_sbeCommAddr_rsp, l_expected_response))
+ {
+ TRACFBIN( g_trac_sbeio,
+ "testSbeMessagePassingErrorPaths: expected rsp",
+ &l_expected_response,
+ l_hdrsSize);
+ TRACFBIN( g_trac_sbeio,
+ "testSbeMessagePassingErrorPaths: actual rsp",
+ l_sbeCommAddr_rsp,
+ l_hdrsSize);
+ TS_FAIL("Unexpected response from RT SBE message passing. "
+ "chipID: 0x%08X, response data too large",
+ chipId);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId,
+ SBE_MSG_IN_PROGRESS);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected 0 for "
+ "CFAM register checking",
+ chipId, rc);
+ break;
+ }
+
+ // Increment Total Tests
+ g_TotalTests++;
+
+ // Set the test option to error log
+ l_request.cmdHdr.status = 0x2;
+
+ // Change back sizes in expected response
+ l_expected_response.sbeHdr.msgSize = l_hdrsSize;
+ l_expected_response.cmdHdr.dataSize = 0;
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0x2800 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "Testing error log returned for chipID: 0x%08X",
+ chipId);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId,
+ SBE_MSG_IN_PROGRESS);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected 0 for "
+ "CFAM register checking",
+ chipId, rc);
+ break;
+ }
+
+ // Increment Total Tests
+ g_TotalTests++;
+
+ // Set the test option to generic failure status
+ l_request.cmdHdr.status = 0x3;
+
+ // Change status in expected response
+ l_expected_response.cmdHdr.status = 0xFE;
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "Testing failure status returned for chipID:"
+ "0x%08X, rc: 0x%08x, but expected 0",
+ chipId, rc);
+ break;
+ }
+
+ // Compare test response from SBE Communication area
+ if(cmpSbeHdr(*l_sbeCommAddr_rsp, l_expected_response) ||
+ cmpCmdHdr(*l_sbeCommAddr_rsp, l_expected_response))
+ {
+ TRACFBIN( g_trac_sbeio,
+ "testSbeMessagePassingErrorPaths: expected rsp",
+ &l_expected_response,
+ l_expected_response.sbeHdr.msgSize);
+ TRACFBIN( g_trac_sbeio,
+ "testSbeMessagePassingErrorPaths: actual rsp",
+ l_sbeCommAddr_rsp,
+ l_sbeCommAddr_rsp->sbeHdr.msgSize);
+ TS_FAIL("Unexpected response from RT SBE message passing. "
+ "chipID: 0x%08X, status of generic failure",
+ chipId);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected 0 for "
+ "CFAM register checking",
+ chipId, rc);
+ break;
+ }
+
+ // Increment Total Tests
+ g_TotalTests++;
+
+ // Set the test option to altered SBE Header version
+ l_request.cmdHdr.status = 0x4;
+
+ // Change back status in expected response
+ l_expected_response.cmdHdr.status = 0;
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0x2837 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "Testing altered SBE Header version for chipID: "
+ "0x%08X",
+ chipId);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId,
+ SBE_MSG_IN_PROGRESS);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected 0 for "
+ "CFAM register checking",
+ chipId, rc);
+ break;
+ }
+
+ // Increment Total Tests
+ g_TotalTests++;
+
+ // Set the test option to altered SBE Header sequence ID
+ l_request.cmdHdr.status = 0x5;
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0x2837 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "Testing altered SBE Header sequence ID for "
+ "chipID: 0x%08X",
+ chipId);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId,
+ SBE_MSG_IN_PROGRESS);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected 0 for "
+ "CFAM register checking",
+ chipId, rc);
+ break;
+ }
+
+ // Increment Total Tests
+ g_TotalTests++;
+
+ // Set the test option to altered Command Header version
+ l_request.cmdHdr.status = 0x6;
+
+ // Change back status in expected response
+ l_expected_response.cmdHdr.status = 0;
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0x2837 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "Testing altered Command Header version for "
+ "chipID: 0x%08X",
+ chipId);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId,
+ SBE_MSG_IN_PROGRESS);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected 0 for "
+ "CFAM register checking",
+ chipId, rc);
+ break;
+ }
+
+ // Increment Total Tests
+ g_TotalTests++;
+
+ // Set the test option to altered altered Command Header command
+ l_request.cmdHdr.status = 0x7;
+
+ // Copy test request into SBE Communication area
+ memcpy(reinterpret_cast<void*>(l_sbeCommAddr),
+ reinterpret_cast<void*>(&l_request),
+ sizeof(l_request));
+
+ // Call the SBE message passing code
+ rc = rt_intf->sbe_message_passing(chipId);
+ if(0x2837 != rc)
+ {
+ TS_FAIL("Unexpected return during RT SBE message passing. "
+ "Testing altered Command Header command for "
+ "chipID: 0x%08X",
+ chipId);
+ break;
+ }
+
+ // Check setting of bits in CFAM register
+ rc = checkResetSbeMessagePassingCFAM(chipId,
+ SBE_MSG_IN_PROGRESS);
+ if(0 != rc)
+ {
+ TS_FAIL("Unexpected error during RT SBE message passing. "
+ "chipID: 0x%08X, rc: 0x%08x, but expected 0 for "
+ "CFAM register checking",
+ chipId, rc);
+ break;
+ }
+ }while (0);
+
+ // Test exit
+ TRACFCOMP(g_trac_sbeio, EXIT_MRK "SbeMessagePassingRtTest::"
+ "testSbeMessagePassingErrorPaths");
+ }
+
+}; // class SbeMessagePassingRtTest
+#endif
diff --git a/src/usr/testcore/rtloader/loader.H b/src/usr/testcore/rtloader/loader.H
index a5167ff45..98b055f74 100644
--- a/src/usr/testcore/rtloader/loader.H
+++ b/src/usr/testcore/rtloader/loader.H
@@ -354,6 +354,8 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
return rt_get_targ();
else if (0 == strcmp(i_region, HBRT_RSVD_MEM__OVERRIDES))
return rt_get_targ_override();
+ else if (0 == strcmp(i_region, HBRT_RSVD_MEM__SBE_COMM))
+ return rt_get_comm(i_instance);
else
return 0;
}
@@ -545,6 +547,7 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
}
+ //--------------------------------------------------------------------
static uint64_t rt_get_targ()
{
if (cv_targ_addr != 0)
@@ -562,6 +565,7 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
return cv_targ_addr;
}
+ //--------------------------------------------------------------------
static uint64_t rt_get_targ_override()
{
using namespace TARGETING;
@@ -605,6 +609,59 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
return cv_targ_over_addr;
}
+ //--------------------------------------------------------------------
+ static uint64_t rt_get_comm(uint32_t i_instance)
+ {
+ if (cv_comm_addr != 0)
+ {
+ TRACFCOMP(g_trac_hbrt, EXIT_MRK"rt_get_comm: "
+ "stored cv_comm_addr:%lld",
+ cv_comm_addr);
+ return cv_comm_addr;
+ }
+
+ TARGETING::TargetHandleList procChips;
+ getAllChips(procChips, TARGETING::TYPE_PROC, true);
+ for (const auto & l_procChip: procChips)
+ {
+ uint64_t l_instance =
+ l_procChip->getAttr<TARGETING::ATTR_POSITION>();
+ if(l_instance == i_instance)
+ {
+ cv_comm_addr =
+ l_procChip->getAttr<TARGETING::ATTR_SBE_COMM_ADDR>();
+ if (cv_comm_addr != 0)
+ {
+ TRACFCOMP(g_trac_hbrt, EXIT_MRK"rt_get_comm: "
+ "retrieved attribute cv_comm_addr:%lld",
+ cv_comm_addr);
+ return cv_comm_addr;
+ }
+ }
+ }
+
+ cv_comm_phys_addr = TARGETING::get_top_mem_addr();
+
+ assert (cv_comm_phys_addr != 0,
+ "bld_devtree: Top of memory was 0!");
+
+ cv_comm_phys_addr -= (VMM_RT_VPD_OFFSET + 64*KILOBYTE);
+
+ uint8_t *comm_ptr = reinterpret_cast<uint8_t *>(cv_comm_phys_addr);
+
+ void *cptr = mm_block_map(comm_ptr, PAGESIZE);
+
+ assert(cptr != NULL,"rt_get_comm. Could not map SBE Comm memory");
+
+ cv_comm_addr = reinterpret_cast<uint64_t>(cptr);
+
+ TRACFCOMP(g_trac_hbrt, EXIT_MRK"rt_get_comm: "
+ "calculated cv_comm_addr:%lld",
+ cv_comm_addr);
+ return cv_comm_addr;
+ }
+
+ //--------------------------------------------------------------------
static int rt_ipmi_msg(uint8_t netfn, uint8_t cmd,
void *tx_buf, size_t tx_size,
void *rx_buf, size_t *rx_size)
@@ -637,6 +694,8 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
static uint64_t cv_targ_addr;
static uint64_t cv_targ_phys_addr;
static uint64_t cv_targ_over_addr;
+ static uint64_t cv_comm_addr;
+ static uint64_t cv_comm_phys_addr;
};
@@ -647,6 +706,8 @@ uint64_t RuntimeLoaderTest::cv_vpd_phys_addr = 0;
uint64_t RuntimeLoaderTest::cv_targ_addr = 0;
uint64_t RuntimeLoaderTest::cv_targ_phys_addr = 0;
uint64_t RuntimeLoaderTest::cv_targ_over_addr = 0;
+uint64_t RuntimeLoaderTest::cv_comm_addr = 0;
+uint64_t RuntimeLoaderTest::cv_comm_phys_addr = 0;
OpenPOWER on IntegriCloud