From 76a14949a1eea0daeb4f14749a26cfc38a42ac00 Mon Sep 17 00:00:00 2001 From: "Richard J. Knight" Date: Tue, 21 Aug 2018 22:39:07 -0500 Subject: Modify the getFfdc routine to consider the SBE proc -The SBE returns target instance numbers associated with the proc, not the system. This commit adds a translation to map the instance number to the FAPI_FAPI position based on the proc number. Change-Id: I9b296142cd977dee8c1f390f48abfd4b0cb0abe8 CQ:SW442966 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/64995 Tested-by: Jenkins Server Tested-by: HWSV CI Tested-by: PPE CI Tested-by: Hostboot CI Reviewed-by: Matt K. Light Reviewed-by: Christian R. Geddes Reviewed-by: Jennifer A. Stofer Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/64998 Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins --- src/import/hwpf/fapi2/include/error_info_defs.H | 58 +++++++++++-- src/import/hwpf/fapi2/src/fapi2_utils.C | 109 ++++++++++++++++++++++++ src/import/hwpf/fapi2/tools/parseErrorInfo.pl | 8 +- 3 files changed, 165 insertions(+), 10 deletions(-) (limited to 'src/import/hwpf') diff --git a/src/import/hwpf/fapi2/include/error_info_defs.H b/src/import/hwpf/fapi2/include/error_info_defs.H index c4264d107..e5347ae84 100644 --- a/src/import/hwpf/fapi2/include/error_info_defs.H +++ b/src/import/hwpf/fapi2/include/error_info_defs.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2017 */ +/* Contributors Listed Below - COPYRIGHT 2015,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -160,6 +160,24 @@ enum ErrorInfoType EI_LAST_TYPE = EI_TYPE_COLLECT_TRACE + 1, }; +// @brief used when translating the SBE targets instance into a fapi pos. +enum maxTargetsPerProc : uint16_t +{ + MAX_MCBIST_PER_PROC = 2, + MAX_MC_PER_PROC = 2, + MAX_MI_PER_PROC = 4, + MAX_MCS_PER_PROC = 4, + MAX_EQ_PER_PROC = 6, + MAX_MCA_PER_PROC = 8, + MAX_PHB_PER_PROC = 6, + MAX_EX_PER_PROC = 12, + MAX_CORE_PER_PROC = 24, + MAX_PERV_PER_PROC = 56, + INVALID_TARGET_COUNT = 0xFFFF, + INVALID_FAPI_POS = INVALID_TARGET_COUNT, +}; + + #ifndef MINIMUM_FFDC /// /// @enum HwCallout @@ -251,10 +269,21 @@ enum CollectTrace }; } +// @brief convert the processor relative sbe target instance into a fapi pos +// +// @param[in] i_targType - type of target from SBE FFDC buffer +// @param[in] i_proc - current SBE processor number +// @param[in] i_instance - instance of i_targType relitive to the processor +// number i_proc. +// +uint16_t convertSbeTargInstanceToFapiPos(fapi2::TargetType i_targType, + fapi2::Target& i_proc, uint16_t i_instance); + // NOTE - this assumes no buffer_t or variable_buffers are passed // data is converted to a uint64_t when placed into the sbe ffdc // buffer -inline fapi2::ffdc_t getFfdcData( sbeFfdc_t& i_sbeFfdc, bool& invalid_data ) +inline fapi2::ffdc_t getFfdcData( sbeFfdc_t& i_sbeFfdc, uint8_t i_proc_instance, + bool& invalid_data ) { fapi2::ffdc_t l_ffdc; @@ -264,15 +293,32 @@ inline fapi2::ffdc_t getFfdcData( sbeFfdc_t& i_sbeFfdc, bool& invalid_data ) { #ifdef FAPI2_ENABLE_PLATFORM_GET_TARGET uint64_t targetData = i_sbeFfdc.data; + // get a fapi target for the passed in proc instance + auto l_proc = + getTarget(i_proc_instance); + fapi2::TargetType type = static_cast(targetData >> 32); - uint8_t instance = static_cast(targetData & 0xFFFFFFFF); - // call hostboot to get the fapi2 target reference - l_ffdc.ptr() = static_cast(getTarget(type, instance)); - if(l_ffdc.ptr() == nullptr ) + // sbe returns the target instance based on processor scope, + // we will need to convert that number to system scope (FAPI_POS) + uint16_t instance = static_cast(targetData & 0xFFFFFFFF); + + uint16_t fapi_pos = convertSbeTargInstanceToFapiPos(type, l_proc, instance); + + if( fapi_pos == INVALID_FAPI_POS ) { invalid_data = true; } + else + { + // call hostboot to get the fapi2 target pointer + l_ffdc.ptr() = static_cast(getTarget(type, fapi_pos)); + + if(l_ffdc.ptr() == nullptr ) + { + invalid_data = true; + } + } #endif } diff --git a/src/import/hwpf/fapi2/src/fapi2_utils.C b/src/import/hwpf/fapi2/src/fapi2_utils.C index e1010cf87..f1c364f77 100644 --- a/src/import/hwpf/fapi2/src/fapi2_utils.C +++ b/src/import/hwpf/fapi2/src/fapi2_utils.C @@ -58,4 +58,113 @@ ReturnCode queryChipEcAndName( return l_rc; } + + +// convert sbe instance of target to a fapi position +uint16_t convertSbeTargInstanceToFapiPos(fapi2::TargetType i_targType, + fapi2::Target& i_proc, uint16_t i_instance) +{ + // Compute this target's FAPI_POS value. We first take the parent's + // FAPI_POS and multiply by the max number of targets of this type that + // the parent's type can have. This yields the lower bound of this + // target's FAPI_POS. Then we add in the relative position of this + // target with respect to the parent. Typically this is done by passing + // in the chip unit, in which case (such as for cores) it can be much + // greater than the architecture limit ratio (there can be cores with + // chip units of 0..23, but only 2 cores per ex), so to normalize we + // have to take the value mod the architecture limit. Note that this + // scheme only holds up because every parent also had the same type of + // calculation to compute its own FAPI_POS. + + uint16_t max_targets = 0; + + uint16_t fapi_pos = INVALID_FAPI_POS; + + ATTR_FAPI_POS_Type l_procPosition = 0; + + FAPI_ATTR_GET(fapi2::ATTR_FAPI_POS, i_proc, l_procPosition); + + switch( i_targType ) + { + case TARGET_TYPE_EQ: + { + max_targets = MAX_EQ_PER_PROC; + break; + } + + case TARGET_TYPE_CORE: + { + max_targets = MAX_CORE_PER_PROC; + break; + } + + case TARGET_TYPE_EX: + { + max_targets = MAX_EX_PER_PROC; + break; + } + + case TARGET_TYPE_MCS: + { + max_targets = MAX_MCS_PER_PROC; + break; + } + + case TARGET_TYPE_MCA: + { + max_targets = MAX_MCA_PER_PROC; + break; + } + + case TARGET_TYPE_MC: + { + max_targets = MAX_MC_PER_PROC; + break; + } + + case TARGET_TYPE_MI: + { + max_targets = MAX_MI_PER_PROC; + break; + } + + case TARGET_TYPE_PHB: + { + max_targets = MAX_PHB_PER_PROC; + break; + } + + case TARGET_TYPE_MCBIST: + { + max_targets = MAX_MCBIST_PER_PROC; + break; + } + + case TARGET_TYPE_PERV: + { + max_targets = MAX_PERV_PER_PROC; + break; + } + + default: + max_targets = INVALID_TARGET_COUNT; + break; + } + + if( max_targets == INVALID_TARGET_COUNT ) + { + FAPI_ERR("Unable to determine the target count " + "for target type = 0x%x and instance 0x%d " + "associated with proc position %d", + i_targType, i_instance, l_procPosition); + } + else + { + fapi_pos = max_targets * l_procPosition + + (i_instance % max_targets); + } + + return fapi_pos; +} + }; diff --git a/src/import/hwpf/fapi2/tools/parseErrorInfo.pl b/src/import/hwpf/fapi2/tools/parseErrorInfo.pl index 88f9ae663..0ebb81bc4 100755 --- a/src/import/hwpf/fapi2/tools/parseErrorInfo.pl +++ b/src/import/hwpf/fapi2/tools/parseErrorInfo.pl @@ -303,7 +303,7 @@ sub addFfdcMethod $method_body .= " fapi2::getErrorInfoFfdcSize(i_value);\n return *this;\n }\n\n"; $methods->{$key}{member} = "$ffdc_type $ffdc_uc;"; $methods->{$objectNumber}{localvar} = - "$ffdc_type $ffdc_uc = fapi2::getFfdcData(i_ebuf[$objectNumber],invalid_data);"; + "$ffdc_type $ffdc_uc = fapi2::getFfdcData(i_ebuf[$objectNumber],proc_instance,invalid_data);"; $methods->{$objectNumber}{assignment_string} = "l_obj.$ffdc_uc = $ffdc_uc;"; } else @@ -336,7 +336,7 @@ sub addFfdcMethod $method_body .= " }\n\n"; $methods->{$key}{member} = "$ffdc_type $ffdc_uc;"; $methods->{$objectNumber}{localvar} = - "$buffer_ffdc_type $ffdc_uc = fapi2::getFfdcData(i_ebuf[$objectNumber],invalid_data);"; + "$buffer_ffdc_type $ffdc_uc = fapi2::getFfdcData(i_ebuf[$objectNumber],proc_instance,invalid_data);"; $methods->{$objectNumber}{assignment_string} = "l_obj.$ffdc_uc = $ffdc_uc;"; } @@ -373,7 +373,7 @@ sub addFfdcMethod $methods->{$key}{member} = "$ffdc_type $ffdc_uc;"; $methods->{$objectNumber}{localvar} = - "$ffdc_type $ffdc_uc = fapi2::getFfdcData(i_ebuf[$objectNumber],invalid_data);"; + "$ffdc_type $ffdc_uc = fapi2::getFfdcData(i_ebuf[$objectNumber],proc_instance,invalid_data);"; $methods->{$objectNumber}{assignment_string} = "l_obj.$ffdc_uc=$ffdc_uc;"; } elsif ( $type eq $scom_addr_type ) @@ -394,7 +394,7 @@ sub addFfdcMethod $method_body .= " return *this;}\n\n"; $methods->{$key}{member} = "$type $ffdc_uc;"; $methods->{$objectNumber}{localvar} = - "$type $ffdc_uc = fapi2::getFfdcData(i_ebuf[$objectNumber],invalid_data);"; + "$type $ffdc_uc = fapi2::getFfdcData(i_ebuf[$objectNumber],proc_instance,invalid_data);"; $methods->{$objectNumber}{assignment_string} = "l_obj.$ffdc_uc = $ffdc_uc;"; } else -- cgit v1.2.1