diff options
author | Stephen Glancy <sglancy@us.ibm.com> | 2019-04-19 12:31:12 -0400 |
---|---|---|
committer | Christian R. Geddes <crgeddes@us.ibm.com> | 2019-04-30 11:23:52 -0500 |
commit | 902e166a98fe9cce8dbf6dc69534f45499c0ab1d (patch) | |
tree | 45715a9904aaae1baad766f62310510aa0b17a1c /src/import/chips/ocmb/explorer/procedures | |
parent | 0d02b87f9c90d3a777de91db0f784b5e2ba60a12 (diff) | |
download | talos-hostboot-902e166a98fe9cce8dbf6dc69534f45499c0ab1d.tar.gz talos-hostboot-902e166a98fe9cce8dbf6dc69534f45499c0ab1d.zip |
Adds explorer to check for response doorbell
Change-Id: Ife6127372837ae6ceea59c1eb8a50d5f34641e3a
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/76238
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Reviewed-by: ANDRE A. MARIN <aamarin@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/76266
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: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/import/chips/ocmb/explorer/procedures')
3 files changed, 80 insertions, 8 deletions
diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.C b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.C index 9c90bb53f..e5b70a7c1 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.C +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.C @@ -274,7 +274,7 @@ fapi2::ReturnCode putCMD( // Clear the doorbell l_scom.setBit<EXPLR_MMIO_MDBELLC_MDBELL_MDBELL>(); - FAPI_TRY(mss::exp::ib::putScom(i_target, EXPLR_MMIO_MDBELLC, l_scom)); + FAPI_TRY(fapi2::putScom(i_target, EXPLR_MMIO_MDBELLC, l_scom)); // Set the command FAPI_TRY(fapi2::putMMIO(i_target, EXPLR_IB_CMD_ADDR, BUFFER_TRANSACTION_SIZE, l_data)) @@ -282,7 +282,7 @@ fapi2::ReturnCode putCMD( // Ring the doorbell - aka the bit that interrupts the microchip FW and tells it to do the thing l_scom.flush<0>(); l_scom.setBit<EXPLR_MMIO_MDBELL_MDBELL>(); - FAPI_TRY(mss::exp::ib::putScom(i_target, EXPLR_MMIO_MDBELL, l_scom)); + FAPI_TRY(fapi2::putScom(i_target, EXPLR_MMIO_MDBELL, l_scom)); fapi_try_exit: FAPI_DBG("Exiting with return code : 0x%08X...", (uint64_t) fapi2::current_err); @@ -460,6 +460,48 @@ fapi_try_exit: return fapi2::current_err; } +/// +/// @brief Polls for response ready door bell bit +/// @param[in] i_target the OCMB target on which to operate +/// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. +/// +fapi2::ReturnCode poll_for_response_ready(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target) +{ + constexpr uint64_t NUM_LOOPS = 50; + // So, why aren't we using the memory team's polling API? + // This is a base function that will be utilized by the platform code + // As such, we don't want to pull in more libraries than we need to: it would cause extra dependencies + // So, we're decomposing the polling library below + bool l_doorbell_response = false; + uint64_t l_loop = 0; + fapi2::buffer<uint64_t> l_data; + + // Loop until we max our our loop count or get a doorbell response + for(; l_loop < NUM_LOOPS && !l_doorbell_response; ++l_loop) + { + FAPI_TRY(fapi2::getScom(i_target, EXPLR_MIPS_TO_OCMB_INTERRUPT_REGISTER1, l_data)); + l_doorbell_response = l_data.getBit<EXPLR_MIPS_TO_OCMB_INTERRUPT_REGISTER1_DOORBELL>(); + FAPI_TRY( fapi2::delay( DELAY_100NS, 200) ); + } + + FAPI_DBG("%s stopped on loop%u/%u data:0x%016lx %u", + mss::c_str(i_target), l_loop, NUM_LOOPS, l_data, l_doorbell_response); + + // Error check - doorbell response should be true + FAPI_ASSERT(l_doorbell_response, + fapi2::EXP_INBAND_RSP_NO_DOORBELL() + .set_OCMB_TARGET(i_target) + .set_DATA(l_data) + .set_NUM_LOOPS(l_loop), + "%s doorbell timed out after %u loops: data 0x%016lx", + mss::c_str(i_target), l_loop, l_data); + + // Ding-dong! the doorbell is rung and the response is ready + return fapi2::FAPI2_RC_SUCCESS; +fapi_try_exit: + return fapi2::current_err; +} + /// @brief Reads a response from the response buffer /// /// @param[in] i_target The Explorer chip to read data from @@ -469,24 +511,33 @@ fapi_try_exit: /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. fapi2::ReturnCode getRSP( const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target, - host_fw_response_struct& o_rsp, std::vector<uint8_t>& o_data) + host_fw_response_struct& o_rsp, + std::vector<uint8_t>& o_data) { std::vector<uint8_t> l_data(static_cast<int>(sizeof(o_rsp))); - FAPI_TRY(fapi2::getMMIO(i_target, EXPLR_IB_RSP_ADDR, BUFFER_TRANSACTION_SIZE, l_data)); + // Polls for the response to be ready first + FAPI_TRY(poll_for_response_ready(i_target)); + + FAPI_INF("Reading the response buffer..."); + FAPI_TRY(fapi2::getMMIO(i_target, EXPLR_IB_RSP_ADDR, BUFFER_TRANSACTION_SIZE, l_data)); FAPI_TRY(host_fw_response_struct_from_little_endian(i_target, l_data, o_rsp)); + FAPI_INF("Checking if we have response data..."); + // If response data in buffer portion, return that too if (o_rsp.response_length > 0) { // make sure expected size is a multiple of 8 o_data.resize( o_rsp.response_length + (8 - (o_rsp.response_length % 8)) ); + FAPI_INF("Reading response data..."); FAPI_TRY( fapi2::getMMIO(i_target, EXPLR_IB_DATA_ADDR, BUFFER_TRANSACTION_SIZE, o_data) ); } else { + FAPI_INF("No response data returned..."); // make sure no buffer data is returned o_data.clear(); } diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.H b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.H index 1dc6699ad..989910f21 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.H +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.H @@ -87,6 +87,8 @@ #include <exp_data_structs.H> #include <explorer_scom_addresses.H> #include <explorer_scom_addresses_fld.H> +#include <explorer_scom_addresses_fixes.H> +#include <explorer_scom_addresses_fld_fixes.H> #include <generic/memory/lib/utils/shared/mss_generic_consts.H> namespace mss @@ -350,8 +352,12 @@ fapi2::ReturnCode getOCCfg( const uint64_t i_cfgAddr, fapi2::buffer<uint32_t>& o_data) ; - - +/// +/// @brief Polls for response ready door bell bit +/// @param[in] i_target the OCMB target on which to operate +/// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. +/// +fapi2::ReturnCode poll_for_response_ready(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target); /// @brief Reads a response from the response buffer /// @@ -363,7 +369,8 @@ fapi2::ReturnCode getOCCfg( /// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. fapi2::ReturnCode getRSP( const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target, - host_fw_response_struct& o_rsp, std::vector<uint8_t>& o_data) ; + host_fw_response_struct& o_rsp, + std::vector<uint8_t>& o_data) ; diff --git a/src/import/chips/ocmb/explorer/procedures/xml/error_info/exp_inband_errors.xml b/src/import/chips/ocmb/explorer/procedures/xml/error_info/exp_inband_errors.xml index f69b3dd8e..1a337a57f 100644 --- a/src/import/chips/ocmb/explorer/procedures/xml/error_info/exp_inband_errors.xml +++ b/src/import/chips/ocmb/explorer/procedures/xml/error_info/exp_inband_errors.xml @@ -5,7 +5,7 @@ <!-- --> <!-- OpenPOWER HostBoot Project --> <!-- --> -<!-- Contributors Listed Below - COPYRIGHT 2018 --> +<!-- Contributors Listed Below - COPYRIGHT 2018,2019 --> <!-- [+] International Business Machines Corp. --> <!-- --> <!-- --> @@ -70,4 +70,18 @@ </callout> </hwpError> + <hwpError> + <rc>RC_EXP_INBAND_RSP_NO_DOORBELL</rc> + <description> + Doorbell is low when expecting a response + </description> + <ffdc>DATA</ffdc> + <ffdc>NUM_LOOPS</ffdc> + <ffdc>OCMB_TARGET</ffdc> + <callout> + <target>OCMB_TARGET</target> + <priority>HIGH</priority> + </callout> + </hwpError> + </hwpErrors> |