Skip to content

Commit

Permalink
Generalize set fields in pre_data_init
Browse files Browse the repository at this point in the history
Added a definition file for data engine traits for
specialization purposes.  Moved pre_data_engine
definitions into a common templated version.

Change-Id: Ifb204da9cc6eb9d5d36b6eaeb1e1a5e99c97544e
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/69411
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com>
Dev-Ready: ANDRE A. MARIN <aamarin@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/69423
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Tested-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
aamarin authored and dcrowell77 committed Feb 5, 2019
1 parent 79fc8b6 commit 605baad
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 61 deletions.
28 changes: 7 additions & 21 deletions src/import/generic/memory/lib/utils/index.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -37,28 +37,14 @@
#define _MSS_INDEX_H_

#include <fapi2.H>
#include <generic/memory/lib/utils/shared/mss_generic_consts.H>
#include <generic/memory/lib/utils/pos.H>

///
/// @brief Trait classes for the mss::index functions
///
template<fapi2::TargetType T>
class indexTraits
{
public:
enum
{
MCS_PER_MC = 2,
PORTS_PER_MCBIST = 4,
PORTS_PER_MCS = 2,
DIMMS_PER_PORT = 2,
MBA_PER_MC = 2,
};
};

namespace mss
{

// TODO Add mc_type template on mss::index API"

///
/// @brief Return an attribute array index from a fapi2 target
/// @tparam T the fapi2::TargetType - derived
Expand All @@ -76,7 +62,7 @@ inline size_t index(const fapi2::Target<T>& i_target);
template<>
inline size_t index(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target)
{
typedef indexTraits<fapi2::TARGET_TYPE_DIMM> TT;
typedef procTraits<proc_type::NIMBUS> TT;
return mss::pos(i_target) % TT::DIMMS_PER_PORT;
}

Expand All @@ -88,7 +74,7 @@ inline size_t index(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target)
template<>
inline size_t index(const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target)
{
typedef indexTraits<fapi2::TARGET_TYPE_MCA> TT;
typedef procTraits<proc_type::NIMBUS> TT;
return mss::pos(i_target) % TT::PORTS_PER_MCS;
}

Expand All @@ -100,7 +86,7 @@ inline size_t index(const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target)
template<>
inline size_t index(const fapi2::Target<fapi2::TARGET_TYPE_MCS>& i_target)
{
typedef indexTraits<fapi2::TARGET_TYPE_MCS> TT;
typedef procTraits<proc_type::NIMBUS> TT;
return mss::pos(i_target) % TT::MCS_PER_MC;
}

Expand Down
52 changes: 14 additions & 38 deletions src/import/generic/memory/lib/utils/pos.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -37,6 +37,9 @@
#define _MSS_POS_H_

#include <fapi2.H>
#include <generic/memory/lib/utils/shared/mss_generic_consts.H>

// TODO Add mc_type template on mss::pos API"

///
/// @brief Trait classes for the mss::pos functions
Expand All @@ -49,17 +52,6 @@ class posTraits
// uint8_t and some attr_pos, uint32_t. We don't really care
// but the type checking in the macros sure does ...
typedef uint8_t pos_type;

enum
{
MC_PER_MODULE = 2,
MCS_PER_MC = 2,
PORTS_PER_MCBIST = 4,
PORTS_PER_MCS = 2,
DIMMS_PER_PORT = 2,
DIMMS_PER_MCS = PORTS_PER_MCS * DIMMS_PER_PORT,
MCS_PER_PROC = MC_PER_MODULE * MCS_PER_MC,
};
};

///
Expand All @@ -70,18 +62,6 @@ class posTraits<fapi2::TARGET_TYPE_DIMM>
{
public:
typedef uint32_t pos_type;

enum
{
MC_PER_MODULE = 2,
MCS_PER_MC = 2,
PORTS_PER_MCBIST = 4,
PORTS_PER_MCS = 2,
DIMMS_PER_PORT = 2,
DIMMS_PER_MCS = PORTS_PER_MCS * DIMMS_PER_PORT,
MCS_PER_PROC = MC_PER_MODULE * MCS_PER_MC,
DIMMS_PER_MCBIST = PORTS_PER_MCBIST * DIMMS_PER_PORT,
};
};

///
Expand All @@ -92,13 +72,6 @@ class posTraits<fapi2::TARGET_TYPE_PROC_CHIP>
{
public:
typedef uint32_t pos_type;

enum
{
MC_PER_MODULE = 2,
MCS_PER_MC = 2,
MCS_PER_PROC = MC_PER_MODULE * MCS_PER_MC,
};
};

namespace mss
Expand Down Expand Up @@ -161,16 +134,18 @@ fapi_try_exit:
/// @brief Return a DIMM's position from a fapi2 target
/// @param[in] i_target a target representing the target in question
/// @return The position relative to the chip
/// @warning Nimbus implementation only
///
template<>
inline posTraits<fapi2::TARGET_TYPE_DIMM>::pos_type
pos(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target)
{
typedef posTraits<fapi2::TARGET_TYPE_DIMM> TT;
typedef procTraits<proc_type::NIMBUS> T;

// Proc 0 is DIMM 0-15, proc 2 is 64-79 - 64 is the stride between processors
constexpr uint64_t DIMM_STRIDE_PER_PROC = 64;
constexpr uint64_t TOTAL_DIMM = TT::MC_PER_MODULE * TT::MCS_PER_MC * TT::PORTS_PER_MCS * TT::DIMMS_PER_PORT;
constexpr uint64_t TOTAL_DIMM = T::MC_PER_MODULE * T::MCS_PER_MC * T::PORTS_PER_MCS * T::DIMMS_PER_PORT;

TT::pos_type l_pos = 0;

Expand Down Expand Up @@ -214,7 +189,8 @@ template<>
inline posTraits<fapi2::TARGET_TYPE_MCA>::pos_type
relative_pos<fapi2::TARGET_TYPE_MCBIST>(const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target)
{
typedef posTraits<fapi2::TARGET_TYPE_MCA> TT;

typedef procTraits<proc_type::NIMBUS> TT;
return pos(i_target) % TT::PORTS_PER_MCBIST;
}

Expand All @@ -227,7 +203,7 @@ template<>
inline posTraits<fapi2::TARGET_TYPE_DIMM>::pos_type
relative_pos<fapi2::TARGET_TYPE_MCS>(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target)
{
typedef posTraits<fapi2::TARGET_TYPE_DIMM> TT;
typedef procTraits<proc_type::NIMBUS> TT;
return pos(i_target) % TT::DIMMS_PER_MCS;
}

Expand All @@ -240,7 +216,7 @@ template<>
inline posTraits<fapi2::TARGET_TYPE_DIMM>::pos_type
relative_pos<fapi2::TARGET_TYPE_MCA>(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target)
{
typedef posTraits<fapi2::TARGET_TYPE_DIMM> TT;
typedef procTraits<proc_type::NIMBUS> TT;
return pos(i_target) % TT::DIMMS_PER_PORT;
}

Expand All @@ -253,7 +229,7 @@ template<>
inline posTraits<fapi2::TARGET_TYPE_DIMM>::pos_type
relative_pos<fapi2::TARGET_TYPE_MCBIST>(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target)
{
typedef posTraits<fapi2::TARGET_TYPE_DIMM> TT;
typedef procTraits<proc_type::NIMBUS> TT;
return pos(i_target) % TT::DIMMS_PER_MCBIST;
}

Expand All @@ -266,7 +242,7 @@ template<>
inline posTraits<fapi2::TARGET_TYPE_MCS>::pos_type
relative_pos<fapi2::TARGET_TYPE_PROC_CHIP>(const fapi2::Target<fapi2::TARGET_TYPE_MCS>& i_target)
{
typedef posTraits<fapi2::TARGET_TYPE_MCS> TT;
typedef procTraits<proc_type::NIMBUS> TT;
return pos(i_target) % TT::MCS_PER_PROC;
}

Expand All @@ -279,7 +255,7 @@ template<>
inline posTraits<fapi2::TARGET_TYPE_MCA>::pos_type
relative_pos<fapi2::TARGET_TYPE_MCS>(const fapi2::Target<fapi2::TARGET_TYPE_MCA>& i_target)
{
typedef posTraits<fapi2::TARGET_TYPE_MCA> TT;
typedef procTraits<proc_type::NIMBUS> TT;
return pos(i_target) % TT::PORTS_PER_MCS;
}

Expand Down
33 changes: 31 additions & 2 deletions src/import/generic/memory/lib/utils/shared/mss_generic_consts.H
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,19 @@ enum generic_ffdc_codes
BASE_MODULE_TYPE = 0x101C,
BAD_SPD_DATA = 0x101D,
SET_FIELD = 0x101E,

// mss_freq functions
SELECT_SUPPORTED_FREQ = 0x101F,
FREQ_SCOREBOARD_REMOVE_FREQS_ABOVE_LIMIT = 0x1020,
FREQ_SCOREBOARD_REMOVE_FREQS_ABOVE_LIMIT_VECTOR = 0x1021,
FREQ_SCOREBOARD_REMOVE_FREQS_NOT_ON_LIST = 0x1022,
FREQ_SCOREBOARD_MAX_SUPPORTED_FREQ = 0x1023,
FREQ_SCOREBOARD_SUPPORTED_FREQS = 0x1024,
LIMIT_FREQ_BY_VPD = 0x1025,
SET_DIMM_TYPE = 0x1026,
SET_DRAM_GEN = 0x1027,
SET_HYBRID = 0x1027,
SET_HYBRID_MEDIA = 0x1028,
SET_MRANKS = 0x1029,
SET_DIMM_RANKS_CNFG = 0x1039,
};

///
Expand Down Expand Up @@ -255,6 +259,31 @@ enum nibble_mask
};


///
/// @brief Trait classes for proc_type
///
template< proc_type P >
class procTraits;

///
/// @brief Trait classes for proc_type - NIMBUS specialization
///
template< >
struct procTraits<proc_type::NIMBUS>
{
enum
{
MC_PER_MODULE = 2,
MCS_PER_MC = 2,
MCS_PER_PROC = MC_PER_MODULE * MCS_PER_MC,
PORTS_PER_MCBIST = 4,
PORTS_PER_MCS = 2,
DIMMS_PER_PORT = 2,
DIMMS_PER_MCS = PORTS_PER_MCS * DIMMS_PER_PORT,
DIMMS_PER_MCBIST = PORTS_PER_MCBIST * DIMMS_PER_PORT,
};
};

}// mss

#endif

0 comments on commit 605baad

Please sign in to comment.