Skip to content

Commit

Permalink
Adding after exp_omi_init unmask procedures and unit test
Browse files Browse the repository at this point in the history
- Unmasks for Global FIR, Global SPA ATTN, MMIO_MFIR,
  TLXT FIR, Explorer Local FIR, DLX MC_OMI FIR
- Adding templated after_mc_omi_init for Explorer
- Unit test to check all bit settings

Change-Id: I196f192320d17f546e3ed4d091c0d27795754fe0
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/91312
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Mark Pizzutillo <mark.pizzutillo@ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: MATTHEW I HICKMAN <matthew.hickman@ibm.com>
Reviewed-by: Jennifer A Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/91349
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M Crowell <dcrowell@us.ibm.com>
  • Loading branch information
NicoFajardo authored and dcrowell77 committed Feb 25, 2020
1 parent 504aa7f commit 9b51064
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 9 deletions.
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2018,2019 */
/* Contributors Listed Below - COPYRIGHT 2018,2020 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -32,6 +32,7 @@
// *HWP Level: 2
// *HWP Consumed by: HB

#include <lib/shared/exp_defaults.H>
#include <exp_omi_init.H>
#include <exp_oc_regs.H>
#include <lib/inband/exp_inband.H>
Expand All @@ -41,6 +42,8 @@
#include <generic/memory/mss_git_data_helper.H>
#include <lib/workarounds/exp_omi_workarounds.H>
#include <generic/memory/lib/utils/find.H>
#include <generic/memory/lib/utils/fir/gen_mss_unmask.H>
#include <lib/fir/exp_fir.H>

///
/// @brief Verify we know how to talk to the connected device
Expand Down Expand Up @@ -653,6 +656,7 @@ fapi2::ReturnCode exp_omi_init(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>
FAPI_TRY(omiSetMMIOEnableBAR(i_target));
FAPI_TRY(omiSetACTagPASIDMetaData(i_target));
FAPI_TRY(omiEnableAFU(i_target));
FAPI_TRY(mss::unmask::after_mc_omi_init<mss::mc_type::EXPLORER>(i_target));

fapi_try_exit:

Expand Down
Expand Up @@ -95,5 +95,73 @@ struct firTraits<EXPLR_RDF_FIR>
static constexpr fapi2::TargetType T = fapi2::TARGET_TYPE_OCMB_CHIP;
};

///
/// @brief FIR Register Traits for Explorer LOCAL FIR
///
template <>
struct firTraits<EXPLR_TP_MB_UNIT_TOP_LOCAL_FIR>
{
static constexpr uint64_t REG = EXPLR_TP_MB_UNIT_TOP_LOCAL_FIR;
static constexpr uint64_t ACT0 = EXPLR_TP_MB_UNIT_TOP_LOCAL_FIR_ACTION0;
static constexpr uint64_t ACT1 = EXPLR_TP_MB_UNIT_TOP_LOCAL_FIR_ACTION1;
static constexpr uint64_t MASK = EXPLR_TP_MB_UNIT_TOP_LOCAL_FIR_MASK;
static constexpr uint64_t MASK_AND = EXPLR_TP_MB_UNIT_TOP_LOCAL_FIR_MASK_AND;
static constexpr uint64_t MASK_OR = EXPLR_TP_MB_UNIT_TOP_LOCAL_FIR_MASK_OR;

// Target type of this register
static constexpr fapi2::TargetType T = fapi2::TARGET_TYPE_OCMB_CHIP;
};

///
/// @brief FIR Register Traits for Explorer TLX FIR
///
template <>
struct firTraits<EXPLR_TLXT_TLXFIRQ>
{
static constexpr uint64_t REG = EXPLR_TLXT_TLXFIRQ;
static constexpr uint64_t ACT0 = EXPLR_TLXT_TLXFIRACT0;
static constexpr uint64_t ACT1 = EXPLR_TLXT_TLXFIRACT1;
static constexpr uint64_t MASK = EXPLR_TLXT_TLXFIRMASK;
static constexpr uint64_t MASK_AND = EXPLR_TLXT_TLXFIRMASK_AND;
static constexpr uint64_t MASK_OR = EXPLR_TLXT_TLXFIRMASK_OR;

// Target type of this register
static constexpr fapi2::TargetType T = fapi2::TARGET_TYPE_OCMB_CHIP;
};

///
/// @brief FIR Register Traits for Explorer MC_OMI FIR
///
template <>
struct firTraits<EXPLR_DLX_MC_OMI_FIR_REG>
{
static constexpr uint64_t REG = EXPLR_DLX_MC_OMI_FIR_REG;
static constexpr uint64_t ACT0 = EXPLR_DLX_MC_OMI_FIR_ACTION0_REG;
static constexpr uint64_t ACT1 = EXPLR_DLX_MC_OMI_FIR_ACTION1_REG;
static constexpr uint64_t MASK = EXPLR_DLX_MC_OMI_FIR_MASK_REG;
static constexpr uint64_t MASK_AND = EXPLR_DLX_MC_OMI_FIR_MASK_REG_AND;
static constexpr uint64_t MASK_OR = EXPLR_DLX_MC_OMI_FIR_MASK_REG_OR;

// Target type of this register
static constexpr fapi2::TargetType T = fapi2::TARGET_TYPE_OCMB_CHIP;
};

///
/// @brief FIR Register Traits for Explorer MMIO MFIR
///
template <>
struct firTraits<EXPLR_MMIO_MFIR>
{
static constexpr uint64_t REG = EXPLR_MMIO_MFIR;
static constexpr uint64_t ACT0 = EXPLR_MMIO_MFIRACT0;
static constexpr uint64_t ACT1 = EXPLR_MMIO_MFIRACT1;
static constexpr uint64_t MASK = EXPLR_MMIO_MFIRMASK;
static constexpr uint64_t MASK_AND = EXPLR_MMIO_MFIRMASK_AND;
static constexpr uint64_t MASK_OR = EXPLR_MMIO_MFIRMASK_OR;

// Target type of this register
static constexpr fapi2::TargetType T = fapi2::TARGET_TYPE_OCMB_CHIP;
};

} // end mss ns
#endif
Expand Up @@ -32,11 +32,11 @@
// *HWP Level: 3
// *HWP Consumed by: FSP:HB

#include <lib/shared/exp_defaults.H>
#include <fapi2.H>
#include <generic/memory/lib/utils/scom.H>
#include <lib/shared/exp_defaults.H>
#include <explorer_scom_addresses.H>
#include <explorer_scom_addresses_fld.H>
#include <generic/memory/lib/utils/scom.H>
#include <lib/fir/exp_fir.H>
#include <lib/fir/exp_fir_traits.H>
#include <generic/memory/lib/utils/fir/gen_mss_unmask.H>
Expand Down Expand Up @@ -150,6 +150,97 @@ fapi_try_exit:
return fapi2::current_err;
}


///
/// @brief Unmask Explorer Global FIR and SPECIAL ATTN mask registers afer exp_omi_init
/// @param[in] i_target Explorer to initialize
/// @return fapi2:ReturnCode FAPI2_RC_SUCCESS if success, else error code
///
template<>
fapi2::ReturnCode after_mc_omi_init<mss::mc_type::EXPLORER>(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target)
{
fapi2::ReturnCode l_rc1 = fapi2::FAPI2_RC_SUCCESS;
fapi2::ReturnCode l_rc2 = fapi2::FAPI2_RC_SUCCESS;
fapi2::ReturnCode l_rc3 = fapi2::FAPI2_RC_SUCCESS;
fapi2::ReturnCode l_rc4 = fapi2::FAPI2_RC_SUCCESS;

fapi2::buffer<uint64_t> l_global_fir_mask_reg;
fapi2::buffer<uint64_t> l_global_spa_attn_reg;

mss::fir::reg<EXPLR_MMIO_MFIR> l_exp_mmio_mfir_reg(i_target, l_rc1);
mss::fir::reg<EXPLR_TLXT_TLXFIRQ> l_exp_tlxt_fir_reg(i_target, l_rc2);
mss::fir::reg<EXPLR_TP_MB_UNIT_TOP_LOCAL_FIR> l_exp_local_fir_reg(i_target, l_rc3);
mss::fir::reg<EXPLR_DLX_MC_OMI_FIR_REG> l_exp_dlx_omi_fir_reg(i_target, l_rc4);

FAPI_TRY(l_rc1, "for target %s unable to create fir::reg for EXPLR_MMIO_MFIR 0x%0x",
mss::c_str(i_target), EXPLR_MMIO_MFIR);
FAPI_TRY(l_rc2, "for target %s unable to create fir::reg for EXPLR_TLXT_TLXFIRQ 0x%0x",
mss::c_str(i_target), EXPLR_TLXT_TLXFIRQ);
FAPI_TRY(l_rc3, "for target %s unable to create fir::reg for EXPLR_TP_MB_UNIT_TOP_LOCAL_FIR 0x%0x",
mss::c_str(i_target), EXPLR_TP_MB_UNIT_TOP_LOCAL_FIR);
FAPI_TRY(l_rc4, "for target %s unable to create fir::reg for EXPLR_DLX_MC_OMI_FIR_REG 0x%0x",
mss::c_str(i_target), EXPLR_DLX_MC_OMI_FIR_REG);

// Pull global fir mask state and unmask bits per spec
FAPI_TRY(fapi2::getScom(i_target, EXPLR_TP_MB_UNIT_TOP_FIR_MASK, l_global_fir_mask_reg));
l_global_fir_mask_reg.clearBit<EXPLR_TP_MB_UNIT_TOP_XFIR_IN3>()
.clearBit<EXPLR_TP_MB_UNIT_TOP_XFIR_IN4>()
.clearBit<EXPLR_TP_MB_UNIT_TOP_XFIR_IN7>()
.clearBit<EXPLR_TP_MB_UNIT_TOP_XFIR_IN8>()
.clearBit<EXPLR_TP_MB_UNIT_TOP_XFIR_IN9>()
.clearBit<EXPLR_TP_MB_UNIT_TOP_XFIR_IN11>()
.clearBit<EXPLR_TP_MB_UNIT_TOP_XFIR_IN12>();
FAPI_TRY(fapi2::putScom(i_target, EXPLR_TP_MB_UNIT_TOP_FIR_MASK, l_global_fir_mask_reg));

// Pull global special attn state and unmask bits per spec
FAPI_TRY(fapi2::getScom(i_target, EXPLR_TP_MB_UNIT_TOP_SPA_MASK, l_global_spa_attn_reg));
l_global_spa_attn_reg.clearBit<EXPLR_TP_MB_UNIT_TOP_SPATTN_IN5>();
FAPI_TRY(fapi2::putScom(i_target, EXPLR_TP_MB_UNIT_TOP_SPA_MASK, l_global_spa_attn_reg));

// Setup MMIO MFIR unmasks per spec
FAPI_TRY(l_exp_mmio_mfir_reg.recoverable_error<EXPLR_MMIO_MFIR_SCOM_ERR>()
.local_checkstop<EXPLR_MMIO_MFIR_FSM_PERR>()
.local_checkstop<EXPLR_MMIO_MFIR_FIFO_OVERFLOW>()
.local_checkstop<EXPLR_MMIO_MFIR_CTL_REG_PERR>()
.recoverable_error<EXPLR_MMIO_MFIR_INFO_REG_PERR>()
.write());

// Setup TLXT FIR unmasks per spec
FAPI_TRY(l_exp_tlxt_fir_reg.local_checkstop<EXPLR_TLXT_TLXFIRQ_TLXT_PARITY_ERROR>()
.recoverable_error<EXPLR_TLXT_TLXFIRQ_TLXT_RECOVERABLE_ERROR>()
.recoverable_error<EXPLR_TLXT_TLXFIRQ_TLXT_CONFIG_ERROR>()
.local_checkstop<EXPLR_TLXT_TLXFIRQ_TLXT_INFORMATIONAL_PERROR>()
.recoverable_error<EXPLR_TLXT_TLXFIRQ_TLXT_HARD_ERROR>()
.local_checkstop<EXPLR_TLXT_TLXFIRQ_TLXR_OC_MALFORMED>()
.recoverable_error<EXPLR_TLXT_TLXFIRQ_TLXR_OC_PROTOCOL_ERROR>()
.local_checkstop<EXPLR_TLXT_TLXFIRQ_TLXR_ADDR_XLAT>()
.local_checkstop<EXPLR_TLXT_TLXFIRQ_TLXR_METADATA_UNC_DPERR>()
.local_checkstop<EXPLR_TLXT_TLXFIRQ_TLXR_OC_UNSUPPORTED>()
.local_checkstop<EXPLR_TLXT_TLXFIRQ_TLXR_OC_FATAL>()
.local_checkstop<EXPLR_TLXT_TLXFIRQ_TLXR_CONTROL_ERROR>()
.local_checkstop<EXPLR_TLXT_TLXFIRQ_TLXR_INTERNAL_ERROR>()
.recoverable_error<EXPLR_TLXT_TLXFIRQ_TLXR_INFORMATIONAL>()
.write());

// Setup LOCAL FIR unmasks per spec
FAPI_TRY(l_exp_local_fir_reg.recoverable_error<EXPLR_TP_MB_UNIT_TOP_LOCAL_FIR_IN0>()
.recoverable_error<EXPLR_TP_MB_UNIT_TOP_LOCAL_FIR_IN1>()
.recoverable_error<EXPLR_TP_MB_UNIT_TOP_LOCAL_FIR_IN2>()
.recoverable_error<EXPLR_TP_MB_UNIT_TOP_LOCAL_FIR_IN8>()
.recoverable_error<EXPLR_TP_MB_UNIT_TOP_LOCAL_FIR_IN63>()
.write());

// Setup MC OMI FIR unmasks per spec
FAPI_TRY(l_exp_dlx_omi_fir_reg.recoverable_error<EXPLR_DLX_MC_OMI_FIR_REG_DL0_FLIT_CE>()
.write());

return fapi2::FAPI2_RC_SUCCESS;

fapi_try_exit:

return fapi2::current_err;
}

///
/// @brief Unmask and setup actions performed after mss_scominit
/// @param[in] i_target the fapi2::Target
Expand Down
8 changes: 3 additions & 5 deletions src/import/generic/memory/lib/utils/fir/gen_mss_fir.H
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2018 */
/* Contributors Listed Below - COPYRIGHT 2018,2020 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -52,11 +52,9 @@ namespace mss
/// @brief FIR Register Traits
/// @tparam R FIR Register
///

template <uint64_t R>
struct firTraits;


namespace fir
{

Expand Down Expand Up @@ -232,6 +230,6 @@ class reg
}
};

}
}
} // end ns fir
} // end ns mss
#endif
12 changes: 11 additions & 1 deletion src/import/generic/memory/lib/utils/fir/gen_mss_unmask.H
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2018,2019 */
/* Contributors Listed Below - COPYRIGHT 2018,2020 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -66,6 +66,16 @@ fapi2::ReturnCode after_draminit_mc( const fapi2::Target<T>& i_target );
template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T >
fapi2::ReturnCode after_draminit_training( const fapi2::Target<T>& i_target );

///
/// @brief Unmask and setup actions performed after *_omi_init
/// @tparam MC the memory controller type
/// @tparam T the fapi2::TargetType which hold the FIR bits
/// @param[in] i_target the fapi2::Target
/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok
///
template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T >
fapi2::ReturnCode after_mc_omi_init( const fapi2::Target<T>& i_target );

///
/// @brief Unmask and setup actions performed after mss_scominit
/// @tparam MC the memory controller type
Expand Down

0 comments on commit 9b51064

Please sign in to comment.