summaryrefslogtreecommitdiffstats
path: root/src/import/generic
diff options
context:
space:
mode:
authorStephen Glancy <sglancy@us.ibm.com>2019-02-18 10:25:11 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2019-03-12 12:38:01 -0500
commitc96464c7d52540eda875ac62082f1ebf24de3f72 (patch)
treed609145afac507b684a2d8ab6d13b5572119ecd7 /src/import/generic
parent6f660c2b98b78730f691f62401d14dbffc2a2d0a (diff)
downloadtalos-hostboot-c96464c7d52540eda875ac62082f1ebf24de3f72.tar.gz
talos-hostboot-c96464c7d52540eda875ac62082f1ebf24de3f72.zip
Moves set bad bitmap into generic
Change-Id: I0c9e8beb0e4cd930ebccbf26d1e8149b64fae65d Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/72154 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Dev-Ready: STEPHEN GLANCY <sglancy@us.ibm.com> Reviewed-by: ANDRE A. MARIN <aamarin@us.ibm.com> Reviewed-by: Louis Stermole <stermole@us.ibm.com> Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/72163 Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Tested-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import/generic')
-rw-r--r--src/import/generic/memory/lib/mss_generic_attribute_getters.H27
-rw-r--r--src/import/generic/memory/lib/utils/mss_bad_bits.H80
-rw-r--r--src/import/generic/memory/lib/utils/mss_generic_check.H12
-rw-r--r--src/import/generic/memory/lib/utils/shared/mss_generic_consts.H2
-rwxr-xr-xsrc/import/generic/memory/tools/gen_accessors.pl4
-rwxr-xr-xsrc/import/generic/memory/tools/gen_accessors.pm28
-rw-r--r--src/import/generic/procedures/xml/attribute_info/generic_dq_attributes.xml19
7 files changed, 165 insertions, 7 deletions
diff --git a/src/import/generic/memory/lib/mss_generic_attribute_getters.H b/src/import/generic/memory/lib/mss_generic_attribute_getters.H
index d97816d47..dc22d4fb0 100644
--- a/src/import/generic/memory/lib/mss_generic_attribute_getters.H
+++ b/src/import/generic/memory/lib/mss_generic_attribute_getters.H
@@ -957,6 +957,33 @@ fapi_try_exit:
///
+/// @brief ATTR_BAD_DQ_BITMAP getter
+/// @param[in] const ref to the TARGET_TYPE_DIMM
+/// @param[out] uint8_t&[] array reference to store the value
+/// @note Generated by gen_accessors.pl generate_other_attr_params
+/// @return fapi2::ReturnCode - FAPI2_RC_SUCCESS iff get is OK
+/// @note Bad DQ bitmap from a controller point of view. The data is a 10 byte bitmap for
+/// each of 4 possible ranks. The bad DQ data is stored in NVRAM, and it is stored in
+/// a special format translated to a DIMM Connector point of view. All of these details
+/// are hidden from the user of this attribute.
+///
+inline fapi2::ReturnCode get_bad_dq_bitmap(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
+ uint8_t (&o_array)[4][10])
+{
+ uint8_t l_value[4][10] = {};
+
+ FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_BAD_DQ_BITMAP, i_target, l_value) );
+ memcpy(o_array, &l_value, 40);
+ return fapi2::current_err;
+
+fapi_try_exit:
+ FAPI_ERR("failed getting ATTR_BAD_DQ_BITMAP: 0x%lx",
+ uint64_t(fapi2::current_err));
+ return fapi2::current_err;
+}
+
+
+///
/// @brief ATTR_MEM_EFF_DRAM_GEN getter
/// @param[in] const ref to the TARGET_TYPE_DIMM
/// @param[out] uint8_t& reference to store the value
diff --git a/src/import/generic/memory/lib/utils/mss_bad_bits.H b/src/import/generic/memory/lib/utils/mss_bad_bits.H
index 859a12b5e..cae2bd543 100644
--- a/src/import/generic/memory/lib/utils/mss_bad_bits.H
+++ b/src/import/generic/memory/lib/utils/mss_bad_bits.H
@@ -22,3 +22,83 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
+
+///
+/// @file mss_bad_bits.C
+/// @brief Contains the generic bad bits logic
+///
+// *HWP HWP Owner: Stephen Glancy <sglancy@us.ibm.com>
+// *HWP HWP Backup: Andre Marin <aamarin@us.ibm.com>
+// *HWP Team: Memory
+// *HWP Level: 3
+// *HWP Consumed by: FSP:HB
+
+#ifndef _MSS_BAD_BITS_H_
+#define _MSS_BAD_BITS_H_
+
+#include <fapi2.H>
+#include <generic/memory/lib/utils/shared/mss_generic_consts.H>
+#include <generic/memory/lib/utils/mss_generic_check.H>
+#include <generic/memory/lib/mss_generic_attribute_setters.H>
+
+namespace mss
+{
+
+///
+/// @brief A generic bad bits setter
+/// @tparam MC type memory controller type
+/// @param[in] i_target the fapi2 target oon which training was conducted
+/// @param[in] i_array the bad bits to set
+/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if bad bits can be repaired
+///
+template <mss::mc_type MC>
+fapi2::ReturnCode set_bad_dq_bitmap(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
+ uint8_t (&i_array)[BAD_BITS_RANKS][BAD_DQ_BYTE_COUNT]);
+
+///
+/// @brief Records bad bits into the bad bits attribute
+/// @tparam MC MC type on which training was run
+/// @tparam T fapi2::TargetType on which training was conducted
+/// @tparam I Interface class used to abstract converting bad bits into the attribute
+/// @param[in] i_target the fapi2 target oon which training was conducted
+/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS if bad bits can be repaired
+///
+template <mss::mc_type MC, fapi2::TargetType T, class I >
+inline fapi2::ReturnCode record_bad_bits( const fapi2::Target<T>& i_target, const I& i_helper )
+{
+ // If we have a FIR set that could have caused our training fail, then skip checking bad bits in FW
+ // PRD will handle the FIR and retrigger the procedure
+#ifdef __HOSTBOOT_MODULE
+ bool l_fir_error = false;
+
+ // Note: using success here will cause an RC to not be logged
+ // We can still see if we do have a FIR error though
+ fapi2::ReturnCode l_rc(fapi2::FAPI2_RC_SUCCESS);
+ FAPI_TRY((mss::check::bad_fir_bits<MC, T>(i_target, l_rc, l_fir_error)), "%s took an error while checking FIR's",
+ mss::c_str(i_target));
+
+ // Exit if we took a FIR error - PRD will handle bad bits
+ if(l_fir_error)
+ {
+ FAPI_INF("%s has FIR's set, exiting to let PRD handle it", mss::c_str(i_target));
+ return fapi2::FAPI2_RC_SUCCESS;
+ }
+
+#endif
+
+ for( const auto& d : mss::find_targets<fapi2::TARGET_TYPE_DIMM>(i_target) )
+ {
+ uint8_t l_data[BAD_BITS_RANKS][BAD_DQ_BYTE_COUNT] = {};
+
+ FAPI_TRY( i_helper.record_bad_bits_interface(d, l_data) );
+
+ // Write
+ FAPI_TRY(set_bad_dq_bitmap<MC>(d, l_data));
+ }
+
+fapi_try_exit:
+ return fapi2::current_err;
+}
+
+} // ns
+#endif
diff --git a/src/import/generic/memory/lib/utils/mss_generic_check.H b/src/import/generic/memory/lib/utils/mss_generic_check.H
index f10f4d79a..be9e12f14 100644
--- a/src/import/generic/memory/lib/utils/mss_generic_check.H
+++ b/src/import/generic/memory/lib/utils/mss_generic_check.H
@@ -46,6 +46,18 @@ namespace check
{
///
+/// @brief Checks whether any FIRs have lit up on a target
+/// @tparam MC MC type for which to check FIR's
+/// @tparam T the fapi2::TargetType which hold the FIR bits
+/// @param[in] i_target - the target on which to operate
+/// @param[in,out] io_rc - the return code for the function
+/// @param[out] o_fir_error - true iff a FIR was hit
+/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok
+///
+template< mss::mc_type MC, fapi2::TargetType T >
+fapi2::ReturnCode bad_fir_bits( const fapi2::Target<T>& i_target, fapi2::ReturnCode& io_rc, bool& o_fir_error );
+
+///
/// @brief Checks conditional passes and implements traces & exits if it fails
/// @tparam T fapi2 target type
/// @tparam IT input data type
diff --git a/src/import/generic/memory/lib/utils/shared/mss_generic_consts.H b/src/import/generic/memory/lib/utils/shared/mss_generic_consts.H
index d95ebcf45..c3c3a8f4a 100644
--- a/src/import/generic/memory/lib/utils/shared/mss_generic_consts.H
+++ b/src/import/generic/memory/lib/utils/shared/mss_generic_consts.H
@@ -50,6 +50,8 @@ enum common_consts
{
DEFAULT_POLL_LIMIT = 50, ///< the number of poll attempts in the event we can't calculate another
MEMCMP_EQUAL = 0, ///< Equal comparison value for memcmp
+ BAD_BITS_RANKS = 4, ///< Bad bit attribute's number of ranks
+ BAD_DQ_BYTE_COUNT = 10, ///< Bad bit attribute's number of byte
};
///
diff --git a/src/import/generic/memory/tools/gen_accessors.pl b/src/import/generic/memory/tools/gen_accessors.pl
index b70cef8d7..4100069d0 100755
--- a/src/import/generic/memory/tools/gen_accessors.pl
+++ b/src/import/generic/memory/tools/gen_accessors.pl
@@ -66,8 +66,8 @@ BEGIN
}
use lib "$pwd";
-use lib $ENV{PROJECT_ROOT} . "/generic/memory/tools"; # EKB Path
-use lib $ENV{PROJECT_ROOT} . "/src/import/generic/memory/tools"; # Hostboot Path
+use lib $ENV{PROJECT_ROOT} . "/generic/memory/tools"; # EKB Path
+use lib $ENV{PROJECT_ROOT} . "/src/import/generic/memory/tools"; # Hostboot Path
use English;
use Carp qw( croak );
diff --git a/src/import/generic/memory/tools/gen_accessors.pm b/src/import/generic/memory/tools/gen_accessors.pm
index a3adddf42..ddcb1e0f6 100755
--- a/src/import/generic/memory/tools/gen_accessors.pm
+++ b/src/import/generic/memory/tools/gen_accessors.pm
@@ -941,6 +941,28 @@ sub generate_setters
}
#
+# @brief Helper function to idenitify if we're an MC port target
+# @param[in] system - system type
+# @return reference to an array of target types
+#
+sub identify_mc_port_helper
+{
+
+ # Gets input and checks to make sure it's valid
+ croak "Incorrect number of inputs passed into gen_accessors::identify_mc_port_helper" if ( @ARG != 1 );
+
+ my ($system) = @ARG;
+
+ my @mc_port_target_types = ();
+ foreach my $type ( keys( %{ ${ +TARGET_TYPES }{$system} } ) )
+ {
+ push( @mc_port_target_types, ${ +TARGET_TYPES }{$system}{$type} ) if ( $type ne "DIMM" );
+ }
+
+ return \@mc_port_target_types;
+}
+
+#
# @brief Generate accessor methods for a given attribute
# @param[in] system - system type
# @param[in] attr - reference to the attribute to process
@@ -960,11 +982,7 @@ sub generate_accessor_methods
my @s_parameters = ();
# Generate parameter info depending on target type
- my @target_types = ();
- foreach my $type ( keys( %{ ${ +TARGET_TYPES }{$system} } ) )
- {
- push( @target_types, ${ +TARGET_TYPES }{$system}{$type} );
- }
+ my @target_types = @{ identify_mc_port_helper($system) };
my $attr_type = $attr->{targetType};
if ( grep( /^$attr_type$/, @target_types ) )
diff --git a/src/import/generic/procedures/xml/attribute_info/generic_dq_attributes.xml b/src/import/generic/procedures/xml/attribute_info/generic_dq_attributes.xml
index 333ee3d82..267e30d70 100644
--- a/src/import/generic/procedures/xml/attribute_info/generic_dq_attributes.xml
+++ b/src/import/generic/procedures/xml/attribute_info/generic_dq_attributes.xml
@@ -23,4 +23,23 @@
<!-- -->
<!-- IBM_PROLOG_END_TAG -->
<attributes>
+
+ <attribute>
+ <id>ATTR_BAD_DQ_BITMAP</id>
+ <targetType>TARGET_TYPE_DIMM</targetType>
+ <description>
+ Bad DQ bitmap from a controller point of view.
+ The data is a 10 byte bitmap for each of 4 possible ranks.
+ The bad DQ data is stored in NVRAM, and it is stored in a special format
+ translated to a DIMM Connector point of view.
+ All of these details are hidden from the user of this attribute.
+ </description>
+ <valueType>uint8</valueType>
+ <mssAccessorName>bad_dq_bitmap</mssAccessorName>
+ <array>4 10</array>
+ <platInit/>
+ <initToZero/>
+ <writeable/>
+ </attribute>
+
</attributes>
OpenPOWER on IntegriCloud