summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses_fixes.H8
-rw-r--r--src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses_fld_fixes.H8
-rw-r--r--src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.C59
-rw-r--r--src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_inband.H13
-rw-r--r--src/import/chips/ocmb/explorer/procedures/xml/error_info/exp_inband_errors.xml16
5 files changed, 96 insertions, 8 deletions
diff --git a/src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses_fixes.H b/src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses_fixes.H
index 0e642f2f5..39e55dc78 100644
--- a/src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses_fixes.H
+++ b/src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses_fixes.H
@@ -22,3 +22,11 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
+
+
+#ifndef __EXPLR_SCOM_ADDRESSES_FIXES_H
+#define __EXPLR_SCOM_ADDRESSES_FIXES_H
+
+static const uint64_t EXPLR_MIPS_TO_OCMB_INTERRUPT_REGISTER1 = 0x2058ull;
+
+#endif
diff --git a/src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses_fld_fixes.H b/src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses_fld_fixes.H
index c0182cf9b..80f31c583 100644
--- a/src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses_fld_fixes.H
+++ b/src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses_fld_fixes.H
@@ -22,3 +22,11 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
+
+
+#ifndef __EXPLR_SCOM_ADDRESSES_FLD_FIXES_H
+#define __EXPLR_SCOM_ADDRESSES_FLD_FIXES_H
+
+static const uint64_t EXPLR_MIPS_TO_OCMB_INTERRUPT_REGISTER1_DOORBELL = 63;
+
+#endif
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>
OpenPOWER on IntegriCloud