diff options
Diffstat (limited to 'src/usr/diag')
-rwxr-xr-x | src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C | 141 | ||||
-rwxr-xr-x | src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.H | 10 | ||||
-rwxr-xr-x | src/usr/diag/prdf/common/util/prdfBitString.H | 15 | ||||
-rw-r--r-- | src/usr/diag/prdf/plat/prdfPlatServices.C | 92 | ||||
-rw-r--r-- | src/usr/diag/prdf/plat/prdfPlatServices.H | 26 | ||||
-rwxr-xr-x | src/usr/diag/prdf/test/makefile | 3 | ||||
-rw-r--r-- | src/usr/diag/prdf/test/prdfTest_ScomAccessInterface.H | 123 | ||||
-rwxr-xr-x | src/usr/diag/prdf/test/prdfsimHomRegisterAccess.C | 7 | ||||
-rwxr-xr-x | src/usr/diag/prdf/test/prdfsimHomRegisterAccess.H | 8 |
9 files changed, 279 insertions, 146 deletions
diff --git a/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C b/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C index 75703737f..d5627bb6a 100755 --- a/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C +++ b/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C @@ -32,16 +32,6 @@ //---------------------------------------------------------------------- #define prdfHomRegisterAccess_C -#ifdef __HOSTBOOT_MODULE -// #include <ecmdDataBufferBase.H> TODO RTC 144696 - #include <ibscomreasoncodes.H> -#else - #include <ecmdDataBuffer.H> - #include <hwsvExecutionService.H> - #include <hwco_service_codes.H> -// #include <p8_pore_table_gen_api.H> TODO RTC 136050 -#endif - #include <prdfHomRegisterAccess.H> #include <prdf_service_codes.H> #include <iipbits.h> @@ -125,61 +115,12 @@ uint32_t ScomService::Access(TargetHandle_t i_target, MopRegisterAccess::Operation operation) const { PRDF_DENTER("ScomService::Access()"); - int32_t rc = SUCCESS; - - errlHndl_t errlH = iv_ScomAccessor->Access( i_target, - bs, - registerId, - operation); - #ifdef __HOSTBOOT_MODULE - if( ( NULL != errlH ) && ( MopRegisterAccess::READ == operation ) - && ( IBSCOM::IBSCOM_BUS_FAILURE == errlH->reasonCode() )) - { - PRDF_SET_ERRL_SEV(errlH, ERRL_SEV_INFORMATIONAL); - PRDF_COMMIT_ERRL(errlH, ERRL_ACTION_HIDDEN); - PRDF_INF( "Register access failed with reason code IBSCOM_BUS_FAILURE." - " Trying again, Target HUID:0x%08X Register 0x%016X Op:%u", - PlatServices::getHuid( i_target), registerId, operation ); - - errlH = iv_ScomAccessor->Access( i_target, - bs, - registerId, - operation); - } - #endif + uint32_t rc = SUCCESS; - #ifndef __HOSTBOOT_MODULE - if (errlH != NULL && HWCO_SLW_IN_CHECKSTOP == errlH->getRC()) - { - // We can get a flood of errors from a core in sleep/winkle at the - // time of a checkstop. An errorlog will already be committed for - // for this, so we will ignore these errors here. - delete errlH; - errlH = NULL; - rc = PRD_SCANCOM_FAILURE; - bs.Clear(); - } - #endif - - if(errlH) - { - rc = PRD_SCANCOM_FAILURE; - PRDF_ADD_SW_ERR(errlH, rc, PRDF_HOM_SCOM, __LINE__); - PRDF_ADD_PROCEDURE_CALLOUT(errlH, SRCI_PRIORITY_MED, EPUB_PRC_SP_CODE); - - bool l_isAbort = false; - PRDF_ABORTING(l_isAbort); - if (!l_isAbort) - { - PRDF_SET_ERRL_SEV(errlH, ERRL_SEV_INFORMATIONAL); - PRDF_COMMIT_ERRL(errlH, ERRL_ACTION_HIDDEN); - } - else - { - delete errlH; - errlH = NULL; - } - } + rc = iv_ScomAccessor->Access( i_target, + bs, + registerId, + operation); PRDF_DEXIT("ScomService::Access(): rc=%d", rc); @@ -187,47 +128,24 @@ uint32_t ScomService::Access(TargetHandle_t i_target, } -errlHndl_t ScomAccessor::Access(TargetHandle_t i_target, +uint32_t ScomAccessor::Access(TargetHandle_t i_target, BIT_STRING_CLASS & bs, uint64_t registerId, MopRegisterAccess::Operation operation) const { PRDF_DENTER("ScomAccessor::Access()"); - errlHndl_t errH = NULL; + uint32_t rc = SUCCESS; if(i_target != NULL) { -/* TODO RTC 144696 - uint32_t bsize = bs.GetLength(); - - #ifdef __HOSTBOOT_MODULE - - ecmdDataBufferBase buffer(bsize); - - #else - - ecmdDataBuffer buffer(bsize); - - #endif - switch (operation) { case MopRegisterAccess::WRITE: { - for(unsigned int i = 0; i < bsize; ++i) - { - if(bs.IsSet(i)) buffer.setBit(i); - } - - PRD_FAPI_TO_ERRL(errH, - fapiPutScom, - PlatServices::getFapiTarget(i_target), - registerId, - buffer); + rc = PRDF::PlatServices::putScom(i_target, bs, registerId); #ifndef __HOSTBOOT_MODULE -*/ /* TODO RTC 136050 if( NULL != errH ) break; @@ -276,7 +194,6 @@ errlHndl_t ScomAccessor::Access(TargetHandle_t i_target, } */ -/* TODO RTC 144696 #endif // End of, not __HOSTBOOT_MODULE break; @@ -285,16 +202,7 @@ errlHndl_t ScomAccessor::Access(TargetHandle_t i_target, case MopRegisterAccess::READ: bs.Pattern(0x00000000); // clear all bits - PRD_FAPI_TO_ERRL(errH, - fapiGetScom, - PlatServices::getFapiTarget(i_target), - registerId, - buffer); - - for(unsigned int i = 0; i < bsize; ++i) - { - if(buffer.isBitSet(i)) bs.Set(i); - } + rc = PRDF::PlatServices::getScom(i_target, bs, registerId); break; @@ -304,43 +212,16 @@ errlHndl_t ScomAccessor::Access(TargetHandle_t i_target, break; } // end switch operation -*/ } else // Invalid target { - /*@ - * @errortype - * @subsys EPUB_FIRMWARE_SP - * @reasoncode PRDF_CODE_FAIL - * @moduleid PRDF_HOM_SCOM - * @userdata1 PRD Return code = SCR_ACCESS_FAILED - * @userdata2 The invalid ID causing the fail - * @devdesc Access SCOM failed due to NULL target handle - * @custDesc An internal firmware fault, access failed on hardware - * register. - * @procedure EPUB_PRC_SP_CODE - */ - - // create an error log - PRDF_CREATE_ERRL(errH, - ERRL_SEV_PREDICTIVE, // error on diagnostic - ERRL_ETYPE_NOT_APPLICABLE, - SRCI_MACH_CHECK, - SRCI_NO_ATTR, - PRDF_HOM_SCOM, // module id - FSP_DEFAULT_REFCODE, // refcode What do we use?? - PRDF_CODE_FAIL, // Reason code - SCR_ACCESS_FAILED, // user data word 1 - PlatServices::getHuid(i_target), // user data word 2 - 0x0000, // user data word 3 - 0x0000 // user data word 4 - ); + rc = PRD_SCANCOM_FAILURE; } PRDF_DEXIT("ScomAccessor::Access()"); - return errH; + return rc; } } // End namespace PRDF diff --git a/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.H b/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.H index e54de2aaf..343ef6361 100755 --- a/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.H +++ b/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.H @@ -67,15 +67,15 @@ class ScomAccessor * @param bs holds data read or to write * @param registerId register address * @param operation [READ|WRITE] - * @returns NULL if Success, valid error handle otherwise. + * @returns SUCCESS or PRD_SCANCOM_FAILURE * @pre bs.Length() must be size of register data to read/write * @post For read operation, bs is modified to reflect hardware * register state */ - virtual errlHndl_t Access( TARGETING::TargetHandle_t i_target, - BIT_STRING_CLASS & bs, - uint64_t registerId, - MopRegisterAccess::Operation operation) const; + virtual uint32_t Access( TARGETING::TargetHandle_t i_target, + BIT_STRING_CLASS & bs, + uint64_t registerId, + MopRegisterAccess::Operation operation) const; private: diff --git a/src/usr/diag/prdf/common/util/prdfBitString.H b/src/usr/diag/prdf/common/util/prdfBitString.H index 6ffa66fb0..d144fb08b 100755 --- a/src/usr/diag/prdf/common/util/prdfBitString.H +++ b/src/usr/diag/prdf/common/util/prdfBitString.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ +/* Contributors Listed Below - COPYRIGHT 2012,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -472,6 +472,17 @@ public: */ BitStringBuffer operator<<(uint32_t count) const; + /** + * @brief Gets the CPU_WORD bounded memory address and the relative bit offset + * within the CPU_WORD that corresponds to the provided bit position in the + * bit string + * + * @param iBitPos Bit position in the bit string + * @param oBitOffset Relative bit offset in the CPU_WORD + * + * @return memory address of the CPU_WORD + */ + virtual CPU_WORD * GetRelativePositionAlloc(uint32_t & oBitOffset, uint32_t iBitPos);//dg02a protected: @@ -489,8 +500,6 @@ protected: \param iBitPos Bit position in the bit string */ virtual CPU_WORD * GetRelativePosition(uint32_t & oBitOffset, uint32_t iBitPos) const; - virtual CPU_WORD * GetRelativePositionAlloc(uint32_t & oBitOffset, uint32_t iBitPos);//dg02a - /*! Proides address of the bit string storage diff --git a/src/usr/diag/prdf/plat/prdfPlatServices.C b/src/usr/diag/prdf/plat/prdfPlatServices.C index 781b8528f..35713b32a 100644 --- a/src/usr/diag/prdf/plat/prdfPlatServices.C +++ b/src/usr/diag/prdf/plat/prdfPlatServices.C @@ -44,8 +44,10 @@ #include <errno.h> #include <sys/time.h> #include <time.h> -#include <targeting/common/targetservice.H> #include <initservice/initserviceif.H> +#include <devicefw/userif.H> +#include <iipMopRegisterAccess.h> +#include <ibscomreasoncodes.H> using namespace TARGETING; @@ -109,6 +111,94 @@ bool isSpConfigFsp() #endif } +//------------------------------------------------------------------------------ + +uint32_t getScom(TARGETING::TargetHandle_t i_target, BIT_STRING_CLASS& io_bs, + uint64_t i_address) +{ + errlHndl_t errl = NULL; + uint32_t rc = SUCCESS; + uint32_t tempBitOffset; + size_t bsize = (io_bs.GetLength()+7)/8; + CPU_WORD* buffer = io_bs.GetRelativePositionAlloc(tempBitOffset, 0); + + errl = deviceRead(i_target, buffer, bsize, DEVICE_SCOM_ADDRESS(i_address)); + + if(( NULL != errl ) && ( IBSCOM::IBSCOM_BUS_FAILURE == errl->reasonCode() )) + { + PRDF_SET_ERRL_SEV(errl, ERRL_SEV_INFORMATIONAL); + PRDF_COMMIT_ERRL(errl, ERRL_ACTION_HIDDEN); + PRDF_INF( "Register access failed with reason code IBSCOM_BUS_FAILURE." + " Trying again, Target HUID:0x%08X Register 0x%016X Op:%u", + PlatServices::getHuid( i_target), i_address, + MopRegisterAccess::READ ); + + errl = deviceRead(i_target, buffer, bsize, + DEVICE_SCOM_ADDRESS(i_address)); + } + + if( NULL != errl ) + { + PRDF_ERR("[ScomAccessor::Access()] Error in " + "PRDF::PlatServices::getScom"); + rc = PRD_SCANCOM_FAILURE; + PRDF_ADD_SW_ERR(errl, rc, PRDF_HOM_SCOM, __LINE__); + + bool l_isAbort = false; + PRDF_ABORTING(l_isAbort); + if (!l_isAbort) + { + PRDF_SET_ERRL_SEV(errl, ERRL_SEV_INFORMATIONAL); + PRDF_COMMIT_ERRL(errl, ERRL_ACTION_HIDDEN); + } + else + { + delete errl; + errl = NULL; + } + } + + return rc; +} + +//------------------------------------------------------------------------------ + +uint32_t putScom(TARGETING::TargetHandle_t i_target, BIT_STRING_CLASS& io_bs, + uint64_t i_address) +{ + errlHndl_t errl = NULL; + uint32_t rc = SUCCESS; + uint32_t tempBitOffset; + size_t bsize = (io_bs.GetLength()+7)/8; + CPU_WORD* buffer = io_bs.GetRelativePositionAlloc(tempBitOffset, 0); + + errl = deviceWrite(i_target, buffer, bsize, DEVICE_SCOM_ADDRESS(i_address)); + + if( NULL != errl ) + { + PRDF_ERR("[ScomAccessor::Access()] Error in " + "PRDF::PlatServices::putScom"); + rc = PRD_SCANCOM_FAILURE; + PRDF_ADD_SW_ERR(errl, rc, PRDF_HOM_SCOM, __LINE__); + + bool l_isAbort = false; + PRDF_ABORTING(l_isAbort); + if (!l_isAbort) + { + PRDF_SET_ERRL_SEV(errl, ERRL_SEV_INFORMATIONAL); + PRDF_COMMIT_ERRL(errl, ERRL_ACTION_HIDDEN); + } + else + { + delete errl; + errl = NULL; + } + } + + return rc; +} + + //############################################################################## //## Processor specific functions //############################################################################## diff --git a/src/usr/diag/prdf/plat/prdfPlatServices.H b/src/usr/diag/prdf/plat/prdfPlatServices.H index 00cbb4e32..6fc4c8cf7 100644 --- a/src/usr/diag/prdf/plat/prdfPlatServices.H +++ b/src/usr/diag/prdf/plat/prdfPlatServices.H @@ -48,6 +48,8 @@ #include <prdfPlatServices_ipl.H> #endif +#include <prdfBitString.H> + //------------------------------------------------------------------------------ namespace PRDF @@ -74,6 +76,30 @@ inline bool atRuntime() inline bool isSmpCoherent() { return false; } +/** + * @brief Read data using SCOM + * + * @param i_target Target to read from + * @param io_bs Bit string that holds data that is read in + * @param i_address Address to read from + * + * @return SUCCESS or PRD_SCANCOM_FAILURE + */ +uint32_t getScom(TARGETING::TargetHandle_t i_target, BIT_STRING_CLASS& io_bs, + uint64_t i_address); + +/** + * @brief Write data using SCOM + * + * @param i_target Target to write data to + * @param io_bs Bit string that holds data to write + * @param i_address Address to write data to + * + * @return SUCCESS or PRD_SCANCOM_FAILURE + */ +uint32_t putScom(TARGETING::TargetHandle_t i_target, BIT_STRING_CLASS& io_bs, + uint64_t i_address); + } // end namespace PlatServices } // end namespace PRDF diff --git a/src/usr/diag/prdf/test/makefile b/src/usr/diag/prdf/test/makefile index 6119a5615..dd3ff3fbd 100755 --- a/src/usr/diag/prdf/test/makefile +++ b/src/usr/diag/prdf/test/makefile @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2012,2015 +# Contributors Listed Below - COPYRIGHT 2012,2016 # [+] International Business Machines Corp. # # @@ -49,5 +49,6 @@ TESTS += prdfTest_WriteHomerFir.H endif TESTS += prdfTest_MfgSync.H +TESTS += prdfTest_ScomAccessInterface.H include ${ROOTPATH}/config.mk diff --git a/src/usr/diag/prdf/test/prdfTest_ScomAccessInterface.H b/src/usr/diag/prdf/test/prdfTest_ScomAccessInterface.H new file mode 100644 index 000000000..492e5e376 --- /dev/null +++ b/src/usr/diag/prdf/test/prdfTest_ScomAccessInterface.H @@ -0,0 +1,123 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/test/prdfTest_ScomAccessInterface.H $ */ +/* */ +/* OpenPOWER HostBoot 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 */ + +#ifndef __TEST_PRDFSCOMACCESS_H +#define __TEST_PRDFSCOMACCESS_H + +/** + * @file prdfTest_ScomAccessInterface.H + * + * @brief prdf unit test for scom access interfaces + */ + +#ifdef __HOSTBOOT_MODULE + #include <cxxtest/TestSuite.H> + #include <errl/errlentry.H> + #include <errl/errlmanager.H> +#else + #include <cxxtest/TestSuite.h> + #include <fsp/FipsGlobalFixture.H> + #include <errlentry.H> +#endif + +#include <prdfTrace.H> +#include <prdfMain.H> +#include "prdfsimMacros.H" + +#include <prdfPlatServices.H> +#include <prdfBitString.H> +#include <prdfScomRegister.H> + +using namespace PRDF; + + +class ScomAccessInterface: public CxxTest::TestSuite +{ +public: + + void TestScomInterfaces(void) + { + TS_TRACE(ENTER_MRK "-Scom Access Interface Test 1 - Put Scom - Start-"); + + uint32_t rc = SUCCESS; + TARGETING::TargetHandle_t target; + + //we will be using bit 61 of this address which is a spare bit in the + //OCC fir, which shouldn't generate an attention + uint64_t address = 0x01010800; + CPU_WORD l_cpuWord[(64)/(sizeof(CPU_WORD)*8)] = {0}; + BIT_STRING_CLASS exp(64, l_cpuWord); + BIT_STRING_CLASS bs(64, l_cpuWord); + + TARGETING::TargetHandleList targetList = + PRDF::PlatServices::getFunctionalTargetList(TARGETING::TYPE_PROC); + + do + { + + if (0 == targetList.size()) + { + TS_FAIL("List of functional procs is empty"); + break; + } + else + { + target = targetList[0]; + } + + //spare bit in OCC fir + bs.Set(61); + + rc = PRDF::PlatServices::putScom(target, bs, address); + + exp.SetBits(bs); + + if (SUCCESS != rc) + { + TS_FAIL("Unexpected error calling PRDF::PlatServices::putScom"); + break; + } + bs.Clear(); + + rc = PRDF::PlatServices::getScom(target, bs, address); + + if (SUCCESS != rc) + { + TS_FAIL("Unexpected error calling PRDF::PlatServices::getScom"); + break; + } + + if (!(exp == bs)) + { + TS_FAIL("Unexpected data from getScom"); + break; + } + }while(0); + + TS_TRACE(EXIT_MRK "- Scom Access Interface Test 1 - Put Scom - End -"); + } + +}; +#endif diff --git a/src/usr/diag/prdf/test/prdfsimHomRegisterAccess.C b/src/usr/diag/prdf/test/prdfsimHomRegisterAccess.C index 266254198..e040b7777 100755 --- a/src/usr/diag/prdf/test/prdfsimHomRegisterAccess.C +++ b/src/usr/diag/prdf/test/prdfsimHomRegisterAccess.C @@ -40,13 +40,13 @@ SimScomAccessor::~SimScomAccessor() } -errlHndl_t SimScomAccessor::Access(TARGETING::TargetHandle_t i_target, +uint32_t SimScomAccessor::Access(TARGETING::TargetHandle_t i_target, BIT_STRING_CLASS & bs, uint64_t registerId, MopRegisterAccess::Operation operation) const { PRDF_DENTER("SimScomAccessor::Access()"); - errlHndl_t errlH = NULL; + uint32_t rc = SUCCESS; ScrDB::SimOp l_op = ScrDB::MAX_OP; do @@ -57,6 +57,7 @@ errlHndl_t SimScomAccessor::Access(TARGETING::TargetHandle_t i_target, case MopRegisterAccess::READ: l_op = ScrDB::READ; break; default: PRDF_ERR( "SimScomAccessor::Access() unsupported operation: 0x%X", operation ); + rc = PRD_SCANCOM_FAILURE; break; } getSimServices().processCmd(i_target, bs, registerId, l_op); @@ -65,7 +66,7 @@ errlHndl_t SimScomAccessor::Access(TARGETING::TargetHandle_t i_target, PRDF_DEXIT("SimScomAccessor::Access()"); - return errlH; + return rc; } } // End namespace PRDF diff --git a/src/usr/diag/prdf/test/prdfsimHomRegisterAccess.H b/src/usr/diag/prdf/test/prdfsimHomRegisterAccess.H index f61ad846e..5a6b6ffb7 100755 --- a/src/usr/diag/prdf/test/prdfsimHomRegisterAccess.H +++ b/src/usr/diag/prdf/test/prdfsimHomRegisterAccess.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,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. */ @@ -63,12 +65,12 @@ class SimScomAccessor : public ScomAccessor @param BIT_STRING_CLASS - holds data read or to write @param register address @param [READ|WRITE] - @returns NULL if success, valid error handle otherwise + @returns SUCCESS or PRD_SCANCOM_FAILURE @pre bs.Length() must be size of register data to read/write @post For read operation, bs is modified to reflect hardware register state @note */ - virtual errlHndl_t Access(TARGETING::TargetHandle_t i_target, + virtual uint32_t Access(TARGETING::TargetHandle_t i_target, BIT_STRING_CLASS & bs, uint64_t registerId, MopRegisterAccess::Operation operation) const; |