summaryrefslogtreecommitdiffstats
path: root/src/usr/expaccess
diff options
context:
space:
mode:
authorChristian Geddes <crgeddes@us.ibm.com>2019-02-20 17:37:16 -0600
committerChristian R. Geddes <crgeddes@us.ibm.com>2019-03-11 15:53:07 -0500
commit552339eb7f7855f907dd0836c9cb2730887306a8 (patch)
tree7819872a1d0beae00dd78d2285d1ecca004e6e6a /src/usr/expaccess
parent4984330e0ef90cfa867e7ccde916cea196fa2b44 (diff)
downloadtalos-hostboot-552339eb7f7855f907dd0836c9cb2730887306a8.tar.gz
talos-hostboot-552339eb7f7855f907dd0836c9cb2730887306a8.zip
Create a common explorer accesss module expaccess
Move everything from expscom to the new, more general, expaccess. All code dealing with io to explorer should live here. Also add some ocmb communication test cases. Change-Id: Icd57bc094782873afb18ac22518aa2681db0b933 RTC: 186630 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/72224 Reviewed-by: Matt Derksen <mderkse1@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/usr/expaccess')
-rw-r--r--src/usr/expaccess/README.md258
-rw-r--r--src/usr/expaccess/expaccess.mk38
-rw-r--r--src/usr/expaccess/expscom_trace.C38
-rw-r--r--src/usr/expaccess/expscom_trace.H39
-rw-r--r--src/usr/expaccess/expscom_utils.C223
-rw-r--r--src/usr/expaccess/expscom_utils.H61
-rw-r--r--src/usr/expaccess/i2cscomdd.C174
-rw-r--r--src/usr/expaccess/i2cscomdd.H67
-rw-r--r--src/usr/expaccess/makefile36
-rw-r--r--src/usr/expaccess/mmioscomdd.C158
-rw-r--r--src/usr/expaccess/mmioscomdd.H67
-rw-r--r--src/usr/expaccess/runtime/makefile36
-rw-r--r--src/usr/expaccess/runtime/test/makefile37
-rw-r--r--src/usr/expaccess/test/expscomtest.H717
-rw-r--r--src/usr/expaccess/test/makefile33
-rw-r--r--src/usr/expaccess/test/ocmbcommtest.H334
-rw-r--r--src/usr/expaccess/test/test.mk35
17 files changed, 2351 insertions, 0 deletions
diff --git a/src/usr/expaccess/README.md b/src/usr/expaccess/README.md
new file mode 100644
index 000000000..0710b49ce
--- /dev/null
+++ b/src/usr/expaccess/README.md
@@ -0,0 +1,258 @@
+## Overall Description
+The expscom module contains Hostboots device drivers to communicate with scom regs
+on the Explorer Open-Capi Memory Buffer (OCMB) chip. Initially when Hostboot starts
+the SCOM_SWITCHES attribute on all OCMB chips will be set such that useI2cScom field
+is 1 and all other fields are 0. After OMI 's are trained the SCOM_SWITCHES attribute
+on the OCMB targets will change so that the useIbScom field will be set to 1 and
+all other fields will be 0.
+
+### Explorer I2C SCOM
+
+When the useI2cScom field is set in SCOM_SWITCHES this is how the
+fapi2::getScom API for OCMB targets will be processed (lets say for now this is IBM scom address):
+
+* Generic FAPI2 getScom API that will be called in a hardware procedure (HWP)
+
+
+ fapi2::getScom(myOcmbTarget, scomAddr, io_buffer);
+* Platform Specifc FAPI2 getScom API which the generic wrapper immediately calls
+
+
+ fapi2::platGetScom(myOcmbTarget, scomAddr, io_buffer);
+* Platform Specifc FAPI2 getScom API resolves to calling into Hostboot's device framework to whatever
+function is registered to read OCMB target for DeviceFW::SCOM operations
+
+
+ DeviceFW::deviceRead(myOcmbTarget, io_buffer,
+ sizeof(uint64_t), DeviceFW::SCOM,
+ scomAddr, READ)
+* scomPeformOp is what is defined to handle DeviceFW::SCOM operations to the OCMB chip targets
+
+
+ SCOM::scomPerformOp(READ, myOCMBTarget, io_buffer,
+ sizeof(uint64_t), DeviceFW::SCOM,
+ scomAddr)
+* scomPeformOp is basically a wrapper for checkIndirectAndDoScom There are no indirect scoms for
+OCMB target scoms so we will end up calling doScomOp
+
+
+ checkIndirectAndDoScom(READ, myOCMBTarget, io_buffer,
+ sizeof(uint64_t), DeviceFW::SCOM,
+ scomAddr)
+
+* doScomOp looks at the SCOM_SWITCHES attribute and decides which type of scom to do for the given target.
+
+
+ doScomOp(READ, myOCMBTarget, io_buffer,
+ sizeof(uint64_t), DeviceFW::SCOM,
+ scomAddr)
+
+* If the useI2cScom field is set to 1 then we will call the function that is registered to i2c scoms for OCMB targets
+
+
+ deviceOp(READ, myOCMBTarget, io_buffer,
+ sizeof(uint64_t), DeviceFW::I2CSCOM,
+ scomAddr)
+
+* i2cScomPerformOp is the function that is registered to handle i2cScom operations,
+this function will perform some simple param validation before deciding whether to
+call the getScom or putScom depending if the op is READ or WRITE respectively
+
+
+ i2cScomPerformOp(READ, myOCMBTarget, io_buffer,
+ sizeof(uint64_t), DeviceFW::I2CSCOM,
+ scomAddr)
+
+* The base device drivers are defined as EKB HWPs so we must run FAPI_EXEC_HWP in order to correctly call the i2c_get_scom hwp\
+**Note: that EXEC and not INVOKE is used because it is likely this path
+will be called within other HWPs and nesting INVOKE calls causes deadlock
+due to the way we use mutexes.**
+
+
+ FAPI_EXEC_HWP(l_rc , mss::exp::i2c::i2c_get_scom,
+ myOCMBTarget, static_cast<uint32_t>(l_scomAddr),
+ io_buffer);
+
+* The Explorer chip nativly uses 32-bit regs so we must perform two 32-bit operations
+(LHS and RHS) in order to get the 64-bits that we expect from the IBM scom
+
+
+ fw_reg_read(myOCMBTarget,
+ translateIbmI2cScomAddr(i_addr, LHS),
+ l_readBuffer);
+
+ fw_reg_read(myOCMBTarget,
+ translateIbmI2cScomAddr(i_addr, RHS),
+ l_readBuffer);
+
+* The RHS and LHS fw_reg_read calls are nearly identical except the address is 4 bytes more
+for the RHS. In both cases the way the fw_reg_read works is to first perform an i2cWrite stating
+what address and how many bytes we want to read, then perform an i2c read to get the buffer
+
+
+ < build up l_cmd_vector w/ FW_REG_ADDR_LATCH op, op size, addr >
+ fapi2::putI2c(myOCMBTarget, FW_I2C_SCOM_READ_SIZE,
+ l_cmd_vector, l_read_data);
+
+ < build up l_cmd_vector w/ FW_REG_READ op >
+ fapi2::getI2c(myOCMBTarget, FW_I2C_SCOM_READ_SIZE,
+ l_cmd_vector, l_read_data);
+
+* The fapi2::getI2c/putI2c calls will drill down into the drive routing similar to how we drilled down to find the i2cScom driver
+
+
+ platGetI2c( myOCMBTarget, FW_I2C_SCOM_READ_SIZE
+ l_cmd_vector, l_read_data)
+
+* The hostboot platform specific implementation of platGetI2c will lookup the device route for FAPI_I2C ops to OCMB chips
+
+
+ deviceRead( myOCMBTarget, l_read_data,
+ FW_I2C_SCOM_READ_SIZE, DeviceFW::FAPI_I2C,
+ sizeof(l_cmd_vector), l_cmd_vector);
+
+* The function associated with FAPI_I2C ops to OCMB chips is fapiI2cPerformOp. This
+wrapper function will look up i2c information about the OCMB target and determine
+the i2c address for this operation
+
+
+ fapiI2cPerformOp(READ , myOCMBTarget,
+ l_read_data, FW_I2C_SCOM_READ_SIZE,
+ DeviceFW::FAPI_I2C, sizeof(l_cmd_vector),
+ l_cmd_vector);
+
+* Eventually when the i2c info is known we call i2cRead/i2cWrite which will lookup
+the device op route for I2C address on the OCMB's master I2c device (which will be a processor).
+
+
+ i2cRead( myOCMBTargeti2cMaster, l_read_data,
+ FW_I2C_SCOM_READ_SIZE, &l_myOCMBTargeti2cInfo,
+ l_cmd_vector, sizeof(l_cmd_vector));
+
+* At this point we will drill down into the platform I2C device driver code
+
+
+ deviceOp( DeviceFW::READ, myOCMBTargeti2cMaster,
+ l_read_data, FW_I2C_SCOM_READ_SIZE,
+ DEVICE_I2C_ADDRESS_OFFSET(l_myOCMBTargeti2cInfo->port,
+ l_myOCMBTargeti2cInfo->engine,
+ l_myOCMBTargeti2cInfo->devAddr,
+ sizeof(l_cmd_vector),
+ l_cmd_vector) );
+
+### Explorer MMIO SCOM
+
+When the useIbScom field is set in SCOM_SWITCHES this is how the fapi2::putScom API for OCMB
+targets will be processed (lets say for now this is IBM scom address):
+
+* Generic FAPI2 getScom API
+
+
+ fapi2::getScom(myOcmbTarget, scomAddr, io_buffer);
+
+* Platform Specific FAPI2 getScom API
+
+
+ fapi2::platGetScom(myOcmbTarget, scomAddr, io_buffer);
+
+* Platform Specific FAPI2 getScom API resolves to calling into our device framework to whatever
+function is registered to read OCMB target for DeviceFW::SCOM operations
+
+
+ DeviceFW::deviceRead(myOcmbTarget, io_buffer,
+ sizeof(uint64_t), DeviceFW::SCOM,
+ scomAddr, READ)
+
+* scomPeformOp is what is defined to handle DeviceFW::SCOM operations to the OCMB chip targets
+
+
+ SCOM::scomPerformOp(READ, myOCMBTarget, io_buffer,
+ sizeof(uint64_t), DeviceFW::SCOM,
+ scomAddr)
+
+* scomPeformOp is basically a wrapper for checkIndirectAndDoScom. There are no indirect scoms
+for OCMB target scoms so we will end up calling doScomOp
+
+
+ checkIndirectAndDoScom(READ, myOCMBTarget, io_buffer,
+ sizeof(uint64_t), DeviceFW::SCOM,
+ scomAddr)
+
+* doScomOp looks at the SCOM_SWITCHES attribute and decides which type of scom to do for the given target.
+
+
+ doScomOp(READ, myOCMBTarget, io_buffer,
+ sizeof(uint64_t), DeviceFW::SCOM,
+ scomAddr)
+
+* If the useIbScom field is set to 1 then we will call the function that is registered to inband scoms for OCMB targets
+
+
+ deviceOp(READ, myOCMBTarget, io_buffer,
+ sizeof(uint64_t), DeviceFW::IBSCOM,
+ scomAddr)
+
+* mmioScomPerformOp is the function that is registered to IBSCOM operations to OCMB chips
+
+
+ mmioScomPerformOp(READ, myOCMBTarget, io_buffer,
+ sizeof(uint64_t), DeviceFW::IBSCOM,
+ scomAddr)
+
+* mmioScomPerformOp will call the hwp mss::exp::ib::getScom which is a in-band scom driver for the OCMB explorer chip
+
+
+ FAPI_EXEC_HWP(l_rc , mss::exp::ib::getScom, myOCMBTarget, scomAddr, io_buffer);
+
+* mss::exp::ib::getScom will translate the scomAddress into a mmio address and perform a getMMIO64 operation
+
+
+ getMMIO64(myOCMBTarget, (scomAddr << 3), io_buffer);
+
+* getMMIO64 will add the IB_MMIO offset and perform a 64 bit mmio read using the fapi2::getMMIO interface
+
+
+ fapi2::getMMIO(myOCMBTarget, EXPLR_IB_MMIO_OFFSET | scomAddr, 8, io_buffer)
+
+* fapi2::getMMIO is defined by the platform
+
+
+ ReturnCode platGetMMIO( myOCMBTarget,
+ EXPLR_IB_MMIO_OFFSET | (scomAddr << 3),
+ 8, // bytes
+ io_buffer )
+
+* platGetMMIO will use the device framework to look up the correct routine for MMIO addresses on OCMB targets
+
+
+ DeviceFW::deviceRead(myOCMBTarget,
+ io_buffer,
+ 8, // bytes
+ DEVICE_MMIO_ADDRESS(EXPLR_IB_MMIO_OFFSET | (scomAddr << 3), 8));
+
+
+* the device framework will route the deviceRead call to mmioPerformOp
+
+
+ mmioPerformOp(READ,
+ myOCMBTarget,
+ io_buffer,
+ 8, // bytes
+ DeviceFW::MMIO,
+ address, readLimit);
+
+* mmioPerformOp will execute the actual load/store operation input memory-mapped i/o
+space and handle errors in that operation
+
+
+ if (i_opType == DeviceFW::READ)
+ {
+ memcpy(io_ptr + i, mm_ptr + i, l_accessLimit);
+ }
+ else if (i_opType == DeviceFW::WRITE)
+ {
+ memcpy(mm_ptr + i, io_ptr + i, l_accessLimit);
+
+ // XXX Need to check a processor SCOM here to determine if the
+ // write succeeded or failed.
+ }
diff --git a/src/usr/expaccess/expaccess.mk b/src/usr/expaccess/expaccess.mk
new file mode 100644
index 000000000..84835c522
--- /dev/null
+++ b/src/usr/expaccess/expaccess.mk
@@ -0,0 +1,38 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/expaccess/expaccess.mk $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2019
+# [+] 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
+EXTRAINCDIR += ${ROOTPATH}/src/import
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/ocmb/explorer/common/include/
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/ocmb/explorer/procedures/hwp/memory/
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/common/utils/imageProcs
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc/
+EXTRAINCDIR += ${ROOTPATH}/src/import/hwpf/fapi2/include
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/fapi2
+
+# Need to build exp_indband to use EKB's getMMIO/putMMIO/getCMD/getRSP
+OBJS += exp_inband.o
+OBJS += expscom_trace.o
+OBJS += expscom_utils.o
+OBJS += i2cscomdd.o
+OBJS += mmioscomdd.o \ No newline at end of file
diff --git a/src/usr/expaccess/expscom_trace.C b/src/usr/expaccess/expscom_trace.C
new file mode 100644
index 000000000..041530f27
--- /dev/null
+++ b/src/usr/expaccess/expscom_trace.C
@@ -0,0 +1,38 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/expscom_trace.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015,2019 */
+/* [+] 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 */
+///
+/// @file expscom_trace.C
+///
+/// @brief Initialized trace descriptor for expscom
+///
+
+
+#include "expscom_trace.H"
+#include <limits.h>
+#include <hbotcompid.H>
+
+// Trace definition
+trace_desc_t* g_trac_expscom = nullptr;
+TRAC_INIT(&g_trac_expscom, EXPSCOM_COMP_NAME, 2*KILOBYTE); \ No newline at end of file
diff --git a/src/usr/expaccess/expscom_trace.H b/src/usr/expaccess/expscom_trace.H
new file mode 100644
index 000000000..6e69db714
--- /dev/null
+++ b/src/usr/expaccess/expscom_trace.H
@@ -0,0 +1,39 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/expscom_trace.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015,2019 */
+/* [+] 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 */
+///
+/// @file expscom_trace.H
+/// @brief Defines the extern expscom trace
+///
+
+#ifndef EXPSCOM_TRACE_H_
+#define EXPSCOM_TRACE_H_
+
+#include <trace/interface.H>
+//******************************************************************************
+// Trace descriptors that are defined in matching C file
+//******************************************************************************
+extern trace_desc_t* g_trac_expscom;
+
+#endif // expscom_TRACE_H_ \ No newline at end of file
diff --git a/src/usr/expaccess/expscom_utils.C b/src/usr/expaccess/expscom_utils.C
new file mode 100644
index 000000000..5ea7eeeb2
--- /dev/null
+++ b/src/usr/expaccess/expscom_utils.C
@@ -0,0 +1,223 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/expscom_utils.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2018,2019 */
+/* [+] 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 */
+/**
+ * @file expscom_utls.C
+ *
+ * @brief Provides the common utility functions for i2c and mmio
+ * Explorer OCMB scom drivers
+ */
+
+/*****************************************************************************/
+// I n c l u d e s
+/*****************************************************************************/
+#include <errl/errlmanager.H> // errlCommit
+#include <errl/errludtarget.H> // ErrlUserDetailsTarget
+#include <devicefw/driverif.H> // OperationType
+#include <expscom/expscom_reasoncodes.H> // ReasonCodes/ModuleIds
+#include "expscom_trace.H" //g_trac_expscom
+#include "expscom_utils.H" //validateInputs
+
+namespace EXPSCOM
+{
+
+constexpr uint64_t FIRST_4_BYTES = 0xFFFFFFFF00000000;
+
+///////////////////////////////////////////////////////////////////////////////
+// See header file for doxygen documentation
+///////////////////////////////////////////////////////////////////////////////
+errlHndl_t validateInputs(DeviceFW::OperationType i_opType,
+ const TARGETING::Target* i_target,
+ size_t i_buflen,
+ uint64_t i_scomAddr)
+{
+ errlHndl_t l_err = nullptr;
+ uint32_t l_commonPlid = 0; // If there are multiple issues found link logs with first
+
+ TARGETING::ATTR_MODEL_type l_targetModel =
+ i_target->getAttr<TARGETING::ATTR_MODEL>();
+
+ // Only target we can perform ocmb scoms on are explorer OCMB chip targets
+ if( l_targetModel != TARGETING::MODEL_EXPLORER )
+ {
+ TRACFCOMP( g_trac_expscom, ERR_MRK "validateInputs> Invalid target type : l_targetModel=%d", l_targetModel );
+ /*@
+ * @errortype
+ * @moduleid EXPSCOM::MOD_OCMB_UTILS
+ * @reasoncode EXPSCOM::RC_INVALID_MODEL_TYPE
+ * @userdata1 SCOM Address
+ * @userdata2 Model Type
+ * @devdesc validateInputs> Invalid target type (!= OCMB_CHP)
+ * @custdesc A problem occurred during the IPL of the system:
+ * Invalid target type for a SCOM operation.
+ */
+ l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ EXPSCOM::MOD_OCMB_UTILS,
+ EXPSCOM::RC_INVALID_MODEL_TYPE,
+ i_scomAddr,
+ l_targetModel,
+ ERRORLOG::ErrlEntry::ADD_SW_CALLOUT);
+
+ l_err->collectTrace(EXPSCOM_COMP_NAME);
+ ERRORLOG::ErrlUserDetailsTarget(i_target,"SCOM Target").
+ addToLog(l_err);
+ l_commonPlid = l_err->plid();
+ }
+
+ // The address passed to the OCMB scom functions is really only 32 bits
+ // just to be safe make sure that first 4 bytes are 0s
+ if( i_scomAddr & FIRST_4_BYTES )
+ {
+ TRACFCOMP( g_trac_expscom,
+ ERR_MRK "validateInputs> Invalid address : i_scomAddr=0x%lx , first 32 bits should be 0's",
+ i_scomAddr );
+
+ // If there is already an error from prev checks, then commit it
+ if(l_err)
+ {
+ errlCommit(l_err, EXPSCOM_COMP_ID);
+ }
+
+ /*@
+ * @errortype
+ * @moduleid EXPSCOM::MOD_OCMB_UTILS
+ * @reasoncode EXPSCOM::RC_INVALID_ADDRESS
+ * @userdata1 SCOM Address
+ * @userdata2 Target HUID
+ * @devdesc validateInputs> Invalid scom address, first 4
+ * bytes should be 0's
+ * @custdesc A problem occurred during the IPL of the system:
+ * Invalid address for a SCOM operation.
+ */
+ l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ EXPSCOM::MOD_OCMB_UTILS,
+ EXPSCOM::RC_INVALID_ADDRESS,
+ i_scomAddr,
+ TARGETING::get_huid(i_target),
+ ERRORLOG::ErrlEntry::ADD_SW_CALLOUT);
+
+ l_err->collectTrace(EXPSCOM_COMP_NAME);
+ ERRORLOG::ErrlUserDetailsTarget(i_target,"SCOM Target").
+ addToLog(l_err);
+
+ if(l_commonPlid == 0)
+ {
+ l_commonPlid = l_err->plid();
+ }
+ else
+ {
+ l_err->plid(l_commonPlid);
+ }
+ }
+
+ // The buffer passed into validateInputs should ALWAYS be 8 bytes.
+ // If it is an IBM scom then all 8 bytes are used. If its microchip scom
+ // then only the last 4 bytes are used.
+ if (i_buflen != sizeof(uint64_t))
+ {
+ TRACFCOMP( g_trac_expscom, ERR_MRK "validateInputs> Invalid data length : io_buflen=%d ,"
+ " expected sizeof(uint64_t)", i_buflen );
+
+ // If there is already an error from prev checks, then commit it
+ if(l_err)
+ {
+ errlCommit(l_err, EXPSCOM_COMP_ID);
+ }
+
+ /*@
+ * @errortype
+ * @moduleid EXPSCOM::MOD_OCMB_UTILS
+ * @reasoncode EXPSCOM::RC_INVALID_LENGTH
+ * @userdata1 SCOM Address
+ * @userdata2 Data Length
+ * @devdesc validateInputs> Invalid data length (!= 8 bytes)
+ * @custdesc A problem occurred during the IPL of the system:
+ * Invalid data length for a SCOM operation.
+ */
+ l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ EXPSCOM::MOD_OCMB_UTILS,
+ EXPSCOM::RC_INVALID_LENGTH,
+ i_scomAddr,
+ TO_UINT64(i_buflen),
+ ERRORLOG::ErrlEntry::ADD_SW_CALLOUT);
+
+ l_err->collectTrace(EXPSCOM_COMP_NAME);
+ ERRORLOG::ErrlUserDetailsTarget(i_target,"SCOM Target").
+ addToLog(l_err);
+
+ if(l_commonPlid == 0)
+ {
+ l_commonPlid = l_err->plid();
+ }
+ else
+ {
+ l_err->plid(l_commonPlid);
+ }
+ }
+
+ // The only valid operations are READ and WRITE if anything else comes in we need to error out
+ if (i_opType != DeviceFW::READ && i_opType != DeviceFW::WRITE )
+ {
+ TRACFCOMP( g_trac_expscom, ERR_MRK "validateInputs> Invalid operation type : i_opType=%d", i_opType );
+
+ if(l_err)
+ {
+ errlCommit(l_err, EXPSCOM_COMP_ID);
+ }
+
+ /*@
+ * @errortype
+ * @moduleid EXPSCOM::MOD_OCMB_UTILS
+ * @reasoncode EXPSCOM::RC_INVALID_OPTYPE
+ * @userdata1 SCOM Address
+ * @userdata2 Access Type
+ * @devdesc validateInputs> Invalid OP type (!= READ or WRITE)
+ * @custdesc A problem occurred during the IPL of the system:
+ * Invalid operation type for a SCOM operation.
+ */
+ l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ EXPSCOM::MOD_OCMB_UTILS,
+ EXPSCOM::RC_INVALID_OPTYPE,
+ i_scomAddr,
+ i_opType,
+ ERRORLOG::ErrlEntry::ADD_SW_CALLOUT);
+
+ l_err->collectTrace(EXPSCOM_COMP_NAME);
+ ERRORLOG::ErrlUserDetailsTarget(i_target,"SCOM Target").
+ addToLog(l_err);
+
+ if(l_commonPlid == 0)
+ {
+ l_commonPlid = l_err->plid();
+ }
+ else
+ {
+ l_err->plid(l_commonPlid);
+ }
+ }
+
+ return l_err;
+}
+
+} // End namespace EXPSCOM
diff --git a/src/usr/expaccess/expscom_utils.H b/src/usr/expaccess/expscom_utils.H
new file mode 100644
index 000000000..328b7c823
--- /dev/null
+++ b/src/usr/expaccess/expscom_utils.H
@@ -0,0 +1,61 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/expscom_utils.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2018,2019 */
+/* [+] 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 __EXPSCOM_UTILS_H
+#define __EXPSCOM_UTILS_H
+
+/** @file expscom_utils.H
+ * @brief Provides the common utility functions for i2c and mmio
+ * Explorer OCMB scom drivers
+ */
+#include <stdint.h>
+
+
+namespace EXPSCOM
+{
+
+/**
+* @brief Performs validation of params passed to i2cScomPerformOp and
+* mmioScomPerformOp functions. This function checks that the target
+* model, the buffer lengt, addr format, and the op type are all valid.
+* A unique error will be created for each violation. If multiple error
+* are found the last error will be returned and all previous errors found
+* will be committed as new errors are found (see function).
+*
+* @param[in] i_opType Operation type, see DeviceFW::OperationType
+* in driverif.H
+* @param[in] i_target TARGETING::Target passed to mmioscomPerformOp
+* @param[in] i_buflen size of buffer passed to mmioscomPerformOp
+* @param[in] i_scomAddr Scom address operation will be performed on
+
+* @return errlHndl_t
+*/
+errlHndl_t validateInputs(DeviceFW::OperationType i_opType,
+ const TARGETING::Target* i_target,
+ size_t i_buflen,
+ uint64_t i_scomAddr);
+
+}
+
+#endif \ No newline at end of file
diff --git a/src/usr/expaccess/i2cscomdd.C b/src/usr/expaccess/i2cscomdd.C
new file mode 100644
index 000000000..97d760009
--- /dev/null
+++ b/src/usr/expaccess/i2cscomdd.C
@@ -0,0 +1,174 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/i2cscomdd.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2019 */
+/* [+] 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 */
+
+/**
+ * @file i2cscomdd.C
+ *
+ * @brief Implementation of I2C SCOM operations to OCMB chip */
+
+/*****************************************************************************/
+// I n c l u d e s
+/*****************************************************************************/
+#include <errl/errlmanager.H> // errlCommit
+#include <lib/i2c/exp_i2c_scom.H> // i2c_get_scom
+#include <errl/errludtarget.H> // ErrlUserDetailsTarget
+#include <hwpf/fapi2/include/fapi2_hwp_executor.H> // FAPI_EXEC_HWP
+#include <expscom/expscom_reasoncodes.H> // EXPSCOM::MOD_I2CSCOM_PERFORM_OP
+#include "i2cscomdd.H" //i2cScomPerformOp
+#include "expscom_trace.H" //g_trac_expscom
+#include "expscom_utils.H" //validateInputs
+
+namespace I2CSCOMDD
+{
+
+DEVICE_REGISTER_ROUTE(DeviceFW::WILDCARD,
+ DeviceFW::I2CSCOM,
+ TARGETING::TYPE_OCMB_CHIP,
+ i2cScomPerformOp);
+
+///////////////////////////////////////////////////////////////////////////////
+// See header for doxygen documentation
+///////////////////////////////////////////////////////////////////////////////
+errlHndl_t i2cScomPerformOp(DeviceFW::OperationType i_opType,
+ TARGETING::Target* i_target,
+ void* io_buffer,
+ size_t& io_buflen,
+ int64_t i_accessType,
+ va_list i_args)
+{
+ errlHndl_t l_err = nullptr;
+ fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_SUCCESS;
+ // The only extra arg should be the scomAddress
+ uint64_t l_scomAddr = va_arg(i_args,uint64_t);
+
+ // The fapi2 put/get i2cScom interfaces require a fapi2::buffer so convert
+ // to a uint64_t buffer (for IBM scom) and uint32_t buffer (for Microchip scoms)
+ fapi2::buffer<uint64_t> l_fapi2Buffer64(*reinterpret_cast<uint64_t *>(io_buffer));
+ fapi2::buffer<uint32_t> l_fapi2Buffer32;
+ l_fapi2Buffer64.extractToRight<32,32>(l_fapi2Buffer32);
+
+ TRACDCOMP( g_trac_expscom, ERR_MRK "i2cScomPerformOp> %s 0x%.16x or 0x%.8x to Address 0x%lx ",
+ i_opType == DeviceFW::READ ? "READ" : "WRITE", l_fapi2Buffer64(), l_fapi2Buffer32() , l_scomAddr );
+
+ do
+ {
+ // First make sure the inputs are valid
+ l_err = EXPSCOM::validateInputs ( i_opType, i_target, io_buflen, l_scomAddr );
+
+ if(l_err)
+ {
+ // Write a trace out to the buffer and then collect it on the log
+ // this way we can know if the fail was in i2cScomPerformOp or mmioScomPerformOp
+ TRACFCOMP( g_trac_expscom, ERR_MRK "i2cScomPerformOp> Validation of inputs failed see error logs for details ");
+ l_err->collectTrace(EXPSCOM_COMP_NAME);
+ break;
+ }
+
+ // Check if this is a IBM_SCOM address by &ing the address with IBM_SCOM_INDICATOR
+ // If the indicator is not set, then we will assume this is a microChip address
+ if( (l_scomAddr & mss::exp::i2c::IBM_SCOM_INDICATOR) == mss::exp::i2c::IBM_SCOM_INDICATOR)
+ {
+ // READ and WRITE equates to i2c_get_scom and i2c_put_scom respectively. any other OP is invalid
+ // i/o data is expected to be 8 bytes for IBM scoms
+ if(i_opType == DeviceFW::READ)
+ {
+ FAPI_EXEC_HWP(l_rc , mss::exp::i2c::i2c_get_scom,
+ i_target, static_cast<uint32_t>(l_scomAddr),
+ l_fapi2Buffer64);
+
+ l_err = fapi2::rcToErrl(l_rc);
+ if(l_err)
+ {
+ // Sizes stolen from plat_hwp_invoker.H
+ l_err->collectTrace(FAPI_IMP_TRACE_NAME, 256);
+ l_err->collectTrace(FAPI_TRACE_NAME, 384);
+ TRACFCOMP( g_trac_expscom, ERR_MRK "i2cScomPerformOp> i2c_get_scom failed for HUID 0x%x Address 0x%lx ",
+ TARGETING::get_huid(i_target), l_scomAddr );
+ }
+ else
+ {
+ // Copy contents of what we read to io_buffer
+ memcpy(io_buffer, reinterpret_cast<uint8_t *>(l_fapi2Buffer64.pointer()), sizeof(uint64_t));
+ }
+ }
+ else
+ {
+ FAPI_EXEC_HWP(l_rc , mss::exp::i2c::i2c_put_scom, i_target, static_cast<uint32_t>(l_scomAddr), l_fapi2Buffer64);
+ l_err = fapi2::rcToErrl(l_rc);
+ if(l_err)
+ {
+ // Sizes stolen from plat_hwp_invoker.H
+ l_err->collectTrace(FAPI_IMP_TRACE_NAME, 256);
+ l_err->collectTrace(FAPI_TRACE_NAME, 384);
+ TRACFCOMP( g_trac_expscom, ERR_MRK "i2cScomPerformOp> i2c_put_scom failed for HUID 0x%x Address 0x%lx ",
+ TARGETING::get_huid(i_target), l_scomAddr );
+ }
+ }
+ }
+ else
+ {
+ // READ and WRITE equates to i2c_get_scom and i2c_put_scom respectively. any other OP is invalid
+ // i/o data is expected to be 4 bytes for Microchip scoms
+ if(i_opType == DeviceFW::READ)
+ {
+ FAPI_EXEC_HWP(l_rc , mss::exp::i2c::i2c_get_scom, i_target, static_cast<uint32_t>(l_scomAddr), l_fapi2Buffer32);
+ l_err = fapi2::rcToErrl(l_rc);
+ if(l_err)
+ {
+ // Sizes stolen from plat_hwp_invoker.H
+ l_err->collectTrace(FAPI_IMP_TRACE_NAME, 256);
+ l_err->collectTrace(FAPI_TRACE_NAME, 384);
+ TRACFCOMP( g_trac_expscom, ERR_MRK "i2cScomPerformOp> i2c_get_scom failed for HUID 0x%x Address 0x%lx ",
+ TARGETING::get_huid(i_target), l_scomAddr );
+ }
+ else
+ {
+ // Put the contexts of the 32 bit buffer right justified into the 64 bit buffer
+ l_fapi2Buffer64.flush<0>();
+ l_fapi2Buffer64.insertFromRight<32,32>(l_fapi2Buffer32);
+ // Copy contents of 64 bit buffer to io_buffer
+ memcpy(io_buffer, reinterpret_cast<uint8_t *>(l_fapi2Buffer64.pointer()), sizeof(uint64_t));
+ }
+ }
+ else
+ {
+ FAPI_EXEC_HWP(l_rc , mss::exp::i2c::i2c_put_scom, i_target, static_cast<uint32_t>(l_scomAddr), l_fapi2Buffer32);
+ l_err = fapi2::rcToErrl(l_rc);
+ if(l_err)
+ {
+ // Sizes stolen from plat_hwp_invoker.H
+ l_err->collectTrace(FAPI_IMP_TRACE_NAME, 256);
+ l_err->collectTrace(FAPI_TRACE_NAME, 384);
+ TRACFCOMP( g_trac_expscom, ERR_MRK "i2cScomPerformOp> i2c_put_scom failed for HUID 0x%x Address 0x%lx ",
+ TARGETING::get_huid(i_target), l_scomAddr );
+ }
+ }
+
+ }
+
+ } while (0);
+ return l_err;
+}
+} \ No newline at end of file
diff --git a/src/usr/expaccess/i2cscomdd.H b/src/usr/expaccess/i2cscomdd.H
new file mode 100644
index 000000000..84b3f97a0
--- /dev/null
+++ b/src/usr/expaccess/i2cscomdd.H
@@ -0,0 +1,67 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/i2cscomdd.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2019 */
+/* [+] 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 __I2CSCOMDD_H
+#define __I2CSCOMDD_H
+
+/** @file i2cscomdd.H
+ * @brief Provides the interfaces to perform I2Cscom
+ */
+#include <stdint.h>
+
+
+namespace I2CSCOMDD
+{
+
+/**
+ * @brief Performs an I2CSCOM access operation
+ * This function performs an I2CSCOM access operation. It follows a pre-defined
+ * prototype functions in order to be registered with the device-driver
+ * framework.
+ *
+ * @param[in] i_opType Operation type, see DeviceFW::OperationType
+ * in driverif.H
+ * @param[in] i_target I2CSCOM Explorer Chip target
+ * @param[in/out] io_buffer Read: Pointer to output data storage
+ * Write: Pointer to input data storage
+ * @param[in/out] io_buflen Input: size of io_buffer (in bytes)
+ * Output:
+ * Read: Size of output data
+ * Write: Size of data written
+ * @param[in] i_accessType DeviceFW::AccessType enum (usrif.H)
+ * @param[in] i_args This is an argument list for DD framework.
+ * In this function, there's only one argument,
+ * which is the IBM scom address
+ * @return errlHndl_t nullptr on success, non-null ptr on error
+ */
+errlHndl_t i2cScomPerformOp(DeviceFW::OperationType i_opType,
+ TARGETING::Target* i_target,
+ void* io_buffer,
+ size_t& io_buflen,
+ int64_t i_accessType,
+ va_list i_args);
+
+}
+
+#endif // __I2CSCOMDD_H \ No newline at end of file
diff --git a/src/usr/expaccess/makefile b/src/usr/expaccess/makefile
new file mode 100644
index 000000000..f25c22bf5
--- /dev/null
+++ b/src/usr/expaccess/makefile
@@ -0,0 +1,36 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/expaccess/makefile $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2011,2019
+# [+] 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
+
+ROOTPATH = ../../..
+MODULE = expaccess
+
+SUBDIRS += test.d
+SUBDIRS += runtime.d
+
+include expaccess.mk
+
+include ${ROOTPATH}/config.mk
+
+VPATH += ${ROOTPATH}/src/import/chips/ocmb/explorer/procedures/hwp/memory/ \ No newline at end of file
diff --git a/src/usr/expaccess/mmioscomdd.C b/src/usr/expaccess/mmioscomdd.C
new file mode 100644
index 000000000..bf4513158
--- /dev/null
+++ b/src/usr/expaccess/mmioscomdd.C
@@ -0,0 +1,158 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/mmioscomdd.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2019 */
+/* [+] 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 */
+
+/**
+ * @file mmioscomdd.C
+ *
+ * @brief Implementation of MMIO SCOM operations to OCMB chip */
+
+/*****************************************************************************/
+// I n c l u d e s
+/*****************************************************************************/
+#include <exp_inband.H> // mmio_get_scom
+#include <lib/shared/exp_consts.H> // IBM_SCOM_INDICATOR
+#include <hwpf/fapi2/include/fapi2_hwp_executor.H>// FAPI_EXEC_HWP
+#include "mmioscomdd.H" //mmioScomPerformOp
+#include "expscom_trace.H" //g_trac_expscom
+#include "expscom_utils.H" //validateInputs
+
+namespace MMIOSCOMDD
+{
+
+DEVICE_REGISTER_ROUTE(DeviceFW::WILDCARD,
+ DeviceFW::IBSCOM,
+ TARGETING::TYPE_OCMB_CHIP,
+ mmioScomPerformOp);
+
+///////////////////////////////////////////////////////////////////////////////
+// See header for doxygen documentation
+///////////////////////////////////////////////////////////////////////////////
+errlHndl_t mmioScomPerformOp(DeviceFW::OperationType i_opType,
+ TARGETING::Target* i_target,
+ void* io_buffer,
+ size_t& io_buflen,
+ int64_t i_accessType,
+ va_list i_args)
+{
+ errlHndl_t l_err = nullptr;
+ fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_SUCCESS;
+ // The only extra arg should be the scomAddress
+ uint64_t l_expAddr = va_arg(i_args,uint64_t);
+
+ // The fapi2 put/get mmioScom interfaces require a fapi2::buffer so convert
+ // to a uint64_t buffer (for IBM scom) and uint32_t buffer (for Microchip scoms)
+ fapi2::buffer<uint64_t> l_fapi2Buffer64(*reinterpret_cast<uint64_t *>(io_buffer));
+ fapi2::buffer<uint32_t> l_fapi2Buffer32;
+ l_fapi2Buffer64.extractToRight<32,32>(l_fapi2Buffer32);
+
+ do
+ {
+ // First make sure the inputs are valid
+ l_err = EXPSCOM::validateInputs ( i_opType, i_target, io_buflen, l_expAddr);
+
+ if(l_err)
+ {
+ // Write a trace out to the buffer and then collect it on the log
+ // this way we can know if the fail was in i2cScomPerformOp or mmioScomPerformOp
+ TRACFCOMP( g_trac_expscom, ERR_MRK "mmioscomPerformOp> Validation of inputs failed see error logs for details ");
+ l_err->collectTrace(EXPSCOM_COMP_NAME);
+ break;
+ }
+
+ // Check if this is a IBM_SCOM address by &ing the address with IBM_SCOM_INDICATOR
+ // If the indicator is not set, then we will assume this is a microChip address
+ if( (l_expAddr & mss::exp::i2c::IBM_SCOM_INDICATOR) == mss::exp::i2c::IBM_SCOM_INDICATOR)
+ {
+ // READ and WRITE equates to mss::exp::ib::getScom and mss::exp::ib::putScom respectively.
+ // any other OP is invalid. i/o data is expected to be 8 bytes for IBM scoms
+ if(i_opType == DeviceFW::READ)
+ {
+ FAPI_EXEC_HWP(l_rc , mss::exp::ib::getScom, i_target, l_expAddr, l_fapi2Buffer64);
+ l_err = fapi2::rcToErrl(l_rc);
+ if(l_err)
+ {
+ l_err->collectTrace(FAPI_IMP_TRACE_NAME,256);
+ l_err->collectTrace(FAPI_TRACE_NAME,384);
+ TRACFCOMP( g_trac_expscom, ERR_MRK "mmioscomPerformOp> mss::exp::ib::getScom failed for HUID 0x%x Address 0x%lx ",
+ TARGETING::get_huid(i_target), l_expAddr );
+ }
+ else
+ {
+ // Copy contents of what we read to io_buffer
+ memcpy(io_buffer, reinterpret_cast<uint8_t *>(l_fapi2Buffer64.pointer()), sizeof(uint64_t));
+ }
+ }
+ else
+ {
+ FAPI_EXEC_HWP(l_rc , mss::exp::ib::putScom, i_target, l_expAddr, l_fapi2Buffer64);
+ l_err = fapi2::rcToErrl(l_rc);
+ if(l_err)
+ {
+ l_err->collectTrace(FAPI_IMP_TRACE_NAME,256);
+ l_err->collectTrace(FAPI_TRACE_NAME,384);
+ TRACFCOMP( g_trac_expscom, ERR_MRK "mmioscomPerformOp> mss::exp::ib::putScom failed for HUID 0x%x Address 0x%lx ",
+ TARGETING::get_huid(i_target), l_expAddr );
+ }
+ }
+ }
+ else
+ {
+ // READ and WRITE equates to mss::exp::ib::gettMMIO32 and mss::exp::ib::putMMIO32 respectively.
+ // any other OP is invalid.
+ if(i_opType == DeviceFW::READ)
+ {
+ FAPI_EXEC_HWP(l_rc , mss::exp::ib::getMMIO32, i_target, l_expAddr, l_fapi2Buffer32);
+ l_err = fapi2::rcToErrl(l_rc);
+ if(l_err)
+ {
+ TRACFCOMP( g_trac_expscom, ERR_MRK "mmioscomPerformOp> getMMIO32 failed for HUID 0x%x Address 0x%lx ",
+ TARGETING::get_huid(i_target), l_expAddr );
+ }
+ else
+ {
+ // Put the contexts of the 32 bit buffer right justified into the 64 bit buffer
+ l_fapi2Buffer64.flush<0>();
+ l_fapi2Buffer64.insertFromRight<32,32>(l_fapi2Buffer32);
+ // Copy contents of 64 bit buffer to io_buffer
+ memcpy(io_buffer, reinterpret_cast<uint8_t *>(l_fapi2Buffer64.pointer()), sizeof(uint64_t));
+ }
+ }
+ else
+ {
+ FAPI_EXEC_HWP(l_rc , mss::exp::ib::putMMIO32, i_target, l_expAddr, l_fapi2Buffer32);
+ l_err = fapi2::rcToErrl(l_rc);
+ if(l_err)
+ {
+ TRACFCOMP( g_trac_expscom, ERR_MRK "mmioscomPerformOp> putMMIO32 failed for HUID 0x%x Address 0x%lx ",
+ TARGETING::get_huid(i_target), l_expAddr );
+ }
+ }
+
+ }
+
+ } while (0);
+ return l_err;
+}
+} \ No newline at end of file
diff --git a/src/usr/expaccess/mmioscomdd.H b/src/usr/expaccess/mmioscomdd.H
new file mode 100644
index 000000000..edb9ec474
--- /dev/null
+++ b/src/usr/expaccess/mmioscomdd.H
@@ -0,0 +1,67 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/mmioscomdd.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2019 */
+/* [+] 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 __MMIOSCOMDD_H
+#define __MMIOSCOMDD_H
+
+/** @file mmioscomdd.H
+ * @brief Provides the interfaces to perform mmioscom to OCMB chip
+ */
+#include <stdint.h>
+
+
+namespace MMIOSCOMDD
+{
+
+/**
+ * @brief Performs an MMIOSCOM access operation
+ * This function performs an MMIOSCOM access operation. It follows a pre-defined
+ * prototype functions in order to be registered with the device-driver
+ * framework.
+ *
+ * @param[in] i_opType Operation type, see DeviceFW::OperationType
+ * in driverif.H
+ * @param[in] i_target MMIOSCOM Explorer Chip target
+ * @param[in/out] io_buffer Read: Pointer to output data storage
+ * Write: Pointer to input data storage
+ * @param[in/out] io_buflen Input: size of io_buffer (in bytes)
+ * Output:
+ * Read: Size of output data
+ * Write: Size of data written
+ * @param[in] i_accessType DeviceFW::AccessType enum (usrif.H)
+ * @param[in] i_args This is an argument list for DD framework.
+ * In this function, there's only one argument,
+ * which is the IBM scom address
+ * @return errlHndl_t
+ */
+errlHndl_t mmioScomPerformOp(DeviceFW::OperationType i_opType,
+ TARGETING::Target* i_target,
+ void* io_buffer,
+ size_t& io_buflen,
+ int64_t i_accessType,
+ va_list i_args);
+
+}
+
+#endif // __MMIOSCOMDD_H \ No newline at end of file
diff --git a/src/usr/expaccess/runtime/makefile b/src/usr/expaccess/runtime/makefile
new file mode 100644
index 000000000..ed744eab2
--- /dev/null
+++ b/src/usr/expaccess/runtime/makefile
@@ -0,0 +1,36 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/expaccess/runtime/makefile $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2011,2019
+# [+] 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
+
+ROOTPATH = ../../../..
+MODULE = expaccess_rt
+
+SUBDIRS += test.d
+
+include ../expaccess.mk
+
+VPATH += ${ROOTPATH}/src/import/chips/ocmb/explorer/procedures/hwp/memory/
+VPATH += ${ROOTPATH}/src/usr/expaccess/
+
+include ${ROOTPATH}/config.mk \ No newline at end of file
diff --git a/src/usr/expaccess/runtime/test/makefile b/src/usr/expaccess/runtime/test/makefile
new file mode 100644
index 000000000..addcbd5e7
--- /dev/null
+++ b/src/usr/expaccess/runtime/test/makefile
@@ -0,0 +1,37 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/expaccess/runtime/test/makefile $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2011,2019
+# [+] 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 = testexpaccess_rt
+
+include ../../test/test.mk
+
+TESTS = ../../test/*.H
+
+include ${ROOTPATH}/config.mk
+
+
diff --git a/src/usr/expaccess/test/expscomtest.H b/src/usr/expaccess/test/expscomtest.H
new file mode 100644
index 000000000..c943ca7ba
--- /dev/null
+++ b/src/usr/expaccess/test/expscomtest.H
@@ -0,0 +1,717 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/test/expscomtest.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2019 */
+/* [+] 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 __EXPSCOMTEST_H
+#define __EXPSCOMTEST_H
+
+/**
+ * @file expscomtest.H
+ *
+ * @brief Test case for EXPSCOM code
+*/
+
+#include <cxxtest/TestSuite.H>
+#include <errl/errlmanager.H>
+#include <errl/errlentry.H>
+#include <devicefw/userif.H>
+#include <expscom/expscom_reasoncodes.H>
+#include <fapi2/target.H>
+#include <fapi2/plat_hwp_invoker.H>
+#include <fapi2_hwp_executor.H>
+#include <fapi2/hw_access.H>
+#include <lib/shared/exp_consts.H>
+
+extern trace_desc_t* g_trac_expscom;
+
+using namespace TARGETING;
+using namespace ERRORLOG;
+
+// Address and data to read/write
+struct testExpscomAddrData
+{
+ uint32_t addr;
+ uint64_t data;
+};
+
+// Test table values
+const testExpscomAddrData g_expscomAddrTable[] =
+{
+ {0x501C, 0x00000000DEADBEEF},
+ {0x209004, 0x00000000C0DEDEAD},
+ {0x8010002, 0xDEADC0DEC0DEBEEF}
+};
+const uint32_t g_expscomAddrTableSz =
+ sizeof(g_expscomAddrTable)/sizeof(testExpscomAddrData);
+
+
+const ScomSwitches forceI2CScom = {.useFsiScom = 0, .useXscom = 0,
+ .useInbandScom = 0, .useSbeScom = 0,
+ .useI2cScom = 1};
+
+const ScomSwitches forceMMIOScom = {.useFsiScom = 0, .useXscom = 0,
+ .useInbandScom = 1, .useSbeScom = 0,
+ .useI2cScom = 0};
+
+#define FAIL_TEST_RC(TARGET, STRING) \
+l_fails++; \
+TS_FAIL(STRING , \
+ l_testEntry.data, \
+ l_testEntry.addr, \
+ get_huid(TARGET)); \
+l_err = fapi2::rcToErrl(l_rc); \
+errlCommit(l_err, 0x10);
+
+#define FAIL_TEST_ERRL(TARGET, STRING) \
+l_fails++; \
+TS_FAIL(STRING , \
+ l_testEntry.data, \
+ l_testEntry.addr, \
+ get_huid(TARGET)); \
+errlCommit(l_err, 0x10);
+
+class expscomTest: public CxxTest::TestSuite
+{
+private:
+ fapi2::ReturnCode put_scom(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target,
+ const uint64_t i_address,
+ const fapi2::buffer<uint64_t> i_data)
+ {
+ return fapi2::putScom(i_target,i_address,i_data);
+ }
+
+ fapi2::ReturnCode get_scom(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target,
+ const uint64_t i_address,
+ fapi2::buffer<uint64_t>& o_data)
+ {
+ return fapi2::getScom(i_target,i_address,o_data);
+ }
+
+public:
+
+ /**
+ * @brief EXPSCOM test I2C Path
+ * Write value and read back to verify i2c scoms to OCMBs
+ */
+ void testExpscomI2c(void)
+ {
+ TRACFCOMP( g_trac_expscom, ">> Enter testExpscomI2c");
+ // Keep trace of pass/fails
+ uint32_t l_tests = 0;
+ uint32_t l_fails = 0;
+ errlHndl_t l_err = nullptr;
+
+ // Fapi interfaces will be used in these tests so this variable
+ // will be used to hold error from fapi calls
+ fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_SUCCESS;
+ fapi2::buffer<uint64_t> l_scom_buffer;
+ TargetHandleList l_explorerList;
+
+ do{
+// Causing a data storage exception in c_str...
+#ifdef CONFIG_AXONE_BRING_UP
+TRACFCOMP( g_trac_expscom,"skipping testExpscomI2c");
+break;
+#endif
+ // Get the system's OCMB chips, we will use these as test targets
+ getAllChips( l_explorerList,
+ TYPE_OCMB_CHIP,
+ true ); // true: return functional OCMBs
+
+ if(l_explorerList.size() == 0 )
+ {
+ TRACFCOMP( g_trac_expscom, "No OCMB targets found, skipping testExpscomI2c");
+ break;
+ }
+
+
+ // We will use the first and last targets for these scom tests
+ auto l_firstExpChip = l_explorerList.front();
+ auto l_lastExpChip = l_explorerList.back();
+
+ // Cast the TARGETING::Targets into fapi2::Targets
+ fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP> l_firstExpChip_fapi(l_firstExpChip);
+ fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP> l_lastExpChip_fapi(l_lastExpChip);
+
+ // Save away original scom switch info so we can restore it at the end of the test
+ auto first_ocmb_info = l_firstExpChip->getAttr<TARGETING::ATTR_SCOM_SWITCHES>();
+ auto last_ocmb_info = l_lastExpChip->getAttr<TARGETING::ATTR_SCOM_SWITCHES>();
+
+ // This goal of this tests is to make sure I2C scom to OCMB is working so force
+ // scom to go over I2C path for these targets
+ l_firstExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(forceI2CScom);
+ l_lastExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(forceI2CScom);
+
+ // Loop through table for first and last OCMB targets
+ for( uint32_t l_num=0; l_num < g_expscomAddrTableSz; l_num++)
+ {
+ // Read the test entry info from the global table at the top of this file
+ testExpscomAddrData l_testEntry = g_expscomAddrTable[l_num];
+
+ if(l_testEntry.addr & mss::exp::i2c::IBM_SCOM_INDICATOR)
+ {
+ // If this is an IBM address then we expect 64 bits of data
+ l_scom_buffer.insert<0,64,0,uint64_t>(l_testEntry.data);
+ }
+ else
+ {
+ // Otherwise we know this is a native OCMB address and it is only 32 bits
+ l_scom_buffer.insert<32,32,0,uint32_t>(l_testEntry.data);
+ }
+
+ FAPI_INVOKE_HWP(l_err, put_scom,
+ l_firstExpChip_fapi,
+ l_testEntry.addr,
+ l_scom_buffer );
+ l_tests++;
+ if(l_err)
+ {
+ FAIL_TEST_ERRL(l_firstExpChip,
+ "testExpscomI2c>> Failed putScom writing 0x%.16X to 0x%.8X on target w/ huid 0x%.8X");
+
+ }
+
+ // putScom to last OCMB over i2c
+ FAPI_INVOKE_HWP(l_err, put_scom,
+ l_lastExpChip_fapi,
+ l_testEntry.addr,
+ l_scom_buffer );
+ l_tests++;
+ if(l_err)
+ {
+ FAIL_TEST_ERRL(l_lastExpChip,
+ "testExpscomI2c>> Failed putScom writing 0x%.16X to 0x%.8X on target w/ huid 0x%.8X");
+ }
+
+
+ // Flush scom buffers so it doesnt mess up next test
+ l_scom_buffer.flush<0>();
+
+ // getScom to first OCMB over i2c
+ FAPI_INVOKE_HWP(l_err, get_scom,
+ l_firstExpChip_fapi,
+ l_testEntry.addr,
+ l_scom_buffer );
+ l_tests++;
+ if(l_err)
+ {
+ FAIL_TEST_ERRL(l_firstExpChip,
+ "testExpscomI2c>> Failed getScom reading 0x%.16X to 0x%.8X on target w/ huid 0x%.8X")
+ }
+
+ l_tests++;
+ if(l_scom_buffer() != l_testEntry.data)
+ {
+ l_fails++;
+ TS_FAIL("testExpscomI2c>> Expected 0x%.16X but got 0x%.16X on target w/ huid 0x%.8X",
+ l_testEntry.data,
+ l_scom_buffer(),
+ get_huid(l_firstExpChip));
+ }
+
+ // Flush scom buffers so it doesnt mess up next test
+ l_scom_buffer.flush<0>();
+
+ // getScom to last OCMB over i2c
+ FAPI_INVOKE_HWP(l_err, get_scom,
+ l_lastExpChip_fapi,
+ l_testEntry.addr,
+ l_scom_buffer );
+ l_tests++;
+ if(l_err)
+ {
+ FAIL_TEST_ERRL(l_lastExpChip,
+ "testExpscomI2c>> Failed getScom reading 0x%.16X to 0x%.8X on target w/ huid 0x%.8X")
+ }
+
+ l_tests++;
+ if(l_scom_buffer() != l_testEntry.data)
+ {
+ l_fails++;
+ TS_FAIL("testExpscomI2c>> Expected 0x%.16X but got 0x%.16X on target w/ huid 0x%.8X",
+ l_testEntry.data,
+ l_scom_buffer(),
+ get_huid(l_lastExpChip));
+ }
+ }
+
+ // Set ATTR_SCOM_SWITCHES back to their original values
+ l_firstExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(first_ocmb_info);
+ l_lastExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(last_ocmb_info);
+ }while(0);
+
+ TRACFCOMP( g_trac_expscom, "<< Exit testExpscomI2c");
+ return;
+ }
+
+ void testExpscomI2cPlatform(void)
+ {
+
+ TRACFCOMP( g_trac_expscom, ">> Enter testExpscomI2cPlatform");
+ // Keep trace of pass/fails
+ uint32_t l_tests = 0;
+ uint32_t l_fails = 0;
+ errlHndl_t l_err = nullptr;
+ size_t l_scomSize = sizeof(uint64_t);
+
+ // Fapi interfaces will be used in these tests so this variable
+ // will be used to hold error from fapi calls
+ fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_SUCCESS;
+ fapi2::buffer<uint64_t> l_scom_buffer;
+
+ // Get the system's OCMB chips, we will use these as test targets
+ TargetHandleList l_explorerList;
+
+ do{
+// Causing a data storage exception in c_str...
+#ifdef CONFIG_AXONE_BRING_UP
+TRACFCOMP( g_trac_expscom,"skipping testExpscomI2cPlatformPlatform");
+break;
+#endif
+
+ getAllChips( l_explorerList,
+ TYPE_OCMB_CHIP,
+ true ); // true: return functional OCMBs
+
+
+ if(l_explorerList.size() == 0 )
+ {
+ TRACFCOMP( g_trac_expscom, "No OCMB targets found, skipping testExpscomI2cPlatformPlatform");
+ break;
+ }
+
+ // We will use the first and last targets for these scom tests
+ auto l_firstExpChip = l_explorerList.front();
+ auto l_lastExpChip = l_explorerList.back();
+
+ // Save away original scom switch info so we can restore it at the end of the test
+ auto first_ocmb_info = l_firstExpChip->getAttr<TARGETING::ATTR_SCOM_SWITCHES>();
+ auto last_ocmb_info = l_lastExpChip->getAttr<TARGETING::ATTR_SCOM_SWITCHES>();
+
+ // This goal of this tests is to make sure I2C scom to OCMB is working so force
+ // scom to go over I2C path for these targets
+ l_firstExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(forceI2CScom);
+ l_lastExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(forceI2CScom);
+
+ // Loop through table for first and last OCMB targets
+ for( uint32_t l_num=0; l_num < g_expscomAddrTableSz; l_num++)
+ {
+ // Read the test entry info from the global table at the top of this file
+ testExpscomAddrData l_testEntry = g_expscomAddrTable[l_num];
+
+ if(l_testEntry.addr & mss::exp::i2c::IBM_SCOM_INDICATOR)
+ {
+ // If this is an IBM address then we expect 64 bits of data
+ l_scom_buffer.insert<0,64,0,uint64_t>(l_testEntry.data);
+ }
+ else
+ {
+ // Otherwise we know this is a native OCMB address and it is only 32 bits
+ l_scom_buffer.insert<32,32,0,uint32_t>(l_testEntry.data);
+ }
+ l_err = deviceWrite(l_firstExpChip,
+ &l_scom_buffer,
+ l_scomSize,
+ DEVICE_SCOM_ADDRESS( l_testEntry.addr));
+ l_tests++;
+ if(l_err)
+ {
+ FAIL_TEST_ERRL(l_firstExpChip,
+ "testExpscomI2cPlatform>> Failed putScom writing 0x%.16X to 0x%.8X on target w/ huid 0x%.8X");
+
+ }
+
+ l_err = deviceWrite(l_lastExpChip,
+ &l_scom_buffer,
+ l_scomSize,
+ DEVICE_SCOM_ADDRESS( l_testEntry.addr));
+ l_tests++;
+ if(l_err)
+ {
+ FAIL_TEST_ERRL(l_firstExpChip,
+ "testExpscomI2cPlatform>> Failed putScom writing 0x%.16X to 0x%.8X on target w/ huid 0x%.8X");
+
+ }
+ // Flush scom buffers so it doesnt mess up next test
+ l_scom_buffer.flush<0>();
+
+ // getScom to first OCMB over i2c
+ l_err = deviceRead(l_firstExpChip,
+ &l_scom_buffer(),
+ l_scomSize,
+ DEVICE_SCOM_ADDRESS( l_testEntry.addr));
+ l_tests++;
+ if(l_err)
+ {
+ FAIL_TEST_ERRL(l_firstExpChip,
+ "testExpscomI2cPlatform>> Failed getScom reading 0x%.16X to 0x%.8X on target w/ huid 0x%.8X")
+ }
+
+ l_tests++;
+ if(l_scom_buffer() != l_testEntry.data)
+ {
+ l_fails++;
+ TS_FAIL("testExpscomI2cPlatform>> Expected 0x%.16X but got 0x%.16X on target w/ huid 0x%.8X",
+ l_testEntry.data,
+ l_scom_buffer(),
+ get_huid(l_firstExpChip));
+ }
+
+
+ // Flush scom buffers so it doesnt mess up next test
+ l_scom_buffer.flush<0>();
+
+ // getScom to last OCMB over i2c
+ l_err = deviceRead(l_lastExpChip,
+ &l_scom_buffer(),
+ l_scomSize,
+ DEVICE_SCOM_ADDRESS( l_testEntry.addr));
+ l_tests++;
+ if(l_err)
+ {
+ FAIL_TEST_ERRL(l_firstExpChip,
+ "testExpscomI2cPlatform>> Failed getScom reading 0x%.16X to 0x%.8X on target w/ huid 0x%.8X")
+ }
+
+ l_tests++;
+ if(l_scom_buffer() != l_testEntry.data)
+ {
+ l_fails++;
+ TS_FAIL("testExpscomI2cPlatform>> Expected 0x%.16X but got 0x%.16X on target w/ huid 0x%.8X",
+ l_testEntry.data,
+ l_scom_buffer(),
+ get_huid(l_firstExpChip));
+ }
+ }
+
+ // Set ATTR_SCOM_SWITCHES back to their original values
+ l_firstExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(first_ocmb_info);
+ l_lastExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(last_ocmb_info);
+ }while(0);
+
+ TRACFCOMP( g_trac_expscom, "<< Exit testExpscomI2cPlatform");
+ return;
+ }
+
+// TODO RTC: 189447 Enable MMIO tests when MMIO drivers avail
+ /**
+ * @brief EXPSCOM test MMIO
+ * Write value and read back to verify MMIO scoms to OCMBs
+ */
+// void testExpscomMmio(void)
+// {
+// TargetHandleList l_explorerList;
+// uint32_t l_tests = 0;
+// uint32_t l_fails = 0;
+// errlHndl_t l_err = nullptr;
+// fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_SUCCESS;
+// fapi2::buffer<uint64_t> l_scom_buffer;
+//
+// // Get the system's procs
+// getAllChips( l_explorerList,
+// TYPE_OCMB_CHIP,
+// true ); // true: return functional OCMBs
+//
+// auto l_firstExpChip = l_explorerList.front();
+// auto l_lastExpChip = l_explorerList.back();
+//
+// fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP> l_firstExpChip_fapi(l_firstExpChip);
+// fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP> l_lastExpChip_fapi(l_lastExpChip);
+//
+// auto first_ocmb_info = l_firstExpChip->getAttr<TARGETING::ATTR_SCOM_SWITCHES>();
+// auto last_ocmb_info = l_lastExpChip->getAttr<TARGETING::ATTR_SCOM_SWITCHES>();
+//
+//
+// // Loop through table for first and last OCMB, perform i2c write, then
+// // mmio read, and mmio write followed by i2c read.
+// for( uint32_t l_num=0; l_num < g_expscomAddrTableSz; l_num++)
+// {
+// testExpscomAddrData l_testEntry = g_expscomAddrTable[l_num];
+// if(l_testEntry.addr & mss::exp::i2c::IBM_SCOM_INDICATOR)
+// {
+// l_scom_buffer.insert<0,64,0,uint64_t>(l_testEntry.data);
+// }
+// else
+// {
+// l_scom_buffer.insert<0,32,0,uint32_t>(l_testEntry.data);
+// }
+//
+// // putScom to first OCMB over mmio
+// l_rc = put_scom(l_firstExpChip_fapi,
+// l_testEntry.addr,
+// l_scom_buffer);
+// l_tests++;
+// if(l_rc)
+// {
+// l_fails++;
+// TS_FAIL("testExpscomMmio>> Failed putScom writing 0x%.16X to 0x%.8X on target w/ huid 0x%.8X",
+// l_testEntry.data,
+// l_testEntry.addr,
+// get_huid(l_firstExpChip));
+// l_err = fapi2::rcToErrl(l_rc);
+// errlCommit(l_err, 0x10);
+// }
+//
+// // putScom to last OCMB over mmio
+// l_rc = put_scom(l_lastExpChip_fapi,
+// l_testEntry.addr,
+// l_scom_buffer);
+// l_tests++;
+// if(l_rc)
+// {
+// l_fails++;
+// TS_FAIL("testExpscomMmio>> Failed putScom writing 0x%.16X to 0x%.8X on target w/ huid 0x%.8X",
+// l_testEntry.data,
+// l_testEntry.addr,
+// get_huid(l_lastExpChip));
+// l_err = fapi2::rcToErrl(l_rc);
+// errlCommit(l_err, 0x10);
+// }
+//
+// // Flush scom buffer so it doesnt mess up next test
+// l_scom_buffer.flush<0>();
+//
+//
+// // getScom to first OCMB over mmio
+// l_rc = get_scom(l_firstExpChip_fapi,
+// l_testEntry.addr,
+// l_scom_buffer);
+// l_tests++;
+// if(l_rc)
+// {
+// l_fails++;
+// TS_FAIL("testExpscomMmio>> Failed getScom reading 0x%.16X to 0x%.8X on target w/ huid 0x%.8X",
+// l_testEntry.data,
+// l_testEntry.addr,
+// get_huid(l_firstExpChip));
+// l_err = fapi2::rcToErrl(l_rc);
+// errlCommit(l_err, 0x10);
+// }
+//
+// l_tests++;
+// if(l_scom_buffer() != l_testEntry.data)
+// {
+// l_fails++;
+// TS_FAIL("testExpscomMmio>> Expected 0x%.16X but got 0x%.16X on target w/ huid 0x%.8X",
+// l_testEntry.data,
+// l_scom_buffer(),
+// get_huid(l_firstExpChip));
+// l_err = fapi2::rcToErrl(l_rc);
+// errlCommit(l_err, 0x10);
+// }
+//
+// // Flush scom buffer so it doesnt mess up next test
+// l_scom_buffer.flush<0>();
+//
+// // getScom to last OCMB over mmio
+// l_rc = get_scom(l_lastExpChip_fapi,
+// l_testEntry.addr,
+// l_scom_buffer);
+// l_tests++;
+// if(l_rc)
+// {
+// l_fails++;
+// TS_FAIL("testExpscomMmio>> Failed getScom reading 0x%.16X to 0x%.8X on target w/ huid 0x%.8X",
+// l_testEntry.data,
+// l_testEntry.addr,
+// get_huid(l_lastExpChip));
+// l_err = fapi2::rcToErrl(l_rc);
+// errlCommit(l_err, 0x10);
+// }
+//
+// l_tests++;
+// if(l_scom_buffer() != l_testEntry.data)
+// {
+// l_fails++;
+// TS_FAIL("testExpscomMmio>> Expected 0x%.16X but got 0x%.16X on target w/ huid 0x%.8X",
+// l_testEntry.data,
+// l_scom_buffer(),
+// get_huid(l_lastExpChip));
+// l_err = fapi2::rcToErrl(l_rc);
+// errlCommit(l_err, 0x10);
+// }
+// }
+// // Set ATTR_SCOM_SWITCHES back to their original values
+// l_firstExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(first_ocmb_info);
+// l_lastExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(last_ocmb_info);
+// return;
+// }
+
+ /**
+ * @brief EXPSCOM test MMIO
+ * Write value and read back to verify MMIO
+ */
+// void testExpscomCombined(void)
+// {
+// TargetHandleList l_explorerList;
+// uint32_t l_tests = 0;
+// uint32_t l_fails = 0;
+// fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_SUCCESS;
+// fapi2::buffer<uint64_t> l_scom_buffer;
+//
+// // Get the system's procs
+// getAllChips( l_explorerList,
+// TYPE_OCMB_CHIP,
+// true ); // true: return functional OCMBs
+//
+// auto l_firstExpChip = l_explorerList.front();
+// auto l_lastExpChip = l_explorerList.back();
+//
+// fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP> l_firstExpChip_fapi(l_firstExpChip);
+// fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP> l_lastExpChip_fapi(l_lastExpChip);
+//
+// auto first_ocmb_info = l_firstExpChip->getAttr<TARGETING::ATTR_SCOM_SWITCHES>();
+// auto last_ocmb_info = l_lastExpChip->getAttr<TARGETING::ATTR_SCOM_SWITCHES>();
+//
+// // Loop through table for first and last OCMB
+// for( uint32_t l_num=0; l_num < g_expscomAddrTableSz; l_num++)
+// {
+// testExpscomAddrData l_testEntry = g_expscomAddrTable[l_num];
+//
+// if(l_testEntry.addr & mss::exp::i2c::IBM_SCOM_INDICATOR)
+// {
+// l_scom_buffer.insert<0,64,0,uint64_t>(l_testEntry.data);
+// }
+// else
+// {
+// l_scom_buffer.insert<0,32,0,uint32_t>(l_testEntry.data);
+// }
+//
+// // ODD tests : first target writes MMIO, last target writes I2C
+// // EVEN tests : first target writes I2C, last target writes MMIO
+// if(l_num % 2)
+// {
+// l_firstExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(forceMMIOScom);
+// l_lastExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(forceI2CScom);
+// }
+// else
+// {
+// l_firstExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(forceI2CScom);
+// l_lastExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(forceMMIOScom);
+// }
+//
+// // putScom to first OCMB over mmio
+// l_rc = put_scom(l_firstExpChip_fapi,
+// l_testEntry.addr,
+// l_scom_buffer);
+// l_tests++;
+// if(l_rc)
+// {
+// l_fails++;
+// TS_FAIL("testExpscomMmio>> Failed putScom writing 0x%.16X to 0x%.8X on target w/ huid 0x%.8X",
+// l_testEntry.data,
+// l_testEntry.addr,
+// get_huid(l_firstExpChip));
+// }
+//
+// // putScom to last OCMB over mmio
+// l_rc = put_scom(l_lastExpChip_fapi,
+// l_testEntry.addr,
+// l_scom_buffer);
+// l_tests++;
+// if(l_rc)
+// {
+// l_fails++;
+// TS_FAIL("testExpscomMmio>> Failed putScom writing 0x%.16X to 0x%.8X on target w/ huid 0x%.8X",
+// l_testEntry.data,
+// l_testEntry.addr,
+// get_huid(l_lastExpChip));
+// }
+//
+// // Flush scom buffer so it doesnt mess up next test
+// l_scom_buffer.flush<0>();
+//
+// // getScom to first OCMB over mmio
+// l_rc = get_scom(l_firstExpChip_fapi,
+// l_testEntry.addr,
+// l_scom_buffer);
+// l_tests++;
+// if(l_rc)
+// {
+// l_fails++;
+// TS_FAIL("testExpscomMmio>> Failed getScom reading 0x%.16X to 0x%.8X on target w/ huid 0x%.8X",
+// l_testEntry.data,
+// l_testEntry.addr,
+// get_huid(l_firstExpChip));
+// }
+//
+// l_tests++;
+// if(l_scom_buffer() != l_testEntry.data)
+// {
+// l_fails++;
+// TS_FAIL("testExpscomMmio>> Expected 0x%.16X but got 0x%.16X on target w/ huid 0x%.8X",
+// l_testEntry.data,
+// l_scom_buffer(),
+// get_huid(l_firstExpChip));
+// }
+//
+// // ODD tests : first target reads I2C, last target reads MMIO
+// // EVEN tests : first target reads MMIO, last target reads I2C
+// if(l_num % 2)
+// {
+// l_firstExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(forceI2CScom);
+// l_lastExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(forceMMIOScom);
+// }
+// else
+// {
+// l_firstExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(forceMMIOScom);
+// l_lastExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(forceI2CScom);
+// }
+//
+// // Flush scom buffer so it doesnt mess up next test
+// l_scom_buffer.flush<0>();
+//
+// // getScom to last OCMB over mmio
+// l_rc = get_scom(l_lastExpChip_fapi,
+// l_testEntry.addr,
+// l_scom_buffer);
+// l_tests++;
+// if(l_rc)
+// {
+// l_fails++;
+// TS_FAIL("testExpscomMmio>> Failed getScom reading 0x%.16X to 0x%.8X on target w/ huid 0x%.8X",
+// l_testEntry.data,
+// l_testEntry.addr,
+// get_huid(l_lastExpChip));
+// }
+//
+// l_tests++;
+// if(l_scom_buffer() != l_testEntry.data)
+// {
+// l_fails++;
+// TS_FAIL("testExpscomMmio>> Expected 0x%.16X but got 0x%.16X on target w/ huid 0x%.8X",
+// l_testEntry.data,
+// l_scom_buffer(),
+// get_huid(l_lastExpChip));
+// }
+// }
+// // Set ATTR_SCOM_SWITCHES back to their original values
+// l_firstExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(first_ocmb_info);
+// l_lastExpChip->setAttr<TARGETING::ATTR_SCOM_SWITCHES>(last_ocmb_info);
+// return;
+// }
+
+
+};
+
+#endif
diff --git a/src/usr/expaccess/test/makefile b/src/usr/expaccess/test/makefile
new file mode 100644
index 000000000..8f8fb86fc
--- /dev/null
+++ b/src/usr/expaccess/test/makefile
@@ -0,0 +1,33 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/expaccess/test/makefile $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2018,2019
+# [+] 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
+
+ROOTPATH = ../../../..
+MODULE = testexpaccess
+
+include test.mk
+
+TESTS = *.H
+
+include ${ROOTPATH}/config.mk \ No newline at end of file
diff --git a/src/usr/expaccess/test/ocmbcommtest.H b/src/usr/expaccess/test/ocmbcommtest.H
new file mode 100644
index 000000000..3c717d939
--- /dev/null
+++ b/src/usr/expaccess/test/ocmbcommtest.H
@@ -0,0 +1,334 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/expaccess/test/ocmbcommtest.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2018,2019 */
+/* [+] 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 __OCMBCOMMTEST_H
+#define __OCMBCOMMTEST_H
+/**
+ * @file ocmbcommtest.H
+ *
+ * @brief Test cases for OCMB communication protocol
+ */
+#include <cxxtest/TestSuite.H>
+#include <errl/errlmanager.H>
+#include <errl/errlentry.H>
+#include <fapi2.H>
+#ifndef __HOSTBOOT_RUNTIME
+#include <vfs/vfs.H> // module_is_loaded & module_load
+#endif
+#include <plat_hwp_invoker.H>
+#include <exp_inband.H>
+#include <exp_data_structs.H>
+#include <generic/memory/lib/utils/endian_utils.H>
+
+// EXP_FW_ADAPTER_PROPERTIES_GET data response format
+#define FW_ADAPTER_MAX_FW_IMAGE 4
+#define FW_ADAPTER_CHIP_VERSION_SIZE 128
+#define FW_ADAPTER_SPI_FLASH_ID_SIZE 32
+typedef struct
+{
+ uint32_t fw_number_of_images; // number of FW images
+ uint32_t boot_partion_id; // ID of current boot partion
+ struct fw_version_string
+ {
+ uint32_t major; // FW version - Major release
+ uint32_t minor; // FW version - Minor release
+ uint32_t build_num; // FW build number
+ uint32_t build_patch; // FW build path number
+ uint32_t sector_size; // FW sector size
+ } fw_ver_str[FW_ADAPTER_MAX_FW_IMAGE];
+
+ uint32_t ram_size_in_bytes; // RAM size in bytes
+ unsigned char chip_version[FW_ADAPTER_CHIP_VERSION_SIZE]; // Explorer chip revision
+ unsigned char spi_flash_id[FW_ADAPTER_SPI_FLASH_ID_SIZE]; // SPI flash ID
+ uint32_t spi_flash_size; // SPI flash size in bytes
+ uint32_t error_buffer_offset; // FW error buffer offset in SPI flash
+ uint32_t error_buffer_size; // FW error buffer size in bytes
+} FW_ADAPTER_PROPERTIES_type;
+
+
+// Testing this code
+const char EXPLORER_LIBRARY_NAME[16] = "libexpaccess.so";
+
+// Need this module for mss::c_str call in HWP failure path traces
+const char MSS_LIBRARY_NAME[17] = "libisteps_mss.so";
+
+/**
+ * @brief Generic function to load a module
+ * @param o_module_loaded - returns true if module is loaded by this function
+ * @param i_modName - module name to load
+ * @return error handle if module_load call fails
+ */
+errlHndl_t loadModule(bool & o_module_loaded, const char * i_modName)
+{
+ errlHndl_t err = NULL;
+ o_module_loaded = false;
+
+// VFS functions only compilable in non-runtime environment
+#ifndef __HOSTBOOT_RUNTIME
+ if(!VFS::module_is_loaded(i_modName))
+ {
+ err = VFS::module_load(i_modName);
+ if(err)
+ {
+ TS_FAIL("loadModule() - %s load failed", i_modName );
+ }
+ else
+ {
+ o_module_loaded = true;
+ FAPI_INF("loadModule: %s loaded", i_modName);
+ }
+ }
+#endif
+ return err;
+}
+
+/**
+ * @brief Generic function to unload a module
+ * @param i_modName - module name to load
+ * @return error handle if module_unload call fails
+ */
+errlHndl_t unloadModule(const char * i_modName)
+{
+ errlHndl_t err = NULL;
+
+// VFS function only compilable in non-runtime environment
+#ifndef __HOSTBOOT_RUNTIME
+ err = VFS::module_unload(i_modName);
+ if(err)
+ {
+ TS_FAIL("unloadExplorerModule() - %s unload failed", i_modName );
+ }
+ else
+ {
+ FAPI_INF("unloadModule: %s unloaded", i_modName);
+ }
+#endif
+ return err;
+}
+
+
+class OCMBCommTest: public CxxTest::TestSuite
+{
+ public:
+
+ /**
+ * @brief Fills in command structure for the EXP_FW_ADAPTER_PROPERTIES_GET cmd
+ * @param io_cmd -- command that gets filled in
+ */
+ void buildPropertiesGetCmd(host_fw_command_struct & io_cmd)
+ {
+ io_cmd.cmd_id = 0x07; // EXP_FW_ADAPTER_PROPERTIES_GET
+ io_cmd.cmd_flags = 0x00; // no additional data
+ io_cmd.request_identifier = 0x0203; // host generated id number
+ io_cmd.cmd_length = 0x00000000; // length of addditional data
+ io_cmd.cmd_crc = 0xFFFFFFFF; // CRC-32 of no additional data
+ io_cmd.host_work_area = 0x00000000;
+ io_cmd.cmd_work_area = 0x00000000;
+ memset(io_cmd.padding, 0, sizeof(io_cmd.padding));
+ memset(io_cmd.command_argument, 0, sizeof(io_cmd.command_argument));
+ }
+
+ /**
+ * @brief Convert structure from little endian format into big endian
+ * @param o_data -- big endian output
+ * @param i_data -- vector of little endian data
+ * @return true if successful, else false
+ */
+ bool fw_adapter_properties_struct_from_little_endian(
+ FW_ADAPTER_PROPERTIES_type & o_data,
+ std::vector<uint8_t>& i_data)
+ {
+ bool l_rc = false;
+
+ // make sure we don't go outside i_data range
+ if (i_data.size() >= sizeof(o_data))
+ {
+ uint32_t l_idx = 0;
+ l_rc = mss::readLE(i_data, l_idx, o_data.fw_number_of_images);
+ l_rc &= mss::readLE(i_data, l_idx, o_data.boot_partion_id);
+ for (int i = 0; i < FW_ADAPTER_MAX_FW_IMAGE; ++i)
+ {
+ l_rc &= mss::readLE(i_data, l_idx, o_data.fw_ver_str[i].major);
+ l_rc &= mss::readLE(i_data, l_idx, o_data.fw_ver_str[i].minor);
+ l_rc &= mss::readLE(i_data, l_idx, o_data.fw_ver_str[i].build_num);
+ l_rc &= mss::readLE(i_data, l_idx, o_data.fw_ver_str[i].build_patch);
+ l_rc &= mss::readLE(i_data, l_idx, o_data.fw_ver_str[i].sector_size);
+ }
+ l_rc &= mss::readLE(i_data, l_idx, o_data.ram_size_in_bytes);
+ l_rc &= mss::readLEArray(i_data, FW_ADAPTER_CHIP_VERSION_SIZE, l_idx, o_data.chip_version);
+ l_rc &= mss::readLEArray(i_data, FW_ADAPTER_SPI_FLASH_ID_SIZE, l_idx, o_data.spi_flash_id);
+ l_rc &= mss::readLE(i_data, l_idx, o_data.spi_flash_size);
+ l_rc &= mss::readLE(i_data, l_idx, o_data.error_buffer_offset);
+ l_rc &= mss::readLE(i_data, l_idx, o_data.error_buffer_size);
+ }
+ else
+ {
+ TS_FAIL("fw_adapter_properties_struct_from_little_endian(): "
+ "not enough data present (%d, expected %d)",
+ i_data.size(), sizeof(o_data) );
+ }
+ return l_rc;
+ }
+
+ /**
+ * @brief Test the Explorer inband command/response path
+ */
+ void testOcmbInbandCmdRsp( void )
+ {
+ errlHndl_t l_errl = nullptr;
+
+ // Create a vector of TARGETING::Target pointers
+ TARGETING::TargetHandleList l_chipList;
+
+ // Get a list of all of the functioning ocmb chips
+ TARGETING::getAllChips(l_chipList, TARGETING::TYPE_OCMB_CHIP, true);
+
+ host_fw_command_struct l_cmd;
+ host_fw_response_struct l_rsp;
+ std::vector<uint8_t> l_rsp_data;
+
+ // Create a non-destructive get_properties command
+ buildPropertiesGetCmd(l_cmd);
+
+ for (auto & l_ocmb: l_chipList)
+ {
+ FAPI_INF("testOcmbInbandCmdRsp: testing 0x%.8X OCMB", TARGETING::get_huid(l_ocmb));
+
+ fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>l_fapi2_target( l_ocmb );
+
+ // send the command
+ FAPI_INVOKE_HWP(l_errl, mss::exp::ib::putCMD, l_fapi2_target,
+ l_cmd);
+ if (l_errl)
+ {
+ TS_FAIL("Error from putCMD for 0x%.8X target",
+ TARGETING::get_huid(l_ocmb));
+ break;
+ }
+
+ // grab the response
+ FAPI_INVOKE_HWP(l_errl, mss::exp::ib::getRSP, l_fapi2_target,
+ l_rsp, l_rsp_data);
+ if (l_errl)
+ {
+ TS_FAIL("Error from getRSP for 0x%.8X target",
+ TARGETING::get_huid(l_ocmb));
+ break;
+ }
+
+ // Check for a valid data response length
+ if (l_rsp.response_length != sizeof(FW_ADAPTER_PROPERTIES_type))
+ {
+ TS_FAIL("Unexpected response length 0x%.8X (expected 0x%.8X)",
+ l_rsp.response_length, sizeof(FW_ADAPTER_PROPERTIES_type));
+ break;
+ }
+
+ // Now convert the little endian response data into big endian
+ FW_ADAPTER_PROPERTIES_type l_fw_adapter_data;
+ fw_adapter_properties_struct_from_little_endian(l_fw_adapter_data,
+ l_rsp_data);
+
+ // Check for some expected response values
+ // Simics should return 0x10 as the first byte of chip_version
+ if (l_fw_adapter_data.chip_version[0] != 0x10 )
+ {
+ TS_FAIL("Expected chip_version to start with 0x10, found 0x%02X",
+ l_fw_adapter_data.chip_version[0]);
+ }
+ }
+
+ if (l_errl)
+ {
+ errlCommit( l_errl, TARG_COMP_ID );
+ }
+ FAPI_INF("testOcmbInbandCmdRsp: exiting");
+ };
+
+ /**
+ * @brief Constructor
+ */
+ OCMBCommTest() : CxxTest::TestSuite()
+ {
+ explorer_module_loaded = false;
+ mss_module_loaded = false;
+
+ // All modules are loaded by runtime,
+ // so testcase loading of modules is not required
+#ifndef __HOSTBOOT_RUNTIME
+ errlHndl_t err = nullptr;
+ err = loadModule(explorer_module_loaded, EXPLORER_LIBRARY_NAME);
+ if(err)
+ {
+ TS_FAIL("OCMBCommTest() - Constuctor: failed to load EXPLORER module");
+ errlCommit( err, TARG_COMP_ID );
+ }
+ else
+ {
+ err = loadModule(mss_module_loaded, MSS_LIBRARY_NAME);
+ if(err)
+ {
+ TS_FAIL("OCMBCommTest() - Constuctor: failed to load MSS module");
+ errlCommit( err, TARG_COMP_ID );
+ }
+ }
+#endif
+ };
+
+
+ /**
+ * @brief Destructor
+ */
+ ~OCMBCommTest()
+ {
+ errlHndl_t err = nullptr;
+ if (explorer_module_loaded)
+ {
+ err = unloadModule(EXPLORER_LIBRARY_NAME);
+ if(err)
+ {
+ TS_FAIL("~OCMBCommTest() - Destructor: failed to unload EXPLORER module");
+ errlCommit( err, TARG_COMP_ID );
+ }
+ }
+ if (mss_module_loaded)
+ {
+ err = unloadModule(MSS_LIBRARY_NAME);
+ if(err)
+ {
+ TS_FAIL("~OCMBCommTest() - Destructor: failed to unload MSS module");
+ errlCommit( err, TARG_COMP_ID );
+ }
+ }
+ };
+
+ private:
+ // use these to keep track of if we need to unload any
+ // modules loaded by this testcase
+ bool explorer_module_loaded;
+ bool mss_module_loaded;
+
+};
+
+#endif
diff --git a/src/usr/expaccess/test/test.mk b/src/usr/expaccess/test/test.mk
new file mode 100644
index 000000000..059efe27d
--- /dev/null
+++ b/src/usr/expaccess/test/test.mk
@@ -0,0 +1,35 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/expaccess/test/test.mk $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2019
+# [+] 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
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/fapi2
+EXTRAINCDIR += ${ROOTPATH}/src/import/hwpf/fapi2/include
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/common/utils/imageProcs
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/shared
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/ocmb/explorer/procedures/hwp/memory/
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/ocmb/explorer/common/include
+EXTRAINCDIR += ${ROOTPATH}/src/import
+
+
+include ${ROOTPATH}/config.mk
OpenPOWER on IntegriCloud