summaryrefslogtreecommitdiffstats
path: root/src/usr/diag
diff options
context:
space:
mode:
authorZane Shelley <zshelle@us.ibm.com>2015-02-23 21:30:04 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-02-27 23:46:15 -0600
commitb6ec5b042850fd80517dfdbb1226624b98cf617d (patch)
treed9edd14d8f2a2601e7cea519bb337f90f2f165bd /src/usr/diag
parentb640d9b9361402f45b5c88a6bb2384ab2995accc (diff)
downloadtalos-hostboot-b6ec5b042850fd80517dfdbb1226624b98cf617d.tar.gz
talos-hostboot-b6ec5b042850fd80517dfdbb1226624b98cf617d.zip
PRD: Support scom operations from PNOR FIRDATA section
Change-Id: I77bf6f4b361dd18ae6d68f07a95e631509974f3b RTC: 119623 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/15040 Reviewed-by: Christopher T. Phan <cphan@us.ibm.com> Tested-by: Jenkins Server Reviewed-by: Sachin Gupta <sgupta2m@in.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.C45
-rw-r--r--src/usr/diag/attn/ipl/makefile4
-rw-r--r--src/usr/diag/prdf/occ_firdata/prdfPnorFirDataReader.C131
-rw-r--r--src/usr/diag/prdf/occ_firdata/prdfReadPnorFirData.C76
-rw-r--r--src/usr/diag/prdf/occ_firdata/prdfReadPnorFirData.H83
-rw-r--r--src/usr/diag/prdf/prdf_hb_only.mk1
6 files changed, 215 insertions, 125 deletions
diff --git a/src/usr/diag/attn/ipl/attn.C b/src/usr/diag/attn/ipl/attn.C
index 48f8147b2..705964954 100644
--- a/src/usr/diag/attn/ipl/attn.C
+++ b/src/usr/diag/attn/ipl/attn.C
@@ -43,6 +43,10 @@
// Custom compile configs
#include <config.h>
+#ifdef CONFIG_ENABLE_CHECKSTOP_ANALYSIS
+ #include <diag/prdf/prdfPnorFirDataReader.H>
+#endif
+
using namespace std;
using namespace PRDF;
using namespace TARGETING;
@@ -92,11 +96,46 @@ errlHndl_t checkForIplAttentions()
errlHndl_t checkForCSAttentions()
{
- errlHndl_t err = NULL;
+ ATTN_SLOW("Checking for checkstop attentions");
+
+ errlHndl_t errl = NULL;
+
+ assert(!Singleton<Service>::instance().running());
+
+ do
+ {
+ // Read register data from PNOR into memory.
+ PnorFirDataReader & firData = PnorFirDataReader::getPnorFirDataReader();
+ bool validData;
+ errl = firData.readPnor( validData );
+ if ( NULL != errl )
+ {
+ ATTN_ERR("PnorFirDataReader::readPnor() failed");
+ break;
+ }
+
+ // Check if there was valid data in PNOR.
+ if ( !validData )
+ {
+ // Nothing to do, exit quietly.
+ break;
+ }
+
+ // TODO: RTC 119543 Process the checkstop attention
+
+ // Analysis is complete. Clear the PNOR data.
+ errl = firData.clearPnor();
+ if ( NULL != errl )
+ {
+ ATTN_ERR("PnorFirDataReader::clearPnor() failed");
+ break;
+ }
+
+ } while (0);
- // TODO: RTC 119543
+ ATTN_SLOW("checkForCSAttentions complete");
- return err;
+ return errl;
}
#endif // CONFIG_ENABLE_CHECKSTOP_ANALYSIS
diff --git a/src/usr/diag/attn/ipl/makefile b/src/usr/diag/attn/ipl/makefile
index 528a8d1b0..71dedf1d7 100644
--- a/src/usr/diag/attn/ipl/makefile
+++ b/src/usr/diag/attn/ipl/makefile
@@ -1,11 +1,11 @@
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
-# $Source: src/usr/diag/attn/hostboot/makefile $
+# $Source: src/usr/diag/attn/ipl/makefile $
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2014
+# Contributors Listed Below - COPYRIGHT 2014,2015
# [+] International Business Machines Corp.
#
#
diff --git a/src/usr/diag/prdf/occ_firdata/prdfPnorFirDataReader.C b/src/usr/diag/prdf/occ_firdata/prdfPnorFirDataReader.C
new file mode 100644
index 000000000..030fe9bbc
--- /dev/null
+++ b/src/usr/diag/prdf/occ_firdata/prdfPnorFirDataReader.C
@@ -0,0 +1,131 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/occ_firdata/prdfPnorFirDataReader.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 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 <prdfPnorFirDataReader.H>
+
+#include <iipCaptureData.h>
+#include <prdfGlobal.H>
+#include <prdfPfa5Data.h>
+#include <prdfPlatServices.H>
+#include <prdfRasServices.H>
+#include <prdfTrace.H>
+#include <UtilHash.H>
+
+using namespace TARGETING;
+
+namespace PRDF
+{
+
+using namespace PlatServices;
+
+//------------------------------------------------------------------------------
+
+PnorFirDataReader & PnorFirDataReader::getPnorFirDataReader()
+{
+ return PRDF_GET_SINGLETON( PnorFirData );
+}
+
+//------------------------------------------------------------------------------
+
+errlHndl_t PnorFirDataReader::readPnor( bool & o_validData )
+{
+ return readPnorFirData(o_validData, iv_trgtRegMap, iv_ffdc, iv_trgtFfdcMap);
+}
+
+//------------------------------------------------------------------------------
+
+errlHndl_t PnorFirDataReader::clearPnor() const
+{
+ return clearPnorFirData();
+}
+
+//------------------------------------------------------------------------------
+
+void PnorFirDataReader::getScom( TargetHandle_t i_trgt,
+ uint64_t i_addr, uint64_t & o_val ) const
+{
+ o_val = 0;
+
+ PnorTrgtMap::const_iterator trgtItr = iv_trgtRegMap.find( i_trgt );
+ if ( iv_trgtRegMap.end() != trgtItr )
+ {
+ const PnorRegMap & regMap = trgtItr->second;
+
+ PnorRegMap::const_iterator regItr = regMap.find( i_addr );
+ if ( regMap.end() != regItr )
+ {
+ o_val = regItr->second;
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+
+void PnorFirDataReader::putScom( TargetHandle_t i_trgt,
+ uint64_t i_addr, uint64_t i_val )
+{
+ iv_trgtRegMap[i_trgt][i_addr] = i_val;
+}
+
+//------------------------------------------------------------------------------
+
+void PnorFirDataReader::addFfdc( errlHndl_t io_errl ) const
+{
+ size_t u16 = sizeof(uint16_t);
+ size_t u32 = sizeof(uint32_t);
+
+ uint32_t trgtFfdcMapCnt = iv_trgtFfdcMap.size();
+
+ if ( 0 != trgtFfdcMapCnt || iv_ffdc.full )
+ {
+ size_t sz_data = u32 + ((u32 + u16) * trgtFfdcMapCnt);
+ uint8_t data[sz_data];
+
+ data[0] = iv_ffdc.trgts;
+ data[1] = (iv_ffdc.full ? 1 : 0) << 7; // 1:7 reserved
+ data[2] = 0; // 0:7 reserved
+ data[3] = trgtFfdcMapCnt;
+
+ uint32_t idx = 4;
+ for ( PnorTrgtFfdcMap::const_iterator it = iv_trgtFfdcMap.begin();
+ it != iv_trgtFfdcMap.end(); ++it )
+ {
+ HUID huid = getHuid(it->first);
+ memcpy( &data[idx], &huid, u32 ); idx += u32;
+ memcpy( &data[idx], &(it->second.scomErrs), u16 ); idx += u16;
+ }
+
+ BIT_STRING_ADDRESS_CLASS bs ( 0, sz_data * 8, (CPU_WORD *)&data );
+
+ CaptureData cd;
+ cd.Add( getSystemTarget(), Util::hashString("OCC_CS_FFDC"), bs );
+ ErrDataService::AddCapData( cd, io_errl );
+ }
+}
+
+//------------------------------------------------------------------------------
+
+} // end namespace PRDF
+
diff --git a/src/usr/diag/prdf/occ_firdata/prdfReadPnorFirData.C b/src/usr/diag/prdf/occ_firdata/prdfReadPnorFirData.C
index 16d71ae44..596d879fb 100644
--- a/src/usr/diag/prdf/occ_firdata/prdfReadPnorFirData.C
+++ b/src/usr/diag/prdf/occ_firdata/prdfReadPnorFirData.C
@@ -25,6 +25,9 @@
#include <prdfReadPnorFirData.H>
+#include <pnorData_common.h>
+
+#include <prdfPlatServices.H>
#include <prdfTrace.H>
#include <pnor/pnorif.H>
@@ -138,19 +141,15 @@ TargetHandle_t getTargetHandle( PNOR_Trgt_t * i_pTrgt )
//------------------------------------------------------------------------------
-int32_t readPnorData( uint8_t * & o_pBuf, size_t & o_pBufSize )
+errlHndl_t readPnorData( uint8_t * & o_pBuf, size_t & o_pBufSize )
{
#define FUNC "[PRDF::readPnorData] "
- int32_t rc = SUCCESS;
-
PNOR::SectionInfo_t info;
errlHndl_t errl = PNOR::getSectionInfo( PNOR::FIRDATA, info );
if ( NULL != errl )
{
- ERRORLOG::errlCommit( errl, PRDF_COMP_ID );
PRDF_ERR( FUNC"getSectionInfo() failed" );
- rc = FAIL;
}
else
{
@@ -158,19 +157,19 @@ int32_t readPnorData( uint8_t * & o_pBuf, size_t & o_pBufSize )
o_pBufSize = info.size;
}
- return rc;
+ return errl;
#undef FUNC
}
//------------------------------------------------------------------------------
-int32_t readPnorFirData( bool & o_validData, PnorTrgtMap & o_trgtMap,
- PnorFfdc & o_ffdc, PnorTrgtFfdcMap & o_trgtFfdc )
+errlHndl_t readPnorFirData( bool & o_validData, PnorTrgtMap & o_trgtMap,
+ PnorFfdc & o_ffdc, PnorTrgtFfdcMap & o_trgtFfdc )
{
#define FUNC "[PRDF::readPnorFirData] "
- int32_t rc = SUCCESS;
+ errlHndl_t errl = NULL;
o_validData = false;
@@ -181,8 +180,8 @@ int32_t readPnorFirData( bool & o_validData, PnorTrgtMap & o_trgtMap,
do
{
// Read the PNOR data.
- rc = readPnorData( pBuf, sz_pBuf );
- if ( SUCCESS != rc )
+ errl = readPnorData( pBuf, sz_pBuf );
+ if ( NULL != errl )
{
PRDF_ERR( FUNC"readPnorData() failed" );
break;
@@ -193,13 +192,7 @@ int32_t readPnorFirData( bool & o_validData, PnorTrgtMap & o_trgtMap,
// Get the PNOR header data.
PNOR_Data_t * data = NULL;
bool full = firData.getData( data );
- if ( full )
- {
- PRDF_ERR( FUNC"PNOR buffer size %d is less than PNOR header data "
- "size %d", sz_pBuf, sizeof(*data) );
- rc = FAIL;
- break;
- }
+ if ( full ) break;
// Check the header for valid data.
if ( PNOR_FIR1 != data->header )
@@ -222,7 +215,19 @@ int32_t readPnorFirData( bool & o_validData, PnorTrgtMap & o_trgtMap,
if ( NULL == trgtHndl )
{
PRDF_ERR( FUNC"getTargetHandle() failed" );
- rc = FAIL;
+
+ /*@
+ * @errortype
+ * @reasoncode PRDF_NULL_VALUE_RETURNED
+ * @severity ERRL_SEV_UNRECOVERABLE
+ * @moduleid PRDF_CS_FIRDATA_READ
+ * @userdata1 0
+ * @userdata2 0
+ * @devdesc NULL system target.
+ */
+ errl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ PRDF_CS_FIRDATA_READ,
+ PRDF_NULL_VALUE_RETURNED, 0, 0);
break;
}
@@ -265,33 +270,30 @@ int32_t readPnorFirData( bool & o_validData, PnorTrgtMap & o_trgtMap,
{
PRDF_ERR( FUNC"Needed more data than availabe in PNOR (%d bytes)",
sz_pBuf );
- rc = FAIL;
+ /*@
+ * @errortype
+ * @reasoncode PRDF_INVALID_CONFIG
+ * @severity ERRL_SEV_UNRECOVERABLE
+ * @moduleid PRDF_CS_FIRDATA_READ
+ * @userdata1 Size needed
+ * @userdata2 0
+ * @devdesc PNOR data is of inefficient size.
+ */
+ errl = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ PRDF_CS_FIRDATA_READ,
+ PRDF_INVALID_CONFIG, sz_pBuf, 0);
}
- return rc;
+ return errl;
#undef FUNC
}
//------------------------------------------------------------------------------
-int32_t clearPnorFirData()
+errlHndl_t clearPnorFirData()
{
- #define FUNC "[PRDF::clearPnorFirData] "
-
- int32_t rc = SUCCESS;
-
- errlHndl_t errl = PNOR::clearSection( PNOR::FIRDATA );
- if ( NULL != errl )
- {
- ERRORLOG::errlCommit( errl, PRDF_COMP_ID );
- PRDF_ERR( FUNC"clearSection() failed" );
- rc = FAIL;
- }
-
- return rc;
-
- #undef FUNC
+ return PNOR::clearSection( PNOR::FIRDATA );
}
}; // end namespace PRDF
diff --git a/src/usr/diag/prdf/occ_firdata/prdfReadPnorFirData.H b/src/usr/diag/prdf/occ_firdata/prdfReadPnorFirData.H
deleted file mode 100644
index 6e184bae6..000000000
--- a/src/usr/diag/prdf/occ_firdata/prdfReadPnorFirData.H
+++ /dev/null
@@ -1,83 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/diag/prdf/occ_firdata/prdfReadPnorFirData.H $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 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 __prdfReadPnorFirData_H
-#define __prdfReadPnorFirData_H
-
-#include <map>
-
-#include <pnorData_common.h>
-#include <prdfPlatServices.H>
-
-namespace PRDF
-{
-
-typedef std::map<uint64_t, uint64_t> PnorRegMap;
-
-typedef std::map<TARGETING::TargetHandle_t, PnorRegMap> PnorTrgtMap;
-
-struct PnorFfdc
-{
- uint8_t trgts; ///< Total number of target in the PNOR data.
- bool full; ///< True if the PNOR data was unable to capture all regs.
-
- PnorFfdc() : trgts(0), full(false) {}
- PnorFfdc( uint8_t t, bool f ) : trgts(t), full(f) {}
-};
-
-struct PnorTrgtFfdc
-{
- uint16_t scomErrs; ///< Total number of SCOM error detected on this target
-
- PnorTrgtFfdc() : scomErrs(0) {}
- PnorTrgtFfdc(uint16_t s) : scomErrs(s) {}
-};
-
-typedef std::map<TARGETING::TargetHandle_t, PnorTrgtFfdc> PnorTrgtFfdcMap;
-
-/** @brief Read register data captured by the OCC in the event of a system
- * checkstop.
- * @param o_validData True, if there the was a system checkstop and the OCC
- * stored valid data in the PNOR. False otherwise.
- * @param o_trgtMap If the data if valid, a map containing the register
- * values for each target and address.
- * @param o_ffdc PNOR FFDC data for debug.
- * @param o_trgtFfdc PNOR target FFDC data for debug.
- * @return Non-SUCCESS if an internal function fails. SUCCESS otherwise.
- */
-int32_t readPnorFirData( bool & o_validData, PnorTrgtMap & o_trgtMap,
- PnorFfdc & o_ffdc, PnorTrgtFfdcMap & o_trgtFfdc );
-
-/** @brief Clears the OCC FIR data from the PNOR. This must be done after the
- * checkstop analysis is complete so that analysis is not repeated on
- * subsequent IPLs.
- * @return Non-SUCCESS if an internal function fails. SUCCESS otherwise.
- */
-int32_t clearPnorFirData();
-
-}; // end namespace PRDF
-
-#endif // __prdfReadPnorFirData_H
-
diff --git a/src/usr/diag/prdf/prdf_hb_only.mk b/src/usr/diag/prdf/prdf_hb_only.mk
index 31f950fea..f9f24ffc2 100644
--- a/src/usr/diag/prdf/prdf_hb_only.mk
+++ b/src/usr/diag/prdf/prdf_hb_only.mk
@@ -108,6 +108,7 @@ prd_obj += prdfPlatServices_ipl.o
prd_obj += prdfMfgSync.o
# occ_firdata/
+prd_obj += $(if $(CONFIG_ENABLE_CHECKSTOP_ANALYSIS), prdfPnorFirDataReader.o)
prd_obj += $(if $(CONFIG_ENABLE_CHECKSTOP_ANALYSIS), prdfReadPnorFirData.o)
# plat/pegasus/ (non-rule plugin related)
OpenPOWER on IntegriCloud