<commit_before>/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/import/generic/memory/lib/spd/lrdimm/ddr4/lrdimm_decoder_ddr4.H $ */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2016,2019                        */
/* [+] 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                                                     */

///
/// @file lrdimm_decoder_ddr4.H
/// @brief LRDIMM module SPD decoder declarations
///
// *HWP HWP Owner: <NAME> <<EMAIL>>
// *HWP HWP Backup: <NAME> <<EMAIL>>
// *HWP Team: Memory
// *HWP Level: 3
// *HWP Consumed by: HB:FSP


#ifndef _MSS_LRDIMM_DECODER_DDR4_H_
#define _MSS_LRDIMM_DECODER_DDR4_H_

#include <fapi2.H>
#include <vector>
#include <generic/memory/lib/spd/common/dimm_module_decoder.H>

namespace mss
{
namespace spd
{
namespace ddr4
{
namespace lrdimm
{

///
/// @brief LRDIMM module decoder for revision 1.0
///
class decoder_v1_0 : public dimm_module_decoder
{
    protected:

        const fapi2::Target<fapi2::TARGET_TYPE_DIMM> iv_target;

    public:

        // First field - SPD byte
        // Second field - start bit
        // Third field - bit length
        constexpr static field_t MODULE_NOMINAL_HEIGHT{128, 3, 5};
        constexpr static field_t RAW_CARD_EXTENSION{128, 0, 3};

        constexpr static field_t FRONT_MODULE_THICKNESS{129, 4, 4};
        constexpr static field_t BACK_MODULE_THICKNESS{129, 0, 4};

        constexpr static field_t NUM_REGISTERS_USED{131, 6, 2};
        constexpr static field_t NUM_ROWS_OF_DRAMS{131, 4, 2};
        constexpr static field_t REGISTER_TYPE{131, 0, 4};

        constexpr static field_t HEAT_SPREADER_THERM_CHAR{132, 1, 7};
        constexpr static field_t HEAT_SPREADER_SOLUTION{132, 0, 1};

        constexpr static field_t CONTINUATION_CODES{133, 1, 7};
        constexpr static field_t ADDR_MAPPING{136, 7, 1};

        constexpr static field_t CKE_DRIVE_STRENGTH{137, 6, 2};
        constexpr static field_t ODT_DRIVE_STRENGTH{137, 4, 2};
        constexpr static field_t CA_DRIVE_STRENGTH{137, 2, 2};
        constexpr static field_t CS_DRIVE_STRENGTH{137, 0, 2};

        constexpr static field_t B_SIDE_DRIVE_STRENGTH{138, 6, 2};
        constexpr static field_t A_SIDE_DRIVE_STRENGTH{138, 4, 2};
        constexpr static field_t BCOM_BODT_BCKE_DRIVE_STRENGTH{138, 3, 1};
        constexpr static field_t BCK_DRIVE_STRENGTH{138, 2, 1};
        constexpr static field_t RCD_SLEW_CNTRL{138, 1, 1 };

        constexpr static field_t VREF_DQ_RANK0{140, 2, 6};
        constexpr static field_t VREF_DQ_RANK1{141, 2, 6};
        constexpr static field_t VREF_DQ_RANK2{142, 2, 6};
        constexpr static field_t VREF_DQ_RANK3{143, 2, 6};

        constexpr static field_t DATA_BUFFER_MDQ{145, 1, 3};

        constexpr static field_t DRAM_VREF_DQ_RANGE{155, 4, 4};
        constexpr static field_t DATA_BUFFER_VREF_DQ{155, 3, 1};

        constexpr static field_t DATA_BUFFER_GAIN_ADJUST{156, 7, 1};
        constexpr static field_t DATA_BUFFER_DFE{156, 6, 1};

        // Allows injection of errors for testing
        // TK - Consider API change to use setter/getters
        // for this instance variable, RDIMM decoder
        // uses this interface so they have to match - AAM
        std::vector<uint8_t> iv_spd_data;

        // deleted default ctor
        decoder_v1_0() = delete;

        ///
        /// @brief ctor
        /// @param[in] i_target dimm target
        /// @param[in] i_spd_data vector DIMM SPD data
        ///
        decoder_v1_0(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
                     const std::vector<uint8_t>& i_spd_data)
            : iv_target(i_target), iv_spd_data(i_spd_data)
        {}

        ///
        /// @brief default dtor
        ///
        virtual ~decoder_v1_0() = default;

        ///<commit_msg>Remove mss::c_str dependency for SPD decoder for future reuse<commit_after>/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/import/generic/memory/lib/spd/lrdimm/ddr4/lrdimm_decoder_ddr4.H $ */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2016,2019                        */
/* [+] 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                                                     */

///
/// @file lrdimm_decoder_ddr4.H
/// @brief LRDIMM module SPD decoder declarations
///
// *HWP HWP Owner: <NAME> <<EMAIL>>
// *HWP HWP Backup: Stephen Glancy <<EMAIL>>
// *HWP Team: Memory
// *HWP Level: 3
// *HWP Consumed by: HB:FSP


#ifndef _MSS_LRDIMM_DECODER_DDR4_H_
#define _MSS_LRDIMM_DECODER_DDR4_H_

#include <fapi2.H>
#include <vector>
#include <generic/memory/lib/spd/common/dimm_module_decoder.H>

namespace mss
{
namespace spd
{
namespace ddr4
{
namespace lrdimm
{

///
/// @brief LRDIMM module decoder for revision 1.0
///
class decoder_v1_0 : public dimm_module_decoder
{
    public:

        // First field - SPD byte
        // Second field - start bit
        // Third field - bit length
        constexpr static field_t MODULE_NOMINAL_HEIGHT{128, 3, 5};
        constexpr static field_t RAW_CARD_EXTENSION{128, 0, 3};

        constexpr static field_t FRONT_MODULE_THICKNESS{129, 4, 4};
        constexpr static field_t BACK_MODULE_THICKNESS{129, 0, 4};

        constexpr static field_t NUM_REGISTERS_USED{131, 6, 2};
        constexpr static field_t NUM_ROWS_OF_DRAMS{131, 4, 2};
        constexpr static field_t REGISTER_TYPE{131, 0, 4};

        constexpr static field_t HEAT_SPREADER_THERM_CHAR{132, 1, 7};
        constexpr static field_t HEAT_SPREADER_SOLUTION{132, 0, 1};

        constexpr static field_t CONTINUATION_CODES{133, 1, 7};
        constexpr static field_t ADDR_MAPPING{136, 7, 1};

        constexpr static field_t CKE_DRIVE_STRENGTH{137, 6, 2};
        constexpr static field_t ODT_DRIVE_STRENGTH{137, 4, 2};
        constexpr static field_t CA_DRIVE_STRENGTH{137, 2, 2};
        constexpr static field_t CS_DRIVE_STRENGTH{137, 0, 2};

        constexpr static field_t B_SIDE_DRIVE_STRENGTH{138, 6, 2};
        constexpr static field_t A_SIDE_DRIVE_STRENGTH{138, 4, 2};
        constexpr static field_t BCOM_BODT_BCKE_DRIVE_STRENGTH{138, 3, 1};
        constexpr static field_t BCK_DRIVE_STRENGTH{138, 2, 1};
        constexpr static field_t RCD_SLEW_CNTRL{138, 1, 1 };

        constexpr static field_t VREF_DQ_RANK0{140, 2, 6};
        constexpr static field_t VREF_DQ_RANK1{141, 2, 6};
        constexpr static field_t VREF_DQ_RANK2{142, 2, 6};
        constexpr static field_t VREF_DQ_RANK3{143, 2, 6};

        constexpr static field_t DATA_BUFFER_MDQ{145, 1, 3};

        constexpr static field_t DRAM_VREF_DQ_RANGE{155, 4, 4};
        constexpr static field_t DATA_BUFFER_VREF_DQ{155, 3, 1};

        constexpr static field_t DATA_BUFFER_GAIN_ADJUST{156, 7, 1};
        constexpr static field_t DATA_BUFFER_DFE{156, 6, 1};

        // deleted default ctor
        decoder_v1_0() = delete;

        ///
        /// @brief ctor
        /// @param[in] i_target dimm target
        /// @param[in] i_spd_data vector DIMM SPD data
        ///
        decoder_v1_0(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
                     const std::vector<uint8_t>& i_spd_data)
            : dimm_module_decoder(i_target, i_spd_data)
        {}

        ///
        /// @brief default dtor
        ///
        virtual ~decoder_v1_0() = default;

        ///
{'fraction_non_alphanumeric': 0.08883958715153853, 'fraction_numerical': 0.035400790971351404, 'mean_word_length': 1.5752608047690015, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 62, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3523268', 'n_tokens_mistral': 3313, 'n_tokens_neox': 2945, 'n_words': 795}