From 817c7e5b595b389f3957054f2da53912c2f6d90c Mon Sep 17 00:00:00 2001 From: Raja Das Date: Tue, 28 Jun 2016 05:58:06 -0500 Subject: Get Ring Support Change-Id: Ieb6bb823182dc41e16f82aa944d9e5f41d53d436 RTC: 128979 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/26332 Reviewed-by: Shakeeb A. Pasha B K Tested-by: Jenkins Server Reviewed-by: Sachin Gupta --- sbe/hwpf/include/plat/plat_hw_access.H | 5 +- sbe/hwpf/src/plat/fapi2sbeplatfiles.mk | 2 +- sbe/sbefw/sbeSpMsg.H | 14 +++- sbe/sbefw/sbecmdgeneric.C | 27 +++++++ sbe/sbefw/sbecmdmemaccess.C | 28 +++---- sbe/sbefw/sbecmdparser.C | 19 +++++ sbe/sbefw/sbecmdringaccess.C | 143 ++++++++++++++++++++++++++++++++- sbe/sbefw/sbecmdringaccess.H | 15 +++- sbe/sbefw/sbeutil.H | 8 ++ sbe/test/test.xml | 2 + sbe/test/testGetCapabilities.py | 26 +++++- sbe/test/testGetRing.py | 96 ++++++++++++++++++++++ sbe/test/testGetRing.xml | 30 +++++++ 13 files changed, 388 insertions(+), 27 deletions(-) create mode 100644 sbe/test/testGetRing.py create mode 100755 sbe/test/testGetRing.xml (limited to 'sbe') diff --git a/sbe/hwpf/include/plat/plat_hw_access.H b/sbe/hwpf/include/plat/plat_hw_access.H index 109e678a..6c42e13d 100644 --- a/sbe/hwpf/include/plat/plat_hw_access.H +++ b/sbe/hwpf/include/plat/plat_hw_access.H @@ -91,7 +91,8 @@ asm volatile \ static_assert( K == TARGET_TYPE_NONE, \ "modifyCfamRegister is not supported by PPE platforms") - +namespace fapi2 +{ // This function loads the scan region data for the given ring address and // updates the check word data // @param[in] : ring addtress @@ -119,7 +120,7 @@ asm volatile \ // @return fapi::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. fapi2::ReturnCode getRing_verifyAndcleanup(const uint32_t i_ringAddress, const fapi2::RingMode i_ringMode); - +} #endif // PLATHWACCESS_H_ diff --git a/sbe/hwpf/src/plat/fapi2sbeplatfiles.mk b/sbe/hwpf/src/plat/fapi2sbeplatfiles.mk index 17a74e57..bd32c5e3 100644 --- a/sbe/hwpf/src/plat/fapi2sbeplatfiles.mk +++ b/sbe/hwpf/src/plat/fapi2sbeplatfiles.mk @@ -41,7 +41,7 @@ # Object Files ########################################################################## -FAPI2PLAT-CPP-SOURCES += plat_ring_traverse.C +#FAPI2PLAT-CPP-SOURCES += plat_ring_traverse.C FAPI2PLAT-CPP-SOURCES += plat_hw_access.C FAPI2PLAT-C-SOURCES = diff --git a/sbe/sbefw/sbeSpMsg.H b/sbe/sbefw/sbeSpMsg.H index 07c25c53..704b9a21 100644 --- a/sbe/sbefw/sbeSpMsg.H +++ b/sbe/sbefw/sbeSpMsg.H @@ -319,7 +319,7 @@ typedef struct { uint32_t coreChipletId:8; //Pervasive Core Chiplet Id for PBA uint32_t eccByte:8; //Ecc Override Byte from user - uint32_t flags:16; //Operational Flags -refer enum sbeMemoryAccessFlags + uint32_t flags:16; //Operational Flags -refer enum sbeMemoryAccessFlags uint32_t addrHi; //Higher 32-Bit Memory Address uint32_t addrLo; //Lower 32-Bit Memory Address uint32_t len; //Length of Data in Bytes @@ -574,6 +574,18 @@ typedef struct } } }sbeCntlInstRegMsgHdr_t; + +/** + * @brief Get Ring access message header + */ +typedef struct +{ + uint32_t ringAddr; + uint32_t ringLenInBits; + uint32_t reserved:16; + uint32_t ringMode:16; +}sbeGetRingAccessMsgHdr_t; + /** * @brief Reg access message header */ diff --git a/sbe/sbefw/sbecmdgeneric.C b/sbe/sbefw/sbecmdgeneric.C index a1d62aa5..54cb6d31 100644 --- a/sbe/sbefw/sbecmdgeneric.C +++ b/sbe/sbefw/sbecmdgeneric.C @@ -1,3 +1,27 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: sbe/sbefw/sbecmdgeneric.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/sbecmdgeneric.C * @@ -47,6 +71,9 @@ sbeCapabilityRespMsg::sbeCapabilityRespMsg() capability[REGISTER_CAPABILITY_START_IDX] = GET_REGISTER_SUPPPORTED | PUT_REGISTER_SUPPPORTED ; + + capability[RING_CAPABILITY_START_IDX] = + GET_RING_SUPPPORTED; } // Functions //---------------------------------------------------------------------------- diff --git a/sbe/sbefw/sbecmdmemaccess.C b/sbe/sbefw/sbecmdmemaccess.C index b697a3ea..7aa52a8a 100644 --- a/sbe/sbefw/sbecmdmemaccess.C +++ b/sbe/sbefw/sbecmdmemaccess.C @@ -34,6 +34,7 @@ #include "sbe_sp_intf.H" #include "sbetrace.H" #include "sbeFifoMsgUtils.H" +#include "sbeutil.H" #include "fapi2.H" @@ -90,13 +91,6 @@ static const uint32_t CACHE_INHIBIT_MODE_SHIFT = 29; // Fast Mode bit shift for PBA static const uint32_t PBA_FAST_MODE_SHIFT = 31; -// Macros Defined for Internal RC Check, Break if Error -#define checkSbeRC(l_rc) \ -if ((l_rc) != SBE_SEC_OPERATION_SUCCESSFUL) \ -{ \ - break; \ -} \ - /////////////////////////////////////////////////////////////////////// // @brief align4ByteWordLength - Internal Method to this file // Align the length passed and return number of words @@ -375,7 +369,7 @@ uint32_t processPbaRequest(const sbeMemAccessReqMsgHdr_t &i_hdr, l_rc = sbeUpFifoDeq_mult (l_len2dequeue, (uint32_t *)&l_dataFifo, false); - checkSbeRC(l_rc); + CHECK_SBE_RC_AND_BREAK_IF_NOT_SUCCESS(l_rc); } // Call PBA access l_fapiRc = p9_pba_access( @@ -405,7 +399,7 @@ uint32_t processPbaRequest(const sbeMemAccessReqMsgHdr_t &i_hdr, // Number of 4Bytes to put, to align with Granule Size uint32_t l_len = l_sizeMultiplier; // l_len*4 = Granule Size l_rc = sbeDownFifoEnq_mult (l_len, (uint32_t *)&l_dataFifo); - checkSbeRC(l_rc); + CHECK_SBE_RC_AND_BREAK_IF_NOT_SUCCESS(l_rc); } l_granulesCompleted++; l_numCurrAcc++; @@ -424,13 +418,13 @@ uint32_t processPbaRequest(const sbeMemAccessReqMsgHdr_t &i_hdr, { // If there was a FIFO error, will skip sending the response, // instead give the control back to the command processor thread - checkSbeRC(l_rc); + CHECK_SBE_RC_AND_BREAK_IF_NOT_SUCCESS(l_rc); // If there was a HWP failure for putmem request, // need to Flush out upstream FIFO, until EOT arrives if (!i_isFlagRead) { l_rc = flushUpstreamFifo(l_fapiRc); - checkSbeRC(l_rc); + CHECK_SBE_RC_AND_BREAK_IF_NOT_SUCCESS(l_rc); } // first enqueue the length of data actually written @@ -439,7 +433,7 @@ uint32_t processPbaRequest(const sbeMemAccessReqMsgHdr_t &i_hdr, SBE_DEBUG(SBE_FUNC "Total length Pushed for ChipOp [%d]", l_respLen); l_rc = sbeDownFifoEnq_mult ( l_len, &l_respLen ); - checkSbeRC(l_rc); + CHECK_SBE_RC_AND_BREAK_IF_NOT_SUCCESS(l_rc); l_rc = sbeDsSendRespHdr( l_respHdr, l_ffdc); } while(false); @@ -579,7 +573,7 @@ uint32_t processAduRequest(const sbeMemAccessReqMsgHdr_t &i_hdr, l_rc = sbeUpFifoDeq_mult (l_len2dequeue, (uint32_t *)&l_dataFifo, false); - checkSbeRC(l_rc); + CHECK_SBE_RC_AND_BREAK_IF_NOT_SUCCESS(l_rc); // Insert the ECC if ECC Mode is set if(l_isEccMode) @@ -664,7 +658,7 @@ uint32_t processAduRequest(const sbeMemAccessReqMsgHdr_t &i_hdr, if(l_len) { l_rc = sbeDownFifoEnq_mult (l_len, (uint32_t *)&l_dataFifo); - checkSbeRC(l_rc); + CHECK_SBE_RC_AND_BREAK_IF_NOT_SUCCESS(l_rc); } } l_granulesCompleted++; @@ -685,13 +679,13 @@ uint32_t processAduRequest(const sbeMemAccessReqMsgHdr_t &i_hdr, { // If there was a FIFO error, will skip sending the response, // instead give the control back to the command processor thread - checkSbeRC(l_rc); + CHECK_SBE_RC_AND_BREAK_IF_NOT_SUCCESS(l_rc); // If there was a HWP failure for putmem request, // need to Flush out upstream FIFO, until EOT arrives if (!i_isFlagRead) { l_rc = flushUpstreamFifo(l_fapiRc); - checkSbeRC(l_rc); + CHECK_SBE_RC_AND_BREAK_IF_NOT_SUCCESS(l_rc); } // first enqueue the length of data actually written @@ -703,7 +697,7 @@ uint32_t processAduRequest(const sbeMemAccessReqMsgHdr_t &i_hdr, SBE_DEBUG(SBE_FUNC "Total length Pushed for ChipOp [%d]", l_respLen); l_rc = sbeDownFifoEnq_mult ( l_len, &l_respLen ); - checkSbeRC(l_rc); + CHECK_SBE_RC_AND_BREAK_IF_NOT_SUCCESS(l_rc); l_rc = sbeDsSendRespHdr( l_respHdr, l_ffdc); } while(false); diff --git a/sbe/sbefw/sbecmdparser.C b/sbe/sbefw/sbecmdparser.C index 572574fe..e7c7c5f6 100644 --- a/sbe/sbefw/sbecmdparser.C +++ b/sbe/sbefw/sbecmdparser.C @@ -39,6 +39,7 @@ #include "sbecmdringaccess.H" #include "sbecmdsram.H" #include "sbecmdcntlinst.H" +#include "sbecmdringaccess.H" #include "sbetrace.H" #include "sbe_sp_intf.H" #include "sbeHostMsg.H" @@ -157,6 +158,18 @@ static sbeCmdStruct_t g_sbeRegAccessCmdArray [] = }, }; +////////////////////////////////////////////////////////////// +// @brief g_sbeRingAccessCmdArray +// +////////////////////////////////////////////////////////////// +static sbeCmdStruct_t g_sbeRingAccessCmdArray [] = +{ + {sbeGetRing, + SBE_CMD_GETRING, + SBE_FENCE_AT_CONTINUOUS_IPL, + }, +}; + ////////////////////////////////////////////////////////////// // @brief g_sbeCoreStateControlCmdArray // @@ -231,6 +244,12 @@ uint8_t sbeGetCmdStructAttr (const uint8_t i_cmdClass, *o_ppCmd = (sbeCmdStruct_t*)g_sbeRegAccessCmdArray; break; + case SBE_CMD_CLASS_RING_ACCESS: + l_numCmds = sizeof(g_sbeRingAccessCmdArray) / + sizeof(sbeCmdStruct_t); + *o_ppCmd = (sbeCmdStruct_t*)g_sbeRingAccessCmdArray; + break; + // PSU Commands case SBE_PSU_CMD_CLASS_CORE_STATE: l_numCmds = sizeof(g_sbeCoreStateControlCmdArray) / diff --git a/sbe/sbefw/sbecmdringaccess.C b/sbe/sbefw/sbecmdringaccess.C index 79939139..a3844034 100644 --- a/sbe/sbefw/sbecmdringaccess.C +++ b/sbe/sbefw/sbecmdringaccess.C @@ -23,19 +23,29 @@ /* */ /* IBM_PROLOG_END_TAG */ /* - * @file: ppe/sbe/sbefw/sbecmdcntrldmt.C + * @file: ppe/sbe/sbefw/sbecmdringaccess.C * - * @brief This file contains Put Ring From Image Command handler + * @brief This file contains the SBE Ring Access chipOps * */ + #include "sbecmdringaccess.H" +#include "sbefifo.H" +#include "sbe_sp_intf.H" #include "sbetrace.H" #include "sbeHostMsg.H" #include "sbeHostUtils.H" +#include "sbeFifoMsgUtils.H" #include "sbeutil.H" #include "fapi2.H" +#include "plat_hw_access.H" using namespace fapi2; + +static const uint32_t SIZE_OF_LENGTH_INWORDS = 1; +static const uint32_t NUM_WORDS_PER_GRANULE = 2; +static const uint32_t GETRING_GRANULE_SIZE_IN_BITS = 64; + /*@brief - Map sbe ring access modes to fapi ring access modes * * @param[in] - i_ringMode - sbe ring access mode @@ -167,3 +177,132 @@ uint32_t sbePutRingFromImagePSU (uint8_t *i_pArg) return l_rc; #undef SBE_FUNC } + +////////////////////////////////////////////////////// +////////////////////////////////////////////////////// +uint32_t sbeGetRing(uint8_t *i_pArg) +{ + #define SBE_FUNC " sbeGetRing " + SBE_ENTER(SBE_FUNC); + + uint32_t l_rc = SBE_SEC_OPERATION_SUCCESSFUL; + sbeGetRingAccessMsgHdr_t l_reqMsg; + sbeRespGenHdr_t respHdr; + respHdr.init(); + sbeResponseFfdc_t l_ffdc; + ReturnCode l_fapiRc; + uint32_t l_len = 0; + uint32_t l_bitSentCnt = 0; + + do + { + // Get the ring access header + l_len = sizeof(sbeGetRingAccessMsgHdr_t)/sizeof(uint32_t); + l_rc = sbeUpFifoDeq_mult (l_len, (uint32_t *)&l_reqMsg); // EOT fetch + + // If FIFO access failure + CHECK_SBE_RC_AND_BREAK_IF_NOT_SUCCESS(l_rc); + + SBE_DEBUG(SBE_FUNC "Ring Address 0x%08X User Ring Mode 0x%04X " + "Length in Bits 0x%08X", + l_reqMsg.ringAddr, l_reqMsg.ringMode, l_reqMsg.ringLenInBits); + + uint16_t l_ringMode = sbeToFapiRingMode(l_reqMsg.ringMode); + + // Call getRing_setup - loads the scan region data for the given ring + // address and updates the check word data + l_fapiRc = fapi2::getRing_setup(l_reqMsg.ringAddr, + (fapi2::RingMode)l_ringMode); + if( l_fapiRc != FAPI2_RC_SUCCESS ) + { + SBE_ERROR(SBE_FUNC" getRing_setup failed. RingAddress:0x%08X " + "RingMode:0x%04x", l_reqMsg.ringAddr, l_ringMode); + respHdr.setStatus( SBE_PRI_GENERIC_EXECUTION_FAILURE, + SBE_SEC_GENERIC_FAILURE_IN_EXECUTION); + l_ffdc.setRc(l_fapiRc); + break; + } + // Calculate the iteration length + uint32_t l_loopCnt = + (l_reqMsg.ringLenInBits / GETRING_GRANULE_SIZE_IN_BITS); + // Check for modulus - remainder + uint8_t l_mod = (l_reqMsg.ringLenInBits % GETRING_GRANULE_SIZE_IN_BITS); + if(l_mod) + { + ++l_loopCnt; + } + + // fix for the alignment issue + uint32_t l_buf[NUM_WORDS_PER_GRANULE]__attribute__ ((aligned (8))) ={0}; + uint32_t l_bitShift = 0; + l_len = NUM_WORDS_PER_GRANULE; + + // Fetch the ring data in bits, each iteration will give you 64bits + for(uint32_t l_cnt=0; l_cnt < l_loopCnt; l_cnt++) + { + if((l_cnt == (l_loopCnt-1)) && (l_mod)) + { + l_bitShift = l_mod; + } + else + { + l_bitShift = GETRING_GRANULE_SIZE_IN_BITS; + } + // Call getRing_granule_data - read the 64 bit data from the HW + l_fapiRc = getRing_granule_data((uint32_t)(l_reqMsg.ringAddr), + (uint64_t*)&l_buf, + l_bitShift); + if( l_fapiRc != FAPI2_RC_SUCCESS ) + { + SBE_ERROR(SBE_FUNC" getRing_granule_data failed. " + "RingAddress:0x%08X RingMode:0x%04x", + l_reqMsg.ringAddr, l_ringMode); + respHdr.setStatus( SBE_PRI_GENERIC_EXECUTION_FAILURE, + SBE_SEC_GENERIC_FAILURE_IN_EXECUTION); + l_ffdc.setRc(l_fapiRc); + break; + } + + // Send it to DS Fifo + // If this is the last iteration in the loop, let the full 64bit + // go, even for 1bit of remaining length. The length passed to + // the user will take care of actual number of bits. + l_rc = sbeDownFifoEnq_mult (l_len, (uint32_t *)&l_buf); + CHECK_SBE_RC_AND_BREAK_IF_NOT_SUCCESS(l_rc); + l_bitSentCnt = l_bitSentCnt + l_bitShift; + } + if ( (l_fapiRc == FAPI2_RC_SUCCESS) && + (l_rc == SBE_SEC_OPERATION_SUCCESSFUL) ) + { + // Call getRing_verifyAndcleanup - verify the check word data is + // matching or not and will clean up the scan region data + l_fapiRc = getRing_verifyAndcleanup((uint32_t)(l_reqMsg.ringAddr), + (fapi2::RingMode)l_ringMode); + if( l_fapiRc != FAPI2_RC_SUCCESS ) + { + SBE_ERROR(SBE_FUNC" getRing_verifyAndcleanup failed. " + "RingAddress:0x%08X RingMode:0x%04x", + l_reqMsg.ringAddr, l_ringMode); + respHdr.setStatus( SBE_PRI_GENERIC_EXECUTION_FAILURE, + SBE_SEC_GENERIC_FAILURE_IN_EXECUTION); + l_ffdc.setRc(l_fapiRc); + } + } + }while(false); + + // Now build and enqueue response into downstream FIFO + // If there was a FIFO error, will skip sending the response, + // instead give the control back to the command processor thread + if ( SBE_SEC_OPERATION_SUCCESSFUL == l_rc ) + { + l_len = SIZE_OF_LENGTH_INWORDS; + l_rc = sbeDownFifoEnq_mult (l_len, &(l_bitSentCnt)); + if(SBE_SEC_OPERATION_SUCCESSFUL == l_rc) + { + l_rc = sbeDsSendRespHdr( respHdr, l_ffdc); + } + } + return l_rc; +#undef SBE_FUNC +} + diff --git a/sbe/sbefw/sbecmdringaccess.H b/sbe/sbefw/sbecmdringaccess.H index ff835dc4..b0e71012 100644 --- a/sbe/sbefw/sbecmdringaccess.H +++ b/sbe/sbefw/sbecmdringaccess.H @@ -23,9 +23,9 @@ /* */ /* IBM_PROLOG_END_TAG */ /* - * @file: ppe/sbe/sbefw/sbeputringfromimage.H + * @file: ppe/sbe/sbefw/sbecmdringaccess.H * - * @brief This file contains the Put Ring From Image Command handler + * @brief This file contains the Interfaces for the RING Access chip-ops * */ @@ -51,5 +51,14 @@ typedef struct */ uint32_t sbePutRingFromImagePSU(uint8_t *i_pArg); -#endif // __SBEFW_SBECMDRINGACCESS_H +/** + * @brief sbeGetRing : Get the ring data + * + * @param[in] i_pArg Buffer to be passed to the function (not used as of now) + * + * @return Rc from the FIFO access utility + */ +uint32_t sbeGetRing(uint8_t *i_pArg); + +#endif /* __SBEFW_SBECMDRINGACCESS_H */ diff --git a/sbe/sbefw/sbeutil.H b/sbe/sbefw/sbeutil.H index db5b931f..57d55544 100644 --- a/sbe/sbefw/sbeutil.H +++ b/sbe/sbefw/sbeutil.H @@ -31,6 +31,13 @@ #define MASK_ZERO_H32B_UINT64(x) ((x) & 0x00000000FFFFFFFF) #define SHIFT_RIGHT(x, bits) ((x) >> bits) +// Macros Defined for Internal RC Check, Break if Error +#define CHECK_SBE_RC_AND_BREAK_IF_NOT_SUCCESS(l_rc) \ +if ((l_rc) != SBE_SEC_OPERATION_SUCCESSFUL) \ +{ \ + break; \ +} \ + namespace SBE { @@ -60,5 +67,6 @@ namespace SBE { return (uint32_t)(MASK_ZERO_H32B_UINT64(i_lWord)); } + } // namespace SBE #endif //SBE_UTIL_H diff --git a/sbe/test/test.xml b/sbe/test/test.xml index 2564be1d..b06da370 100755 --- a/sbe/test/test.xml +++ b/sbe/test/test.xml @@ -22,6 +22,7 @@ + %%machine%% @@ -39,6 +40,7 @@ ../simics/targets/p9_nimbus/sbeTest/testFifoReset.xml ../simics/targets/p9_nimbus/sbeTest/testAduMem.xml ../simics/targets/p9_nimbus/sbeTest/testExecutorPutRing.xml + ../simics/targets/p9_nimbus/sbeTest/testGetRing.xml sbe-trace 0 diff --git a/sbe/test/testGetCapabilities.py b/sbe/test/testGetCapabilities.py index f9292532..a9287558 100755 --- a/sbe/test/testGetCapabilities.py +++ b/sbe/test/testGetCapabilities.py @@ -1,3 +1,27 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: sbe/test/testGetCapabilities.py $ +# +# 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 import sys sys.path.append("targets/p9_nimbus/sbeTest" ) import testUtil @@ -12,7 +36,7 @@ EXPDATA1 = [0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0xa2,0x0,0x0,0x0f, #getscom/putscom/modifyscom/putscomundermask 0x0,0x0,0x0,0x0, - 0x0,0x0,0x0,0x0, + 0xa3,0x0,0x0,0x1, #getring 0x00,0x0,0x0,0x0]; EXPDATA2 = [0xa4,0x0,0x0,0x0f, #GetMemPba/PutMemPba/GetSramOcc/PutSramOcc diff --git a/sbe/test/testGetRing.py b/sbe/test/testGetRing.py new file mode 100644 index 00000000..4137108d --- /dev/null +++ b/sbe/test/testGetRing.py @@ -0,0 +1,96 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: sbe/test/testGetRing.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 sys +sys.path.append("targets/p9_nimbus/sbeTest" ) +import testUtil +err = False +#from testWrite import * + +LOOP_COUNT = 1 + +#aligned Data +GETRING_TESTDATA = [0,0,0,0x6, + 0,0,0xA3,0x01, + 0xa,0xa,0xa,0xa, # address + 0,0,0,0x40, # length of data + 0x00,0x00,0x00,0x01] + +GETRING_EXPDATA = [0,0,0,0, #data + 0,0,0,0, #data + 0,0,0,0x40, # length of data + 0xc0,0xde,0xa3,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + +#Un-aligned Data +GETRING_TESTDATA1 = [0,0,0,0x6, + 0,0,0xA3,0x01, + 0xa,0xa,0xa,0xa, # address + 0,0,0,0x45, # length of data + 0x00,0x00,0x00,0x01] + +GETRING_EXPDATA1 = [0,0,0,0, #data + 0,0,0,0, #data + 0,0,0,0, #data + 0,0,0,0, #data + 0,0,0,0x45, # length of data + 0xc0,0xde,0xa3,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + + + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + + # GetRing test - Aligned Data + testUtil.writeUsFifo( GETRING_TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( GETRING_EXPDATA ) + testUtil.runCycles( 10000000 ) + testUtil.readEot( ) + + # GetRing test - un-aligned Data + testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( GETRING_TESTDATA1 ) + testUtil.writeEot( ) + testUtil.readDsFifo( GETRING_EXPDATA1 ) + testUtil.runCycles( 10000000 ) + testUtil.readEot( ) + +#------------------------------------------------- +# Calling all test code +#------------------------------------------------- +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/testGetRing.xml b/sbe/test/testGetRing.xml new file mode 100755 index 00000000..e3f240c1 --- /dev/null +++ b/sbe/test/testGetRing.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + run-python-file targets/p9_nimbus/sbeTest/testGetRing.py + yes + + -- cgit v1.2.1