From 9d4827735558fe03ee021afb7dacfa6ac76719bb Mon Sep 17 00:00:00 2001 From: Doug Gilbert Date: Fri, 21 Mar 2014 17:05:40 -0500 Subject: HW279456 code workaround for MBSECCQ - HB Change-Id: Ieb10dbe271c9b0414b3147c809bc3a1a3ab2bf72 RTC: 97286 CQ: SW253664 Backport: release-fips810 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/9843 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III --- src/usr/scom/scom.C | 60 ++++++++++++++++++++++++++++++++++++++++++-- src/usr/scom/scom.H | 35 +++++++++++++++++++++++--- src/usr/scom/test/scomtest.H | 56 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 145 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/usr/scom/scom.C b/src/usr/scom/scom.C index 38864cbe5..0ee21d1ee 100644 --- a/src/usr/scom/scom.C +++ b/src/usr/scom/scom.C @@ -41,7 +41,6 @@ #include #include - // Trace definition trace_desc_t* g_trac_scom = NULL; TRAC_INIT(&g_trac_scom, SCOM_COMP_NAME, KILOBYTE, TRACE::BUFFER_SLOW); //1K @@ -59,7 +58,7 @@ DEVICE_REGISTER_ROUTE(DeviceFW::WILDCARD, DEVICE_REGISTER_ROUTE(DeviceFW::WILDCARD, DeviceFW::SCOM, TARGETING::TYPE_MEMBUF, - scomPerformOp); + scomMemBufPerformOp); /////////////////////////////////////////////////////////////////////////////// @@ -88,6 +87,63 @@ errlHndl_t scomPerformOp(DeviceFW::OperationType i_opType, return l_err; } +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +errlHndl_t scomMemBufPerformOp(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 = NULL; + + + uint64_t l_scomAddr = va_arg(i_args,uint64_t); + + + + l_err = checkIndirectAndDoScom(i_opType, + i_target, + io_buffer, + io_buflen, + i_accessType, + l_scomAddr); + + // Check for ATTR_CENTAUR_EC_ENABLE_RCE_WITH_OTHER_ERRORS_HW246685 + // if ATTR set and MBSECCQ being read then set bit 16 + // See RTC 97286 + // + if(!l_err && (i_opType == DeviceFW::READ)) + { + const uint64_t MBS_ECC0_MBSECCQ_0x0201144A = 0x000000000201144Aull; + const uint64_t MBS_ECC1_MBSECCQ_0x0201148A = 0x000000000201148Aull; + + uint64_t addr = l_scomAddr & 0x000000007FFFFFFFull; + if(addr == MBS_ECC0_MBSECCQ_0x0201144A || + addr == MBS_ECC1_MBSECCQ_0x0201148A) + { + uint8_t enabled = 0; + //FAPI_ATTR_GET @todo RTC 101877 - access FAPI attributes + // (ATTR_CENTAUR_EC_ENABLE_RCE_WITH_OTHER_ERRORS_HW246685, + // i_target, + // enabled); + // For now use: if ec >= 0x20 + if(i_target->getAttr() >= 0x20) + { + enabled = true; + } + + if(enabled) + { + uint64_t * data = reinterpret_cast(io_buffer); + *data |= 0x0000800000000000ull; // Force on bit 16 + } + } + } + + return l_err; +} /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/src/usr/scom/scom.H b/src/usr/scom/scom.H index 06416640b..30cc0f61a 100644 --- a/src/usr/scom/scom.H +++ b/src/usr/scom/scom.H @@ -73,7 +73,7 @@ enum ScomErrorMask * Output: Read: size of output data * Write: size of data written * @param[in] i_accessType Select from DeviceFW::AccessType enum - * (usrif.H) + * @see usr/devicefw/(userif.H) * @param[in] i_args This is an argument list for DD framework. * In this function, there's only one argument, * which is the SCom address value. @@ -87,6 +87,35 @@ errlHndl_t scomPerformOp(DeviceFW::OperationType i_opType, int64_t i_accessType, va_list i_args); +/** + * @brief Performs a SCom operation on a target TYPE_MEMBUF + * This function performs a SCOM operation by calling + * checkIndirectScomOP. It handles whether the address + * a regular or an indirect SCOM address + * + * @param[in] i_opType Operation type, see DeviceFW::OperationType + * in driverif.H + * @param[in] i_target SCom target + * @param[in/out] io_buffer Read: pointer to output data storage + * Write: pointer to data to be written + * @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 Select from DeviceFW::AccessType enum + * @see usr/devicefw/(userif.H) + * @param[in] i_args This is an argument list for DD framework. + * In this function, there's only one argument, + * which is the SCom address value. + * + * @return errlHndl_t + */ +errlHndl_t scomMemBufPerformOp(DeviceFW::OperationType i_opType, + TARGETING::Target* i_target, + void* io_buffer, + size_t& io_buflen, + int64_t i_accessType, + va_list i_args); + /** * @brief Performs a SCom operation @@ -103,7 +132,7 @@ errlHndl_t scomPerformOp(DeviceFW::OperationType i_opType, * Output: Read: size of output data * Write: size of data written * @param[in] i_accessType Select from DeviceFW::AccessType enum - * (usrif.H) + * @see usr/devicefw/userif.H * @param[in] i_addr scom Address Value * * @return errlHndl_t @@ -130,7 +159,7 @@ errlHndl_t doScomOp(DeviceFW::OperationType i_opType, * Output: Read: size of output data * Write: size of data written * @param[in] i_accessType Select from DeviceFW::AccessType enum - * (usrif.H) + * @see usr/devicefw/userif.H * @param[in] i_addr Scom Address Value. * * @return errlHndl_t diff --git a/src/usr/scom/test/scomtest.H b/src/usr/scom/test/scomtest.H index cb28829bc..2e8bebf99 100644 --- a/src/usr/scom/test/scomtest.H +++ b/src/usr/scom/test/scomtest.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2013 */ +/* COPYRIGHT International Business Machines Corp. 2011,2014 */ /* */ /* p1 */ /* */ @@ -35,6 +35,7 @@ #include #include #include +#include #include @@ -1813,6 +1814,59 @@ public: } + /** + * Test MBSECCQ bit 16 fix + * Bit 16 should be on if ATTR_CENTAUR_EC_ENABLE_RCE_WITH_OTHER_ERRORS set + */ + void test_MBSECCQ(void) + { + errlHndl_t l_err = NULL; + + // get an existing membuf + TARGETING::TargetHandleList targetList; + getAllChips(targetList,TARGETING::TYPE_MEMBUF); + if(targetList.size()) + { + TARGETING::Target * mbuf = targetList[0]; + uint8_t enabled = 0; + + // @todo RTC 101877 + //FAPI_ATTR_GET + // (ATTR_CENTAUR_EC_ENABLE_RCE_WITH_OTHER_ERRORS_HW246685, + // mbuf, + // enabled); + // Fow now use this: + if(mbuf->getAttr() >= 0x20) + { + enabled = true; + } + + if(enabled) + { + TRACFCOMP(g_trac_scom,"MBSECCQ test run"); + uint64_t data = 0; + size_t op_size = sizeof(uint64_t); + + l_err = deviceOp(DeviceFW::READ, + mbuf, + &data, + op_size, + DEVICE_SCOM_ADDRESS(0x0201144a)); + + if(l_err) + { + TS_FAIL("test_MBSECCQ: unexpected error log"); + errlCommit(l_err,SCOM_COMP_ID); + } + + if( (data & 0x0000800000000000ull) == 0 ) + { + TS_FAIL("test_MBSECCQ: Bit 16 is not set"); + } + } + } + } + }; -- cgit v1.2.1