summaryrefslogtreecommitdiffstats
path: root/src/import/generic/memory/lib/spd
diff options
context:
space:
mode:
authorAndre Marin <aamarin@us.ibm.com>2017-03-27 23:52:06 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-03-02 09:04:03 -0500
commit157d87dcea5a8679fcef352fb9200f0fbcaccdba (patch)
tree4c95f3305ba7d2c5fb29241baa518d7ca11bc87a /src/import/generic/memory/lib/spd
parentc50ad6201b4a06fa06d21d9a4b101020deddf7ff (diff)
downloadtalos-hostboot-157d87dcea5a8679fcef352fb9200f0fbcaccdba.tar.gz
talos-hostboot-157d87dcea5a8679fcef352fb9200f0fbcaccdba.zip
Change base decoder, add ddr4 namespace, and common API btw modules
Change-Id: I67b3f7cb94d31b9f4e8438ec81794a7bfd66f64c Original-Change-Id: I78b8b929e3136e3edec646321e0d8bb32229911d Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38506 Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Brian R. Silver <bsilver@us.ibm.com> Reviewed-by: JACOB L. HARVEY <jlharvey@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/54756 CI-Ready: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Tested-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import/generic/memory/lib/spd')
-rw-r--r--src/import/generic/memory/lib/spd/common/spd_decoder_base.H68
1 files changed, 60 insertions, 8 deletions
diff --git a/src/import/generic/memory/lib/spd/common/spd_decoder_base.H b/src/import/generic/memory/lib/spd/common/spd_decoder_base.H
index cef070dbe..af58d361d 100644
--- a/src/import/generic/memory/lib/spd/common/spd_decoder_base.H
+++ b/src/import/generic/memory/lib/spd/common/spd_decoder_base.H
@@ -49,10 +49,60 @@ namespace spd
{
///
+/// @brief Helper function to extract byte information
+/// @tparam F the SPD field to extract
+/// @param[in] i_target the dimm target
+/// @param[in] i_spd_data the SPD data
+/// @return extracted byte (right aligned)
+///
+template< const field_t& F >
+inline uint8_t extract_spd_field(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
+ const std::vector<uint8_t>& i_spd_data)
+{
+ FAPI_INF("%s SPD data at Byte %d: 0x%llX.",
+ mss::c_str(i_target),
+ F.iv_byte,
+ i_spd_data[F.iv_byte]);
+
+ fapi2::buffer<uint8_t> l_buffer(i_spd_data[F.iv_byte]);
+
+ // Extracting desired bits
+ uint8_t l_field_bits = 0;
+ l_buffer.extractToRight<F.iv_start, F.iv_length>(l_field_bits);
+
+ return l_field_bits;
+}
+
+///
+/// @brief Helper function to extract byte information
+/// @param[in] i_target the dimm target
+/// @param[in] i_field the SPD field
+/// @param[in] i_spd_data the SPD data
+/// @return extracted byte (right aligned)
+///
+inline uint8_t extract_spd_field(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
+ const field_t& i_field,
+ const std::vector<uint8_t>& i_spd_data)
+{
+ FAPI_INF("%s SPD data at Byte %d: 0x%llX.",
+ mss::c_str(i_target),
+ i_field.iv_byte,
+ i_spd_data[i_field.iv_byte]);
+
+ fapi2::buffer<uint8_t> l_buffer(i_spd_data[i_field.iv_byte]);
+
+ // Extracting desired bits
+ uint8_t l_field_bits = 0;
+ l_buffer.extractToRight( l_field_bits, i_field.iv_start, i_field.iv_length );
+
+ return l_field_bits;
+}
+
+///
/// @class decoder
/// @brief Base SPD DRAM decoder
///
-class base_decoder
+class decoder
{
protected:
@@ -84,8 +134,10 @@ class base_decoder
std::vector<uint8_t> iv_spd_data;
rcw_settings iv_raw_card;
- // Default constructor deleted
- base_decoder() = delete;
+ ///
+ /// @brief default ctor
+ ///
+ decoder() = default;
///
/// @brief ctor
@@ -94,10 +146,10 @@ class base_decoder
/// @param[in] i_module_decoder shared_ptr to dimm module decoder
/// @param[in] i_raw_card raw pointer to rcd data
///
- base_decoder(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
- const std::vector<uint8_t>& i_spd_data,
- const std::shared_ptr<dimm_module_decoder>& i_module_decoder,
- const rcw_settings& i_raw_card)
+ decoder(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
+ const std::vector<uint8_t>& i_spd_data,
+ const std::shared_ptr<dimm_module_decoder>& i_module_decoder,
+ const rcw_settings& i_raw_card)
: iv_target(i_target),
iv_module_decoder(i_module_decoder),
iv_spd_data(i_spd_data),
@@ -107,7 +159,7 @@ class base_decoder
///
/// @brief Default dtor
///
- virtual ~base_decoder() = default;
+ virtual ~decoder() = default;
/////////////////////////
// Member Methods
OpenPOWER on IntegriCloud