diff options
author | Sachin Gupta <sgupta2m@in.ibm.com> | 2014-12-07 22:27:30 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-02-27 23:51:19 -0600 |
commit | 64b4d0061a5d02c5664ee30401208b5a76d4030f (patch) | |
tree | e183326294ea832a72d7378f91b144812ca215b0 /src/usr/diag | |
parent | b6ec5b042850fd80517dfdbb1226624b98cf617d (diff) | |
download | talos-hostboot-64b4d0061a5d02c5664ee30401208b5a76d4030f.tar.gz talos-hostboot-64b4d0061a5d02c5664ee30401208b5a76d4030f.zip |
ATTN PRD : Wrapper Functions for checkstop analysis.
Change-Id: I5a16cf0be729405df5bfbbaf727ce5b1dec81983
RTC: 119543
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/14768
Tested-by: Jenkins Server
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Reviewed-by: Prem Shanker Jha <premjha2@in.ibm.com>
Reviewed-by: Christopher T. Phan <cphan@us.ibm.com>
Reviewed-by: Bilicon Patil <bilpatil@in.ibm.com>
Reviewed-by: Zane Shelley <zshelle@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/diag')
-rw-r--r-- | src/usr/diag/attn/ipl/attn.C | 8 | ||||
-rw-r--r-- | src/usr/diag/attn/ipl/attn_hb.mk | 5 | ||||
-rw-r--r-- | src/usr/diag/attn/ipl/attnfilereg.C | 115 | ||||
-rw-r--r-- | src/usr/diag/attn/ipl/attnfilereg.H | 115 | ||||
-rwxr-xr-x | src/usr/diag/prdf/framework/register/prdfFileRegisterAccess.C | 68 | ||||
-rwxr-xr-x | src/usr/diag/prdf/framework/register/prdfFileRegisterAccess.H | 79 | ||||
-rw-r--r-- | src/usr/diag/prdf/prdfMain_ipl.C | 36 | ||||
-rw-r--r-- | src/usr/diag/prdf/prdf_hb_only.mk | 5 |
8 files changed, 428 insertions, 3 deletions
diff --git a/src/usr/diag/attn/ipl/attn.C b/src/usr/diag/attn/ipl/attn.C index 705964954..181c7ce34 100644 --- a/src/usr/diag/attn/ipl/attn.C +++ b/src/usr/diag/attn/ipl/attn.C @@ -44,6 +44,7 @@ #include <config.h> #ifdef CONFIG_ENABLE_CHECKSTOP_ANALYSIS + #include "ipl/attnfilereg.H" #include <diag/prdf/prdfPnorFirDataReader.H> #endif @@ -121,8 +122,15 @@ errlHndl_t checkForCSAttentions() break; } + // Install File scom implementation + FileRegSvc fileRegs; + fileRegs.installScomImpl(); + // TODO: RTC 119543 Process the checkstop attention + // Uninstall File scom implementation. + Singleton<ScomImpl>::instance().installScomImpl(); + // Analysis is complete. Clear the PNOR data. errl = firData.clearPnor(); if ( NULL != errl ) diff --git a/src/usr/diag/attn/ipl/attn_hb.mk b/src/usr/diag/attn/ipl/attn_hb.mk index ef8bab79e..e9617eab6 100644 --- a/src/usr/diag/attn/ipl/attn_hb.mk +++ b/src/usr/diag/attn/ipl/attn_hb.mk @@ -1,11 +1,11 @@ # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # -# $Source: src/usr/diag/attn/hostboot/attn_hb.mk $ +# $Source: src/usr/diag/attn/ipl/attn_hb.mk $ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2012,2014 +# Contributors Listed Below - COPYRIGHT 2012,2015 # [+] International Business Machines Corp. # # @@ -25,3 +25,4 @@ ATTN_HB_OBJS += attn.o ATTN_HB_OBJS += attnsvc.o +ATTN_HB_OBJS += $(if $(CONFIG_ENABLE_CHECKSTOP_ANALYSIS), attnfilereg.o) diff --git a/src/usr/diag/attn/ipl/attnfilereg.C b/src/usr/diag/attn/ipl/attnfilereg.C new file mode 100644 index 000000000..1655ff32d --- /dev/null +++ b/src/usr/diag/attn/ipl/attnfilereg.C @@ -0,0 +1,115 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/attn/ipl/attnfilereg.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* [+] 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 attnfilereg.C + * + * @brief HBATTN file register class method definitions. + */ + +#include "common/attnlist.H" +#include "common/attntrace.H" +#include "common/attntarget.H" +#include "attnfilereg.H" + +#include <diag/prdf/prdfPnorFirDataReader.H> + +using namespace std; +using namespace PRDF; +using namespace TARGETING; + +namespace ATTN +{ + +errlHndl_t FileRegSvc::putScom( + TargetHandle_t i_target, + uint64_t i_address, + uint64_t i_data) +{ + + using namespace PRDF; + + ATTN_DBG("FileRegSvc::putScom: huid: 0x%08X, add: %016x, data: %016x", + get_huid(i_target), i_address, i_data); + + PnorFirDataReader & firData = PnorFirDataReader::getPnorFirDataReader(); + firData.putScom( i_target, i_address, i_data ); + + return NULL; +} + +errlHndl_t FileRegSvc::getScom( + TargetHandle_t i_target, + uint64_t i_address, + uint64_t & o_data) +{ + using namespace PRDF; + + PnorFirDataReader & firData = PnorFirDataReader::getPnorFirDataReader(); + firData.getScom( i_target, i_address, o_data); + + ATTN_DBG("FileRegSvc::getScom: huid: 0x%08X, add: %016x, data: %016x", + get_huid(i_target), i_address, o_data); + + return NULL; +} + +errlHndl_t FileRegSvc::modifyScom( + TargetHandle_t i_target, + uint64_t i_address, + uint64_t i_data, + uint64_t & o_data, + ScomOp i_op) +{ + errlHndl_t err = 0; + + uint64_t data = 0; + + do + { + err = getScom( i_target, i_address, data ); + if( err ) break; + + uint64_t changedData = i_op == SCOM_OR + ? (data | i_data) + : (data & i_data); + + bool changed = changedData != data; + + if(changed) + { + err = putScom( i_target, i_address, changedData); + if ( err ) break; + } + }while( 0 ); + if( NULL != err ) + { + ATTN_ERR("FileRegSvc::modifyScom() failed. huid: 0x%08X, add: %016x, " + "data: %016x", get_huid(i_target), i_address, i_data); + } + return err; +} + +} // end namespace ATTN + diff --git a/src/usr/diag/attn/ipl/attnfilereg.H b/src/usr/diag/attn/ipl/attnfilereg.H new file mode 100644 index 000000000..2ea9ee4d2 --- /dev/null +++ b/src/usr/diag/attn/ipl/attnfilereg.H @@ -0,0 +1,115 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/attn/ipl/attnfilereg.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* [+] 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 __ATTN_FILE_REG_SVC__ +#define __ATTN_FILE_REG_SVC__ + +/** + * @file attnfilereg.H + * + * @brief HBATTN file register class definition. The interfaces in this class + * will do operations on scom data in a file. + */ + +#include "common/attnscom.H" +#include <map> + +namespace ATTN +{ + +/** + * @brief FileRegSvc + * + * Container that presents an interface to file scom + * implementations. + */ +class FileRegSvc : public ScomImpl +{ + public: + + /** + * @brief putScom Write a register using SCOM. + * + * @param[in] i_target Target to write register on. + * @param[in] i_address Register address to write to. + * @param[in] i_data Data to write to register. + * + * @retval[0] No errors. + * @retval[!0] Unexpected error occurred. + */ + errlHndl_t putScom( + TARGETING::TargetHandle_t i_target, + uint64_t i_address, + uint64_t i_data); + + /** + * @brief getScom Read a register using SCOM. + * + * @param[in] i_target Target to read register from. + * @param[in] i_address Register address to read from. + * @param[out] o_data Buffer to write register content to. + * + * @retval[0] No errors. + * @retval[!0] Unexpected error occurred. + */ + errlHndl_t getScom( + TARGETING::TargetHandle_t i_target, + uint64_t i_address, + uint64_t & o_data); + + /** + * @brief modifyScom RMW a register using SCOM. + * + * @param[in] i_target Target to update register on. + * @param[in] i_address Register address to update. + * @param[in] i_data Data to write to register. + * @param[out] o_data Data read from register. + * @param[in] i_op and/or behavior. + * + * @retval[0] No errors. + * @retval[!0] Unexpected error occurred. + */ + errlHndl_t modifyScom( + TARGETING::TargetHandle_t i_target, + uint64_t i_address, + uint64_t i_data, + uint64_t & o_data, + ScomOp i_op); + + + /** + * @brief ctor + */ + FileRegSvc(){}; + + /** + * @brief dtor + */ + virtual ~FileRegSvc(){}; + +}; + +} // end namespace ATTN + +#endif diff --git a/src/usr/diag/prdf/framework/register/prdfFileRegisterAccess.C b/src/usr/diag/prdf/framework/register/prdfFileRegisterAccess.C new file mode 100755 index 000000000..18037d157 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/prdfFileRegisterAccess.C @@ -0,0 +1,68 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/framework/register/prdfFileRegisterAccess.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* [+] 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 */ + +#include "prdfFileRegisterAccess.H" +#include <prdfTrace.H> +#include <prdfPnorFirDataReader.H> +#include <prdfBitString.H> + +using namespace TARGETING; + +namespace PRDF +{ + +errlHndl_t FileScomAccessor::Access( + TargetHandle_t i_target, + BIT_STRING_CLASS & bs, + uint64_t registerId, + MopRegisterAccess::Operation operation) const +{ + #define PRDF_FUNC "[FileScomAccessor::Access()] " + + errlHndl_t errlH = NULL; + + PnorFirDataReader & firData = PnorFirDataReader::getPnorFirDataReader(); + uint64_t data = 0; + + switch (operation) + { + case MopRegisterAccess::WRITE: + data = bs.GetFieldJustify(0, 64); + firData.putScom( i_target, registerId, data); + break; + case MopRegisterAccess::READ: + firData.getScom( i_target, registerId, data); + bs.SetFieldJustify( 0, 64, data); + break; + default: + PRDF_ERR(PRDF_FUNC"Wrong Operation:%u", operation); + } + + return errlH; + + #undef PRDF_FUNC +} + +} // End namespace PRDF diff --git a/src/usr/diag/prdf/framework/register/prdfFileRegisterAccess.H b/src/usr/diag/prdf/framework/register/prdfFileRegisterAccess.H new file mode 100755 index 000000000..b70c33959 --- /dev/null +++ b/src/usr/diag/prdf/framework/register/prdfFileRegisterAccess.H @@ -0,0 +1,79 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/framework/register/prdfFileRegisterAccess.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* [+] 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 PRDFFILEREGISTERACCESS_H +#define PRDFFILEREGISTERACCESS_H +/** + * @file prdfFileRegisterAccess.H + * @brief Provide access to scom registers via the File +*/ + + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#include <prdfHomRegisterAccess.H> + + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +namespace PRDF +{ + +class FileScomAccessor : public ScomAccessor +{ + public: + + /** + * @brief ctor + */ + FileScomAccessor() {}; + + /** + * @brief dtor + */ + virtual ~FileScomAccessor() {}; + + /** + * Access the scom register using file. + * @param i_target Target to access the register + * @param BIT_STRING_CLASS - holds data read or to write + * @param register address + * @param [READ|WRITE] + * @returns NULL if success, valid error handle otherwise + * @pre bs.Length() must be size of register data to read/write + */ + virtual errlHndl_t Access(TARGETING::TargetHandle_t i_target, + BIT_STRING_CLASS & bs, + uint64_t registerId, + MopRegisterAccess::Operation operation) const; +}; + +} // End namespace PRDF + +#endif /* PRDFFILEREGISTERACCESS_H */ diff --git a/src/usr/diag/prdf/prdfMain_ipl.C b/src/usr/diag/prdf/prdfMain_ipl.C index 599bef145..f2ec5c87c 100644 --- a/src/usr/diag/prdf/prdfMain_ipl.C +++ b/src/usr/diag/prdf/prdfMain_ipl.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014 */ +/* Contributors Listed Below - COPYRIGHT 2014,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -39,6 +39,13 @@ #include <prdfPlatServices.H> #include <prdfMbaDomain.H> +// Custom compile configs +#include <config.h> + +#ifdef CONFIG_ENABLE_CHECKSTOP_ANALYSIS + #include <prdfFileRegisterAccess.H> +#endif + using namespace TARGETING; using namespace HWAS; @@ -186,4 +193,31 @@ errlHndl_t startScrub() #undef PRDF_FUNC } +//------------------------------------------------------------------------------ + +#ifdef CONFIG_ENABLE_CHECKSTOP_ANALYSIS + +errlHndl_t analyzeCheckStop( ATTENTION_VALUE_TYPE i_attentionType, + const AttnList & i_attnList ) +{ + PRDF_ENTER( "PRDF::analyzeCheckStop() Global attnType=%04X", + i_attentionType ); + + // install file Scom Accessor + FileScomAccessor * fileScomAccessor = new FileScomAccessor(); + getScomService().setScomAccessor( *fileScomAccessor); + + // Call main to analyze checkstop + errlHndl_t errl = main( i_attentionType, i_attnList ); + + // Uninstall file scom. setScomAccessor() will also free up + // memory for fileScomAccessor. + ScomAccessor * scomAccessor = new ScomAccessor(); + getScomService().setScomAccessor( *scomAccessor); + + return errl; +} + +#endif // CONFIG_ENABLE_CHECKSTOP_ANALYSIS + } // end namespace PRDF diff --git a/src/usr/diag/prdf/prdf_hb_only.mk b/src/usr/diag/prdf/prdf_hb_only.mk index f9f24ffc2..fc86879ba 100644 --- a/src/usr/diag/prdf/prdf_hb_only.mk +++ b/src/usr/diag/prdf/prdf_hb_only.mk @@ -37,6 +37,7 @@ prd_vpath += ${PRD_SRC_PATH} prd_vpath += ${PRD_SRC_PATH}/framework/config prd_vpath += ${PRD_SRC_PATH}/framework/resolution prd_vpath += ${PRD_SRC_PATH}/framework/service +prd_vpath += ${PRD_SRC_PATH}/framework/register prd_vpath += ${PRD_SRC_PATH}/mnfgtools prd_vpath += ${PRD_SRC_PATH}/occ_firdata prd_vpath += ${PRD_SRC_PATH}/plat @@ -48,6 +49,7 @@ prd_incpath += ${PRD_INC_PATH}/common # Stored differently in FSP prd_incpath += ${PRD_SRC_PATH} prd_incpath += ${PRD_SRC_PATH}/framework/config prd_incpath += ${PRD_SRC_PATH}/framework/resolution +prd_incpath += ${PRD_SRC_PATH}/framework/register prd_incpath += ${PRD_SRC_PATH}/framework/service prd_incpath += ${PRD_SRC_PATH}/mnfgtools prd_incpath += ${PRD_SRC_PATH}/occ_firdata @@ -79,6 +81,9 @@ prd_obj += prdfDumpResolution.o prd_obj += prdfPlatServices.o prd_obj += prdfRasServices.o +# framework/register +prd_obj += $(if $(CONFIG_ENABLE_CHECKSTOP_ANALYSIS), prdfFileRegisterAccess.o) + # plat/pegasus/ (non-rule plugin related) prd_obj += prdfPllUtils.o |