summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/procedures/hwp/pm
diff options
context:
space:
mode:
authorPrasad Bg Ranganath <prasadbgr@in.ibm.com>2017-10-02 12:41:43 -0500
committerChristian R. Geddes <crgeddes@us.ibm.com>2017-10-09 16:01:31 -0400
commitfb91c96d1158b58a698615e2bdef1217e39ea0e0 (patch)
tree3bf1a781fca891f38651fd00cbd0db19a474d888 /src/import/chips/p9/procedures/hwp/pm
parent6072cd8cb0f8eed933ec35aca419166f76e2d79a (diff)
downloadtalos-hostboot-fb91c96d1158b58a698615e2bdef1217e39ea0e0.tar.gz
talos-hostboot-fb91c96d1158b58a698615e2bdef1217e39ea0e0.zip
PM Recovery FFDC: Added support to collect Register data for PPM
Change-Id: I841cf840c8df49640b7612832960f56a59419ad7 RTC:179598 RTC:179602 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/47011 Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com> Reviewed-by: Prem Shanker Jha <premjha2@in.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: AMIT J. TENDOLKAR <amit.tendolkar@in.ibm.com> Reviewed-by: PARVATHI RACHAKONDA <prachako@in.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/47051 Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/import/chips/p9/procedures/hwp/pm')
-rw-r--r--src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_base.H37
-rw-r--r--src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cme.C32
-rw-r--r--src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cme.H10
-rw-r--r--src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cppm.C190
-rw-r--r--src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cppm.H91
-rw-r--r--src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cppm.mk31
-rw-r--r--src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_defines.H18
-rw-r--r--src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_pgpe.C223
-rw-r--r--src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_pgpe.H115
-rw-r--r--src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_pgpe.mk33
-rw-r--r--src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_qppm.C135
-rw-r--r--src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_qppm.H85
-rw-r--r--src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_qppm.mk31
13 files changed, 1024 insertions, 7 deletions
diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_base.H b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_base.H
index 711ebeb80..7ac75e5e8 100644
--- a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_base.H
+++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_base.H
@@ -41,6 +41,7 @@
// Includes
//--------------------------------------------------------------------------
#include <fapi2.H>
+#include <collect_reg_ffdc.H>
#include <stdint.h>
#include <p9_hcd_memmap_cme_sram.H>
#include <p9_hcd_memmap_occ_sram.H>
@@ -119,6 +120,19 @@ namespace p9_stop_recov_ffdc
FfdcDataType i_dataType,
uint32_t i_sramLength );
+ ///@brief Collects register data
+ ///param[in] i_chipletTarget Chip/chilpet target
+ ///param[out] o_pHomerBuf Homer base address to fill register
+ // data
+ // param[in] i_ffdcId Hwp ffdc id to know register
+ // collection type
+ ///@return fapi2 return code
+ template<fapi2::TargetType T>
+ fapi2::ReturnCode collectRegisterData( const fapi2::Target<T>& i_chipletTarget,
+ uint8_t* o_pHomerBuf,
+ fapi2::HwpFfdcId i_ffdcId);
+
+
///@brief updates parts of PPE FFDC Header common for all platforms.
///param[in] i_pFfdcHdr points to the PPE FFDC header
///param[in] i_ffdcValid bit vector summarizing FFDC validity
@@ -142,6 +156,29 @@ namespace p9_stop_recov_ffdc
PmComplexPlatId iv_plat;
};
+ template<fapi2::TargetType T>
+ fapi2::ReturnCode PlatPmComplex::collectRegisterData(const fapi2::Target<T>& i_chipletTarget,
+ uint8_t *o_pHomerBuf,
+ fapi2::HwpFfdcId i_ffdcId)
+ {
+ FAPI_DBG(">> collectRegisterData");
+ std::vector<uint32_t> l_cfamAddresses;
+ std::vector<uint64_t> l_scomAddresses;
+ uint32_t l_ffdcRegReadSize = 0;
+ uint32_t l_offset = 0;
+ fapi2::ScomReader<T> l_scomReader(i_chipletTarget);
+
+ fapi2::getAddressData(i_ffdcId, l_scomAddresses, l_cfamAddresses, l_ffdcRegReadSize);
+
+ FAPI_TRY((fapi2::collectRegisterAndAddressData<uint64_t,
+ fapi2::ScomReader<T> >(l_scomAddresses, l_scomReader,
+ l_offset, o_pHomerBuf)),
+ "Failed in collectRegisterAndAddressData");
+
+ fapi_try_exit:
+ FAPI_DBG("<< collectRegisterData");
+ return fapi2::current_err;
+ }
} //namespace p9_stop_recov_ffdc ends
diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cme.C b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cme.C
index 0f49b63dc..2774f1539 100644
--- a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cme.C
+++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cme.C
@@ -42,6 +42,7 @@
#include <p9_pm_recovery_ffdc_cme.H>
#include <p9_hcd_memmap_cme_sram.H>
+#include <collect_reg_ffdc.H>
#include <p9_ppe_defs.H>
#include <stddef.h>
#include <endian.h>
@@ -83,6 +84,7 @@
if( !ex.isFunctional() )
{
//Marking CME FFDC region as Invalid
+ l_ffdcValdityVect = PPE_FFDC_INVALID;
FAPI_TRY( updateCmeFfdcHeader( l_pFfdcLoc, l_cmePos, l_ffdcValdityVect, l_haltState ),
"Failed To Update CME FFDC Header for CME 0x%0d", l_cmePos );
continue;
@@ -126,6 +128,7 @@
{
FAPI_ERR("Error in collecting CME Globals, CME Pos 0x%08x", l_cmePos );
l_ffdcValdityVect &= ~PPE_DASHBOARD_VALID;
+
}
l_retCode = collectImageHeader( l_pFfdcLoc, ex );
@@ -136,8 +139,19 @@
l_ffdcValdityVect &= ~PPE_IMAGE_HEADER_VALID;
}
+ l_retCode = collectInternalReg( l_pFfdcLoc, ex , l_cmePos);
+
+ if( l_retCode )
+ {
+ FAPI_ERR("Error in collecting CME Internal Regs, CME Pos 0x%08x", l_cmePos );
+ l_ffdcValdityVect &= ~PPE_INT_REG_VALID;
+ }
+
+
+
FAPI_TRY( updateCmeFfdcHeader( l_pFfdcLoc, l_cmePos, l_ffdcValdityVect, l_haltState ),
"Failed To Update CME FFDC Header for CME 0x%0d", l_cmePos );
+
}
fapi_try_exit:
@@ -191,8 +205,24 @@
//-----------------------------------------------------------------------
fapi2::ReturnCode PlatCme::collectInternalReg( uint8_t * i_pCmeIntReg,
- const fapi2::Target<fapi2::TARGET_TYPE_EX >& i_exTgt )
+ const fapi2::Target<fapi2::TARGET_TYPE_EX >& i_exTgt ,
+ const uint8_t i_exPos)
{
+ FAPI_DBG(">> PlatCme::collectInternalReg" );
+
+ PpeFfdcLayout * l_pCmeFfdc = ( PpeFfdcLayout *) ( i_pCmeIntReg);
+ uint8_t * l_pIntRegs = &l_pCmeFfdc->iv_ppeInternalReg[0];
+
+ FAPI_INF("CME Internal FFDC Pos %d ", i_exPos);
+
+ FAPI_TRY(collectRegisterData<fapi2::TARGET_TYPE_EX> (i_exTgt,
+ l_pIntRegs,
+ static_cast<fapi2::HwpFfdcId>(fapi2::CME_INTERNAL_FFDC_REGISTERS)),
+ "Failed to collect register data for CME instance %u",i_exPos);
+
+
+ fapi_try_exit:
+ FAPI_DBG("<< PlatCme::collectInternalReg" );
return fapi2::FAPI2_RC_SUCCESS;
}
diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cme.H b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cme.H
index a9ad0f0c4..39be147af 100644
--- a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cme.H
+++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cme.H
@@ -22,8 +22,8 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
-#ifndef __PM_RECOVERY_FFDC_BASE_
-#define __PM_RECOVERY_FFDC_BASE_
+#ifndef __PM_RECOVERY_FFDC_CME_
+#define __PM_RECOVERY_FFDC_CME_
///
/// @file p9_pm_recovery_ffdc_cme.H
@@ -76,8 +76,10 @@ namespace p9_stop_recov_ffdc
/// @brief collects internal register info for a given CME
/// @param[in] i_pHomerBuf points to location of HOMER meant for CME's internal register.
/// @param[in] i_exTgt fapi2 target for ex
+ /// @param[in] i_exPos EX target position
fapi2::ReturnCode collectInternalReg( uint8_t * i_pHomerBuf,
- const fapi2::Target< fapi2::TARGET_TYPE_EX > & i_exTgt );
+ const fapi2::Target< fapi2::TARGET_TYPE_EX > & i_exTgt ,
+ const uint8_t i_exPos);
/// @brief collects CME Image Header info from CME SRAM buffer.
/// @param[in] i_pHomerBuf points to location of HOMER meant for CME's header.
@@ -106,4 +108,4 @@ extern "C"
} //namespace p9_stop_recov_ffdc ends
-#endif //__PM_RECOVERY_FFDC_BASE_
+#endif //__PM_RECOVERY_FFDC_CME_
diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cppm.C b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cppm.C
new file mode 100644
index 000000000..cfa2f5994
--- /dev/null
+++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cppm.C
@@ -0,0 +1,190 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cppm.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2017 */
+/* [+] 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 */
+// *INDENT-OFF*
+
+
+///
+/// @file p9_pm_recovery_ffdc_cppm.C
+/// @brief PPM FFDC collection of PM complex
+///
+/// *HWP HWP Owner: Greg Still <stillgs@us.ibm.com>
+/// *HWP FW Owner: Prasad Bg Ranganath <prasadbgr@in.ibm.com>
+/// *HWP Team: PM
+/// *HWP Level: 2
+/// *HWP Consumed by: Hostboot
+//
+// *INDENT-OFF*
+//--------------------------------------------------------------------------
+// Includes
+//--------------------------------------------------------------------------
+
+#include <p9_pm_recovery_ffdc_cppm.H>
+#include <collect_reg_ffdc.H>
+#include <stddef.h>
+#include <endian.h>
+
+ namespace p9_stop_recov_ffdc
+ {
+ CppmRegs::CppmRegs( const fapi2::Target< fapi2::TARGET_TYPE_PROC_CHIP > i_procChipTgt )
+ : PlatPmComplex( i_procChipTgt,0,0,0,PLAT_PPM)
+ { }
+
+ //----------------------------------------------------------------------
+
+ fapi2::ReturnCode CppmRegs::collectRegFfdc( void * i_pHomerBuf )
+ {
+ FAPI_DBG(">> CppmRegs::collectRegFfdc");
+ fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_SUCCESS;
+ auto l_quadList =
+ getProcChip().getChildren< fapi2::TARGET_TYPE_EQ > ( fapi2::TARGET_STATE_PRESENT );
+ uint8_t l_quadPos = 0;
+ uint8_t l_corePos = 0;
+ uint8_t *l_pFfdcLoc = NULL;
+ uint8_t l_cppmFfdcValid = 0;
+ uint8_t l_quadFfdcValid = 0;
+ HomerFfdcRegion * l_pHomerFfdc =
+ ( HomerFfdcRegion *)( (uint8_t *)i_pHomerBuf + FFDC_REGION_HOMER_BASE_OFFSET );
+
+ for( auto quad : l_quadList )
+ {
+ l_cppmFfdcValid = 0;
+ l_quadFfdcValid = 0;
+ FAPI_TRY( FAPI_ATTR_GET( fapi2::ATTR_CHIP_UNIT_POS, quad, l_quadPos),
+ "FAPI_ATTR_GET Failed To Read QUAD Position" );
+ if( quad.isFunctional() )
+ {
+ l_quadFfdcValid = 1;
+ auto l_exList =
+ quad.getChildren< fapi2::TARGET_TYPE_EX > ( fapi2::TARGET_STATE_PRESENT );
+
+ for( auto ex : l_exList )
+ {
+ auto l_coreList =
+ ex.getChildren< fapi2::TARGET_TYPE_CORE > ( fapi2::TARGET_STATE_PRESENT );
+
+ for ( auto core : l_coreList )
+ {
+ FAPI_TRY( FAPI_ATTR_GET( fapi2::ATTR_CHIP_UNIT_POS, core, l_corePos ),
+ "FAPI_ATTR_GET Failed To Read CORE Position" );
+
+ l_pFfdcLoc = &l_pHomerFfdc->iv_quadFfdc[l_quadPos].iv_quadCppmRegion[l_corePos][0];
+
+ if( core.isFunctional() )
+ {
+ l_cppmFfdcValid = 1;
+
+ FAPI_INF("CPPM FFDC Pos %d ", l_corePos);
+
+ l_rc = collectRegisterData <fapi2::TARGET_TYPE_CORE> (core,
+ l_pFfdcLoc + sizeof (PpmFfdcHeader),
+ fapi2::CPPM_FFDC_REGISTERS);
+ if (l_rc)
+ {
+ l_cppmFfdcValid = 0;
+ }
+ }
+
+
+ FAPI_TRY( updateCppmFfdcHeader( l_pFfdcLoc, l_corePos, l_cppmFfdcValid),
+ "Failed To Update CPPM FFDC Header for CORE 0x%0d", l_corePos );
+ }
+ }
+ }
+ FAPI_TRY( updateQuadFfdcHeader( l_pFfdcLoc,l_quadPos, l_quadFfdcValid),
+ "Failed To Update CPPM FFDC Header for CORE 0x%0d", l_corePos );
+ }
+
+ fapi_try_exit:
+ FAPI_DBG("<< CppmRegs::collectRegFfdc");
+ return fapi2::current_err;
+ }
+
+ fapi2::ReturnCode CppmRegs::updateCppmFfdcHeader( uint8_t * i_pHomerBuf,
+ const uint8_t i_corePos,
+ const uint8_t i_ffdcValid)
+ {
+ FAPI_DBG(">> updateCppmFfdcHeader" );
+
+ PpmFfdcHeader * l_CppmFfdcHdr = (PpmFfdcHeader *) i_pHomerBuf ;
+ l_CppmFfdcHdr->iv_ppmMagicWord = htobe32(FFDC_CPPM_MAGIC_NUM);
+ l_CppmFfdcHdr->iv_Instance = i_corePos;
+ l_CppmFfdcHdr->iv_ppmHeaderSize = sizeof(PpmFfdcHeader);
+ l_CppmFfdcHdr->iv_sectionSize = FFDC_CPPM_REGISTERS_SIZE;
+ l_CppmFfdcHdr->iv_ffdcValid = i_ffdcValid;
+
+ FAPI_DBG("<< updateCppmFfdcHeader" );
+ return fapi2::FAPI2_RC_SUCCESS;
+ }
+ //-----------------------------------------------------------------------
+ //
+ fapi2::ReturnCode CppmRegs::updateQuadFfdcHeader( uint8_t * i_pHomerBuf,
+ const uint8_t i_eqPos,
+ const uint8_t i_ffdcValid)
+ {
+ FAPI_DBG(">> updateQuadFfdcHeader" );
+
+ QuadFfdcHeader* l_QuadFfdcHdr = (QuadFfdcHeader*) i_pHomerBuf ;
+ l_QuadFfdcHdr->iv_quadMagicWord = htobe32(FFDC_QUAD_MAGIC_NUM);
+ l_QuadFfdcHdr->iv_quadInstance = i_eqPos;
+ l_QuadFfdcHdr->iv_quadHeaderSize = sizeof(QuadFfdcHeader);
+ l_QuadFfdcHdr->iv_sectionSize = sizeof(HomerQuadFfdcRegion);
+ l_QuadFfdcHdr->iv_offsetCppm0 = htobe16(offsetof (struct HomerQuadFfdcRegion,
+ iv_quadCppmRegion[0][0]));
+ l_QuadFfdcHdr->iv_offsetCppm1 = htobe16(offsetof (struct HomerQuadFfdcRegion,
+ iv_quadCppmRegion[1][0]));
+ l_QuadFfdcHdr->iv_offsetCppm2 = htobe16(offsetof (struct HomerQuadFfdcRegion,
+ iv_quadCppmRegion[2][0]));
+ l_QuadFfdcHdr->iv_offsetCppm3 = htobe16(offsetof (struct HomerQuadFfdcRegion,
+ iv_quadCppmRegion[3][0]));
+ l_QuadFfdcHdr->iv_offsetCme0 = htobe16(offsetof(struct HomerQuadFfdcRegion,
+ iv_quadCmeBlock[0][0]));
+ l_QuadFfdcHdr->iv_offsetCme1 = htobe16(offsetof(struct HomerQuadFfdcRegion,
+ iv_quadCmeBlock[1][0]));
+ l_QuadFfdcHdr->iv_offsetQppm = htobe16(offsetof(struct HomerQuadFfdcRegion,
+ iv_quadQppmRegion[0]));
+ l_QuadFfdcHdr->iv_ffdcValid = i_ffdcValid;
+
+ FAPI_DBG("<< updateQuadFfdcHeader" );
+ return fapi2::FAPI2_RC_SUCCESS;
+ }
+
+
+extern "C"
+{
+ fapi2::ReturnCode p9_pm_recovery_ffdc_cppm( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP >& i_procChip, void * i_pFfdcBuf )
+ {
+ FAPI_IMP(">> p9_pm_recovery_ffdc_cppm" );
+ CppmRegs l_cppmFfdc( i_procChip );
+ FAPI_TRY( l_cppmFfdc.collectRegFfdc( i_pFfdcBuf ),
+ "Failed To Collect CPPM FFDC" );
+
+ fapi_try_exit:
+ FAPI_IMP("<< p9_pm_recovery_ffdc_cppm" );
+ return fapi2::current_err;
+ }
+
+}
+
+ }//namespace p9_stop_recov_ffdc ends
diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cppm.H b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cppm.H
new file mode 100644
index 000000000..ffd72dca3
--- /dev/null
+++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cppm.H
@@ -0,0 +1,91 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cppm.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2017 */
+/* [+] 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 __PM_RECOVERY_FFDC_CPPM_
+#define __PM_RECOVERY_FFDC_CPPM_
+
+///
+/// @file p9_pm_recovery_ffdc_cppm.H
+/// @brief CPPM FFDC collection of PM complex
+///
+/// *HWP HWP Owner: Greg Still <stillgs@us.ibm.com>
+/// *HWP FW Owner: Prasad Bg Ranganath <prasadbgr@in.ibm.com>
+/// *HWP Team: PM
+/// *HWP Level: 2
+/// *HWP Consumed by: Hostboot
+//
+// *INDENT-OFF*
+//--------------------------------------------------------------------------
+// Includes
+//--------------------------------------------------------------------------
+#include <fapi2.H>
+#include <stdint.h>
+#include <p9_pm_recovery_ffdc_base.H>
+
+namespace p9_stop_recov_ffdc
+{
+
+ class CppmRegs : public PlatPmComplex
+ {
+ public:
+ /// @brief constructor
+ CppmRegs(const fapi2::Target< fapi2::TARGET_TYPE_PROC_CHIP > i_procChipTgt );
+
+ /// @brief destructor
+ virtual ~CppmRegs () { };
+
+ /// @brief collects Register FFDC pertaining to all functional cores in the chip.
+ /// @param[in] i_pHomerBuf points to base of P9 HOMER.
+ // @return fapi2 return code.
+ fapi2::ReturnCode collectRegFfdc( void* i_pHomerBuf );
+
+ private:
+ /// @brief updates the CPPM FFDC Header
+ ///@param[in] i_pHomerBuf points to a location in HOMER meant for CPPM Header
+ ///@param[in] i_CppmInstance CPPM instance
+ ///@return fapi2 return code.
+
+ fapi2::ReturnCode updateCppmFfdcHeader( uint8_t * i_pHomerBuf,
+ const uint8_t i_cppmInstance,
+ const uint8_t i_ffdcValid);
+ /// @brief updates the QUAD FFDC Header
+ ///@param[in] i_pHomerBuf points to a location in HOMER meant for CPPM Header
+ ///@param[in] i_quadInstance Quad instance
+ ///@return fapi2 return code.
+
+ fapi2::ReturnCode updateQuadFfdcHeader( uint8_t * i_pHomerBuf,
+ const uint8_t i_quadInstance,
+ const uint8_t i_ffdcValid);
+ };
+
+extern "C"
+{
+ typedef fapi2::ReturnCode( *p9_pm_recovery_ffdc_cppm_FP_t )
+ ( const fapi2::Target< fapi2::TARGET_TYPE_PROC_CHIP > & i_procChipTgt,
+ void * i_cppmFfdcBuf );
+}
+
+} //namespace p9_stop_recov_ffdc ends
+
+#endif //PM_RECOVERY_FFDC_CPPM
diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cppm.mk b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cppm.mk
new file mode 100644
index 000000000..af5010096
--- /dev/null
+++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cppm.mk
@@ -0,0 +1,31 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_cppm.mk $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2017
+# [+] 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
+PROCEDURE=p9_pm_recovery_ffdc_cppm
+CPPM_FFDC_INC=$(ROOTPATH)/chips/p9/procedures/hwp/pm/
+CPPM_FFDC_INC+=$(ROOTPATH)/chips/p9/procedures/hwp/lib
+CPPM_FFDC_INC+=$(ROOTPATH)/hwpf/fapi2/include
+lib$(PROCEDURE)_DEPLIBS += p9_pm_recovery_ffdc_base
+$(call ADD_MODULE_INCDIR,$(CPPM_FFDC_INC))
+$(call BUILD_PROCEDURE)
diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_defines.H b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_defines.H
index cde15a590..6a9e02852 100644
--- a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_defines.H
+++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_defines.H
@@ -130,7 +130,8 @@ struct __attribute__((packed)) QuadFfdcHeader
uint16_t iv_offsetCme0;
uint16_t iv_offsetCme1;
uint16_t iv_offsetQppm;
- uint8_t iv_reserve[2];
+ uint8_t iv_ffdcValid;
+ uint8_t iv_reserve;
};
@@ -160,6 +161,19 @@ enum OccFfdcValidStatus
/**
+ * @brief models C_Q_PPM FFDC header.
+ */
+struct __attribute__((packed)) PpmFfdcHeader
+{
+ uint32_t iv_ppmMagicWord;
+ uint8_t iv_Instance;
+ uint8_t iv_ppmHeaderSize;
+ uint16_t iv_sectionSize;
+ uint8_t iv_ffdcValid;
+ uint8_t iv_reserved[7];
+};
+
+/**
* * @brief models OCC Region FFDC header.
* */
struct __attribute__((packed)) OccFfdcHeader
@@ -217,7 +231,7 @@ struct __attribute__((packed)) PpeFfdcLayout
struct __attribute__((packed)) HomerQuadFfdcRegion
{
uint8_t iv_quadFfdcHeader[FFDC_QUAD_HDR_SIZE];
- uint8_t iv_quadCppmRegion[FFDC_CPPM_REGISTERS_SIZE];
+ uint8_t iv_quadCppmRegion[MAX_CORES_PER_QUAD][FFDC_CPPM_REGISTERS_SIZE];
uint8_t iv_quadCmeBlock[MAX_CMES_PER_QUAD][FFDC_PPE_BLOCK_SIZE];
uint8_t iv_quadQppmRegion[FFDC_QPPM_REGISTERS_SIZE];
};
diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_pgpe.C b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_pgpe.C
new file mode 100644
index 000000000..daddc6191
--- /dev/null
+++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_pgpe.C
@@ -0,0 +1,223 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_pgpe.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
+/* [+] 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 */
+// *INDENT-OFF*
+
+
+///
+/// @file p9_pm_recovery_ffdc_pgpe.C
+/// @brief Models PGPE platform for the FFDC collection of PM complex
+///
+/// *HWP HWP Owner: Greg Still <stillgs@us.ibm.com>
+/// *HWP FW Owner: Prem S Jha <premjha2@in.ibm.com>
+/// *HWP Team: PM
+/// *HWP Level: 2
+/// *HWP Consumed by: Hostboot
+//
+// *INDENT-OFF*
+//--------------------------------------------------------------------------
+// Includes
+//--------------------------------------------------------------------------
+
+#include <p9_pm_recovery_ffdc_pgpe.H>
+#include <p9_hcd_memmap_occ_sram.H>
+#include <p9_ppe_defs.H>
+#include <stddef.h>
+#include <endian.h>
+
+ namespace p9_stop_recov_ffdc
+ {
+ PlatPgpe::PlatPgpe( const fapi2::Target< fapi2::TARGET_TYPE_PROC_CHIP > i_procChipTgt )
+ : PlatPmComplex( i_procChipTgt,
+ OCC_SRAM_PGPE_HEADER_ADDR,
+ OCC_SRAM_PGPE_TRACE_START,
+ OCC_SRAM_PGPE_DASHBOARD_START,
+ PLAT_PGPE )
+ { }
+
+ //----------------------------------------------------------------------
+
+ fapi2::ReturnCode PlatPgpe::collectFfdc( void * i_pHomerBuf )
+ {
+ FAPI_DBG(">> PlatPgpe::collectFfdc");
+ fapi2::current_err = fapi2::FAPI2_RC_SUCCESS;
+ fapi2::ReturnCode l_retCode = fapi2::FAPI2_RC_SUCCESS;
+ uint8_t l_ffdcValdityVect = PPE_FFDC_ALL_VALID;
+
+ uint8_t l_haltState = PPE_HALT_COND_UNKNOWN;
+ uint8_t *l_pFfdcLoc = NULL;
+ HomerFfdcRegion * l_pHomerFfdc =
+ ( HomerFfdcRegion *)( (uint8_t *)i_pHomerBuf + FFDC_REGION_HOMER_BASE_OFFSET );
+
+ l_pFfdcLoc = (uint8_t *)(&l_pHomerFfdc->iv_pgpeFfdcRegion);
+
+ //In case of error , invalidate FFDC in header.
+
+ l_retCode = collectPpeState ( PGPE_BASE_ADDRESS,
+ l_pFfdcLoc );
+ if ( l_retCode != fapi2::FAPI2_RC_SUCCESS )
+ {
+ FAPI_ERR ( "Error collecting PGPE State" );
+ l_ffdcValdityVect &= ~PPE_STATE_VALID;
+ }
+
+ l_retCode = collectTrace( l_pFfdcLoc );
+
+ if( l_retCode )
+ {
+ FAPI_ERR("Error in collecting PGPE Trace " );
+ l_ffdcValdityVect &= ~PPE_TRACE_VALID;
+ }
+
+ l_retCode = collectGlobals( l_pFfdcLoc );
+
+ if( l_retCode )
+ {
+ FAPI_ERR("Error in collecting PGPE Globals" );
+ l_ffdcValdityVect &= ~PPE_DASHBOARD_VALID;
+ }
+
+ l_retCode = collectImageHeader( l_pFfdcLoc );
+
+ if( l_retCode )
+ {
+ FAPI_ERR("Error in collecting PGPE Image header" );
+ l_ffdcValdityVect &= ~PPE_IMAGE_HEADER_VALID;
+ }
+
+
+ FAPI_TRY( updatePgpeFfdcHeader( l_pFfdcLoc, l_ffdcValdityVect, l_haltState ),
+ "Failed To Update PGPE FFDC Header for PGPE " );
+
+ fapi_try_exit:
+ FAPI_DBG("<< PlatPgpe::collectFfdc");
+ return fapi2::current_err;
+ }
+
+ //-----------------------------------------------------------------------
+
+ fapi2::ReturnCode PlatPgpe::collectTrace( uint8_t * i_pTraceBuf )
+ {
+ FAPI_DBG(">> PlatPgpe::collectTrace" );
+ PpeFfdcLayout * l_pPgpeFfdc = ( PpeFfdcLayout *) ( i_pTraceBuf );
+
+ uint8_t * l_pTraceLoc = &l_pPgpeFfdc->iv_ppeTraces[0];
+
+ FAPI_TRY( PlatPmComplex::collectSramInfo
+ ( PlatPmComplex::getProcChip(),
+ l_pTraceLoc,
+ TRACES,
+ FFDC_PPE_TRACES_SIZE ),
+ "Trace Collection Failed" );
+
+ fapi_try_exit:
+ FAPI_DBG("<< PlatPgpe::collectTrace" );
+ return fapi2::current_err;
+ }
+
+ //-----------------------------------------------------------------------
+
+ fapi2::ReturnCode PlatPgpe::collectGlobals( uint8_t * i_pPgpeGlobals )
+ {
+ FAPI_DBG(">> PlatPgpe::collectGlobals" );
+ PpeFfdcLayout * l_pPgpeFfdc = ( PpeFfdcLayout *) ( i_pPgpeGlobals );
+ uint8_t * l_pTraceLoc = &l_pPgpeFfdc->iv_ppeGlobals[0];
+
+ FAPI_TRY( PlatPmComplex::collectSramInfo
+ ( PlatPmComplex::getProcChip(),
+ l_pTraceLoc,
+ DASH_BOARD_VAR,
+ OCC_SRAM_PGPE_DASHBOARD_SIZE ),
+ "Failed To Collect PGPE Global Variables" );
+
+
+ fapi_try_exit:
+ FAPI_DBG("<< PlatPgpe::collectGlobals" );
+ return fapi2::current_err;
+ }
+
+ //-----------------------------------------------------------------------
+
+ fapi2::ReturnCode PlatPgpe::collectInternalReg( uint8_t * i_pPgpeIntReg )
+ {
+ return fapi2::FAPI2_RC_SUCCESS;
+ }
+
+ //-----------------------------------------------------------------------
+
+ fapi2::ReturnCode PlatPgpe::collectImageHeader( uint8_t * i_pPgpeImgHdr )
+ {
+ FAPI_DBG(">> PlatPgpe::collectImageHeader" );
+ PpeFfdcLayout *l_pPgpeFfdc = ( PpeFfdcLayout *) ( i_pPgpeImgHdr );
+
+ uint8_t * l_pTraceLoc = &l_pPgpeFfdc->iv_ppeImageHeader[0];
+ FAPI_TRY( PlatPmComplex::collectSramInfo
+ ( PlatPmComplex::getProcChip(),
+ l_pTraceLoc,
+ IMAGE_HEADER,
+ FFDC_PPE_IMG_HDR_SIZE ),
+ "Failed To Collect PGPE Image Header" );
+
+ fapi_try_exit:
+ FAPI_DBG("<< PlatPgpe::collectImageHeader" );
+ return fapi2::current_err;
+ }
+
+ //-----------------------------------------------------------------------
+
+ fapi2::ReturnCode PlatPgpe::updatePgpeFfdcHeader( uint8_t * i_pHomerBuf,
+ bool i_ffdcValid, uint8_t i_haltState )
+ {
+ FAPI_DBG(">> updatePgpeFfdcHeader" );
+
+ PpeFfdcHeader * l_pPgpeFfdcHdr = ( (PpeFfdcHeader *)(( PpeFfdcHdrRegion * ) i_pHomerBuf ));
+ l_pPgpeFfdcHdr->iv_ppeMagicNumber = htobe32( FFDC_PGPE_MAGIC_NUM );
+ l_pPgpeFfdcHdr->iv_ppeNumber = 0;
+ PlatPmComplex::updatePpeFfdcHeader( l_pPgpeFfdcHdr, i_ffdcValid, i_haltState );
+
+ FAPI_DBG("<< updatePgpeFfdcHeader" );
+ return fapi2::FAPI2_RC_SUCCESS;
+ }
+ //-----------------------------------------------------------------------
+
+extern "C"
+{
+ fapi2::ReturnCode p9_pm_recovery_ffdc_pgpe( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP >& i_procChip,
+ void * i_pFfdcBuf )
+ {
+ FAPI_IMP(">> p9_pm_recovery_pgpe" );
+
+ PlatPgpe l_pgpeFfdc( i_procChip );
+ FAPI_TRY( l_pgpeFfdc.collectFfdc( i_pFfdcBuf ),
+ "Failed To Collect PGPE FFDC" );
+
+ fapi_try_exit:
+ FAPI_IMP("<< p9_pm_recovery_pgpe" );
+ return fapi2::current_err;
+ }
+
+}
+
+
+}//namespace p9_stop_recov_ffdc ends
diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_pgpe.H b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_pgpe.H
new file mode 100644
index 000000000..4c8222336
--- /dev/null
+++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_pgpe.H
@@ -0,0 +1,115 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_pgpe.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2017 */
+/* [+] 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 __PM_RECOVERY_FFDC_PGPE_
+#define __PM_RECOVERY_FFDC_PGPE_
+
+///
+/// @file p9_pm_recovery_ffdc_pgpe.H
+/// @brief Models PGPE platform for the FFDC collection of PM complex
+///
+/// *HWP HWP Owner: Greg Still <stillgs@us.ibm.com>
+/// *HWP FW Owner: Prem S Jha <premjha2@in.ibm.com>
+/// *HWP Team: PM
+/// *HWP Level: 2
+/// *HWP Consumed by: Hostboot
+//
+// *INDENT-OFF*
+//--------------------------------------------------------------------------
+// Includes
+//--------------------------------------------------------------------------
+#include <fapi2.H>
+#include <stdint.h>
+#include <p9_pm_recovery_ffdc_base.H>
+
+namespace p9_stop_recov_ffdc
+{
+
+ class PlatPgpe : public PlatPmComplex
+ {
+ public:
+ /// @brief constructor
+ PlatPgpe( const fapi2::Target< fapi2::TARGET_TYPE_PROC_CHIP > i_procChipTgt );
+
+ /// @brief destructor
+ virtual ~PlatPgpe() { };
+
+ /// @brief collects FFDC pertaining to all functional PGPEs in the chip.
+ /// @param[in] i_pHomerBuf points to base of P9 HOMER.
+ /// @return fapi2 return code.
+ fapi2::ReturnCode collectFfdc( void* i_pHomerBuf );
+
+ private:
+ /// @brief collects trace info from PGPE's SRAM buffer.
+ /// @param[in] i_pHomerBuf points to location of HOMER meant for PGPE Trace info.
+ /// @return fapi2 return code.
+ fapi2::ReturnCode collectTrace( uint8_t * i_pHomerBuf );
+
+ /// @brief collects global variables from PGPE's's SRAM.
+ /// @param[in] i_pHomerBuf points to location of HOMER meant for PGPE's global variable
+ /// @return fapi2 return code.
+ fapi2::ReturnCode collectGlobals( uint8_t * i_pHomerBuf );
+
+ /// @brief collects PGPE state
+ /// @param[in] i_pHomerBuf points to location of HOMER meant for PGPE's state.
+ /// @return fapi2 return code.
+ fapi2::ReturnCode collectPgpeState( uint8_t * i_pHomerBuf );
+
+ /// @brief collects internal register info for a PGPE
+ /// @param[in] i_pHomerBuf points to location of HOMER meant for PGPE internal register.
+ /// @return fapi2 return code.
+ fapi2::ReturnCode collectInternalReg( uint8_t * i_pHomerBuf );
+
+ /// @brief collects PGPE Image Header info from PGPE SRAM buffer.
+ /// @param[in] i_pHomerBuf points to location of HOMER meant for PGPE's header.
+ /// @return fapi2 return code.
+ fapi2::ReturnCode collectImageHeader( uint8_t * i_pHomerBuf );
+
+ /// @brief updates the PGPE FFDC Header
+ ///@param[in] i_pHomerBuf points to a location in HOMER meant for PGPE FFDC Header
+ ///@param[in] i_ffdcValid true if FFDC is valid, false otherwise
+ ///@param[in] i_haltCondition hlat state of PGPE
+ ///@return fapi2 return code.
+ ///@note refer to PPE Spec for details on halt state.
+
+ fapi2::ReturnCode updatePgpeFfdcHeader( uint8_t * i_pHomerBuf,
+ bool i_ffdcValid, uint8_t i_haltCondition );
+
+ ///@brief returns type of platform
+ PmComplexPlatId getPlatType() { return iv_plat; }
+
+ private:
+ PmComplexPlatId iv_plat;
+ };
+
+extern "C"
+{
+ typedef fapi2::ReturnCode( *p9_pm_recovery_ffdc_pgpe_FP_t )
+ ( const fapi2::Target< fapi2::TARGET_TYPE_PROC_CHIP > & i_procChipTgt,
+ void * i_pgpeFfdcBuf );
+}
+
+} //namespace p9_stop_recov_ffdc ends
+
+#endif //__PM_RECOVERY_FFDC_PGPE_
diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_pgpe.mk b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_pgpe.mk
new file mode 100644
index 000000000..4f3063553
--- /dev/null
+++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_pgpe.mk
@@ -0,0 +1,33 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_pgpe.mk $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2017
+# [+] 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
+PROCEDURE=p9_pm_recovery_ffdc_pgpe
+PGPE_FFDC_INC=$(ROOTPATH)/chips/p9/procedures/hwp/pm/
+PGPE_FFDC_INC+=$(ROOTPATH)/chips/p9/procedures/hwp/lib
+lib$(PROCEDURE)_DEPLIBS +=p9_pm_recovery_ffdc_base
+lib$(PROCEDURE)_DEPLIBS+=p9_pm_ocb_indir_access
+lib$(PROCEDURE)_DEPLIBS+=p9_pm_ocb_indir_setup_linear
+lib$(PROCEDURE)_DEPLIBS+=p9_cme_sram_access
+$(call ADD_MODULE_INCDIR,$(PGPE_FFDC_INC))
+$(call BUILD_PROCEDURE)
diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_qppm.C b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_qppm.C
new file mode 100644
index 000000000..2dcc181c7
--- /dev/null
+++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_qppm.C
@@ -0,0 +1,135 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_qppm.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2017 */
+/* [+] 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 */
+// *INDENT-OFF*
+
+
+///
+/// @file p9_pm_recovery_ffdc_qppm.C
+/// @brief QPPM FFDC collection of PM complex
+///
+/// *HWP HWP Owner: Greg Still <stillgs@us.ibm.com>
+/// *HWP FW Owner: Prasad Bg Ranganath <prasadbgr@in.ibm.com>
+/// *HWP Team: PM
+/// *HWP Level: 2
+/// *HWP Consumed by: Hostboot
+//
+// *INDENT-OFF*
+//--------------------------------------------------------------------------
+// Includes
+//--------------------------------------------------------------------------
+
+#include <p9_pm_recovery_ffdc_qppm.H>
+#include <collect_reg_ffdc.H>
+#include <stddef.h>
+#include <endian.h>
+
+ namespace p9_stop_recov_ffdc
+ {
+ QppmRegs::QppmRegs( const fapi2::Target< fapi2::TARGET_TYPE_PROC_CHIP > i_procChipTgt )
+ : PlatPmComplex( i_procChipTgt,0,0,0,PLAT_PPM)
+ { }
+
+ //----------------------------------------------------------------------
+
+ fapi2::ReturnCode QppmRegs::collectRegFfdc( void * i_pHomerBuf )
+ {
+ FAPI_DBG(">> QppmRegs::collectRegFfdc");
+ fapi2::current_err = fapi2::FAPI2_RC_SUCCESS;
+ fapi2::ReturnCode l_rc = fapi2::current_err;
+ auto l_quadList =
+ getProcChip().getChildren< fapi2::TARGET_TYPE_EQ > ( fapi2::TARGET_STATE_PRESENT );
+ uint8_t l_quadPos = 0;
+ uint8_t *l_pFfdcLoc = NULL;
+ uint8_t l_ffdcValid = 0;
+ HomerFfdcRegion * l_pHomerFfdc =
+ ( HomerFfdcRegion *)( (uint8_t *)i_pHomerBuf + FFDC_REGION_HOMER_BASE_OFFSET );
+
+ for( auto quad : l_quadList )
+ {
+ FAPI_TRY( FAPI_ATTR_GET( fapi2::ATTR_CHIP_UNIT_POS, quad, l_quadPos ),
+ "FAPI_ATTR_GET Failed To Read QUAD Position" );
+
+ l_pFfdcLoc = &l_pHomerFfdc->iv_quadFfdc[l_quadPos].iv_quadQppmRegion[0];
+ if( quad.isFunctional() )
+ {
+ l_ffdcValid = 1;
+ FAPI_INF("QPPM FFDC Pos %d ", l_quadPos);
+
+ l_rc = collectRegisterData<fapi2::TARGET_TYPE_EQ> (quad,
+ l_pFfdcLoc + sizeof(PpmFfdcHeader),
+ static_cast<fapi2::HwpFfdcId>(fapi2::QPPM_FFDC_REGISTERS));
+ if (l_rc )
+ {
+ l_ffdcValid = 0;
+ }
+ }
+
+
+ FAPI_TRY( updateQppmFfdcHeader( l_pFfdcLoc, l_quadPos, l_ffdcValid),
+ "Failed To Update QPPM FFDC Header for quad 0x%0d", l_quadPos);
+ }
+
+ fapi_try_exit:
+ FAPI_DBG("<< QppmRegs::collectRegFfdc");
+ return fapi2::current_err;
+ }
+
+ fapi2::ReturnCode QppmRegs::updateQppmFfdcHeader( uint8_t * i_pHomerBuf,
+ const uint8_t i_quadPos,
+ const uint8_t i_ffdcValid)
+ {
+ FAPI_DBG(">> updateQppmFfdcHeader" );
+
+ PpmFfdcHeader * l_QppmFfdcHdr = (PpmFfdcHeader *) i_pHomerBuf ;
+ l_QppmFfdcHdr->iv_ppmMagicWord = htobe32(FFDC_QPPM_MAGIC_NUM);
+ l_QppmFfdcHdr->iv_Instance = i_quadPos;
+ l_QppmFfdcHdr->iv_ppmHeaderSize = sizeof(PpmFfdcHeader);
+ l_QppmFfdcHdr->iv_sectionSize = FFDC_QPPM_REGISTERS_SIZE;
+ l_QppmFfdcHdr->iv_ffdcValid = i_ffdcValid;
+
+ FAPI_DBG("<< updateQppmFfdcHeader" );
+ return fapi2::FAPI2_RC_SUCCESS;
+ }
+ //-----------------------------------------------------------------------
+
+
+
+extern "C"
+{
+ fapi2::ReturnCode p9_pm_recovery_ffdc_qppm( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP >& i_procChip, void * i_pFfdcBuf )
+ {
+ FAPI_IMP(">> p9_pm_recovery_ffdc_qppm" );
+ QppmRegs l_qppmFfdc( i_procChip );
+ FAPI_TRY( l_qppmFfdc.collectRegFfdc( i_pFfdcBuf ),
+ "Failed To Collect QPPM FFDC" );
+
+ fapi_try_exit:
+ FAPI_IMP("<< p9_pm_recovery_ffdc_qppm" );
+ return fapi2::current_err;
+ }
+
+}
+
+ }//namespace p9_stop_recov_ffdc ends
diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_qppm.H b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_qppm.H
new file mode 100644
index 000000000..7b4aafbab
--- /dev/null
+++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_qppm.H
@@ -0,0 +1,85 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_qppm.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2017 */
+/* [+] 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 __PM_RECOVERY_FFDC_QPPM_
+#define __PM_RECOVERY_FFDC_QPPM_
+
+///
+/// @file p9_pm_recovery_ffdc_qppm.H
+/// @brief QPPM FFDC collection of PM complex
+///
+/// *HWP HWP Owner: Greg Still <stillgs@us.ibm.com>
+/// *HWP FW Owner: Prasad Bg Ranganath <prasadbgr@in.ibm.com>
+/// *HWP Team: PM
+/// *HWP Level: 2
+/// *HWP Consumed by: Hostboot
+//
+// *INDENT-OFF*
+//--------------------------------------------------------------------------
+// Includes
+//--------------------------------------------------------------------------
+#include <fapi2.H>
+#include <stdint.h>
+#include <p9_pm_recovery_ffdc_base.H>
+
+namespace p9_stop_recov_ffdc
+{
+
+ class QppmRegs : public PlatPmComplex
+ {
+ public:
+ /// @brief constructor
+ QppmRegs(const fapi2::Target< fapi2::TARGET_TYPE_PROC_CHIP > i_procChipTgt );
+
+ /// @brief destructor
+ virtual ~QppmRegs () { };
+
+ /// @brief collects Register FFDC pertaining to all functional cores in the chip.
+ /// @param[in] i_pHomerBuf points to base of P9 HOMER.
+ // @return fapi2 return code.
+ fapi2::ReturnCode collectRegFfdc( void* i_pHomerBuf );
+
+ private:
+ /// @brief updates the QPPM FFDC Header
+ ///@param[in] i_pHomerBuf points to a location in HOMER meant for QPPM Header
+ ///@param[in] i_qppmInstance QPPM instance
+ ///@param[in] i_ffdcValid QPPM FFDC valid state
+ ///@return fapi2 return code.
+
+ fapi2::ReturnCode updateQppmFfdcHeader( uint8_t * i_pHomerBuf,
+ const uint8_t i_qppmInstance,
+ const uint8_t i_ffdcValid);
+
+ };
+
+extern "C"
+{
+ typedef fapi2::ReturnCode( *p9_pm_recovery_ffdc_qppm_FP_t )
+ ( const fapi2::Target< fapi2::TARGET_TYPE_PROC_CHIP > & i_procChipTgt,
+ void * i_qppmFfdcBuf );
+}
+
+} //namespace p9_stop_recov_ffdc ends
+
+#endif //PM_RECOVERY_FFDC_QPPM
diff --git a/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_qppm.mk b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_qppm.mk
new file mode 100644
index 000000000..86a1f25af
--- /dev/null
+++ b/src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_qppm.mk
@@ -0,0 +1,31 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/import/chips/p9/procedures/hwp/pm/p9_pm_recovery_ffdc_qppm.mk $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2017
+# [+] 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
+PROCEDURE=p9_pm_recovery_ffdc_qppm
+QPPM_FFDC_INC=$(ROOTPATH)/chips/p9/procedures/hwp/pm/
+QPPM_FFDC_INC+=$(ROOTPATH)/chips/p9/procedures/hwp/lib
+QPPM_FFDC_INC+=$(ROOTPATH)/hwpf/fapi2/include
+lib$(PROCEDURE)_DEPLIBS += p9_pm_recovery_ffdc_base
+$(call ADD_MODULE_INCDIR,$(QPPM_FFDC_INC))
+$(call BUILD_PROCEDURE)
OpenPOWER on IntegriCloud