From 785e89f5fcf9f50e8cfb5484c43936f04e709cdf Mon Sep 17 00:00:00 2001 From: Ben Gass Date: Tue, 5 Dec 2017 16:23:32 -0600 Subject: Shorten A-link timers for sim. Add polling for A-link training. Change-Id: Ic55d4ad2e8e11bb07f2e5f67cf8fe907782611fc Original-Change-Id: Iad63bc098741d328c4ccf90268b3817f4cf67858 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/50536 Tested-by: FSP CI Jenkins Reviewed-by: Joseph J. McGill Reviewed-by: Thi N. Tran Tested-by: Jenkins Server Tested-by: Hostboot CI Reviewed-by: Jennifer A. Stofer Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/60651 Reviewed-by: Daniel M. Crowell Disable-CI: Daniel M. Crowell Tested-by: Daniel M. Crowell --- .../chips/p9/procedures/hwp/nest/p9_fab_iovalid.C | 47 +++++++++++++++------- 1 file changed, 32 insertions(+), 15 deletions(-) (limited to 'src/import') 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 67599e5f7..5e4d3982f 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 @@ -82,6 +82,10 @@ const uint64_t TL_FRAMER4567_ERR_REG_OFFSET = 0x26; const uint64_t TL_PARSER0123_ERR_REG_OFFSET = 0x27; const uint64_t TL_PARSER4567_ERR_REG_OFFSET = 0x28; +// DL polling constants +const uint32_t DL_MAX_POLL_LOOPS = 100; +const uint32_t DL_POLL_SIM_CYCLES = 10000000; +const uint32_t DL_POLL_HW_DELAY_NS = 1000000; //------------------------------------------------------------------------------ // Function definitions @@ -464,6 +468,7 @@ fapi2::ReturnCode p9_fab_iovalid_link_validate( fapi2::ATTR_LINK_TRAIN_Type l_loc_link_train; bool l_dl_trained = false; bool l_tl_trained = false; + uint32_t l_poll_loops = DL_MAX_POLL_LOOPS; // obtain link endpoints for FFDC FAPI_TRY(p9_fab_iovalid_get_link_endpoints(i_target, @@ -479,23 +484,35 @@ fapi2::ReturnCode p9_fab_iovalid_link_validate( l_loc_link_train), "Error from FAPI_ATTR_GET (ATTR_LINK_TRAIN)"); - // validate DL training state - FAPI_TRY(fapi2::getScom(i_target, i_loc_link_ctl.dl_fir_addr, l_dl_fir_reg), - "Error from getScom (0x%.16llX)", i_loc_link_ctl.dl_fir_addr); - - if (l_loc_link_train == fapi2::ENUM_ATTR_LINK_TRAIN_BOTH) - { - l_dl_trained = l_dl_fir_reg.getBit() && - l_dl_fir_reg.getBit(); - } - else if (l_loc_link_train == fapi2::ENUM_ATTR_LINK_TRAIN_EVEN_ONLY) + do { - l_dl_trained = l_dl_fir_reg.getBit(); - } - else - { - l_dl_trained = l_dl_fir_reg.getBit(); + // validate DL training state + FAPI_TRY(fapi2::getScom(i_target, i_loc_link_ctl.dl_fir_addr, l_dl_fir_reg), + "Error from getScom (0x%.16llX)", i_loc_link_ctl.dl_fir_addr); + + if (l_loc_link_train == fapi2::ENUM_ATTR_LINK_TRAIN_BOTH) + { + l_dl_trained = l_dl_fir_reg.getBit() && + l_dl_fir_reg.getBit(); + } + else if (l_loc_link_train == fapi2::ENUM_ATTR_LINK_TRAIN_EVEN_ONLY) + { + l_dl_trained = l_dl_fir_reg.getBit(); + } + else + { + l_dl_trained = l_dl_fir_reg.getBit(); + } + + if (!l_dl_trained) + { + FAPI_TRY(fapi2::delay(DL_POLL_HW_DELAY_NS, DL_POLL_SIM_CYCLES), "fapiDelay error"); + + } + + l_poll_loops--; } + while (l_poll_loops > 0 && !l_dl_trained); FAPI_ASSERT(l_dl_trained, fapi2::P9_FAB_IOVALID_DL_NOT_TRAINED_ERR() -- cgit v1.2.1