From e56200820de7c0c617abc60635df9a6c9e0e1555 Mon Sep 17 00:00:00 2001 From: Shakeeb Date: Thu, 23 Jun 2016 02:55:46 -0500 Subject: SBE Host Utility updates Addition of auto ack in read API Addition of API to extract 32bit words from double word Change-Id: If092456994185a246d4741455496fdc2236ea031 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/26156 Tested-by: Jenkins Server Reviewed-by: RAJA DAS Reviewed-by: Sachin Gupta --- sbe/sbefw/sbeHostUtils.C | 39 ++++++++++++++++++++++++++++++++- sbe/sbefw/sbeHostUtils.H | 31 +++++++++++++++++++++++++- sbe/sbefw/sbeutil.H | 57 ++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 121 insertions(+), 6 deletions(-) (limited to 'sbe') diff --git a/sbe/sbefw/sbeHostUtils.C b/sbe/sbefw/sbeHostUtils.C index 028245c1..f143db6b 100644 --- a/sbe/sbefw/sbeHostUtils.C +++ b/sbe/sbefw/sbeHostUtils.C @@ -1,3 +1,27 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: sbe/sbefw/sbeHostUtils.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/sbeHostUtils.C * @@ -23,7 +47,8 @@ /////////////////////////////////////////////////////////////////// uint32_t sbeReadPsu2SbeMbxReg (uint32_t i_addr, const uint8_t i_count, - uint64_t *o_pData) + uint64_t *o_pData, + bool i_isFinalRead) { #define SBE_FUNC " sbeReadPsu2SbeMbxReg " SBE_DEBUG(SBE_FUNC"i_count[0x%02X], i_addr=[0x%08X]", i_count, i_addr); @@ -53,6 +78,18 @@ uint32_t sbeReadPsu2SbeMbxReg (uint32_t i_addr, ++l_count; ++i_addr; } + + // Set the Ack bit in SBE->PSU DB register + // if the message requires ack and if its a final read operation + if ((i_isFinalRead) && (SBE_SEC_OPERATION_SUCCESSFUL == l_rc)) + { + l_rc = sbeAcknowledgeHost(); + if (l_rc) + { + SBE_ERROR(SBE_FUNC " Failed to Sent Ack to Host over " + "SBE_SBE2PSU_DOORBELL_SET_BIT1"); + } + } return l_rc; #undef SBE_FUNC diff --git a/sbe/sbefw/sbeHostUtils.H b/sbe/sbefw/sbeHostUtils.H index d8324233..c172e4e9 100644 --- a/sbe/sbefw/sbeHostUtils.H +++ b/sbe/sbefw/sbeHostUtils.H @@ -1,3 +1,27 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: sbe/sbefw/sbeHostUtils.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/sbeHostUtils.H * @@ -109,6 +133,10 @@ inline uint32_t sbeReadPsu2SbeDbReg (uint64_t *o_data) * Starting Mbx Register Address * @param[in] i_count * Number of Mbx registers to be read. + * @param[in] i_isFinalRead + * Indicates if its a final read operation for this chip op and + * internally handle the ack + * By default it is false. * @param[out] o_pData * Contents of the Mbx registers read into the buffer * @return Return Code @@ -116,7 +144,8 @@ inline uint32_t sbeReadPsu2SbeDbReg (uint64_t *o_data) */ uint32_t sbeReadPsu2SbeMbxReg (uint32_t i_addr, const uint8_t i_count, - uint64_t *o_pData); + uint64_t *o_pData, + bool i_isFinalRead = false); /*****************************************************************/ /** SBE->PSU register access utilities **/ diff --git a/sbe/sbefw/sbeutil.H b/sbe/sbefw/sbeutil.H index 7ce440f9..db5b931f 100644 --- a/sbe/sbefw/sbeutil.H +++ b/sbe/sbefw/sbeutil.H @@ -1,15 +1,64 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: sbe/sbefw/sbeutil.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 */ #ifndef SBE_UTIL_H #define SBE_UTIL_H #include "pk.h" #include "pk_api.h" +#define MASK_ZERO_L32B_UINT64(x) ((x) & 0xFFFFFFFF00000000) +#define MASK_ZERO_H32B_UINT64(x) ((x) & 0x00000000FFFFFFFF) +#define SHIFT_RIGHT(x, bits) ((x) >> bits) + namespace SBE { -enum -{ - PANIC_ASSERT = PK_APP_OFFSET_SBE + 1 -}; + enum + { + PANIC_ASSERT = PK_APP_OFFSET_SBE + 1 + }; + + /*@brief - Get higher 32bit number from uint64 + * + * @param[in] - i_lWord - 64bit long word + * + * @return - uint32_t word + */ + inline uint32_t higher32BWord(uint64_t i_lWord) + { + return (uint32_t)(SHIFT_RIGHT(MASK_ZERO_L32B_UINT64(i_lWord), 32)); + } + /*@brief - Get lower 32bit number from uint64 + * + * @param[in] - i_lWord - 64bit long word + * + * @return - uint32_t word + */ + inline uint32_t lower32BWord(uint64_t i_lWord) + { + return (uint32_t)(MASK_ZERO_H32B_UINT64(i_lWord)); + } } // namespace SBE #endif //SBE_UTIL_H -- cgit v1.2.1