summaryrefslogtreecommitdiffstats
path: root/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.C
diff options
context:
space:
mode:
authorStephen Glancy <sglancy@us.ibm.com>2019-04-19 12:31:12 -0400
committerChristian R. Geddes <crgeddes@us.ibm.com>2019-04-30 11:23:52 -0500
commit902e166a98fe9cce8dbf6dc69534f45499c0ab1d (patch)
tree45715a9904aaae1baad766f62310510aa0b17a1c /src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.C
parent0d02b87f9c90d3a777de91db0f784b5e2ba60a12 (diff)
downloadtalos-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/hwp/memory/exp_inband.C')
-rw-r--r--src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.C59
1 files changed, 55 insertions, 4 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();
}
OpenPOWER on IntegriCloud