summaryrefslogtreecommitdiffstats
path: root/src/import/hwpf
diff options
context:
space:
mode:
authorRichard J. Knight <rjknight@us.ibm.com>2016-01-13 10:29:10 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-08-25 15:29:04 -0400
commit545e3d6c29a897eb3a4e9d16ee6326edebd57b76 (patch)
tree4c89dcb8325f9b1bcb95e375900cade277b7337d /src/import/hwpf
parentb0bf18528f97ecef49ff27fd4715b2d2a50ad5ba (diff)
downloadtalos-hostboot-545e3d6c29a897eb3a4e9d16ee6326edebd57b76.tar.gz
talos-hostboot-545e3d6c29a897eb3a4e9d16ee6326edebd57b76.zip
FAPI2 - Enable register ffdc support
Change-Id: Ie57fce533cab3fea09aa58ad81364900e434d8e7 RTC:132226 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/22626 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Deepak Kodihalli <dkodihal@in.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/22658 Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Tested-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import/hwpf')
-rwxr-xr-xsrc/import/hwpf/fapi2/docs/topics/Ffdc.md99
-rw-r--r--src/import/hwpf/fapi2/include/collect_reg_ffdc.H609
-rw-r--r--src/import/hwpf/fapi2/include/ffdc.H8
-rw-r--r--src/import/hwpf/fapi2/src/fapi2_utils.mk3
-rw-r--r--src/import/hwpf/fapi2/tools/parseErrorInfo.mk1
-rwxr-xr-xsrc/import/hwpf/fapi2/tools/parseErrorInfo.pl554
6 files changed, 918 insertions, 356 deletions
diff --git a/src/import/hwpf/fapi2/docs/topics/Ffdc.md b/src/import/hwpf/fapi2/docs/topics/Ffdc.md
index a79c79705..2a3e495cc 100755
--- a/src/import/hwpf/fapi2/docs/topics/Ffdc.md
+++ b/src/import/hwpf/fapi2/docs/topics/Ffdc.md
@@ -8,13 +8,18 @@ easily be used by the FAPI_ASSERT macro.
## Using the Tools
-parseErrorInfo.pl [--empty-ffdc-classes] [--use-variable-buffers] --output-dir=<output dir> <filename1> <filename2> ...
+parseErrorInfo.pl [--local-ffdc ][--empty-ffdc-classes] [--use-variable-buffers]
+ --output-dir=<output dir> <filename1> <filename2> ...
- This perl script will parse HWP Error XML files and creates the following files:
- hwp_return_codes.H. HwpReturnCode enumeration (HWP generated errors)
- hwp_error_info.H. Error information (used by FAPI_SET_HWP_ERROR when a HWP generates an error)
-- collect_reg_ffdc.H. Function to collect register FFDC
+- collect_reg_ffdc.regs.C Function to grab registers required for collectRegFfdc functionality.
- set_sbe_error.H. Macro to create an SBE error
+The --local-ffdc option is for platforms (SBE) which desire to collect only local ffdc info and return it to
+the platform via a preformatted buffer. Local ffdc logging and out of band ffdc collection for the SBE will
+be driven by the SET_SBE_ERROR macro.
+
The --empty-ffdc-classes option is for platforms which don't collect FFDC. It will generate stub classes which
will allow the source to have the same code, but compile to no-ops on certain platforms.
@@ -142,10 +147,84 @@ type without changing the XML
fapi2::buffer<uint64_t> data;
set_RAS_STATUS(unt64_t(data)) ...
+
+### Collecting Register Data as Part of FFDC
+
+For fapi2 the addtional of tags to indicate the target
+type are required. XML parsing will fail if the targetType
+tag is missing for any of the collectRegisterFfdc tags.
+
+
+Specifying registers to collect:
+
+ <registerFfdc>
+ <id>REG_FFDC_TEST_X_PROC_REGISTERS</id>
+ <scomRegister>EX_PRD_PURGE_CMD_REG</scomRegister>
+ <scomRegister>EX_L2_FIR_REG</scomRegister>
+ <cfamRegister>PERV_FSI2PIB_CHIPID_FSI</cfamRegister>
+ </registerFfdc>
+
+
+The register FFDC id tag contents will be used in the specification
+of the collectRegisterFfdx xml below.
+
+To collect the contents of registers as part FFDC you
+can add it to the XML:
+
+ <!-- Collect chip/chiplet register FFDC -->
+ <collectRegisterFfdc>
+ <id>REG_FFDC_TEST_X_PROC_REGISTERS</id>
+ <target>UNIT_TEST_CHIP_TARGET</target>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ </collectRegisterFfdc>
+
+ <!-- Collect register FFDC based for child targets (implies functional) -->
+ <collectRegisterFfdc>
+ <id>REG_FFDC_TEST_X_EX_REGISTERS</id>
+ <childTargets>
+ <parent>UNIT_TEST_CHIP_TARGET</parent>
+ <parentType>TARGET_TYPE_PROC_CHIP</parentType>
+ <childType>TARGET_TYPE_EX_CHIPLET</childType>
+ </childTargets>
+ </collectRegisterFfdc>
+
+ <!-- Collect register FFDC based on present children (does not imply functional) -->
+ <collectRegisterFfdc>
+ <id>REG_FFDC_TEST_X_PROC_REGISTERS_PRES_CHILDREN</id>
+ <basedOnPresentChildren>
+ <target>UNIT_TEST_CHIP_TARGET</target>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ <childType>TARGET_TYPE_EX_CHIPLET</childType>
+ <childPosOffsetMultiplier>0x01000000</childPosOffsetMultiplier>
+ </basedOnPresentChildren>
+ </collectRegisterFfdc>
+
+## Collect FFDC using an addtional HWP
+
+To collect addtional FFDC info using a hwp to do the work requires
+the writing of a procedure, the signature must include the ability
+to pass a vector of shared_pointers to ErrorInfoFfdc types as the
+first parameter, as follows:
+
+fapi2::ReturnCode p9_collect_some_ffdc(std::vector<std::shared_ptr<fapi2::ErrorInfoFfdc>>& o_ffdc_data, args...);
+
+the first argument must be the containter for the returned ffdc, addtional parameters can be added as needed.
+
+Addtional parameters are included in the xml tag as comma separated values.
+
+ <collectFfdc>p9_collect_some_ffdc,parm1,parm2</collectFfdc>
+
+ the generated C code in hwp_error_info.H will look like this once
+ expanded.
+
+ std::vector<std::shared_ptr<ErrorInfoFfdc>>ffdc;
+ RC = p9_collect_some_ffdc(ffdc,parm1,parm2);
+ RC.addErrorInfo(ffdc);
+
## Error Log Generation
-FAPI had a function called fapiLogError() which would generate platform
-errors. The pattern was to call fapiLogError() at the end of the block
+ FAPI had a function called fapiLogError() which would generate platform
+ errors. The pattern was to call fapiLogError() at the end of the block
which generated the FFDC. With the addition of the FFDC classes, this
is no longer needed - the class knows to create these logs for you.
@@ -153,15 +232,9 @@ However, the severity information is needed by this logging mechanism.
It was an argument to fapiLogError(), and so it's been added to the
constructor of the FFDC class:
-rc_repair_ring_invalid_ringbuf_ptr(fapi2::errlSeverity_t i_sev, ...)
+ rc_repair_ring_invalid_ringbuf_ptr(fapi2::errlSeverity_t i_sev, ...)
-It defaults to "unrecoverable" and so only need be set for errors
-which have a different severity. That is, doing nothing will get you
+ It defaults to "unrecoverable" and so only need be set for errors
+ which have a different severity. That is, doing nothing will get you
and error log with unrecoverable severity - which was the default
for FAPI.
-
-## Known Limitations
-
-- Collecting register FFDC is not presently implemented.
-- Calling out to hwp to collect FFDC is not presently implemented.
-- The FirstFailureData class does not have a platform pointer
diff --git a/src/import/hwpf/fapi2/include/collect_reg_ffdc.H b/src/import/hwpf/fapi2/include/collect_reg_ffdc.H
new file mode 100644
index 000000000..753a245a1
--- /dev/null
+++ b/src/import/hwpf/fapi2/include/collect_reg_ffdc.H
@@ -0,0 +1,609 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/import/hwpf/fapi2/include/collect_reg_ffdc.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015,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 FAPI2_COLLECT_REG_FFDC_H_
+#define FAPI2_COLLECT_REG_FFDC_H_
+#include <stdint.h>
+#include <vector>
+#include <hw_access.H>
+#include <ffdc.H>
+#include <hwp_error_info.H>
+#include <error_info_defs.H>
+#include <buffer.H>
+#include <target.H>
+#include <return_code.H>
+#include <fapi2_attribute_service.H>
+#include <plat_trace.H>
+
+
+namespace fapi2
+{
+
+// in generated file collect_reg_ffdc_regs.C
+void getAddressData(const fapi2::HwpFfdcId i_ffdcId,
+ std::vector<uint64_t>& o_scomAddresses ,
+ std::vector<uint32_t>& o_cfamAddresses ,
+ uint32_t& o_ffdcSize );
+
+
+///
+/// @brief converts value to a type to enable overloading based on values
+///
+/// @tparam[in] v - value to create to a unique type
+///
+/// @return v - value.
+///
+template <int v>
+struct toType
+{
+ enum { value = v };
+};
+
+///
+/// @class TargetPosition
+///
+/// helper class to get the position for the passed in chip
+/// or chiplet.
+///
+///
+template < TargetType T, bool isChiplet = T& TARGET_TYPE_CHIPLETS >
+class TargetPosition
+{
+
+ public:
+ ///
+ /// @brief constructor
+ ///
+ TargetPosition(const Target<T>& t)
+ : iv_targ(t)
+ {};
+
+ ///
+ /// @brief Return position of either a chip or chiplet target
+ ///
+ /// @param[out] o_pos - position of chip/chiplet target
+ /// @param[in] is_chiplet - converted to type for overloading
+ /// to correct function call.
+ ///
+ /// @return fapi2::ReturnCode. FAPI_RC_SUCCESS, or failure value.
+ ///
+ fapi2::ReturnCode getPosition( uint32_t& o_pos)
+ {
+ return getPosition(o_pos, toType<isChiplet>());
+ }
+
+ private:
+ ///
+ /// @brief return target position for chiplet
+ ///
+ /// @param[out] o_pos - chiplet position
+ /// @param[in] is_chiplet = true
+ ///
+ /// @return fapi2::ReturnCode. FAPI_RC_SUCCESS, or failure value.
+ ///
+ fapi2::ReturnCode getPosition(uint32_t& o_pos, toType<true>)
+ {
+ fapi2::ReturnCode l_rc;
+
+ uint8_t l_chipletPos = 0;
+
+ l_rc = FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, iv_targ, l_chipletPos);
+
+ if (l_rc)
+ {
+ FAPI_ERR("collect_reg_ffdc.C: Error getting chiplet position");
+ l_chipletPos = 0xFF;
+ }
+
+ o_pos = static_cast<uint32_t>(l_chipletPos);
+
+ return l_rc;
+ }
+
+ ///
+ /// @brief return target position for chip
+ ///
+ /// @param[out] o_pos - chiplet position
+ /// @param[in] is_chiplet = false
+ ///
+ /// @return fapi2::ReturnCode. FAPI_RC_SUCCESS, or failure value.
+ ///
+ fapi2::ReturnCode getPosition(uint32_t& o_pos, toType<false>)
+ {
+ fapi2::ReturnCode l_rc;
+
+ uint32_t l_Pos = 0;
+
+ l_rc = FAPI_ATTR_GET(fapi2::ATTR_POS, iv_targ, l_Pos);
+
+ if (l_rc)
+ {
+ FAPI_ERR("collect_reg_ffdc.C: Error getting position");
+ l_Pos = 0xFF;
+ }
+
+ o_pos = l_Pos;
+
+ return l_rc;
+ }
+
+ const fapi2::Target<T>& iv_targ;
+};
+
+
+
+
+const fapi2::TargetType TARGET_TYPE_PROC_CHIPLETS = fapi2::TARGET_TYPE_EX |
+ fapi2::TARGET_TYPE_MCS |
+ fapi2::TARGET_TYPE_XBUS |
+ fapi2::TARGET_TYPE_CORE |
+ fapi2::TARGET_TYPE_EQ |
+ fapi2::TARGET_TYPE_MCA |
+ fapi2::TARGET_TYPE_MCBIST |
+ fapi2::TARGET_TYPE_MI |
+ fapi2::TARGET_TYPE_CAPP |
+ fapi2::TARGET_TYPE_DMI |
+ fapi2::TARGET_TYPE_OBUS |
+ fapi2::TARGET_TYPE_NV |
+ fapi2::TARGET_TYPE_SBE |
+ fapi2::TARGET_TYPE_PPE |
+ fapi2::TARGET_TYPE_PERV |
+ fapi2::TARGET_TYPE_PEC |
+ fapi2::TARGET_TYPE_PHB;
+
+const fapi2::TargetType TARGET_TYPE_SCOM_TARGET = fapi2::TARGET_TYPE_PROC_CHIP |
+ fapi2::TARGET_TYPE_MEMBUF_CHIP |
+ fapi2::TARGET_TYPE_EX |
+ fapi2::TARGET_TYPE_MBA |
+ fapi2::TARGET_TYPE_MCS |
+ fapi2::TARGET_TYPE_XBUS |
+ fapi2::TARGET_TYPE_ABUS |
+ fapi2::TARGET_TYPE_L4 |
+ fapi2::TARGET_TYPE_CORE |
+ fapi2::TARGET_TYPE_EQ |
+ fapi2::TARGET_TYPE_MCA |
+ fapi2::TARGET_TYPE_MCBIST |
+ fapi2::TARGET_TYPE_MI |
+ fapi2::TARGET_TYPE_DMI |
+ fapi2::TARGET_TYPE_OBUS |
+ fapi2::TARGET_TYPE_NV |
+ fapi2::TARGET_TYPE_SBE |
+ fapi2::TARGET_TYPE_PPE |
+ fapi2::TARGET_TYPE_PERV |
+ fapi2::TARGET_TYPE_PEC |
+ fapi2::TARGET_TYPE_PHB;
+
+
+
+template< TargetType T>
+inline fapi2::Target<fapi2::TARGET_TYPE_CHIPS>
+getChipTarget(const fapi2::Target<T>& i_target)
+{
+ return getChipTarget(i_target);
+}
+
+// handle membuf/proc targets
+inline fapi2::Target<fapi2::TARGET_TYPE_CHIPS>
+getChipTarget(const fapi2::Target<fapi2::TARGET_TYPE_CHIPS>& i_target)
+{
+ return i_target;
+}
+
+// handle dimms
+inline fapi2::Target<fapi2::TARGET_TYPE_CHIPS>
+getChipTarget(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target)
+{
+ return i_target.getParent<fapi2::TARGET_TYPE_MBA>().getParent<fapi2::TARGET_TYPE_MEMBUF_CHIP>();
+}
+
+// everything else is w/proc chip?
+inline fapi2::Target<fapi2::TARGET_TYPE_CHIPS>
+getChipTarget(const
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIPLETS>& i_target)
+{
+ return i_target.getParent<fapi2::TARGET_TYPE_CHIPS>();
+}
+
+template < TargetType T>
+fapi2::Target<fapi2::TARGET_TYPE_SCOM_TARGET>
+getScomTarget(const fapi2::Target<T>& i_target)
+{
+ return i_target;
+}
+
+inline fapi2::Target<fapi2::TARGET_TYPE_SCOM_TARGET>
+getScomTarget(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target)
+{
+ return i_target.getParent<fapi2::TARGET_TYPE_MBA>();
+}
+
+
+template<TargetType T>
+class CfamReader
+{
+ public:
+ CfamReader(const fapi2::Target<T>& i_target)
+ : iv_target(i_target) {};
+
+ ReturnCode
+ read_register(const uint32_t address, fapi2::buffer<uint32_t>& i_buf)
+ {
+ FAPI_DBG("CfamReader.read_register - no-op");
+
+ return FAPI2_RC_SUCCESS;
+ }
+
+ private:
+ const fapi2::Target<T>& iv_target;
+};
+
+template<>
+class CfamReader<TARGET_TYPE_MEMBUF_CHIP>
+{
+ public:
+ CfamReader(const fapi2::Target<TARGET_TYPE_MEMBUF_CHIP>& i_target)
+ : iv_target(i_target) {};
+
+ ReturnCode read_register
+ (const uint32_t address, fapi2::buffer<uint32_t>& i_buf)
+ {
+ FAPI_DBG("CfamReader.read_register - MEMBUF VERSION");
+ return fapi2::getCfamRegister(iv_target, address, i_buf);
+ }
+
+ private:
+ const fapi2::Target<TARGET_TYPE_MEMBUF_CHIP>& iv_target;
+};
+
+template<>
+class CfamReader<TARGET_TYPE_PROC_CHIP>
+{
+ public:
+ CfamReader(const fapi2::Target<TARGET_TYPE_PROC_CHIP>& i_target)
+ : iv_target(i_target) {};
+
+ ReturnCode
+ read_register(const uint32_t address, fapi2::buffer<uint32_t>& i_buf)
+ {
+ FAPI_DBG("CfamReader.read_register - PROC VERSION");
+ return fapi2::getCfamRegister(iv_target, address, i_buf);
+ }
+
+ private:
+ const fapi2::Target<TARGET_TYPE_PROC_CHIP>& iv_target;
+};
+
+///
+/// @class ScomReader
+///
+/// Class to abstract away details of reading of a scom register
+///
+template< TargetType T >
+class ScomReader
+{
+ public:
+ ScomReader(const fapi2::Target<T>& i_target)
+ : iv_target(i_target)
+ {};
+
+ ReturnCode read_register(const uint64_t i_address,
+ fapi2::buffer<uint64_t>& o_buf)
+ {
+ FAPI_DBG("ScomReader.read_register - BASE version");
+ return getScom(iv_target, i_address, o_buf);
+ }
+ private:
+ const fapi2::Target<T>& iv_target;
+};
+
+///
+/// @brief class to handle reading from scom registers from generic function
+///
+template<>
+class ScomReader<TARGET_TYPE_DIMM>
+{
+ public:
+ ScomReader(const fapi2::Target<TARGET_TYPE_DIMM>& i_target)
+ : iv_target(getScomTarget(i_target))
+ {};
+
+ ReturnCode
+ read_register(const uint64_t i_address, fapi2::buffer<uint64_t>& o_buf)
+ {
+ FAPI_DBG("ScomReader.read_register - DIMM version");
+ ReturnCode l_rc = getScom(iv_target, i_address, o_buf);
+ return l_rc;
+ }
+
+ private:
+ const fapi2::Target<TARGET_TYPE_SCOM_TARGET>& iv_target;
+
+};
+
+///
+/// @brief collectRegisterData
+///
+/// collect all the data from a list of registers and return it to the caller
+///
+/// @tparam[in] T register data size - uint32_t or uint64_t
+/// @tparam[in] U - reader object for specific data type
+/// @param[in] i_addresses - vector containing either cfam or scom addresses
+/// @param[in] i_offset - optional offset to add to the address values
+/// passed in the vector of addresses
+/// @param[out] o_pData - pointer to the data destination
+///
+/// @return fapi2::ReturnCode. FAPI_RC_SUCCESS, or failure value.
+///
+template< typename T, class U>
+ReturnCode collectRegisterData(std::vector<T>& i_addresses, U& i_reader,
+ uint32_t i_offset, uint8_t* o_pData)
+{
+ FAPI_DBG("collectRegisterData -> address count: 0x%lx", i_addresses.size());
+
+ T l_data = 0;
+
+ ReturnCode l_rc = FAPI2_RC_SUCCESS;
+
+ for( auto address : i_addresses )
+ {
+ fapi2::buffer<T> l_buf;
+
+ const T l_address = address + i_offset;
+
+ l_rc = i_reader.read_register(l_address, l_buf);
+
+ if(l_rc)
+ {
+ l_data = 0xbaddbadd;
+ }
+ else
+ {
+ l_data = l_buf();
+ }
+
+ memcpy(o_pData, &l_data, sizeof(T));
+
+ o_pData += sizeof(T);
+
+ }
+
+ return l_rc;
+}
+
+
+///
+/// @brief read registers
+///
+/// Template function to allow reading either scom and cfam data from registers
+/// for a given target
+///
+/// @tparam[in] T - fapi2::TargetType
+/// @param[out] o_pData - pointer to a location to store register data
+/// @param[in] i_cfamAddresses - vector of cfam addresses to read
+/// @param[in] i_scomAddresses - vector of scom addresses to read
+/// @param[i/o] input/output parm description
+///
+/// @return fapi2::ReturnCode. FAPI_RC_SUCCESS, or failure value.
+///
+template<fapi2::TargetType T>
+void readRegisters(const fapi2::Target<T>& i_target,
+ uint8_t* o_pData,
+ std::vector<uint32_t> i_cfamAddresses,
+ std::vector<uint64_t> i_scomAddresses,
+ uint32_t i_childOffset = 0)
+{
+ FAPI_DBG("readRegisters()");
+
+ // create an object to read Cfam registers
+ CfamReader<T> l_cfamReader(i_target);
+
+ // Create an object to read scom registers
+ ScomReader<T> l_scomReader(i_target);
+
+ // read data from the cfam registers if required
+ ReturnCode rc = collectRegisterData<uint32_t,
+ CfamReader<T> >(i_cfamAddresses, l_cfamReader,
+ i_childOffset, o_pData);
+
+ if(rc)
+ {
+ FAPI_ERR("An error occured when reading from the cfam registers skipping..");
+ }
+
+ // read data from Scom registers if present
+ rc = collectRegisterData<uint64_t,
+ ScomReader<T> >(i_scomAddresses, l_scomReader,
+ i_childOffset, o_pData);
+
+ if(rc)
+ {
+ FAPI_ERR("An error occured when reading the scom registers..");
+ }
+
+ FAPI_DBG("readRegisters() exit");
+}
+
+///
+/// @brief Collect register data for child targets
+///
+/// @tparam[in] C - child target type
+/// @tparam[in] T - parent target type
+/// @param[in] i_parent - fapi2::Target
+/// @param[in] i_childState - fapi2::TargetState for child targets
+/// @param[in] i_ffdcId - type of ffdc to be collected
+/// @param[out] o_errorInfo - vector of shared pointers to fapi2::ErrorInfoFfdc type
+/// for returned register data
+/// @param[in] i_childOffsetMult - child offset for register calculations
+/// @param[i/o] input/output parm description
+///
+///
+template<fapi2::TargetType C, fapi2::TargetType T>
+void collectRegFfdc(const fapi2::ffdc_t i_parent,
+ const fapi2::TargetState i_childState,
+ const HwpFfdcId i_ffdcId,
+ std::vector<std::shared_ptr<fapi2::ErrorInfoFfdc>>& o_errorInfoFfdc,
+ uint32_t i_childOffsetMult = 0)
+{
+
+ FAPI_INF("collectRegFfdc child targets version");
+
+ std::vector<fapi2::Target<C> > l_targets;
+
+ Target<T> l_parent =
+ *(static_cast<const Target<T>*>(i_parent.ptr()));
+
+ // Collect FFDC for functional or present chiplets of
+ // type C associated with i_target - yeah, odd syntax.
+ l_targets = l_parent.template getChildren<C>(i_childState);
+
+ if (l_targets.empty())
+ {
+ FAPI_INF("collect_reg_ffdc.C: Error: No chiplets found. ");
+ return;
+ }
+
+ std::vector<uint32_t> l_cfamAddresses;
+ std::vector<uint64_t> l_scomAddresses;
+
+ uint32_t l_ffdcSize = 0;
+
+ // call generated code to fetch the address vectors
+ getAddressData(i_ffdcId, l_scomAddresses, l_cfamAddresses, l_ffdcSize);
+
+ uint32_t l_position = 0;
+
+ // add the position size to the total
+ l_ffdcSize += sizeof(l_position);
+
+ // update size for each target
+ l_ffdcSize += (l_ffdcSize * l_targets.size());
+
+ uint8_t l_pBuf[l_ffdcSize];
+
+ uint8_t* l_pData = &l_pBuf[0];
+
+ // grab the data for each child target
+ for( auto target : l_targets)
+ {
+ ReturnCode l_rc =
+ TargetPosition<C>(target).getPosition(l_position);
+
+ // add chip/chiplets position to the data
+ memcpy(l_pData, &l_position, sizeof(l_position));
+
+ // advance the pointer into our buffer
+ l_pData += sizeof(l_position);
+
+ if(i_childState == TARGET_STATE_FUNCTIONAL)
+ {
+ FAPI_INF(" calling version for TARGET_STATE_FUNCTIONAL ");
+
+ // since its functional just read from the child target
+ readRegisters(target, l_pData, l_cfamAddresses,
+ l_scomAddresses, i_childOffsetMult);
+ }
+ else
+ {
+ // use the parent and read address + offset since the
+ // child targets may not be functional
+ uint32_t l_offset = i_childOffsetMult * l_position;
+
+ FAPI_INF(" calling version for TARGET_STATE_PRESENT ");
+
+ readRegisters(l_parent, l_pData, l_cfamAddresses,
+ l_scomAddresses, l_offset);
+ }
+ }
+
+ FAPI_INF("collectRegFfdc. SCOM address count: %#lx", l_scomAddresses.size());
+ FAPI_INF("collectRegFfdc. CFAM address count: %#lx", l_cfamAddresses.size());
+
+ FAPI_DBG("size info i_ffdcId = %d, l_pBuf = %p, l_ffdcSize=%d", i_ffdcId, l_pBuf, l_ffdcSize);
+
+ // Create a ErrorInfoFfdc object and pass it back
+ o_errorInfoFfdc.push_back(std::shared_ptr<fapi2::ErrorInfoFfdc>(new ErrorInfoFfdc(i_ffdcId, l_pBuf, l_ffdcSize)));
+
+}
+///
+/// @brief Collect register data for a single target
+///
+/// @tparam[in] T - target type
+/// @param[in] i_target - fapi2::Target
+/// @param[in] i_ffdcId - type of ffdc to be collected
+/// @param[out] o_errorInfo - shared pointer to fapi2::ErrorInfoFfdc type
+/// for returned register data
+/// @param[in] i_childOffsetMult - child offset for register calculations
+///
+template<fapi2::TargetType T>
+void collectRegFfdc(const fapi2::ffdc_t i_target,
+ const HwpFfdcId i_ffdcId,
+ std::vector<std::shared_ptr<fapi2::ErrorInfoFfdc> >& o_errorInfoFfdc,
+ uint32_t i_childOffset = 0)
+{
+
+ FAPI_INF("single target no children - ");
+
+ Target<T> l_target =
+ *(static_cast<const Target<T>*>(i_target.ptr()));
+
+ std::vector<uint32_t> l_cfamAddresses;
+ std::vector<uint64_t> l_scomAddresses;
+
+ uint32_t l_ffdcSize = 0;
+
+ // call generated code to fetch the address vectors
+ getAddressData(i_ffdcId, l_scomAddresses, l_cfamAddresses, l_ffdcSize);
+
+ uint32_t l_position = 0;
+
+ ReturnCode l_rc = TargetPosition<T>(l_target).getPosition(l_position);
+
+ l_ffdcSize += sizeof(l_position);
+
+ uint8_t l_pBuf[l_ffdcSize];
+
+ uint8_t* l_pData = &l_pBuf[0];
+
+ // add chip/chiplets position to the data
+ memcpy(l_pData, &l_position, sizeof(l_position));
+
+ l_pData += sizeof(l_position);
+
+ // do the work
+ readRegisters(l_target, l_pData, l_cfamAddresses, l_scomAddresses,
+ i_childOffset);
+
+ FAPI_DBG("size info i_ffdcId = %d, l_pBuf = %p, l_ffdcSize=%d", i_ffdcId, l_pBuf, l_ffdcSize);
+ // Create a ErrorInfoFfdc object and add it to the Error Information
+ // object of the FFDC class
+ o_errorInfoFfdc.push_back(std::shared_ptr<fapi2::ErrorInfoFfdc>(new ErrorInfoFfdc(i_ffdcId, l_pBuf, l_ffdcSize)));
+
+ FAPI_INF("collectRegFfdc. SCOM address count: 0x%lx", l_scomAddresses.size());
+ FAPI_INF("collectRegFfdc. CFAM address count: 0x%lx", l_cfamAddresses.size());
+
+ FAPI_INF("collectRegFfdc() - exit");
+}
+
+}// end namespace
+#endif
diff --git a/src/import/hwpf/fapi2/include/ffdc.H b/src/import/hwpf/fapi2/include/ffdc.H
index 9bc164f4d..4f6f4e153 100644
--- a/src/import/hwpf/fapi2/include/ffdc.H
+++ b/src/import/hwpf/fapi2/include/ffdc.H
@@ -119,7 +119,8 @@ class FirstFailureData
static_cast<R*>(this)->operator=(i_rcValue);
// Forget about any associated data (this is a new error)
- iv_info.reset(new ErrorInfo());
+ iv_info.reset( new ErrorInfo());
+
}
///
@@ -183,8 +184,6 @@ class FirstFailureData
};
///
-
- ///
/// @brief Get a pointer to any ErrorInfo
///
/// This is called by PLAT to find information about an error
@@ -225,11 +224,12 @@ class FirstFailureData
iv_platDataPtr = i_ptr;
};
- private:
+ protected:
// Pointer to the error info
std::shared_ptr<ErrorInfo> iv_info;
+ private:
// free format data, to be used by the platform
void* iv_platDataPtr;
};
diff --git a/src/import/hwpf/fapi2/src/fapi2_utils.mk b/src/import/hwpf/fapi2/src/fapi2_utils.mk
index 1512f3fcb..5cb44c305 100644
--- a/src/import/hwpf/fapi2/src/fapi2_utils.mk
+++ b/src/import/hwpf/fapi2/src/fapi2_utils.mk
@@ -24,7 +24,10 @@
# IBM_PROLOG_END_TAG
MODULE=fapi2_utils
$(call ADD_MODULE_SRCDIR,$(MODULE),$(GENPATH))
+$(call ADD_MODULE_INCDIR,$(MODULE),$(GENPATH))
$(call ADD_MODULE_INCDIR,$(MODULE),$(FAPI2_PLAT_INCLUDE))
+$(call ADD_MODULE_INCDIR,$(MODULE),$(ROOTPATH)/chips/p9/common/include)
OBJS+=fapi2_utils.o
OBJS+=fapi2_attribute_service.o
+OBJS+=collect_reg_ffdc_regs.o
$(call BUILD_MODULE)
diff --git a/src/import/hwpf/fapi2/tools/parseErrorInfo.mk b/src/import/hwpf/fapi2/tools/parseErrorInfo.mk
index c6b436075..f472ec2e4 100644
--- a/src/import/hwpf/fapi2/tools/parseErrorInfo.mk
+++ b/src/import/hwpf/fapi2/tools/parseErrorInfo.mk
@@ -34,7 +34,6 @@ SOURCES += $(GENPATH)/empty_error.xml
TARGETS += hwp_return_codes.H
TARGETS += hwp_error_info.H
TARGETS += hwp_ffdc_classes.H
-TARGETS += collect_reg_ffdc.H
TARGETS += set_sbe_error.H
TARGETS += collect_reg_ffdc_regs.C
diff --git a/src/import/hwpf/fapi2/tools/parseErrorInfo.pl b/src/import/hwpf/fapi2/tools/parseErrorInfo.pl
index dd1c64d84..485b6de5b 100755
--- a/src/import/hwpf/fapi2/tools/parseErrorInfo.pl
+++ b/src/import/hwpf/fapi2/tools/parseErrorInfo.pl
@@ -109,10 +109,10 @@ if (($numArgs < 1) || ($arg_output_dir eq undef))
print ("Usage: parseErrorInfo.pl [--empty-ffdc-classes] [--use-variable-buffers] --output-dir=<output dir> <filename1> <filename2> ...\n");
print (" This perl script will parse HWP Error XML files and creates\n");
print (" the following files:\n");
- print (" - hwp_return_codes.H. HwpReturnCode enumeration (HWP generated errors)\n");
- print (" - hwp_error_info.H. Error information (used by FAPI_SET_HWP_ERROR\n");
- print (" when a HWP generates an error)\n");
- print (" - collect_reg_ffdc.H. Function to collect register FFDC\n");
+ print (" - hwp_return_codes.H. HwpReturnCode enumeration (HWP generated errors)\n");
+ print (" - hwp_error_info.H. Error information (used by FAPI_SET_HWP_ERROR\n");
+ print (" when a HWP generates an error)\n");
+ print (" - collect_reg_ffdc_regs.H. File containing registers used by collectRegFfdc() \n");
print (" - set_sbe_error.H. Macro to create an SBE error\n");
print (" The --empty-ffdc-classes option is for platforms which don't collect ffdc.\n");
exit(1);
@@ -127,8 +127,8 @@ my %errValuePresentHash;
#------------------------------------------------------------------------------
# Hashes containing ffdc names/enum-values
#------------------------------------------------------------------------------
-my %ffdcNameToValueHash;
-my %ffdcValuePresentHash;
+my %ffdcNameToValueHash = ();
+my %ffdcValuePresentHash = ();
#------------------------------------------------------------------------------
# Subroutine that checks if an entry exists in an array. If it doesn't exist
@@ -282,7 +282,7 @@ sub addFfdcMethod
return if ($methods->{$key}{type} eq $type);
return if ($methods->{$key_target}{type} eq $target_ffdc_type);
- # Just leave if this is a variable_buffer ans we're not supporting that.
+ # Just leave if this is a variable_buffer as we're not supporting that.
return if (($type eq $variable_buffer_ffdc_type) && ($arg_use_variable_buffers eq undef));
# Set the proper type, and clear out any previous members/methods if
@@ -302,7 +302,7 @@ sub addFfdcMethod
$method = "\ttemplate< typename T >\n";
$method .= "\tinline $class_name& set_$ffdc_uc(const T& $param)\n";
- if(!$arg_local_ffdc)
+ if($arg_local_ffdc eq undef)
{
$method_body = " {$ffdc_uc.ptr() = &i_value; $ffdc_uc.size() =";
$method_body .= " fapi2::getErrorInfoFfdcSize(i_value); return *this;}\n\n";
@@ -336,7 +336,7 @@ sub addFfdcMethod
elsif ($type eq $variable_buffer_ffdc_type)
{
$method = "\n inline $class_name& set_$ffdc_uc(const fapi2::variable_buffer& $param)\n";
- $method_body = " {$ffdc_uc.ptr() = &i_value(); $ffdc_uc.size() = i_value.template getLength<uint8_t>(); return *this;}\n\n";
+ $method_body = " {$ffdc_uc.ptr() = &$param(); $ffdc_uc.size() = $param.template getLength<uint8_t>(); return *this;}\n\n";
# No need to add the member here, it was added with fapi2::buffer. And we can't have variable
# buffer support with out integral buffer support (can we?)
@@ -346,7 +346,8 @@ sub addFfdcMethod
{
$method = "\n template< TargetType T >\n";
$method .= " inline $class_name& set_$ffdc_uc(const $type& $param)\n";
- $method_body .= " {$ffdc_uc.ptr() = &i_value; $ffdc_uc.size() = fapi2::getErrorInfoFfdcSize(i_value); return *this;}\n\n";
+ $method_body .= " {$ffdc_uc.ptr() = &$param; $ffdc_uc.size() = fapi2::getErrorInfoFfdcSize($param); " .
+ " return *this;}\n\n";
$methods->{$key}{member} = "$ffdc_type $ffdc_uc;";
$methods->{$objectNumber}{localvar} = "$ffdc_type $ffdc_uc = getFfdcData(FFDC_BUFFER[$objectNumber]);";
@@ -357,7 +358,7 @@ sub addFfdcMethod
{
$method .= "\tinline $class_name& set_$ffdc_uc($type $param)\n";
- if(!$arg_local_ffdc)
+ if($arg_local_ffdc eq undef)
{
$method_body = " { $ffdc_uc = i_value; ";
$method_body .= " return *this;}\n\n";
@@ -401,7 +402,7 @@ open(ECFILE, ">", $ecFile);
my $crFile = $arg_output_dir;
$crFile .= "/";
-$crFile .= "collect_reg_ffdc.H";
+$crFile .= "collect_reg_ffdc_regs.C";
open(CRFILE, ">", $crFile);
my $sbFile = $arg_output_dir;
@@ -440,7 +441,7 @@ print ECFILE "#include <variable_buffer.H>\n" if ($arg_use_variable_buffers ne u
print ECFILE "#include <hwp_error_info.H>\n";
print ECFILE "#if !defined(FAPI2_NO_FFDC) && !defined(MINIMUM_FFDC)\n";
print ECFILE "#include <ffdc_includes.H>\n";
-print ECFILE "//#include <collect_reg_ffdc.H>\n";
+print ECFILE "#include <collect_reg_ffdc.H>\n";
print ECFILE "#endif\n";
print ECFILE "/**\n";
print ECFILE " * \@brief FFDC gathering classes\n";
@@ -451,47 +452,31 @@ if($arg_local_ffdc)
print ECFILE "extern SbeFfdcData_t g_FfdcData; \n";
}
#------------------------------------------------------------------------------
-# Print start of file information to collectRegFfdc.H
+# Print start of file information to collect_reg_ffdc_regs.C
#------------------------------------------------------------------------------
-print CRFILE "// collect_reg_ffdc.H\n";
+print CRFILE "// collect_reg_ffdc_regs.C\n";
print CRFILE "// This file is generated by the perl script parseErrorInfo.pl\n\n";
-print CRFILE "#ifndef FAPI2_COLLECT_REG_FFDC_H_\n";
-print CRFILE "#define FAPI2_COLLECT_REG_FFDC_H_\n";
print CRFILE "#include <stdint.h>\n";
print CRFILE "#include <vector>\n";
-print CRFILE "#include <ffdc.H>\n";
-print CRFILE "#include <hwp_error_info.H>\n";
-print CRFILE "#include <error_info_defs.H>\n";
-print CRFILE "#include <buffer.H>\n";
-print CRFILE "#include <target.H>\n";
-print CRFILE "#include <return_code.H>\n";
-print CRFILE "#include <hw_access.H>\n";
print CRFILE "#include <plat_trace.H>\n";
+print CRFILE "#include <hwp_error_info.H>\n";
+print CRFILE "#include <p9_mc_scom_addresses.H>\n";
+print CRFILE "#include <p9_misc_scom_addresses.H>\n";
+print CRFILE "#include <p9_obus_scom_addresses.H>\n";
+print CRFILE "#include <p9_perv_scom_addresses.H>\n";
+print CRFILE "#include <p9_quad_scom_addresses.H>\n";
+print CRFILE "#include <p9_xbus_scom_addresses.H>\n";
print CRFILE "namespace fapi2\n";
print CRFILE "{\n";
-print CRFILE "template< TargetType C, TargetType P >\n";
-print CRFILE "void collectRegFfdc(const fapi2::ffdc_t& i_target,\n";
-print CRFILE " const fapi2::HwpFfdcId i_ffdcId,\n";
-print CRFILE " fapi2::ReturnCode & o_rc,\n";
-print CRFILE " uint32_t i_childOffsetMult = 0)\n";
+print CRFILE "void getAddressData(const fapi2::HwpFfdcId i_ffdcId,\n";
+print CRFILE " std::vector<uint64_t>& o_scomAddresses ,\n";
+print CRFILE " std::vector<uint32_t>& o_cfamAddresses ,\n";
+print CRFILE " uint32_t & o_ffdcSize )\n";
print CRFILE "{\n";
-print CRFILE " FAPI_INF(\"collectRegFfdc. FFDC ID: 0x%x\", i_ffdcId);\n";
-print CRFILE " fapi2::ReturnCode l_rc;\n";
-print CRFILE " fapi2::buffer<uint64_t> l_buf;\n";
-print CRFILE " uint32_t l_cfamData = 0;\n";
-print CRFILE " uint64_t l_scomData = 0;\n";
-print CRFILE " std::vector<uint32_t> l_cfamAddresses;\n";
-print CRFILE " std::vector<uint64_t> l_scomAddresses;\n";
-print CRFILE " uint32_t l_ffdcSize = 0;\n\n";
+print CRFILE " FAPI_INF(\"getAddresses. FFDC ID: 0x%x\", i_ffdcId);\n";
+print CRFILE " o_ffdcSize = 0;\n\n";
print CRFILE " switch (i_ffdcId)\n";
print CRFILE " {\n";
-print CRFILE " // void statments for the unused variables\n";
-print CRFILE " static_cast<void>(l_cfamData);\n";
-print CRFILE " static_cast<void>(l_scomData);\n";
-print CRFILE " static_cast<void>(l_ffdcSize);\n";
-print CRFILE " static_cast<const void>(i_target);\n";
-print CRFILE " static_cast<void>(o_rc);\n";
-print CRFILE " static_cast<void>(i_childOffsetMult);\n";
#------------------------------------------------------------------------------
# Print start of file information to setSbeError.H
#------------------------------------------------------------------------------
@@ -544,7 +529,7 @@ foreach my $argnum (0 .. $#ARGV)
'id','collectTrace', 'buffer']);
# Uncomment to get debug output of all errors
- #print "\nFile: ", $infile, "\n", Dumper($errors), "\n";
+# print "\nFile: ", $infile, "\n", Dumper($errors), "\n";
#--------------------------------------------------------------------------
# For each Error
@@ -593,7 +578,7 @@ foreach my $argnum (0 .. $#ARGV)
#----------------------------------------------------------------------
print EIFILE "#define $err->{rc}_CALL_FUNCS_TO_COLLECT_FFDC(RC)";
- my $collectFfdcStr = "";
+ my $collectFfdcStr = undef;
$count = 0;
foreach my $collectFfdc (@{$err->{collectFfdc}})
{
@@ -634,16 +619,11 @@ foreach my $argnum (0 .. $#ARGV)
$collectFfdc .= "@elements[$i]"
}
- #reset the vector before calling the ffdc funciton - only needed if there are more than one
- #collectFfdc calls
- if($count > 1 )
- {
- $collectFfdcStr .= "\tffdc.clear(); \\\n";
- }
+
$collectFfdcStr .= "\tFAPI_EXEC_HWP(l_rc, $collectFfdc); \\\n";
- $collectFfdcStr .= "\tiv_rc.addErrorInfo(ffdc);";
- print EIFILE "\\\n{ \\\n$collectFfdcStr \\\n}";
+ print EIFILE "\\\n{ \\\n$collectFfdcStr";
+ print EIFILE "\tRC.addErrorInfo(ffdc); \\\n}";
} #end collectFfdc tag
print EIFILE "\n";
@@ -651,95 +631,147 @@ foreach my $argnum (0 .. $#ARGV)
#----------------------------------------------------------------------
# Print the CALL_FUNCS_TO_COLLECT_REG_FFDC macro to hwp_error_info.H
#----------------------------------------------------------------------
- print EIFILE "#define $err->{rc}_CALL_FUNCS_TO_COLLECT_REG_FFDC(RC) ";
+ print EIFILE "#define $err->{rc}_CALL_FUNCS_TO_COLLECT_REG_FFDC(RC)";
- if(!$arg_local_ffdc)
- {
- foreach my $collectRegisterFfdc (@{$err->{collectRegisterFfdc}})
+ my $crffdcStr = undef;
+
+ my $crffdcCount =0;
+
+ if($arg_local_ffdc eq undef)
{
- #------------------------------------------------------------------
- # Check that expected fields are present
- #------------------------------------------------------------------
- if (! exists $collectRegisterFfdc->{id}[0])
- {
- print ("parseErrorInfo.pl ERROR in $err->{rc}. id(s) missing from collectRegisterFfdc\n");
- exit(1);
- }
-=begin
- foreach my $id (@{$collectRegisterFfdc->{id}})
+ foreach my $collectRegisterFfdc (@{$err->{collectRegisterFfdc}})
{
- #---------------------------------------------------------------------------------
- # Check FFDC register collection type: target, child, or based on present children
- #---------------------------------------------------------------------------------
- if (exists $collectRegisterFfdc->{target})
+ #------------------------------------------------------------------
+ # Check that expected fields are present
+ #------------------------------------------------------------------
+ if (! exists $collectRegisterFfdc->{id}[0])
{
- print EIFILE "fapi2::collectRegFfdc<fapi2::TARGET_TYPE_NONE, fapi2::TARGET_TYPE_NONE>($collectRegisterFfdc->{target}, ";
- print EIFILE "fapi2::$id, RC); ";
- addFfdcMethod(\%methods, $collectRegisterFfdc->{target},
- $err->{rc}, $target_ffdc_type);
+ print ("parseErrorInfo.pl ERROR in $err->{rc}. id(s) missing from collectRegisterFfdc $infile\n");
+ exit(1);
}
- elsif (exists $collectRegisterFfdc->{childTargets})
+
+
+ foreach my $id (@{$collectRegisterFfdc->{id}})
{
- if (! exists $collectRegisterFfdc->{childTargets}->{parent})
+
+ if( $crffdcCount eq 0 )
{
- print ("parseErrorInfo.pl ERROR: parent missing from collectRegisterFfdc\n");
- exit(1);
+ print EIFILE " \\\n{ \\\n";
+ $crffdcStr = "\tstd::vector<std::shared_ptr<ErrorInfoFfdc>> ffdc; \\\n";
}
- if (! exists $collectRegisterFfdc->{childTargets}->{childType})
+ else
{
- print ("parseErrorInfo.pl ERROR: childType missing from collectRegisterFfdc\n");
- exit(1);
+ $crffdcStr = "";
}
- print EIFILE "fapi2::collectRegFfdc<fapi2::$collectRegisterFfdc->{childTargets}->{childType}, fapi2::TARGET_TYPE_NONE>";
- print EIFILE "($collectRegisterFfdc->{childTargets}->{parent}, fapi2::$id, RC); ";
- addFfdcMethod(\%methods, $collectRegisterFfdc->{childTargets}->{parent},
- $err->{rc}, $target_ffdc_type);
- }
- elsif (exists $collectRegisterFfdc->{basedOnPresentChildren})
- {
- if (! exists $collectRegisterFfdc->{basedOnPresentChildren}->{target})
+
+ $crffdcCount++;
+ #---------------------------------------------------------------------------------
+ # Check FFDC register collection type: target, child, or based on present children
+ #---------------------------------------------------------------------------------
+ if (exists $collectRegisterFfdc->{target})
{
- print ("parseErrorInfo.pl ERROR: target missing from collectRegisterFfdc\n");
- exit(1);
+ if(!(exists $collectRegisterFfdc->{targetType} ))
+ {
+ print ("parseErrorInfo.pl ERROR: target type missing from $collectRegisterFfdc->{target} in file $infile\n");
+ exit(1);
+ }
+ $crffdcStr .= "\tfapi2::collectRegFfdc<$collectRegisterFfdc->{targetType}>($collectRegisterFfdc->{target},";
+ $crffdcStr .= "fapi2::$id,ffdc); \\\n";
+
+ addFfdcMethod(\%methods, $collectRegisterFfdc->{target},
+ $err->{rc}, $target_ffdc_type);
}
- if (! exists $collectRegisterFfdc->{basedOnPresentChildren}->{childType})
+ elsif (exists $collectRegisterFfdc->{childTargets})
{
- print ("parseErrorInfo.pl ERROR: childType missing from collectRegisterFfdc\n");
- exit(1);
+ if(!(exists $collectRegisterFfdc->{childTargets}{parent} ))
+ {
+ print ("parseErrorInfo.pl ERROR: parent missing from $collectRegisterFfdc->{id} in $infile\n");
+ exit(1);
+ }
+
+ if(!(exists $collectRegisterFfdc->{childTargets}{parentType} ))
+ {
+ print ("parseErrorInfo.pl ERROR: parent type missing from $collectRegisterFfdc->{id} in $infile\n");
+ exit(1);
+ }
+
+ $crffdcStr .= "\tfapi2::collectRegFfdc<fapi2::$collectRegisterFfdc->{childTargets}->{childType},";
+ $crffdcStr .= "$collectRegisterFfdc->{childTargets}->{parentType}>";
+ $crffdcStr .= "($collectRegisterFfdc->{childTargets}->{parent}, ";
+ $crffdcStr .= "fapi2::TARGET_STATE_FUNCTIONAL,fapi2::$id, ffdc); \\\n";
+
+ addFfdcMethod(\%methods, $collectRegisterFfdc->{childTargets}->{parent},
+ $err->{rc}, $target_ffdc_type);
+ }
+ elsif (exists $collectRegisterFfdc->{basedOnPresentChildren})
+ {
+ if ( exists $collectRegisterFfdc->{basedOnPresentChildren}->{target})
+ {
+ if (! exists $collectRegisterFfdc->{basedOnPresentChildren}->{childType})
+ {
+ die ("parseErrorInfo.pl ERROR: childType missing from collectRegisterFfdc $infile\n");
+ exit(1);
+ }
+ if(!(exists $collectRegisterFfdc->{basedOnPresentChildren}{targetType} ))
+ {
+ print ("parseErrorInfo.pl ERROR: type missing from ");
+ print ("$collectRegisterFfdc->{basedOnPresentChildren}{parent} in file $infile\n");
+ exit(1);
+ }
+
+ if (! exists $collectRegisterFfdc->{basedOnPresentChildren}->{childPosOffsetMultiplier})
+ {
+ print ("parseErrorInfo.pl ERROR: childPosOffsetMultiplier missing from collectRegisterFfdc $infile\n");
+ exit(1);
+ }
+ $crffdcStr .= "\tfapi2::collectRegFfdc<fapi2::$collectRegisterFfdc->{basedOnPresentChildren}->{childType},";
+ $crffdcStr .= "$collectRegisterFfdc->{basedOnPresentChildren}->{targetType}>";
+ $crffdcStr .= "($collectRegisterFfdc->{basedOnPresentChildren}->{target},";
+ $crffdcStr .= "fapi2::TARGET_STATE_PRESENT,";
+ $crffdcStr .= "fapi2::$id, ffdc,";
+ $crffdcStr .= "$collectRegisterFfdc->{basedOnPresentChildren}->{childPosOffsetMultiplier});\\\n";
+ $crffdcCount++;
+
+ addFfdcMethod(\%methods, $collectRegisterFfdc->{basedOnPresentChildren}->{target},
+ $err->{rc}, $target_ffdc_type);
+ }
+ else
+ {
+ print ("parseErrorInfo.pl ERROR: Invalid collectRegisterFfdc configuration in $infile\n");
+ exit(1);
+
+ }
}
- if (! exists $collectRegisterFfdc->{basedOnPresentChildren}->{childPosOffsetMultiplier})
+ else
{
- print ("parseErrorInfo.pl ERROR: childPosOffsetMultiplier missing from collectRegisterFfdc\n");
+ print ("parseErrorInfo.pl ERROR: Invalid collectRegisterFfdc configuration in $infile\n");
exit(1);
}
- print EIFILE "fapi2::collectRegFfdc<fapi2::$collectRegisterFfdc->{basedOnPresentChildren}->{childType}, fapi2::TARGET_TYPE_NONE>";
- print EIFILE "($collectRegisterFfdc->{basedOnPresentChildren}->{target}, fapi2::$id, RC, ";
- print EIFILE "$collectRegisterFfdc->{basedOnPresentChildren}->{childPosOffsetMultiplier}); ";
- addFfdcMethod(\%methods, $collectRegisterFfdc->{basedOnPresentChildren}->{target},
- $err->{rc}, $target_ffdc_type);
- }
- else
- {
- print ("parseErrorInfo.pl ERROR: Invalid collectRegisterFfdc configuration\n");
- exit(1);
- }
+
+ #print the collectRegFfdc string to the info file
+ print EIFILE "$crffdcStr";
+
+ } #end foreach register id
+
+ } # end foreach collectRegisterFfdc
+
+ if($crffdcCount > 0)
+ {
+ print EIFILE "\tRC.addErrorInfo(ffdc); \\\n}\n";
}
-=cut
- }
- }
+ }
print EIFILE "\n";
#----------------------------------------------------------------------
# Print the ADD_ERROR_INFO macro to hwp_error_info.H
#----------------------------------------------------------------------
- print EIFILE "#define $err->{rc}_ADD_ERROR_INFO(RC) ";
-
+ print EIFILE "#define $err->{rc}_ADD_ERROR_INFO(RC)";
- my $eiEntryStr = "";
- my $eiObjectMap = ""; #object names to buffer address mapping
- my $eiObjectStr = "const void * l_objects[] = {";
- my $executeStr = "";
+ my $eiEntryStr = undef;
+ my $eiObjectMap = undef; #object names to buffer address mapping
+ my $eiObjectStr = "\tconst void * l_objects[] = {";
+ my $executeStr = undef;
my $eiEntryCount = 0;
my %cdgTargetHash; # Records the callout/deconfigure/gards for Targets
my %cdgChildHash; # Records the callout/deconfigure/gards for Children
@@ -748,10 +780,11 @@ foreach my $argnum (0 .. $#ARGV)
foreach my $collectTrace (@{$err->{collectTrace}})
{
# Add an EI entry to eiEntryStr
- $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_COLLECT_TRACE; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].collect_trace.iv_eieTraceId = fapi2::CollectTraces::$collectTrace; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_COLLECT_TRACE; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].collect_trace.iv_eieTraceId = fapi2::CollectTraces::$collectTrace; \\\n";
$eiEntryCount++;
- }
+ } #end foreach $collectTrace
+
# Local FFDC
foreach my $ffdc (@{$err->{ffdc}})
{
@@ -770,12 +803,12 @@ foreach my $argnum (0 .. $#ARGV)
$ffdc = $mangle_names{$ffdc} if ($mangle_names{$ffdc} ne undef);
# Add an EI entry to eiEntryStr
- $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_FFDC; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcObjIndex = $objNum; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcId = fapi2::$ffdcName; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcSize = $ffdc.size(); \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_FFDC; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].ffdc.iv_ffdcObjIndex = $objNum; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].ffdc.iv_ffdcId = fapi2::$ffdcName; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].ffdc.iv_ffdcSize = $ffdc.size(); \\\n";
$eiEntryCount++;
- }
+ } #end foreach $ffdc
# Multicast ID
foreach my $mcast (@{$err->{mcastId}})
@@ -794,14 +827,14 @@ foreach my $argnum (0 .. $#ARGV)
$mcast = $mangle_names{$mcast} if ($mangle_names{$mcast} ne undef);
# Add an EI entry to eiEntryStr
- $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_FFDC; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcObjIndex = $objNum; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcId = fapi2::$ffdcName; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcSize = 4; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_FFDC; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].ffdc.iv_ffdcObjIndex = $objNum; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].ffdc.iv_ffdcId = fapi2::$ffdcName; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].ffdc.iv_ffdcSize = 4; \\\n";
$eiEntryCount++;
- }
+ } #foreach mcastId
- if(!$arg_local_ffdc)
+ if($arg_local_ffdc eq undef)
{
# Buffers, looks a lot like local ffdc
foreach my $buffer (@{$err->{buffer}})
@@ -819,12 +852,12 @@ foreach my $argnum (0 .. $#ARGV)
addFfdcMethod(\%methods, $buffer, $err->{rc}, $variable_buffer_ffdc_type);
# Add an EI entry to eiEntryStr
- $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_FFDC; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcObjIndex = $objNum; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcId = fapi2::$bufferName; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcSize = fapi2::getErrorInfoFfdcSize($buffer); \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_FFDC; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].ffdc.iv_ffdcObjIndex = $objNum; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].ffdc.iv_ffdcId = fapi2::$bufferName; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].ffdc.iv_ffdcSize = fapi2::getErrorInfoFfdcSize($buffer); \\\n";
$eiEntryCount++;
- }
+ } #foreach $buffer
# Procedure/Target/Bus/Child callouts
foreach my $callout (@{$err->{callout}})
@@ -859,21 +892,21 @@ foreach my $argnum (0 .. $#ARGV)
}
# Add an EI entry to eiEntryStr
- $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_HW_CALLOUT; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_hw = fapi2::HwCallouts::$callout->{hw}->{hwid}; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_calloutPriority = fapi2::CalloutPriorities::$callout->{priority}; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_HW_CALLOUT; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].hw_callout.iv_hw = fapi2::HwCallouts::$callout->{hw}->{hwid}; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].hw_callout.iv_calloutPriority = fapi2::CalloutPriorities::$callout->{priority}; \\\n";
if (exists $callout->{hw}->{refTarget})
{
# Add the Targets to the objectlist if they don't already exist
my $objNum = addEntryToArray(\@eiObjects, $callout->{hw}->{refTarget});
- $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_refObjIndex = $objNum; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].hw_callout.iv_refObjIndex = $objNum; \\\n";
# Add a method to the ffdc-gathering class
addFfdcMethod(\%methods, $callout->{hw}->{refTarget}, $err->{rc});
}
else
{
- $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_refObjIndex = 0xff; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].hw_callout.iv_refObjIndex = 0xff; \\\n";
}
$eiEntryCount++;
$elementsFound++;
@@ -882,9 +915,9 @@ foreach my $argnum (0 .. $#ARGV)
{
# Procedure Callout
# Add an EI entry to eiEntryStr
- $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_PROCEDURE_CALLOUT; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].proc_callout.iv_procedure = fapi2::ProcedureCallouts::$callout->{procedure}; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].proc_callout.iv_calloutPriority = fapi2::CalloutPriorities::$callout->{priority}; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_PROCEDURE_CALLOUT; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].proc_callout.iv_procedure = fapi2::ProcedureCallouts::$callout->{procedure}; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].proc_callout.iv_calloutPriority = fapi2::CalloutPriorities::$callout->{priority}; \\\n";
$eiEntryCount++;
$elementsFound++;
}
@@ -910,10 +943,10 @@ foreach my $argnum (0 .. $#ARGV)
addFfdcMethod(\%methods, $targets[1], $err->{rc}, $target_ffdc_type);
# Add an EI entry to eiEntryStr
- $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_BUS_CALLOUT; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].bus_callout.iv_endpoint1ObjIndex = $objNum1; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].bus_callout.iv_endpoint2ObjIndex = $objNum2; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].bus_callout.iv_calloutPriority = fapi2::CalloutPriorities::$callout->{priority}; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_BUS_CALLOUT; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].bus_callout.iv_endpoint1ObjIndex = $objNum1; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].bus_callout.iv_endpoint2ObjIndex = $objNum2; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].bus_callout.iv_calloutPriority = fapi2::CalloutPriorities::$callout->{priority}; \\\n";
$eiEntryCount++;
$elementsFound++;
}
@@ -1128,12 +1161,12 @@ foreach my $argnum (0 .. $#ARGV)
addFfdcMethod(\%methods, $cdg, $err->{rc}, $target_ffdc_type);
# Add an EI entry to eiEntryStr
- $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_CDG; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_targetObjIndex = $objNum; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_callout = $callout; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_deconfigure = $deconf; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_gard = $gard; \\\n";
- $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_calloutPriority = fapi2::CalloutPriorities::$priority; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_CDG; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].target_cdg.iv_targetObjIndex = $objNum; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].target_cdg.iv_callout = $callout; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].target_cdg.iv_deconfigure = $deconf; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].target_cdg.iv_gard = $gard; \\\n";
+ $eiEntryStr .= "\tl_entries[$eiEntryCount].target_cdg.iv_calloutPriority = fapi2::CalloutPriorities::$priority; \\\n";
$eiEntryCount++;
}
@@ -1186,23 +1219,23 @@ foreach my $argnum (0 .. $#ARGV)
# Add an EI entry to eiEntryStr
$eiEntryStr .=
- " l_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_CHILDREN_CDG; \\\n";
+ "\tl_entries[$eiEntryCount].iv_type = fapi2::EI_TYPE_CHILDREN_CDG; \\\n";
$eiEntryStr .=
- " l_entries[$eiEntryCount].children_cdg.iv_parentObjIndex = $objNum; \\\n";
+ "\tl_entries[$eiEntryCount].children_cdg.iv_parentObjIndex = $objNum; \\\n";
$eiEntryStr .=
- " l_entries[$eiEntryCount].children_cdg.iv_callout = $callout; \\\n";
+ "\tl_entries[$eiEntryCount].children_cdg.iv_callout = $callout; \\\n";
$eiEntryStr .=
- " l_entries[$eiEntryCount].children_cdg.iv_deconfigure = $deconf; \\\n";
+ "\tl_entries[$eiEntryCount].children_cdg.iv_deconfigure = $deconf; \\\n";
$eiEntryStr .=
- " l_entries[$eiEntryCount].children_cdg.iv_childType = fapi2::$childType; \\\n";
+ "\tl_entries[$eiEntryCount].children_cdg.iv_childType = fapi2::$childType; \\\n";
$eiEntryStr .=
- " l_entries[$eiEntryCount].children_cdg.iv_childPort = $childPort; \\\n";
+ "\tl_entries[$eiEntryCount].children_cdg.iv_childPort = $childPort; \\\n";
$eiEntryStr .=
- " l_entries[$eiEntryCount].children_cdg.iv_childNumber = $childNumber; \\\n";
+ "\tl_entries[$eiEntryCount].children_cdg.iv_childNumber = $childNumber; \\\n";
$eiEntryStr .=
- " l_entries[$eiEntryCount].children_cdg.iv_gard = $gard; \\\n";
+ "\tl_entries[$eiEntryCount].children_cdg.iv_gard = $gard; \\\n";
$eiEntryStr .=
- " l_entries[$eiEntryCount].children_cdg.iv_calloutPriority = fapi2::CalloutPriorities::$priority; \\\n";
+ "\tl_entries[$eiEntryCount].children_cdg.iv_calloutPriority = fapi2::CalloutPriorities::$priority; \\\n";
$eiEntryCount++;
}
}
@@ -1253,10 +1286,10 @@ foreach my $argnum (0 .. $#ARGV)
# Print info to file
if ($eiEntryCount > 0)
{
- print EIFILE "\\\n{ \\\n $eiObjectStr \\\n";
- print EIFILE " fapi2::ErrorInfoEntry l_entries[$eiEntryCount]; \\\n";
+ print EIFILE " \\\n{ \\\n $eiObjectStr \\\n";
+ print EIFILE "\tfapi2::ErrorInfoEntry l_entries[$eiEntryCount]; \\\n";
print EIFILE "$eiEntryStr";
- print EIFILE " RC.addErrorInfo(l_objects, l_entries, $eiEntryCount); \\\n}";
+ print EIFILE "\tRC.addErrorInfo(l_objects, l_entries, $eiEntryCount); \\\n}";
}
print EIFILE "\n";
@@ -1284,7 +1317,7 @@ foreach my $argnum (0 .. $#ARGV)
# remove it.
if ($arg_empty_ffdc eq undef)
{
- if(!$arg_local_ffdc)
+ if($arg_local_ffdc eq undef)
{
print ECFILE " $class_name(fapi2::errlSeverity_t i_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE, fapi2::ReturnCode& i_rc = fapi2::current_err):\n";
print ECFILE " iv_rc(i_rc),\n";
@@ -1316,7 +1349,7 @@ foreach my $argnum (0 .. $#ARGV)
print ECFILE $methods{$key}{method};
$method_count++;
}
- if(!$arg_local_ffdc)
+ if($arg_local_ffdc eq undef)
{
# add a method to adjust the severity if desired
print ECFILE "\tinline void setSev(const fapi2::errlSeverity_t i_sev)\n";
@@ -1345,6 +1378,8 @@ foreach my $argnum (0 .. $#ARGV)
if( $arg_local_ffdc eq undef )
{
+
+
# Stick the execute method at the end of the other methods. We allow
# passing in of the severity so that macros which call execute() can over-ride
# the default severity.
@@ -1417,9 +1452,7 @@ foreach my $argnum (0 .. $#ARGV)
print SBFILE "\t\tbreak; \\\n\t} \\\n";
}
- }
-
-=pos
+ } #for each hwpError tag
#
#--------------------------------------------------------------------------
# For each registerFfdc.
@@ -1447,195 +1480,40 @@ foreach my $argnum (0 .. $#ARGV)
setFfdcIdValue($registerFfdc->{id}[0]);
#----------------------------------------------------------------------
- # Generate code to capture the registers in collect_reg_ffdc.C
+ # Generate code to capture the registers in collect_reg_ffdc_regs.C
#----------------------------------------------------------------------
print CRFILE " case $registerFfdc->{id}[0]:\n";
-# TODO: RTC 132226
-=begin NEED_P9_REGISTERS
# Look for CFAM Register addresses
foreach my $cfamRegister (@{$registerFfdc->{cfamRegister}})
{
- print CRFILE " l_cfamAddresses.push_back($cfamRegister);\n";
- print CRFILE " l_ffdcSize += sizeof(l_cfamData);\n";
+ print CRFILE " o_cfamAddresses.push_back($cfamRegister);\n";
}
# Look for SCOM Register addresses
foreach my $scomRegister (@{$registerFfdc->{scomRegister}})
{
- print CRFILE " l_scomAddresses.push_back($scomRegister);\n";
- print CRFILE " l_ffdcSize += sizeof(l_scomData);\n";
+ print CRFILE " o_scomAddresses.push_back($scomRegister);\n";
}
-print CRFILE " break;\n";
+ print CRFILE " break;\n";
}
-=cut
+
+
}
#------------------------------------------------------------------------------
-# Print end of file information to collect_reg_ffdc.C
+# Print end of file information to collect_reg_ffdc_regs.C
#------------------------------------------------------------------------------
print CRFILE " default:\n";
-print CRFILE " FAPI_ERR(\"collect_reg_ffdc.C: Invalid FFDC ID 0x%x\", ";
+print CRFILE " FAPI_ERR(\"collect_reg_ffdc_regs.C: Invalid FFDC ID 0x%x\", ";
print CRFILE "i_ffdcId);\n";
print CRFILE " return;\n";
-print CRFILE " }\n\n";
-
-# TODO: RTC 132226
-=begin NEED_P9_REGISTERS
-print CRFILE " uint8_t * l_pBuf = NULL;\n";
-print CRFILE " uint8_t * l_pData = NULL;\n";
-print CRFILE " std::vector<fapi::Target> l_targets;\n";
-print CRFILE " uint32_t l_chipletPos32 = 0;\n";
-
-#---------------------------------------------------------------------------------------------------------
-# Populate chiplet vectors (if required by register collection method) and adjust buffer sizes accordingly
-#---------------------------------------------------------------------------------------------------------
-print CRFILE " if (C != TARGET_TYPE_NONE)\n";
-print CRFILE " {\n";
-print CRFILE " l_rc = fapiGetChildChiplets(i_target, i_child, l_targets, TARGET_STATE_FUNCTIONAL);\n";
-print CRFILE " if (l_rc)\n";
-print CRFILE " {\n";
-print CRFILE " FAPI_ERR(\"collect_reg_ffdc.C: Error: fapiGetChildChiplets: failed to get chiplets.\");\n";
-print CRFILE " return;\n";
-print CRFILE " }\n";
-print CRFILE " if (l_targets.empty())\n";
-print CRFILE " {\n";
-print CRFILE " FAPI_INF(\"collect_reg_ffdc.C: Error: No functional chiplets found. \");\n";
-print CRFILE " return;\n";
-print CRFILE " }\n";
-print CRFILE " l_ffdcSize += sizeof(l_chipletPos32);\n";
-print CRFILE " l_ffdcSize *= l_targets.size();\n";
-print CRFILE " l_pBuf = new uint8_t[l_ffdcSize];\n";
-print CRFILE " l_pData = l_pBuf;\n";
-print CRFILE " }\n";
-print CRFILE " else if (P != TARGET_TYPE_NONE)\n";
-print CRFILE " {\n";
-print CRFILE " l_rc = fapiGetChildChiplets(i_target, i_presChild, l_targets, TARGET_STATE_PRESENT);\n";
-print CRFILE " if (l_rc)\n";
-print CRFILE " {\n";
-print CRFILE " FAPI_ERR(\"collect_reg_ffdc.C: Error: fapiGetChildChiplets: failed to get chiplets.\");\n";
-print CRFILE " return;\n";
-print CRFILE " }\n";
-print CRFILE " if (l_targets.empty())\n";
-print CRFILE " {\n";
-print CRFILE " FAPI_INF(\"collect_reg_ffdc.C: Error: No functional chiplets found. \");\n";
-print CRFILE " return;\n";
-print CRFILE " }\n";
-print CRFILE " l_ffdcSize += sizeof(l_chipletPos32);\n";
-print CRFILE " l_ffdcSize *= l_targets.size();\n";
-print CRFILE " l_pBuf = new uint8_t[l_ffdcSize];\n";
-print CRFILE " l_pData = l_pBuf;\n";
print CRFILE " }\n";
-print CRFILE " else\n";
-print CRFILE " {\n";
-print CRFILE " l_ffdcSize += sizeof(l_chipletPos32);\n";
-print CRFILE " l_pBuf = new uint8_t[l_ffdcSize];\n";
-print CRFILE " l_pData = l_pBuf;\n";
-print CRFILE " l_targets.push_back(i_target);\n";
-print CRFILE " }\n\n";
-
-#---------------------------------------------------------------------------------------------------------
-# Obtain target position and insert as the first word in the buffer
-#---------------------------------------------------------------------------------------------------------
-print CRFILE " bool l_targIsChiplet = i_target.isChiplet();\n\n";
-print CRFILE " for (std::vector<fapi::Target>::const_iterator targetIter = l_targets.begin();\n";
-print CRFILE " targetIter != l_targets.end(); ++targetIter)\n";
-print CRFILE " {\n";
-print CRFILE " if ((fapi2::TARGET_TYPE_NONE != i_child) ||\n";
-print CRFILE " (fapi2::TARGET_TYPE_NONE != i_presChild) ||\n";
-print CRFILE " (true == l_targIsChiplet))\n";
-print CRFILE " {\n";
-print CRFILE " uint8_t l_chipletPos = 0;\n";
-print CRFILE " l_rc = FAPI_ATTR_GET(ATTR_CHIP_UNIT_POS, &(*targetIter), l_chipletPos);\n";
-print CRFILE " if (l_rc)\n";
-print CRFILE " {\n";
-print CRFILE " FAPI_ERR(\"collect_reg_ffdc.C: Error getting chiplet position\");\n";
-print CRFILE " l_chipletPos = 0xFF;\n";
-print CRFILE " }\n";
- #-------------------------------------------------------------------------
- # We print the target's position in the error log whether the target is a
- # chip or chiplet, so we need to store the chiplet position in a uint32_t
- # to have consitency in the buffer as ATTR_POS below returns a uint32_t
- #-------------------------------------------------------------------------
-print CRFILE " l_chipletPos32 = l_chipletPos;\n";
-print CRFILE " }\n";
-print CRFILE " else\n";
-print CRFILE " {\n";
-print CRFILE " l_rc = FAPI_ATTR_GET(ATTR_POS, &(*targetIter), l_chipletPos32);\n";
-print CRFILE " if (l_rc)\n";
-print CRFILE " {\n";
-print CRFILE " FAPI_ERR(\"collect_reg_ffdc.C: Error getting chip position\");\n";
-print CRFILE " l_chipletPos32 = 0xFFFFFFFF;\n";
-print CRFILE " }\n";
-print CRFILE " }\n";
-print CRFILE " *(reinterpret_cast<uint32_t *>(l_pData)) = l_chipletPos32;\n";
-print CRFILE " l_pData += sizeof(l_chipletPos32);\n";
-#---------------------------------------------------------------------------------------------------------
-# Instert cfam data (if any) related to this chip / chiplet into the buffer
-# If collecting FFDC based on present children, adjust the register address by the appropriate offset
-#---------------------------------------------------------------------------------------------------------
-print CRFILE " for (std::vector<uint32_t>::const_iterator cfamIter = l_cfamAddresses.begin();\n";
-print CRFILE " cfamIter != l_cfamAddresses.end(); ++cfamIter)\n";
-print CRFILE " {\n";
-print CRFILE " if (fapi2::TARGET_TYPE_NONE != i_presChild)\n";
-print CRFILE " {\n";
-print CRFILE " l_rc = fapiGetCfamRegister(i_target, (*cfamIter + (l_chipletPos32 * i_childOffsetMult)), l_buf);\n";
-print CRFILE " }\n";
-print CRFILE " else\n";
-print CRFILE " {\n";
-print CRFILE " l_rc = fapiGetCfamRegister(*targetIter, *cfamIter, l_buf);\n";
-print CRFILE " }\n";
-print CRFILE " if (l_rc)\n";
-print CRFILE " {\n";
-print CRFILE " FAPI_ERR(\"collect_reg_ffdc.C: CFAM error for 0x%x\",";
-print CRFILE "*cfamIter);\n";
-print CRFILE " l_cfamData = 0xbaddbadd;\n";
-print CRFILE " }\n";
-print CRFILE " else\n";
-print CRFILE " {\n";
-print CRFILE " l_cfamData = l_buf.getWord(0);\n";
-print CRFILE " }\n";
-print CRFILE " *(reinterpret_cast<uint32_t *>(l_pData)) = l_cfamData;\n";
-print CRFILE " l_pData += sizeof(l_cfamData);\n";
-print CRFILE " }\n\n";
-#---------------------------------------------------------------------------------------------------------
-# Instert any scom data (if any) related to this chip / chiplet into the buffer
-# If collecting FFDC based on present children, adjust the register address by the appropriate offset
-#---------------------------------------------------------------------------------------------------------
-print CRFILE " for (std::vector<uint64_t>::const_iterator scomIter = l_scomAddresses.begin();\n";
-print CRFILE " scomIter != l_scomAddresses.end(); ++scomIter)\n";
-print CRFILE " {\n";
-print CRFILE " if (fapi2::TARGET_TYPE_NONE != i_presChild)\n";
-print CRFILE " {\n";
-print CRFILE " l_rc = fapiGetScom(i_target, (*scomIter + (l_chipletPos32 * i_childOffsetMult)), l_buf);\n";
-print CRFILE " }\n";
-print CRFILE " else\n";
-print CRFILE " {\n";
-print CRFILE " l_rc = fapiGetScom(*targetIter, *scomIter, l_buf);\n";
-print CRFILE " }\n";
-print CRFILE " if (l_rc)\n";
-print CRFILE " {\n";
-print CRFILE " FAPI_ERR(\"collect_reg_ffdc.C: SCOM error for 0x%llx\",";
-print CRFILE "*scomIter);\n";
-print CRFILE " l_scomData = 0xbaddbaddbaddbaddULL;\n";
-print CRFILE " }\n";
-print CRFILE " else\n";
-print CRFILE " {\n";
-print CRFILE " l_scomData = l_buf.getDoubleWord(0);\n";
-print CRFILE " }\n";
-print CRFILE " *(reinterpret_cast<uint64_t *>(l_pData)) = l_scomData;\n";
-print CRFILE " l_pData += sizeof(l_scomData);\n";
-print CRFILE " }\n";
-print CRFILE " }\n\n";
-print CRFILE " o_rc.addEIFfdc(i_ffdcId, l_pBuf, l_ffdcSize);\n";
-print CRFILE " delete [] l_pBuf;\n";
-
-=cut NEED_P9_REGISTERS
-
-print CRFILE "}\n";
+print CRFILE "o_ffdcSize = o_scomAddresses.size() * sizeof(uint64_t);\n";
+print CRFILE "o_ffdcSize += o_cfamAddresses.size() * sizeof(uint32_t);\n";
print CRFILE "}\n";
-print CRFILE "#endif\n";
+print CRFILE "} // end namespace\n\n";
#------------------------------------------------------------------------------
# Print the fapiHwpReturnCodes.H file
OpenPOWER on IntegriCloud