From c9a86977d3eb0902e16c51338da83069117d4b7d Mon Sep 17 00:00:00 2001 From: Joe McGill Date: Fri, 1 Dec 2017 13:43:21 -0600 Subject: shift XBUS FIR programming inits for secure boot general approach: - enable runtime FIR settings in SBE code, for all present XBUS regions - remove FIR initialization from HB code which runs prior to SMP build - update HB HWPs to re-mask XBUSes which are present but not functionally used CQ: SW409902 CQ: SW409903 CQ: SW409905 Change-Id: I378ed2ca39c0d5be894420bfc3257e41e3e95de5 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/50519 Tested-by: FSP CI Jenkins Tested-by: Jenkins Server Tested-by: Hostboot CI Tested-by: PPE CI Reviewed-by: Thi N. Tran Reviewed-by: Sachin Gupta Reviewed-by: Jennifer A. Stofer Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/50529 Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Reviewed-by: Daniel M. Crowell --- .../p9/procedures/hwp/io/p9_io_xbus_scominit.C | 45 +++---- .../p9/procedures/hwp/io/p9_io_xbus_scominit.mk | 3 +- .../hwp/nest/p9_chiplet_fabric_scominit.C | 89 ++++++++++---- .../p9/procedures/hwp/nest/p9_chiplet_scominit.C | 133 ++++++++++++++++++--- .../chips/p9/procedures/hwp/nest/p9_fab_iovalid.C | 67 ++++++----- .../p9/procedures/hwp/nest/p9_fbc_smp_utils.H | 5 +- .../procedures/hwp/nest/p9_sys_chiplet_scominit.C | 78 +++++++++--- 7 files changed, 307 insertions(+), 113 deletions(-) diff --git a/src/import/chips/p9/procedures/hwp/io/p9_io_xbus_scominit.C b/src/import/chips/p9/procedures/hwp/io/p9_io_xbus_scominit.C index dff5af3dc..2e42b6527 100644 --- a/src/import/chips/p9/procedures/hwp/io/p9_io_xbus_scominit.C +++ b/src/import/chips/p9/procedures/hwp/io/p9_io_xbus_scominit.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2017 */ +/* Contributors Listed Below - COPYRIGHT 2015,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -49,12 +49,15 @@ //------------------------------------------------------------------------------ // Includes //------------------------------------------------------------------------------ +#include #include #include #include #include #include #include +#include +#include enum { @@ -62,13 +65,6 @@ enum ENUM_ATTR_XBUS_GROUP_1 }; -//------------------------------------------------------------------------------ -// Constant definitions -//------------------------------------------------------------------------------ -const uint64_t FIR_ACTION0 = 0x0000000000000000ULL; -const uint64_t FIR_ACTION1 = 0xFFFFFFFFFFFF0000ULL; -const uint64_t FIR_MASK = 0xDF9797FFFFFFC000ULL; - //------------------------------------------------------------------------------ // Function definitions //------------------------------------------------------------------------------ @@ -219,20 +215,27 @@ fapi2::ReturnCode p9_io_xbus_scominit( break; } - // configure FIR + // configure PHY FIR, only if not already setup by SBE { - FAPI_TRY(fapi2::putScom(i_target, - XBUS_FIR_ACTION0_REG, - FIR_ACTION0), - "Error from putScom (XBUS_FIR_ACTION0_REG)"); - FAPI_TRY(fapi2::putScom(i_target, - XBUS_FIR_ACTION1_REG, - FIR_ACTION1), - "Error from putScom (XBUS_FIR_ACTION1_REG)"); - FAPI_TRY(fapi2::putScom(i_target, - XBUS_FIR_MASK_REG, - FIR_MASK), - "Error from putScom (XBUS_FIR_MASK_REG)"); + fapi2::buffer l_scom_data; + FAPI_TRY(fapi2::getScom(l_proc, PU_PB_CENT_SM0_PB_CENT_FIR_REG, l_scom_data), + "Error from getScom (PU_PB_CENT_SM0_PB_CENT_FIR_REG)"); + + if (!l_scom_data.getBit()) + { + FAPI_TRY(fapi2::putScom(i_target, + XBUS_FIR_ACTION0_REG, + XBUS_PHY_FIR_ACTION0), + "Error from putScom (XBUS_FIR_ACTION0_REG)"); + FAPI_TRY(fapi2::putScom(i_target, + XBUS_FIR_ACTION1_REG, + XBUS_PHY_FIR_ACTION1), + "Error from putScom (XBUS_FIR_ACTION1_REG)"); + FAPI_TRY(fapi2::putScom(i_target, + XBUS_FIR_MASK_REG, + XBUS_PHY_FIR_MASK), + "Error from putScom (XBUS_FIR_MASK_REG)"); + } } // mark HWP exit diff --git a/src/import/chips/p9/procedures/hwp/io/p9_io_xbus_scominit.mk b/src/import/chips/p9/procedures/hwp/io/p9_io_xbus_scominit.mk index 51064f2b1..aad8b4a05 100644 --- a/src/import/chips/p9/procedures/hwp/io/p9_io_xbus_scominit.mk +++ b/src/import/chips/p9/procedures/hwp/io/p9_io_xbus_scominit.mk @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2015,2016 +# Contributors Listed Below - COPYRIGHT 2015,2018 # [+] International Business Machines Corp. # # @@ -24,4 +24,5 @@ # IBM_PROLOG_END_TAG PROCEDURE=p9_io_xbus_scominit +$(call ADD_MODULE_INCDIR,$(PROCEDURE),$(ROOTPATH)/chips/p9/procedures/hwp/nest/) $(call BUILD_PROCEDURE) diff --git a/src/import/chips/p9/procedures/hwp/nest/p9_chiplet_fabric_scominit.C b/src/import/chips/p9/procedures/hwp/nest/p9_chiplet_fabric_scominit.C index 361a1cf83..833cf8ba9 100644 --- a/src/import/chips/p9/procedures/hwp/nest/p9_chiplet_fabric_scominit.C +++ b/src/import/chips/p9/procedures/hwp/nest/p9_chiplet_fabric_scominit.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2017 */ +/* Contributors Listed Below - COPYRIGHT 2017,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -43,6 +43,8 @@ #include #include #include +#include +#include #include #include @@ -51,17 +53,6 @@ #include #include -//------------------------------------------------------------------------------ -// Constant definitions -//------------------------------------------------------------------------------ -const uint64_t FBC_IOE_TL_FIR_ACTION0 = 0x0000000000000000ULL; -const uint64_t FBC_IOE_TL_FIR_ACTION1 = 0x0000000000000000ULL; -const uint64_t FBC_IOE_TL_FIR_MASK = 0xFF6DF0303FFFFF1FULL; - -const uint64_t FBC_IOE_DL_FIR_ACTION0 = 0x0000000000000000ULL; -const uint64_t FBC_IOE_DL_FIR_ACTION1 = 0x0303C00000001FFCULL; -const uint64_t FBC_IOE_DL_FIR_MASK = 0xFCFC3FFFFFFFE003ULL; - //------------------------------------------------------------------------------ // Function definitions //------------------------------------------------------------------------------ @@ -74,6 +65,7 @@ fapi2::ReturnCode p9_chiplet_fabric_scominit(const fapi2::Target FAPI_SYSTEM; std::vector> l_xbus_chiplets; std::vector> l_obus_chiplets; + fapi2::buffer l_fbc_cent_fir_data; fapi2::ATTR_PROC_FABRIC_OPTICS_CONFIG_MODE_Type l_fbc_optics_cfg_mode = { fapi2::ENUM_ATTR_PROC_FABRIC_OPTICS_CONFIG_MODE_SMP }; FAPI_DBG("Start"); @@ -105,14 +97,64 @@ fapi2::ReturnCode p9_chiplet_fabric_scominit(const fapi2::Target(); - if (l_xbus_chiplets.size()) + // configure TL FIR, only if not already setup by SBE + FAPI_TRY(fapi2::getScom(i_target, PU_PB_CENT_SM0_PB_CENT_FIR_REG, l_fbc_cent_fir_data), + "Error from getScom (PU_PB_CENT_SM0_PB_CENT_FIR_REG)"); + + if (!l_fbc_cent_fir_data.getBit()) { FAPI_TRY(fapi2::putScom(i_target, PU_PB_IOE_FIR_ACTION0_REG, FBC_IOE_TL_FIR_ACTION0), "Error from putScom (PU_PB_IOE_FIR_ACTION0_REG)"); FAPI_TRY(fapi2::putScom(i_target, PU_PB_IOE_FIR_ACTION1_REG, FBC_IOE_TL_FIR_ACTION1), "Error from putScom (PU_PB_IOE_FIR_ACTION1_REG)"); - FAPI_TRY(fapi2::putScom(i_target, PU_PB_IOE_FIR_MASK_REG, FBC_IOE_TL_FIR_MASK), - "Error from putScom (PU_PB_IOE_FIR_MASK_REG)"); + + fapi2::buffer l_fir_mask = FBC_IOE_TL_FIR_MASK; + + if (!l_xbus_chiplets.size()) + { + // no valid links, mask + l_fir_mask.flush<1>(); + } + else + { + bool l_x_functional[P9_FBC_UTILS_MAX_ELECTRICAL_LINKS] = + { + false, + false, + false + }; + uint64_t l_x_non_functional_mask[P9_FBC_UTILS_MAX_ELECTRICAL_LINKS] = + { + FBC_IOE_TL_FIR_MASK_X0_NF, + FBC_IOE_TL_FIR_MASK_X1_NF, + FBC_IOE_TL_FIR_MASK_X2_NF + }; + + for (auto l_iter = l_xbus_chiplets.begin(); + l_iter != l_xbus_chiplets.end(); + l_iter++) + { + uint8_t l_unit_pos; + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, + *l_iter, + l_unit_pos), + "Error from FAPI_ATTR_GET (ATTR_CHIP_UNIT_POS)"); + l_x_functional[l_unit_pos] = true; + } + + for (uint8_t ll = 0; + ll < P9_FBC_UTILS_MAX_ELECTRICAL_LINKS; + ll++) + { + if (!l_x_functional[ll]) + { + l_fir_mask |= l_x_non_functional_mask[ll]; + } + } + + FAPI_TRY(fapi2::putScom(i_target, PU_PB_IOE_FIR_MASK_REG, l_fir_mask), + "Error from putScom (PU_PB_IOE_FIR_MASK_REG)"); + } } // setup IOE (XBUS FBC IO) DL SCOMs @@ -131,13 +173,16 @@ fapi2::ReturnCode p9_chiplet_fabric_scominit(const fapi2::Target()) + { + FAPI_TRY(fapi2::putScom(*l_iter, XBUS_LL0_IOEL_FIR_ACTION0_REG, FBC_IOE_DL_FIR_ACTION0), + "Error from putScom (XBUS_LL0_IOEL_FIR_ACTION0_REG)"); + FAPI_TRY(fapi2::putScom(*l_iter, XBUS_LL0_IOEL_FIR_ACTION1_REG, FBC_IOE_DL_FIR_ACTION1), + "Error from putScom (XBUS_LL0_IOEL_FIR_ACTION1_REG)"); + FAPI_TRY(fapi2::putScom(*l_iter, XBUS_LL0_LL0_LL0_IOEL_FIR_MASK_REG, FBC_IOE_DL_FIR_MASK), + "Error from putScom (XBUS_LL0_LL0_LL0_IOEL_FIR_MASK_REG)"); + } } // set FBC optics config mode attribute diff --git a/src/import/chips/p9/procedures/hwp/nest/p9_chiplet_scominit.C b/src/import/chips/p9/procedures/hwp/nest/p9_chiplet_scominit.C index 7c381f53b..635b338a6 100644 --- a/src/import/chips/p9/procedures/hwp/nest/p9_chiplet_scominit.C +++ b/src/import/chips/p9/procedures/hwp/nest/p9_chiplet_scominit.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2017 */ +/* Contributors Listed Below - COPYRIGHT 2015,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -40,6 +40,7 @@ // Includes //------------------------------------------------------------------------------ #include +#include #include #include #include @@ -50,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -72,17 +74,6 @@ const uint64_t FBC_IOO_DL_FIR_MASK = 0xFCFC3FFFFCFF00F3ULL; // link 0,1 internal errors are a simulation artifact in dd1 so they need to be masked const uint64_t FBC_IOO_DL_FIR_MASK_SIM = 0xFCFC3FFFFCFF00FFULL; -static const uint8_t OBRICK0_POS = 0x0; -static const uint8_t OBRICK1_POS = 0x1; -static const uint8_t OBRICK2_POS = 0x2; -static const uint8_t OBRICK9_POS = 0x9; -static const uint8_t OBRICK10_POS = 0xA; -static const uint8_t OBRICK11_POS = 0xB; - -static const uint8_t PERV_OB_CPLT_CONF1_OBRICKA_IOVALID = 0x6; -static const uint8_t PERV_OB_CPLT_CONF1_OBRICKB_IOVALID = 0x7; -static const uint8_t PERV_OB_CPLT_CONF1_OBRICKC_IOVALID = 0x8; - static const uint8_t N3_PG_NPU_REGION_BIT = 7; //------------------------------------------------------------------------------ @@ -96,16 +87,15 @@ fapi2::ReturnCode p9_chiplet_scominit(const fapi2::Target FAPI_SYSTEM; + uint8_t l_xbus_present[P9_FBC_UTILS_MAX_ELECTRICAL_LINKS] = {0}; + uint8_t l_xbus_functional[P9_FBC_UTILS_MAX_ELECTRICAL_LINKS] = {0}; + std::vector> l_xbus_chiplets; std::vector> l_obus_chiplets; std::vector> l_mcs_targets; std::vector> l_mi_targets; std::vector> l_mc_targets; std::vector> l_dmi_targets; std::vector> l_capp_targets; - std::vector> l_obrick_targets; - fapi2::buffer l_ob0data(0x0); - fapi2::buffer l_ob3data(0x0); - uint8_t l_no_ndl_iovalid = 0; uint8_t l_is_simulation = 0; uint8_t l_nmmu_ndd1 = 0; uint32_t l_eps_write_cycles_t1 = 0; @@ -114,8 +104,6 @@ fapi2::ReturnCode p9_chiplet_scominit(const fapi2::Target(); l_obus_chiplets = i_target.getChildren(); l_mcs_targets = i_target.getChildren(); l_mi_targets = i_target.getChildren(); @@ -227,6 +216,114 @@ fapi2::ReturnCode p9_chiplet_scominit(const fapi2::Target()) + { + FAPI_DBG("Determine set of present XBUS regions on target %s...", l_procTargetStr); + { + for (auto& l_cplt_target : i_target.getChildren + (static_cast(fapi2::TARGET_FILTER_XBUS), + fapi2::TARGET_STATE_FUNCTIONAL)) + { + fapi2::buffer l_attr_pg = 0; + // obtain partial good information to determine viable X links + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_PG, l_cplt_target, l_attr_pg), + "Error from FAPI_ATTR_GET (ATTR_PG)"); + + for (uint8_t ii = 0; + ii < P9_FBC_UTILS_MAX_ELECTRICAL_LINKS; + ii++) + { + l_xbus_present[ii] = !l_attr_pg.getBit(X_PG_IOX0_REGION_BIT + ii) && + !l_attr_pg.getBit(X_PG_PBIOX0_REGION_BIT + ii); + } + } + } + + FAPI_DBG("Determine set of functional XBUS regions on target %s...", l_procTargetStr); + { + for (auto l_iter = l_xbus_chiplets.begin(); + l_iter != l_xbus_chiplets.end(); + l_iter++) + { + uint8_t l_unit_pos; + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, *l_iter, l_unit_pos), + "Error from FAPI_ATTR_GET (ATTR_CHIP_UNIT_POS)"); + l_xbus_functional[l_unit_pos] = 1; + } + } + + FAPI_DBG("Masking XBUS FIR resources for unused links on target %s...", l_procTargetStr); + { + if (l_xbus_present[0] && !l_xbus_functional[0]) + { + // XBUS0 FBC DL + FAPI_TRY(putScom(i_target, XBUS_0_LL0_LL0_LL0_IOEL_FIR_MASK_REG, FBC_IOE_DL_FIR_MASK_NF), + "Error from putScom (XBUS_0_LL0_IOEL_FIR_MASK_REG)"); + // XBUS0 PHY + FAPI_TRY(putScom(i_target, XBUS_FIR_MASK_REG, XBUS_PHY_FIR_MASK_NF), + "Error from putScom (XBUS_FIR_MASK_REG)"); + } + + if (!l_xbus_functional[0]) + { + // XBUS0 FBC TL + FAPI_TRY(putScom(i_target, PU_PB_IOE_FIR_MASK_REG_OR, FBC_IOE_TL_FIR_MASK_X0_NF), + "Error from putScom (PU_PB_IOE_FIR_MASK_REG, X0)"); + + // XBUS0 EXTFIR + FAPI_TRY(putScom(i_target, PU_PB_CENT_SM1_EXTFIR_MASK_REG_OR, FBC_EXT_FIR_MASK_X0_NF), + "Error from putScom (PU_PB_CENT_SM1_EXTFIR_MASK_REG_OR)"); + } + + if (l_xbus_present[1] && !l_xbus_functional[1]) + { + // XBUS1 FBC DL + FAPI_TRY(putScom(i_target, XBUS_1_LL1_LL1_LL1_IOEL_FIR_MASK_REG, FBC_IOE_DL_FIR_MASK_NF), + "Error from putScom (XBUS_1_LL1_IOEL_FIR_MASK_REG)"); + // XBUS1 PHY + FAPI_TRY(putScom(i_target, XBUS_1_FIR_MASK_REG, XBUS_PHY_FIR_MASK_NF), + "Error from putScom (XBUS_1_FIR_MASK_REG)"); + } + + if (!l_xbus_functional[1]) + { + // XBUS1 FBC TL + FAPI_TRY(putScom(i_target, PU_PB_IOE_FIR_MASK_REG_OR, FBC_IOE_TL_FIR_MASK_X1_NF), + "Error from putScom (PU_PB_IOE_FIR_MASK_REG, X1)"); + + // XBUS1 EXTFIR + FAPI_TRY(putScom(i_target, PU_PB_CENT_SM1_EXTFIR_MASK_REG_OR, FBC_EXT_FIR_MASK_X1_NF), + "Error from putScom (PU_PB_CENT_SM1_EXTFIR_MASK_REG_OR)"); + } + + if (l_xbus_present[2] && !l_xbus_functional[2]) + { + // XBUS2 FBC DL + FAPI_TRY(putScom(i_target, XBUS_2_LL2_LL2_LL2_IOEL_FIR_MASK_REG, FBC_IOE_DL_FIR_MASK_NF), + "Error from putScom (XBUS_2_LL2_IOEL_FIR_MASK_REG)"); + // XBUS2 PHY + FAPI_TRY(fapi2::putScom(i_target, XBUS_2_FIR_MASK_REG, XBUS_PHY_FIR_MASK_NF), + "Error from putScom (XBUS_2_FIR_MASK_REG)"); + } + + if (!l_xbus_functional[2]) + { + // XBUS2 FBC TL + FAPI_TRY(putScom(i_target, PU_PB_IOE_FIR_MASK_REG_OR, FBC_IOE_TL_FIR_MASK_X2_NF), + "Error from putScom (PU_PB_IOE_FIR_MASK_REG, X2)"); + + // XBUS2 EXTFIR + FAPI_TRY(putScom(i_target, PU_PB_CENT_SM1_EXTFIR_MASK_REG_OR, FBC_EXT_FIR_MASK_X2_NF), + "Error from putScom (PU_PB_CENT_SM1_EXTFIR_MASK_REG_OR)"); + } + } + } FAPI_DBG("Invoking p9.fbc.ioo_tl.scom.initfile on target %s...", l_procTargetStr); FAPI_EXEC_HWP(l_rc, p9_fbc_ioo_tl_scom, i_target, FAPI_SYSTEM); diff --git a/src/import/chips/p9/procedures/hwp/nest/p9_fab_iovalid.C b/src/import/chips/p9/procedures/hwp/nest/p9_fab_iovalid.C index 6344f4df7..5f57a1371 100644 --- a/src/import/chips/p9/procedures/hwp/nest/p9_fab_iovalid.C +++ b/src/import/chips/p9/procedures/hwp/nest/p9_fab_iovalid.C @@ -42,6 +42,8 @@ //------------------------------------------------------------------------------ #include #include +#include +#include //------------------------------------------------------------------------------ @@ -708,7 +710,7 @@ fapi_try_exit: /// -/// @brief Manipulate iovalid/FIR settings for a single fabric link (X/A) +/// @brief Manipulate iovalid settings for a single fabric link (X/A) /// /// @param[in] i_target Reference to processor chip target /// @param[in] i_ctl Reference to link control structure @@ -727,11 +729,13 @@ p9_fab_iovalid_update_link(const fapi2::Target& i_ // form data buffers for iovalid/RAS FIR mask updates fapi2::buffer l_iovalid_mask; - fapi2::buffer l_ras_fir_mask; - fapi2::buffer l_extfir_action; if (i_set_not_clear) { + fapi2::buffer l_ras_fir_mask; + fapi2::buffer l_extfir_action; + fapi2::buffer l_fbc_cent_fir_data; + // set iovalid l_iovalid_mask.flush<0>(); @@ -747,23 +751,34 @@ p9_fab_iovalid_update_link(const fapi2::Target& i_ FAPI_TRY(l_iovalid_mask.setBit(i_ctl.iovalid_field_start_bit + 1)); } - // clear RAS FIR mask - l_ras_fir_mask.flush<1>(); - FAPI_TRY(l_ras_fir_mask.clearBit(i_ctl.ras_fir_field_bit)); - - // get the value of the action 0 register, clear the bit and write it - FAPI_TRY(fapi2::getScom(i_target, PU_PB_CENT_SM1_EXTFIR_ACTION0_REG, l_extfir_action), - "Error reading Action 0 register"); - FAPI_TRY(l_extfir_action.clearBit(i_ctl.ras_fir_field_bit)); - FAPI_TRY(fapi2::putScom(i_target, PU_PB_CENT_SM1_EXTFIR_ACTION0_REG, l_extfir_action), - "Error writing Action 0 register"); - - // get the value of the action 1 registers, clear the bit, and write it - FAPI_TRY(fapi2::getScom(i_target, PU_PB_CENT_SM1_EXTFIR_ACTION1_REG, l_extfir_action), - "Error reading Action 1 register"); - FAPI_TRY(l_extfir_action.clearBit(i_ctl.ras_fir_field_bit)); - FAPI_TRY(fapi2::putScom(i_target, PU_PB_CENT_SM1_EXTFIR_ACTION1_REG, l_extfir_action), - "Error writing Action 1 register"); + FAPI_TRY(fapi2::getScom(i_target, PU_PB_CENT_SM0_PB_CENT_FIR_REG, l_fbc_cent_fir_data), + "Error from getScom (PU_PB_CENT_SM0_PB_CENT_FIR_REG)"); + + // clear RAS FIR mask for optical link, or electrical link if not already setup by SBE + if ((i_ctl.endp_type == OPTICAL) || + ((i_ctl.endp_type == ELECTRICAL) && + (!l_fbc_cent_fir_data.getBit()))) + { + // get the value of the action 0 register, clear the bit and write it + FAPI_TRY(fapi2::getScom(i_target, PU_PB_CENT_SM1_EXTFIR_ACTION0_REG, l_extfir_action), + "Error reading RAS FIR Action 0 register"); + FAPI_TRY(l_extfir_action.clearBit(i_ctl.ras_fir_field_bit)); + FAPI_TRY(fapi2::putScom(i_target, PU_PB_CENT_SM1_EXTFIR_ACTION0_REG, l_extfir_action), + "Error writing RAS FIR Action 0 register"); + + // get the value of the action 1 registers, clear the bit, and write it + FAPI_TRY(fapi2::getScom(i_target, PU_PB_CENT_SM1_EXTFIR_ACTION1_REG, l_extfir_action), + "Error reading RAS FIR Action 1 register"); + FAPI_TRY(l_extfir_action.clearBit(i_ctl.ras_fir_field_bit)); + FAPI_TRY(fapi2::putScom(i_target, PU_PB_CENT_SM1_EXTFIR_ACTION1_REG, l_extfir_action), + "Error writing RAS FIR Action 1 register"); + + // clear associated mask bit + l_ras_fir_mask.flush<1>(); + FAPI_TRY(l_ras_fir_mask.clearBit(i_ctl.ras_fir_field_bit)); + FAPI_TRY(fapi2::putScom(i_target, PU_PB_CENT_SM1_EXTFIR_MASK_REG_AND, l_ras_fir_mask), + "Error writing RAS FIR mask register (PU_PB_CENT_SM1_EXTFIR_MASK_REG_AND)!"); + } } else { @@ -781,26 +796,16 @@ p9_fab_iovalid_update_link(const fapi2::Target& i_ { FAPI_TRY(l_iovalid_mask.clearBit(i_ctl.iovalid_field_start_bit + 1)); } - - // set RAS FIR mask - l_ras_fir_mask.flush<0>(); - FAPI_TRY(l_ras_fir_mask.setBit(i_ctl.ras_fir_field_bit)); } // use AND/OR mask registers to atomically update link specific fields - // in iovalid/RAS FIR mask registers + // in iovalid control register FAPI_TRY(fapi2::putScom(i_target, (i_set_not_clear) ? (i_ctl.iovalid_or_addr) : (i_ctl.iovalid_clear_addr), l_iovalid_mask), "Error writing iovalid control register (0x%08X)!", (i_set_not_clear) ? (i_ctl.iovalid_or_addr) : (i_ctl.iovalid_clear_addr)); - FAPI_TRY(fapi2::putScom(i_target, - (i_set_not_clear) ? (PU_PB_CENT_SM1_EXTFIR_MASK_REG_AND) : (PU_PB_CENT_SM1_EXTFIR_MASK_REG_OR), - l_ras_fir_mask), - "Error writing RAS FIR mask register (0x%08X)!", - (i_set_not_clear) ? (PU_PB_CENT_SM1_EXTFIR_MASK_REG_AND) : (PU_PB_CENT_SM1_EXTFIR_MASK_REG_OR)); - fapi_try_exit: FAPI_DBG("End"); return fapi2::current_err; diff --git a/src/import/chips/p9/procedures/hwp/nest/p9_fbc_smp_utils.H b/src/import/chips/p9/procedures/hwp/nest/p9_fbc_smp_utils.H index 80a01c5e1..ea4fc0032 100644 --- a/src/import/chips/p9/procedures/hwp/nest/p9_fbc_smp_utils.H +++ b/src/import/chips/p9/procedures/hwp/nest/p9_fbc_smp_utils.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016,2017 */ +/* Contributors Listed Below - COPYRIGHT 2016,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -91,6 +91,9 @@ struct p9_fbc_link_ctl_t const uint32_t P9_FBC_UTILS_MAX_X_LINKS = 7; const uint32_t P9_FBC_UTILS_MAX_A_LINKS = 4; +const uint32_t P9_FBC_UTILS_MAX_ELECTRICAL_LINKS = 3; +const uint32_t P9_FBC_UTILS_MAX_OPTICAL_LINKS = 4; + const p9_fbc_link_ctl_t P9_FBC_XBUS_LINK_CTL_ARR[P9_FBC_UTILS_MAX_X_LINKS] = { { diff --git a/src/import/chips/p9/procedures/hwp/nest/p9_sys_chiplet_scominit.C b/src/import/chips/p9/procedures/hwp/nest/p9_sys_chiplet_scominit.C index bfd05abe9..46e2818e4 100644 --- a/src/import/chips/p9/procedures/hwp/nest/p9_sys_chiplet_scominit.C +++ b/src/import/chips/p9/procedures/hwp/nest/p9_sys_chiplet_scominit.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016,2017 */ +/* Contributors Listed Below - COPYRIGHT 2016,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -42,6 +42,9 @@ #include "p9_sys_chiplet_scominit.H" #include "p9_fbc_ioo_tl_scom.H" #include "p9_fbc_ioo_dl_scom.H" +#include "p9_misc_scom_addresses.H" +#include "p9_misc_scom_addresses_fld.H" +#include "p9_fbc_smp_utils.H" //------------------------------------------------------------------------------ // Function definitions @@ -53,38 +56,75 @@ fapi2::ReturnCode p9_sys_chiplet_scominit( fapi2::ReturnCode l_rc; fapi2::Target FAPI_SYSTEM; std::vector> l_obus_chiplets; + fapi2::ATTR_PROC_FABRIC_X_ATTACHED_CHIP_CNFG_Type l_x_en; + fapi2::ATTR_PROC_FABRIC_A_ATTACHED_CHIP_CNFG_Type l_a_en; FAPI_DBG("Start"); - do + // Invoke IOO (OBUS FBC IO) SCOM initfiles + FAPI_DBG("Invoking p9.fbc.ioo_tl.scom.initfile..."); + FAPI_EXEC_HWP(l_rc, p9_fbc_ioo_tl_scom, i_target, FAPI_SYSTEM); + + if (l_rc) + { + FAPI_ERR("Error from p9_fbc_ioo_tl_scom"); + fapi2::current_err = l_rc; + goto fapi_try_exit; + } + + l_obus_chiplets = i_target.getChildren(); + + for (auto l_iter = l_obus_chiplets.begin(); + l_iter != l_obus_chiplets.end(); + l_iter++) { - // Invoke IOO (OBUS FBC IO) SCOM initfiles - FAPI_DBG("Invoking p9.fbc.ioo_tl.scom.initfile..."); - FAPI_EXEC_HWP(l_rc, p9_fbc_ioo_tl_scom, i_target, FAPI_SYSTEM); + FAPI_DBG("Invoking p9.fbc.ioo_dl.scom.initfile..."); + FAPI_EXEC_HWP(l_rc, p9_fbc_ioo_dl_scom, *l_iter, i_target); if (l_rc) { - FAPI_ERR("Error from p9_fbc_ioo_tl_scom"); - break; + FAPI_ERR("Error from p9_fbc_ioo_dl_scom"); + fapi2::current_err = l_rc; + goto fapi_try_exit; } + } - l_obus_chiplets = i_target.getChildren(); + // mask EXTFIR associated with unused inter-drawer links + FAPI_DBG("Masking OBUS FIR resources for unused inter-drawer links"); + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_PROC_FABRIC_X_ATTACHED_CHIP_CNFG, + i_target, + l_x_en), + "Error from FAPI_ATTR_GET (ATTR_PROC_FABRIC_X_ATTACHED_CHIP_CNFG)"); + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_PROC_FABRIC_A_ATTACHED_CHIP_CNFG, + i_target, + l_a_en), + "Error from FAPI_ATTR_GET (ATTR_PROC_FABRIC_A_ATTACHED_CHIP_CNFG)"); - for (auto l_iter = l_obus_chiplets.begin(); - l_iter != l_obus_chiplets.end(); - l_iter++) + for (uint8_t l_obus = 0; + l_obus < P9_FBC_UTILS_MAX_A_LINKS; + l_obus++) + { + if (!l_x_en[3 + l_obus] && !l_a_en[l_obus]) { - FAPI_DBG("Invoking p9.fbc.ioo_dl.scom.initfile..."); - FAPI_EXEC_HWP(l_rc, p9_fbc_ioo_dl_scom, *l_iter, i_target); + fapi2::buffer l_extfir_mask = 0; + fapi2::buffer l_extfir_action1 = 0; + + FAPI_TRY(l_extfir_mask.setBit(PU_PB_CENT_SM1_EXTFIR_REG_PB_X3_FIR_ERR + + l_obus), + "Error forming EXTFIR mask register content"); + FAPI_TRY(fapi2::putScom(i_target, PU_PB_CENT_SM1_EXTFIR_MASK_REG_OR, l_extfir_mask), + "Error from putScom (PU_PB_CENT_SM1_EXTFIR_MASK_REG_OR)"); - if (l_rc) - { - FAPI_ERR("Error from p9_fbc_ioo_dl_scom"); - break; - } + FAPI_TRY(fapi2::getScom(i_target, PU_PB_CENT_SM1_EXTFIR_ACTION1_REG, l_extfir_action1), + "Error from getScom (PU_PB_CENT_SM1_EXTFIR_ACTION1_REG)"); + FAPI_TRY(l_extfir_action1.setBit(PU_PB_CENT_SM1_EXTFIR_REG_PB_X3_FIR_ERR + + l_obus), + "Error forming EXTFIR action1 register content"); + FAPI_TRY(fapi2::putScom(i_target, PU_PB_CENT_SM1_EXTFIR_ACTION1_REG, l_extfir_action1), + "Error from putScom (PU_PB_CENT_SM1_EXTFIR_ACTION1_REG)"); } } - while(0); +fapi_try_exit: FAPI_DBG("End"); return l_rc; } -- cgit v1.2.1