summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShakeeb <shakeebbk@in.ibm.com>2016-04-21 03:18:34 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2016-07-25 07:31:06 -0400
commita6a04775748299d48f4267b5d6e16d045c4d7eb3 (patch)
tree026f929fb64fe67dc89f185fbace721cfbf7f049
parent0841f441375ee8475f52410f354c2641d29ceeaf (diff)
downloadtalos-sbe-a6a04775748299d48f4267b5d6e16d045c4d7eb3.tar.gz
talos-sbe-a6a04775748299d48f4267b5d6e16d045c4d7eb3.zip
Put Ring From Image Chip-Op
Implementation of Put Ring from Image chip op with the signature - Ring ID and Pervasive Chiplet ID Change-Id: I19b88fb83c11c3d5c7f25bc22338a11fef0c8d4d Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/23665 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: RAJA DAS <rajadas2@in.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
-rw-r--r--sbe/sbefw/sbeHostMsg.H24
-rw-r--r--sbe/sbefw/sbeHostUtils.C51
-rw-r--r--sbe/sbefw/sbeHostUtils.H12
-rw-r--r--sbe/sbefw/sbe_host_intf.H42
-rw-r--r--sbe/sbefw/sbe_sp_intf.H51
-rw-r--r--sbe/sbefw/sbecmdparser.C44
-rw-r--r--sbe/sbefw/sbecmdringaccess.C169
-rw-r--r--sbe/sbefw/sbecmdringaccess.H55
-rw-r--r--sbe/sbefw/sbefwfiles.mk2
-rwxr-xr-xsbe/test/test.xml30
-rw-r--r--sbe/test/testExecutorPutRing.py265
-rwxr-xr-xsbe/test/testExecutorPutRing.xml31
-rw-r--r--sbe/test/testPSUUtil.py42
13 files changed, 720 insertions, 98 deletions
diff --git a/sbe/sbefw/sbeHostMsg.H b/sbe/sbefw/sbeHostMsg.H
index 12ab1502..edd040cf 100644
--- a/sbe/sbefw/sbeHostMsg.H
+++ b/sbe/sbefw/sbeHostMsg.H
@@ -1,3 +1,27 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: sbe/sbefw/sbeHostMsg.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2016 */
+/* [+] 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: ppe/sbe/sbefw/sbeHostMsg.H
*
diff --git a/sbe/sbefw/sbeHostUtils.C b/sbe/sbefw/sbeHostUtils.C
index f143db6b..bdb0064e 100644
--- a/sbe/sbefw/sbeHostUtils.C
+++ b/sbe/sbefw/sbeHostUtils.C
@@ -36,7 +36,7 @@
#include "sbe_host_intf.H"
#include "sbeerrorcodes.H"
#include "assert.h"
-
+#include "fapi2.H"
///////////////////////////////////////////////////////////////////
@@ -74,7 +74,9 @@ uint32_t sbeReadPsu2SbeMbxReg (uint32_t i_addr,
break;
}
- SBE_DEBUG(SBE_FUNC"l_data=[0x%016X]", o_pData[l_count]);
+ SBE_DEBUG(SBE_FUNC"l_data=[0x%08X%08X]",
+ SBE::higher32BWord(o_pData[l_count]),
+ SBE::lower32BWord(o_pData[l_count]));
++l_count;
++i_addr;
}
@@ -149,7 +151,9 @@ uint32_t sbeWriteSbe2PsuMbxReg (uint32_t i_addr,
{
while (l_count < i_count)
{
- SBE_DEBUG(SBE_FUNC"l_data=[0x%016X]", *(i_pData+l_count));
+ SBE_DEBUG(SBE_FUNC"l_data=[0x%08X%08X]",
+ SBE::higher32BWord(*(i_pData+l_count)),
+ SBE::lower32BWord(*(i_pData+l_count)));
l_rc = putscom_abs ( i_addr, *(i_pData+l_count) );
if (l_rc)
@@ -180,3 +184,44 @@ uint32_t sbeWriteSbe2PsuMbxReg (uint32_t i_addr,
#undef SBE_FUNC
}
+
+/* @brief - Send PSU Chip Op response
+ *
+ * @param[in] - i_sbe2PsuRespHdr - Response header
+ * @param[in] - i_fapiRc - fapi rc of the relevant hwp call
+ * @param[in/out] - io_rc - rc status of the PSU access utility
+ *
+ * @return - void
+ */
+void sbePSUSendResponse(sbeSbe2PsuRespHdr_t &i_sbe2PsuRespHdr,
+ uint32_t &i_fapiRc,
+ uint32_t &io_rc)
+{
+#define SBE_FUNC "sbePSUSendResponse"
+ do
+ {
+ // Making sure the PSU access utility is functional
+ if(io_rc != SBE_SEC_OPERATION_SUCCESSFUL)
+ {
+ break;
+ }
+ // TODO via RTC:151555 Generate FFDC
+ if(i_fapiRc != fapi2::FAPI2_RC_SUCCESS)
+ {
+ i_sbe2PsuRespHdr.setStatus(SBE_PRI_GENERIC_EXECUTION_FAILURE,
+ SBE_SEC_GENERIC_FAILURE_IN_EXECUTION);
+ }
+
+ // Send the response header
+ io_rc = sbeWriteSbe2PsuMbxReg(SBE_HOST_PSU_MBOX_REG4,
+ (uint64_t*)(&i_sbe2PsuRespHdr),
+ (sizeof(i_sbe2PsuRespHdr)/sizeof(uint64_t)),
+ true);
+ if(SBE_SEC_OPERATION_SUCCESSFUL != io_rc)
+ {
+ SBE_ERROR(SBE_FUNC" Failed to write to "
+ "SBE_HOST_PSU_MBOX_REG4");
+ }
+ } while(0);
+#undef SBE_FUNC
+}
diff --git a/sbe/sbefw/sbeHostUtils.H b/sbe/sbefw/sbeHostUtils.H
index c172e4e9..0605d476 100644
--- a/sbe/sbefw/sbeHostUtils.H
+++ b/sbe/sbefw/sbeHostUtils.H
@@ -35,6 +35,7 @@
#include <stdint.h>
#include "ppe42_scom.h"
+#include "sbeHostMsg.H"
/**
* @brief SBE PSU Access register addresses
@@ -230,4 +231,15 @@ uint32_t sbeWriteSbe2PsuMbxReg (uint32_t i_addr,
const uint8_t i_count,
bool i_setBit0ToIntrHB = false);
+/* @brief - Send PSU Chip Op response
+ *
+ * @param[in] - i_sbe2PsuRespHdr - Response header
+ * @param[in] - i_fapiRc - fapi rc of the relevant hwp call
+ * @param[in/out] - io_rc - rc status of the PSU access utility
+ *
+ * @return - void
+ */
+void sbePSUSendResponse(sbeSbe2PsuRespHdr_t &i_sbe2PsuRespHdr,
+ uint32_t &i_fapiRc,
+ uint32_t &io_rc);
#endif // __SBEFW_SBEHOSTUTILS_H
diff --git a/sbe/sbefw/sbe_host_intf.H b/sbe/sbefw/sbe_host_intf.H
index e31813e9..ac08ae42 100644
--- a/sbe/sbefw/sbe_host_intf.H
+++ b/sbe/sbefw/sbe_host_intf.H
@@ -1,3 +1,27 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: sbe/sbefw/sbe_host_intf.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2016 */
+/* [+] 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: ppe/sbe/sbefw/sbe_host_intf.H
*
@@ -24,8 +48,9 @@ static const uint16_t SBE_SBEFW_HOST_MINOR_VERSION = 0;
*/
enum sbePsuCommandClass
{
- SBE_PSU_CMD_CLASS_UNKNOWN = 0,
- SBE_PSU_CMD_CLASS_CORE_STATE = 0xD1,
+ SBE_PSU_CMD_CLASS_UNKNOWN = 0,
+ SBE_PSU_CMD_CLASS_CORE_STATE = 0xD1,
+ SBE_PSU_CMD_CLASS_RING_ACCESS = 0xD3,
};
/**
@@ -33,8 +58,17 @@ enum sbePsuCommandClass
*/
enum sbePsuCoreStateControlCommands
{
- SBE_PSU_CMD_CONTROL_DEADMAN = 0x01,
- SBE_PSU_CMD_UNKNOWN = 0xFF,
+ SBE_PSU_CMD_CONTROL_DEADMAN = 0x01,
+ SBE_PSU_CMD_UNKNOWN = 0xFF,
+};
+
+/**
+ * @brief enums for SBE-Host interface ring access messages
+ */
+enum sbePsuRingAccessMessages
+{
+ SBE_PSU_MSG_PUT_RING_FROM_IMAGE = 0x01,
+ SBE_PSU_MSG_UNKNOWN = 0xFF,
};
/**
diff --git a/sbe/sbefw/sbe_sp_intf.H b/sbe/sbefw/sbe_sp_intf.H
index 531a72eb..1f02515f 100644
--- a/sbe/sbefw/sbe_sp_intf.H
+++ b/sbe/sbefw/sbe_sp_intf.H
@@ -1,3 +1,27 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: sbe/sbefw/sbe_sp_intf.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* [+] 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 sbe_sp_intf.H
*
@@ -348,6 +372,33 @@ enum sbeRegAccesRegType
SBE_REG_ACCESS_FPR = 0x02,
};
+/*
+ * @brief enums for target types used in ring access chip op
+*/
+typedef enum
+{
+ TARGET_PERV = 0x0000,
+ TARGET_PROC_CHIP = 0x0001,
+ TARGET_CORE = 0x0002,
+ TARGET_EX = 0x0003,
+} sbeRingTargetTypes_t;
+
+/*
+ * @brief enums for access modes used in ring access chip op
+ */
+typedef enum
+{
+ SBE_RING_MODE_NO_HEADER_CHECK = 0x0001, ///< Don't check header
+ SBE_RING_MODE_SET_PULSE_NO_OPCG_COND = 0x0002, ///< Set pulse with
+ /// no OPCG conditioning
+ SBE_RING_MODE_SET_PULSE_NSL = 0x0004, ///< Set pulse with NSL
+ /// pulse
+ SBE_RING_MODE_SET_PULSE_SL = 0x0008, ///< Set pulse with SL
+ /// pulse
+ SBE_RING_MODE_SET_PULSE_ALL = 0x0010, ///< Set pulse with pulse
+ /// to all hold types
+} sbeRingAccessModes_t;
+
#ifdef __cplusplus
}
#endif
diff --git a/sbe/sbefw/sbecmdparser.C b/sbe/sbefw/sbecmdparser.C
index 9dc6c094..572574fe 100644
--- a/sbe/sbefw/sbecmdparser.C
+++ b/sbe/sbefw/sbecmdparser.C
@@ -1,3 +1,27 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: sbe/sbefw/sbecmdparser.C $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* [+] 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: ppe/sbe/sbefw/sbecmdparser.C
*
@@ -12,6 +36,7 @@
#include "sbecmdmemaccess.H"
#include "sbecmdregaccess.H"
#include "sbecmdcntrldmt.H"
+#include "sbecmdringaccess.H"
#include "sbecmdsram.H"
#include "sbecmdcntlinst.H"
#include "sbetrace.H"
@@ -144,6 +169,19 @@ static sbeCmdStruct_t g_sbeCoreStateControlCmdArray [] =
},
};
+//////////////////////////////////////////////////////////////
+// @brief g_sbePutRingFromImageCmdArray
+//
+//////////////////////////////////////////////////////////////
+static sbeCmdStruct_t g_sbePutRingFromImageCmdArray [] =
+{
+ {sbePutRingFromImagePSU,
+ SBE_PSU_MSG_PUT_RING_FROM_IMAGE,
+ SBE_FENCE_AT_CONTINUOUS_IPL,
+ },
+};
+
+
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
uint8_t sbeGetCmdStructAttr (const uint8_t i_cmdClass,
@@ -200,6 +238,12 @@ uint8_t sbeGetCmdStructAttr (const uint8_t i_cmdClass,
*o_ppCmd = (sbeCmdStruct_t*)g_sbeCoreStateControlCmdArray;
break;
+ case SBE_PSU_CMD_CLASS_RING_ACCESS:
+ l_numCmds = sizeof(g_sbePutRingFromImageCmdArray) /
+ sizeof(sbeCmdStruct_t);
+ *o_ppCmd = (sbeCmdStruct_t*)g_sbePutRingFromImageCmdArray;
+ break;
+
// This will grow with each class of chipOp in future
default:
break;
diff --git a/sbe/sbefw/sbecmdringaccess.C b/sbe/sbefw/sbecmdringaccess.C
new file mode 100644
index 00000000..79939139
--- /dev/null
+++ b/sbe/sbefw/sbecmdringaccess.C
@@ -0,0 +1,169 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: sbe/sbefw/sbecmdringaccess.C $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2016 */
+/* [+] 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: ppe/sbe/sbefw/sbecmdcntrldmt.C
+ *
+ * @brief This file contains Put Ring From Image Command handler
+ *
+ */
+#include "sbecmdringaccess.H"
+#include "sbetrace.H"
+#include "sbeHostMsg.H"
+#include "sbeHostUtils.H"
+#include "sbeutil.H"
+#include "fapi2.H"
+
+using namespace fapi2;
+/*@brief - Map sbe ring access modes to fapi ring access modes
+ *
+ * @param[in] - i_ringMode - sbe ring access mode
+ *
+ * @return - l_fapiRingMode - fapi ring mode
+ */
+uint16_t sbeToFapiRingMode(uint16_t i_ringMode)
+{
+ uint16_t l_fapiRingMode = RING_MODE_HEADER_CHECK;
+
+ if(i_ringMode & SBE_RING_MODE_SET_PULSE_NO_OPCG_COND)
+ {
+ l_fapiRingMode |= RING_MODE_SET_PULSE_NO_OPCG_COND;
+ }
+ if(i_ringMode & SBE_RING_MODE_NO_HEADER_CHECK)
+ {
+ l_fapiRingMode |= RING_MODE_NO_HEADER_CHECK;
+ }
+ if(i_ringMode & SBE_RING_MODE_SET_PULSE_NSL)
+ {
+ l_fapiRingMode |= RING_MODE_SET_PULSE_NSL;
+ }
+ if(i_ringMode & SBE_RING_MODE_SET_PULSE_SL)
+ {
+ l_fapiRingMode |= RING_MODE_SET_PULSE_SL;
+ }
+ if(i_ringMode & SBE_RING_MODE_SET_PULSE_ALL)
+ {
+ l_fapiRingMode |= RING_MODE_SET_PULSE_ALL;
+ }
+ return l_fapiRingMode;
+}
+
+/*@brief - create fapi target handle for the target type
+ *
+ * @param[in] - i_taretType - sbe ring target type
+ * @param[in] - i_chipletId - chiplet id
+ * @param[out] - o_tgtHndl - fapi target handle
+ *
+ * @return - true - on success
+ * false - on failure
+ */
+bool sbeGetFapiTargetHandle(uint16_t i_targetType,
+ uint16_t i_chipletId,
+ fapi2::plat_target_handle_t &o_tgtHndl)
+{
+ bool l_rc = true;
+ switch(i_targetType)
+ {
+ case TARGET_CORE:
+ o_tgtHndl = plat_getTargetHandleByChipletNumber
+ <fapi2::TARGET_TYPE_CORE>(i_chipletId);
+ break;
+ case TARGET_EX:
+ o_tgtHndl = plat_getTargetHandleByChipletNumber
+ <fapi2::TARGET_TYPE_EX>(i_chipletId);
+ break;
+ case TARGET_PERV:
+ o_tgtHndl = plat_getTargetHandleByChipletNumber
+ <fapi2::TARGET_TYPE_PERV>(i_chipletId);
+ break;
+ case TARGET_PROC_CHIP:
+ o_tgtHndl = plat_getChipTarget().get();
+ break;
+ default:
+ l_rc = false;
+ break;
+ }
+ return l_rc;
+}
+
+uint32_t sbePutRingFromImagePSU (uint8_t *i_pArg)
+{
+#define SBE_FUNC " sbePutRingFromImagePSU "
+ SBE_ENTER(SBE_FUNC);
+ uint32_t l_rc = SBE_SEC_OPERATION_SUCCESSFUL;
+ uint32_t l_fapiRc = FAPI2_RC_SUCCESS;
+ sbePSUPutRingCMD_t l_cmd = {0};
+ do
+ {
+ // Fetch Ring ID, Ring mode and pervasive chiplet id from the message
+ // and also send Ack to Host via SBE_SBE2PSU_DOORBELL_SET_BIT1
+ l_rc = sbeReadPsu2SbeMbxReg(SBE_HOST_PSU_MBOX_REG1,
+ (sizeof(l_cmd)/sizeof(uint64_t)),
+ (uint64_t*)&l_cmd,
+ true);
+ if(SBE_SEC_OPERATION_SUCCESSFUL != l_rc)
+ {
+ SBE_ERROR(SBE_FUNC "Failed to extract SBE_HOST_PSU_MBOX_REG1 and "
+ "SBE_HOST_PSU_MBOX_REG2");
+ break;
+ }
+
+ // Construct a Target from Chiplet ID and Target Type
+ fapi2::plat_target_handle_t l_tgtHndl = {0};
+ if(!sbeGetFapiTargetHandle(l_cmd.TargetType, l_cmd.ChipletID,
+ l_tgtHndl))
+ {
+ SBE_ERROR(SBE_FUNC "Invalid target type [0x%04x]",
+ (uint16_t)l_cmd.TargetType);
+ g_sbeSbe2PsuRespHdr.setStatus(SBE_PRI_INVALID_DATA,
+ SBE_SEC_INVALID_TARGET_TYPE_PASSED);
+ break;
+ }
+ fapi2::Target<TARGET_TYPE_ALL> l_Tgt(l_tgtHndl);
+
+ // Initialize with HEADER CHECK mode
+ uint16_t l_ringMode = sbeToFapiRingMode(l_cmd.RingMode);
+
+ l_fapiRc = (uint32_t)putRing(l_Tgt, (RingID)l_cmd.RingID,
+ (RingMode)l_ringMode);
+ if(l_fapiRc != FAPI2_RC_SUCCESS)
+ {
+ SBE_ERROR(SBE_FUNC "putRing HWP failure - "
+ "MSG - Target Type [0x%04x] Ring ID [0x%04x]"
+ " Ring Mode [0x%04x] Chiplet ID [0x%04x]",
+ l_cmd.TargetType,
+ l_cmd.RingID,
+ l_cmd.RingMode,
+ l_cmd.ChipletID);
+ break;
+ }
+ }while(0); // End of do-while
+
+ // Send the response
+ sbePSUSendResponse(g_sbeSbe2PsuRespHdr, l_fapiRc, l_rc);
+
+ SBE_EXIT(SBE_FUNC);
+ return l_rc;
+#undef SBE_FUNC
+}
diff --git a/sbe/sbefw/sbecmdringaccess.H b/sbe/sbefw/sbecmdringaccess.H
new file mode 100644
index 00000000..ff835dc4
--- /dev/null
+++ b/sbe/sbefw/sbecmdringaccess.H
@@ -0,0 +1,55 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: sbe/sbefw/sbecmdringaccess.H $ */
+/* */
+/* OpenPOWER sbe Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2016 */
+/* [+] 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: ppe/sbe/sbefw/sbeputringfromimage.H
+ *
+ * @brief This file contains the Put Ring From Image Command handler
+ *
+ */
+
+#ifndef __SBEFW_SBECMDRINGACCESS_H
+#define __SBEFW_SBECMDRINGACCESS_H
+
+#include <stdint.h>
+
+typedef struct
+{
+ uint64_t TargetType:16;
+ uint64_t ChipletID:16;
+ uint64_t RingID:16;
+ uint64_t RingMode:16;
+} sbePSUPutRingCMD_t;
+
+/**
+ * @brief Put Ring From Image Command (0xD301)
+ *
+ * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
+ *
+ * @return RC from the PSU access utility
+ */
+uint32_t sbePutRingFromImagePSU(uint8_t *i_pArg);
+
+#endif // __SBEFW_SBECMDRINGACCESS_H
+
diff --git a/sbe/sbefw/sbefwfiles.mk b/sbe/sbefw/sbefwfiles.mk
index b7fef999..a86c6179 100644
--- a/sbe/sbefw/sbefwfiles.mk
+++ b/sbe/sbefw/sbefwfiles.mk
@@ -40,6 +40,8 @@ SBEFW-CPP-SOURCES += sberegaccess.C
SBEFW-CPP-SOURCES += sbecmdcntlinst.C
SBEFW-CPP-SOURCES += sbecmdregaccess.C
SBEFW-CPP-SOURCES += sbeFFDC.C
+SBEFW-CPP-SOURCES += sbecmdringaccess.C
+
SBEFW-C-SOURCES =
SBEFW-S-SOURCES =
diff --git a/sbe/test/test.xml b/sbe/test/test.xml
index f63d269c..2564be1d 100755
--- a/sbe/test/test.xml
+++ b/sbe/test/test.xml
@@ -1,9 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
+<!-- IBM_PROLOG_BEGIN_TAG -->
+<!-- This is an automatically generated prolog. -->
+<!-- -->
+<!-- $Source: sbe/test/test.xml $ -->
+<!-- -->
+<!-- OpenPOWER sbe Project -->
+<!-- -->
+<!-- Contributors Listed Below - COPYRIGHT 2015,2016 -->
+<!-- [+] 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 -->
<integrationtest>
<platform startsimargs="--notar --norun --sim_parms -nre">
<machine>%%machine%%</machine>
<test>
+ <testcase>
+ <simcmd>p9Proc0.pib_psu->tppsu_tpbr_interrupt_msg_available=[NIL]</simcmd>
+ </testcase>
<include>../simics/targets/p9_nimbus/sbeTest/testIstep.xml</include>
<include>../simics/targets/p9_nimbus/sbeTest/testScom.xml</include>
<include>../simics/targets/p9_nimbus/sbeTest/testGeneric.xml</include>
@@ -13,6 +38,7 @@
<include>../simics/targets/p9_nimbus/sbeTest/testRegAccess.xml</include>
<include>../simics/targets/p9_nimbus/sbeTest/testFifoReset.xml</include>
<include>../simics/targets/p9_nimbus/sbeTest/testAduMem.xml</include>
+ <include>../simics/targets/p9_nimbus/sbeTest/testExecutorPutRing.xml</include>
<testcase>
<simcmd>sbe-trace 0</simcmd>
</testcase>
diff --git a/sbe/test/testExecutorPutRing.py b/sbe/test/testExecutorPutRing.py
index 856c804a..122619fc 100644
--- a/sbe/test/testExecutorPutRing.py
+++ b/sbe/test/testExecutorPutRing.py
@@ -1,20 +1,31 @@
#!/usr/bin/python
-'''
-#############################################################
-# @file testExecutor.py
-# @author: George Keishing <gkeishin@in.ibm.com>
-# @brief Framework to test Host SBE interface on simics
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
#
-# Created on March 29, 2016
-# ----------------------------------------------------
-# @version Developer Date Description
-# ----------------------------------------------------
-# 1.0 gkeishin 29/03/16 Initial create
-#############################################################
-'''
-
-import testClass as testObj
+# $Source: sbe/test/testExecutorPutRing.py $
+#
+# OpenPOWER sbe Project
+#
+# Contributors Listed Below - COPYRIGHT 2016
+# [+] 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
+import testPSUUtil
import testRegistry as reg
+import testUtil
#-------------------------------
# This is a Test Expected Data
@@ -22,100 +33,194 @@ import testRegistry as reg
'''
This data are the values or strings that needs to be validated for the test.
'''
-SBE_TEST_EXPECT_DEFAULT = "None"
-SBE_TEST_EXPECT_MBOX0 = "0000030100F0D101"
-SBE_TEST_EXPECT_DOORBELL = "8000000000000000"
-
-HOST_TEST_EXPECT_DEFAULT = "None"
-HOST_TEST_EXPECT_MBOX04 = "0000000000F0D301"
-HOST_TEST_EXPECT_DOORBELL= "2000000000000000"
-
'''
-The test data is designed to accomodate as many as new entries a test needs
-and can also increase the field in it to add new action associated with it.
+#------------------------------------------------------------------------------------------------------------------------------
+# SBE side test data - Target - Core, Chiplet Id - 32, Ring ID - ec_func(177), mode - 0x0020(RING_MODE_HEADER_CHECK)
+#------------------------------------------------------------------------------------------------------------------------------
+'''
+sbe_test_data1 = (
+ #-----------------------------------------------------------------------------------------------------
+ # OP Reg ValueToWrite size Test Expected Data Description
+ #-----------------------------------------------------------------------------------------------------
+ ["write", reg.REG_MBOX0, "0000010000F0D301", 8, "None", "Writing to MBOX0 address"],
+ ["write", reg.REG_MBOX1, "0002002000F90020", 8, "None", "Writing to MBOX1 address"],
+ ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, "None", "Update SBE Doorbell register to interrupt SBE"],
+ )
+'''
+#------------------------------------------------------------------------------------------------------------------------------
+# SBE side test data - Target - Pervasive, Chiplet Id - 1, Ring ID - perv_pll_bndy_bucket_1(10), mode - 0x0020(RING_MODE_HEADER_CHECK)
+#------------------------------------------------------------------------------------------------------------------------------
+'''
+sbe_test_data2 = (
+ #--------------------------------------------------------------------------------------------------------------------------
+ # OP Reg ValueToWrite size Test Expected Data Description
+ #--------------------------------------------------------------------------------------------------------------------------
+ ["write", reg.REG_MBOX0, "0000010000F0D301", 8, "None", "Writing to MBOX0 address"],
+ ["write", reg.REG_MBOX1, "00000001000A0020", 8, "None", "Writing to MBOX1 address"],
+ ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, "None", "Update SBE Doorbell register to interrupt SBE"],
+ )
'''
#---------------------
-# SBE side test data
+# SBE side test data - Target - PROC CHIP, Chiplet Id - 6, Ring ID - xb_pll_bndy_bucket_1(90), mode - 0x0020(RING_MODE_HEADER_CHECK)
#---------------------
'''
-Every test data entry itself represent an action associated with it's data.
-The data is validated as it executes.
-
-The Test Expected Data if "None" signifies that this test entry is not to be
-validated else it would validated against the expected value in the field.
-On success returns macro SUCCESS else FAILURE
-
-Refer Documentation for the data used here directly.
+sbe_test_data3 = (
+ #--------------------------------------------------------------------------------------------------------------------------
+ # OP Reg ValueToWrite size Test Expected Data Description
+ #--------------------------------------------------------------------------------------------------------------------------
+ ["write", reg.REG_MBOX0, "0000010000F0D301", 8, "None", "Writing to MBOX0 address"],
+ ["write", reg.REG_MBOX1, "0001000600590020", 8, "None", "Writing to MBOX1 address"],
+ ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, "None", "Update SBE Doorbell register to interrupt SBE"],
+ )
'''
-
-sbe_test_data = (
+#------------------------------------------------------------------------------------------------------------------------------
+# SBE side test data - Target - EX, Chiplet Id - 32, Ring ID - ex_l3_refr_repr(223), mode - 0x0020(RING_MODE_HEADER_CHECK)
+#------------------------------------------------------------------------------------------------------------------------------
+'''
+sbe_test_data4 = (
#-----------------------------------------------------------------------------------------------------
- # OP Reg Value size Test Expected Data Description
+ # OP Reg ValueToWrite size Test Expected Data Description
#-----------------------------------------------------------------------------------------------------
- ["write", reg.REG_MBOX0, "0000010000F0D301", 8, SBE_TEST_EXPECT_DEFAULT, "Writing to MBOX0 address"],
- ["write", reg.REG_MBOX0, "123456789ABCDEF0", 8, SBE_TEST_EXPECT_DEFAULT, "Writing to MBOX1 address"],
- ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, SBE_TEST_EXPECT_DEFAULT, "Update SBE Doorbell register to interrupt SBE"],
+ ["write", reg.REG_MBOX0, "0000010000F0D301", 8, "None", "Writing to MBOX0 address"],
+ ["write", reg.REG_MBOX1, "0003002000DF0020", 8, "None", "Writing to MBOX1 address"],
+ ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, "None", "Update SBE Doorbell register to interrupt SBE"],
)
-
+'''
+#------------------------------------------------------------------------------------------------------------------------------
+# SBE side test data - Target - Invalid target 0x10, Chiplet Id - 32, Ring ID - ex_l3_refr_repr(248), mode - 0x0020(RING_MODE_HEADER_CHECK)
+#------------------------------------------------------------------------------------------------------------------------------
+'''
+sbe_test_data5 = (
+ #-----------------------------------------------------------------------------------------------------
+ # OP Reg ValueToWrite size Test Expected Data Description
+ #-----------------------------------------------------------------------------------------------------
+ ["write", reg.REG_MBOX0, "0000010000F0D301", 8, "None", "Writing to MBOX0 address"],
+ ["write", reg.REG_MBOX1, "0010002000F80020", 8, "None", "Writing to MBOX1 address"],
+ ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, "None", "Update SBE Doorbell register to interrupt SBE"],
+ )
+'''
#---------------------
-# Host side test data
+# Host side test data - SUCCESS
#---------------------
'''
-This Host data indicates that this will validate the SBE test set execution
-if the overall test is a success or failure.
-
-It can have as many entries which are needed to be validated.
+host_test_data_success = (
+ #----------------------------------------------------------------------------------------------------------------
+ # OP Reg ValueToWrite size Test Expected Data Description
+ #----------------------------------------------------------------------------------------------------------------
+ ["read", reg.REG_MBOX4, "0", 8, "0000000000F0D301", "Reading Host MBOX4 data to Validate"],
+ )
+'''
+#---------------------
+# Host side test data - FAILURE
+#---------------------
'''
-host_test_data = (
+host_test_data_failure5 = (
#----------------------------------------------------------------------------------------------------------------
- # OP Reg Value size Test Expected Data Description
+ # OP Reg ValueToWrite size Test Expected Data Description
#----------------------------------------------------------------------------------------------------------------
- ["read", reg.PSU_HOST_DOORBELL_REG_WO_OR, "0000000000000000", 8, HOST_TEST_EXPECT_DOORBELL, "Reading Host Doorbell for Interrupt"],
- ["read", reg.REG_MBOX4, "0000000000000000", 8, HOST_TEST_EXPECT_MBOX04, "Reading Host MBOX4 data to Validate"],
+ ["read", reg.REG_MBOX4, "0", 8, "0002000400F0D301", "Reading Host MBOX4 data to Validate"],
)
'''
-User can define a function which does some task and returns SUCCESS or FAILURE.
-one can simply call that function like any OP in the test data and still work.
-
-Define those function in testClassUtil.py context for this to work.
+#-----------------------------------------------------------------------
+# Do not modify - Used to simulate interrupt on Ringing Doorbell on Host
+#-----------------------------------------------------------------------
'''
-
-SAMPLE_TEST_EXPECT_FUNC = "None"
-PARM_DATA = [1, 2, 3, 4] # sample 4 input paramters
-sample_test_data = (
+host_polling_data = (
#----------------------------------------------------------------------------------------------------------------
- # OP function Name Parameters NA Test Expected Data Description
+ # OP Reg ValueToWrite size Test Expected Data Description
#----------------------------------------------------------------------------------------------------------------
- ["func", "classUtilFuncSample", PARM_DATA, 0, SAMPLE_TEST_EXPECT_FUNC, "Load func and do task"],
+ ["read", reg.PSU_HOST_DOORBELL_REG_WO_OR, "0", 8, "8000000000000000", "Reading Host Doorbell for Interrupt"],
)
#-------------------------
# Main Function
#-------------------------
def main():
+ # Run Simics initially
+ testUtil.runCycles( 10000000 );
# Intialize the class obj instances
- print "\n Initializing Registry instances ...."
- regObj = testObj.registry() # Registry obj def for operation
-
- print "\n Execute SBE Test set [ Put Ring ] ...\n"
- # Sim obj Target Test set
- rc_test = regObj.ExecuteTestOp(testObj.simSbeObj,sbe_test_data)
- if rc_test != testObj.SUCCESS:
- print " SBE Test data set .. [ Failed ] .."
- else:
- print " SBE Test data set .. [ OK ] "
- print "\n Poll on Host side for INTR ...\n"
- # Sim obj Target Test set Max timedout
- rc_intr = regObj.pollingOn(testObj.simSbeObj,host_test_data,20)
- if rc_intr == testObj.SUCCESS:
- print " Interrupt Event Recieved .. Success !!"
- else:
- print " Interrupt not Recieved.. Exiting .."
-
- print "\n"
-
-if __name__=="__main__":
+ regObj = testPSUUtil.registry() # Registry obj def for operation
+
+ print "\n Execute SBE Test set1 [ Put Ring ] ...\n"
+
+ '''
+ Test Case 1
+ '''
+ # HOST->SBE data set execution
+ regObj.ExecuteTestOp( testPSUUtil.simSbeObj, sbe_test_data1 )
+
+ print "\n Poll on Host side for INTR ...\n"
+ #Poll on HOST DoorBell Register for interrupt
+ regObj.pollingOn( testPSUUtil.simSbeObj, host_polling_data, 5 )
+
+ #SBE->HOST data set execution
+ regObj.ExecuteTestOp( testPSUUtil.simSbeObj, host_test_data_success )
+
+ print "\n Execute SBE Test set2 [ Put Ring ] ...\n"
+ '''
+ Test Case 2
+ '''
+ # HOST->SBE data set execution
+ regObj.ExecuteTestOp( testPSUUtil.simSbeObj, sbe_test_data2 )
+
+ print "\n Poll on Host side for INTR ...\n"
+ #Poll on HOST DoorBell Register for interrupt
+ regObj.pollingOn( testPSUUtil.simSbeObj, host_polling_data, 5 )
+
+ #SBE->HOST data set execution
+ regObj.ExecuteTestOp( testPSUUtil.simSbeObj, host_test_data_success )
+
+ print "\n Execute SBE Test set3 [ Put Ring ] ...\n"
+ '''
+ Test Case 3
+ '''
+ # HOST->SBE data set execution
+ regObj.ExecuteTestOp( testPSUUtil.simSbeObj, sbe_test_data3 )
+
+ print "\n Poll on Host side for INTR ...\n"
+ #Poll on HOST DoorBell Register for interrupt
+ regObj.pollingOn( testPSUUtil.simSbeObj, host_polling_data, 5 )
+
+ #SBE->HOST data set execution
+ regObj.ExecuteTestOp( testPSUUtil.simSbeObj, host_test_data_success )
+
+ print "\n Execute SBE Test set4 [ Put Ring ] ...\n"
+ '''
+ Test Case 4
+ '''
+ # HOST->SBE data set execution
+ regObj.ExecuteTestOp( testPSUUtil.simSbeObj, sbe_test_data4 )
+
+ print "\n Poll on Host side for INTR ...\n"
+ #Poll on HOST DoorBell Register for interrupt
+ regObj.pollingOn( testPSUUtil.simSbeObj, host_polling_data, 5 )
+
+ #SBE->HOST data set execution
+ regObj.ExecuteTestOp( testPSUUtil.simSbeObj, host_test_data_success )
+
+ print "\n Execute SBE Test set5 [ Put Ring ] ...\n"
+ '''
+ Test Case 5
+ '''
+ # HOST->SBE data set execution
+ regObj.ExecuteTestOp( testPSUUtil.simSbeObj, sbe_test_data5 )
+
+ print "\n Poll on Host side for INTR ...\n"
+ #Poll on HOST DoorBell Register for interrupt
+ regObj.pollingOn( testPSUUtil.simSbeObj, host_polling_data, 5 )
+
+ #SBE->HOST data set execution
+ regObj.ExecuteTestOp( testPSUUtil.simSbeObj, host_test_data_failure5 )
+
+if __name__ == "__main__":
main()
+ if err:
+ print ( "\nTest Suite completed with error(s)" )
+ #sys.exit(1)
+ else:
+ print ( "\nTest Suite completed with no errors" )
+ #sys.exit(0);
+
diff --git a/sbe/test/testExecutorPutRing.xml b/sbe/test/testExecutorPutRing.xml
new file mode 100755
index 00000000..9aef4cf9
--- /dev/null
+++ b/sbe/test/testExecutorPutRing.xml
@@ -0,0 +1,31 @@
+<!-- IBM_PROLOG_BEGIN_TAG -->
+<!-- This is an automatically generated prolog. -->
+<!-- -->
+<!-- $Source: sbe/test/testExecutorPutRing.xml $ -->
+<!-- -->
+<!-- OpenPOWER sbe Project -->
+<!-- -->
+<!-- Contributors Listed Below - COPYRIGHT 2016 -->
+<!-- [+] 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 -->
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <testcase>
+ <simcmd>run-python-file targets/p9_nimbus/sbeTest/testExecutorPutRing.py</simcmd>
+ <exitonerror>yes</exitonerror>
+ </testcase>
+
diff --git a/sbe/test/testPSUUtil.py b/sbe/test/testPSUUtil.py
index a452b5e8..88fd6a29 100644
--- a/sbe/test/testPSUUtil.py
+++ b/sbe/test/testPSUUtil.py
@@ -1,4 +1,28 @@
#!/usr/bin/python
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: sbe/test/testPSUUtil.py $
+#
+# OpenPOWER sbe Project
+#
+# Contributors Listed Below - COPYRIGHT 2016
+# [+] 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 testClass.py
@@ -147,12 +171,12 @@ class registry(object):
#---------------------------
# Read from a memomry
- # Max Sim interface can read 8
+ # Max Sim interface can read 8
# byte data at a given time
#---------------------------
def readFromMemory(self, objType, magicNum):
# Start addr + 8 bytes
- address = self.regAddr
+ address = self.regAddr
size = self.regSize # Max it can read is 8 Bytes
value = self.regVal # Max lentgth it should read
@@ -220,7 +244,7 @@ class registry(object):
# Execute the read or write operation in loop as per
# Test data set pre-defined
#----------------------------------------------------
- def ExecuteTestOp(self, testOp, test_bucket, raiseException):
+ def ExecuteTestOp(self, testOp, test_bucket, raiseException=True):
'''
3 prong steps : set data, read/write data, validate
'''
@@ -289,11 +313,11 @@ class registry(object):
print " Expect bytes : ", self.stringToByte(test_data)
if self.compareList(self.stringToByte(test_data), sim_data, "None") == True:
print " Test ... [ OK ] "
- print " ++++++++++++++++++++++++++++++++++++++++++"
+ print " ++++++++++++++++++++++++++++++++++++++++++"
return SUCCESS
- else:
+ else:
print " Test Failed... !!!"
- print " ++++++++++++++++++++++++++++++++++++++++++"
+ print " ++++++++++++++++++++++++++++++++++++++++++"
return FAILURE
#----------------------------------------------------
@@ -326,10 +350,10 @@ class registry(object):
#----------------------------------------------------
def pollingOn(self, simObj, test_data, retries=20):
for l_param in test_data:
- print "\n***** Polling On result - retrials left [%d] " % retries
while True:
+ print "\n***** Polling On result - retrials left [%d] " % retries
print "\n"
- testUtil.runCycles( 10000000);
+ testUtil.runCycles( 1000000);
test_d = (l_param,)
rc = self.ExecuteTestOp(simObj, test_d, False)
if rc == SUCCESS:
@@ -345,7 +369,7 @@ class registry(object):
#----------------------------------------------------
# Load the function and execute
- #----------------------------------------------------
+ #----------------------------------------------------
def loadFunc(self, func_name, i_pArray ):
rc = testPSUUserUtil.__getattribute__(func_name)(i_pArray)
return rc # Either success or failure from func
OpenPOWER on IntegriCloud