summaryrefslogtreecommitdiffstats
path: root/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_draminit_utils.C
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2019-09-16 16:20:26 -0500
committerDaniel M Crowell <dcrowell@us.ibm.com>2019-10-16 08:28:33 -0500
commited40af7bc74e8790871691591660d65787a816ec (patch)
tree7ba2ce9092ccbf8b08430e5cd0a4e56e2fe2678f /src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_draminit_utils.C
parent68ba813f29145980aae29899fc4fff7a9b476a9d (diff)
downloadtalos-hostboot-ed40af7bc74e8790871691591660d65787a816ec.tar.gz
talos-hostboot-ed40af7bc74e8790871691591660d65787a816ec.zip
Enable rolling counter and verification of req id for Explorer
Rather than using a constant value based on which command is being sent to the OCMB, we will instead define an attribute that is set by the platform in some unique way to differentiate this particular command/response from all others going on. This will allow the code to catch bugs where commands erroneously are sent to the wrong target for some reason. Change-Id: I3162a8ac040d8487e9311f770a0466ee8500b415 RTC: 210371 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/83851 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: PPE CI <ppe-ci+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: STEPHEN GLANCY <sglancy@us.ibm.com> Dev-Ready: STEPHEN GLANCY <sglancy@us.ibm.com> Reviewed-by: ANDRE A MARIN <aamarin@us.ibm.com> Reviewed-by: Matt K Light <mklight@us.ibm.com> Reviewed-by: Jennifer A Stofer <stofer@us.ibm.com> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/84633 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: Daniel M Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_draminit_utils.C')
-rw-r--r--src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_draminit_utils.C29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_draminit_utils.C b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_draminit_utils.C
index e8e8ddb66..843675d6e 100644
--- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_draminit_utils.C
+++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_draminit_utils.C
@@ -42,11 +42,13 @@ namespace exp
///
/// @brief host_fw_command_struct structure setup
+/// @param[in] i_target the OCMB being acted upon
/// @param[in] i_cmd_data_crc the command data CRC
/// @param[in] i_cmd_length the length of the command present in the data buffer (if any)
/// @param[out] o_cmd the command parameters to set
///
-void setup_cmd_params(
+fapi2::ReturnCode setup_cmd_params(
+ const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target,
const uint32_t i_cmd_data_crc,
const uint8_t i_cmd_length,
host_fw_command_struct& o_cmd)
@@ -56,12 +58,20 @@ void setup_cmd_params(
// Explicit with all of these (including 0 values) to avoid ambiguity
o_cmd.cmd_id = mss::exp::omi::EXP_FW_DDR_PHY_INIT;
o_cmd.cmd_flags = 0;
- // TK - Fabricated value need to figure out if we'll be creating req_id tables
- o_cmd.request_identifier = 0xBB;
+
+ // Retrieve a unique sequence id for this transaction
+ uint32_t l_counter = 0;
+ FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_OCMB_COUNTER, i_target, l_counter));
+
+ o_cmd.request_identifier = l_counter;
o_cmd.cmd_length = i_cmd_length;
o_cmd.cmd_crc = i_cmd_data_crc;
o_cmd.host_work_area = 0;
o_cmd.cmd_work_area = 0;
+ memset(o_cmd.padding, 0, sizeof(o_cmd.padding));
+
+fapi_try_exit:
+ return fapi2::current_err;
}
///
@@ -162,15 +172,20 @@ namespace check
/// @return FAPI2_RC_SUCCESS iff okay
///
fapi2::ReturnCode response(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target,
- const host_fw_response_struct& i_rsp)
+ const host_fw_response_struct& i_rsp,
+ const host_fw_command_struct& i_cmd)
{
// Check if cmd was successful
- FAPI_ASSERT(i_rsp.response_argument[0] == omi::response_arg::SUCCESS,
+ FAPI_ASSERT(i_rsp.response_argument[0] == omi::response_arg::SUCCESS &&
+ i_rsp.request_identifier == i_cmd.request_identifier,
fapi2::MSS_EXP_RSP_ARG_FAILED().
set_TARGET(i_target).
set_RSP_ID(i_rsp.response_id).
- set_ERROR_CODE(i_rsp.response_argument[1]),
- "Failed to initialize the PHY for %s", mss::c_str(i_target));
+ set_ERROR_CODE(i_rsp.response_argument[1]).
+ set_EXPECTED_REQID(i_cmd.request_identifier).
+ set_ACTUAL_REQID(i_rsp.request_identifier),
+ "Failed to initialize the PHY for %s, response=0x%X",
+ mss::c_str(i_target), i_rsp.response_argument[0]);
return fapi2::FAPI2_RC_SUCCESS;
OpenPOWER on IntegriCloud