From ed40af7bc74e8790871691591660d65787a816ec Mon Sep 17 00:00:00 2001 From: Dan Crowell Date: Mon, 16 Sep 2019 16:20:26 -0500 Subject: 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 Tested-by: PPE CI Tested-by: Jenkins Server Tested-by: Hostboot CI Reviewed-by: STEPHEN GLANCY Dev-Ready: STEPHEN GLANCY Reviewed-by: ANDRE A MARIN Reviewed-by: Matt K Light Reviewed-by: Jennifer A Stofer Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/84633 Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Reviewed-by: Daniel M Crowell --- .../procedures/hwp/memory/lib/exp_draminit_utils.C | 29 ++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_draminit_utils.C') 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& 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& 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; -- cgit v1.2.1