diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_draminit.C b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_draminit.C index 1f0ae5c9e16..ce9137db940 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_draminit.C +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_draminit.C @@ -55,6 +55,7 @@ extern "C" mss::display_git_commit_info("exp_draminit"); uint32_t l_crc = 0; + host_fw_command_struct l_cmd; user_input_msdg l_phy_params; FAPI_TRY(mss::exp::setup_phy_params(i_target, l_phy_params), @@ -64,10 +65,12 @@ extern "C" FAPI_TRY( mss::exp::ib::putUserInputMsdg(i_target, l_phy_params, l_crc), "Failed putUserInputMsdg() for %s", mss::c_str(i_target) ); - // Issue full boot mode cmd though EXP-FW REQ buffer { - host_fw_command_struct l_cmd; - mss::exp::setup_cmd_params(l_crc, sizeof(l_phy_params), l_cmd); + // Issue full boot mode cmd though EXP-FW REQ buffer + FAPI_TRY( mss::exp::setup_cmd_params(i_target, + l_crc, + sizeof(l_phy_params), + l_cmd) ); FAPI_TRY( mss::exp::ib::putCMD(i_target, l_cmd), "Failed putCMD() for %s", mss::c_str(i_target) ); } @@ -96,7 +99,7 @@ extern "C" FAPI_TRY( mss::exp::train::display_info(i_target, l_train_response)); // Check if cmd was successful - l_rc = mss::exp::check::response(i_target, l_response); + l_rc = mss::exp::check::response(i_target, l_response, l_cmd); // If not, then we need to process the bad bitmap if(l_rc != fapi2::FAPI2_RC_SUCCESS) diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_fw_update.C b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_fw_update.C index 341ebcc6355..8a4cb997857 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_fw_update.C +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_fw_update.C @@ -55,11 +55,13 @@ namespace bupg /// /// @brief Checks explorer response argument for a successful command /// @param[in] i_target OCMB target -/// @param[in] i_rsp response command +/// @param[in] i_rsp response from command +/// @param[in] i_cmd original command /// @return FAPI2_RC_SUCCESS iff okay /// fapi2::ReturnCode check_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) { std::vector resp_arg; uint8_t success_flag = 0; @@ -76,16 +78,16 @@ fapi2::ReturnCode check_response(const fapi2::Target& i_target, + const uint32_t i_binary_size, const uint16_t i_seq_number, const uint32_t i_cmd_data_crc, host_fw_command_struct& o_cmd) @@ -118,7 +121,9 @@ fapi2::ReturnCode setup_flash_write_cmd(const uint32_t i_binary_size, o_cmd.cmd_flags = mss::exp::omi::ADDITIONAL_DATA; // Host generated id number (returned in response packet) - o_cmd.request_identifier = 0xfed1; + uint32_t l_counter = 0; + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_OCMB_COUNTER, i_target, l_counter)); + o_cmd.request_identifier = l_counter; //always send a block of data o_cmd.cmd_length = FLASH_WRITE_BLOCK_SIZE; @@ -171,9 +176,12 @@ fapi_try_exit: /// @brief Sets the command_argument fields for flash_commit sub-command /// in the correct endianness. /// +/// @param[in] i_target OCMB target that will be acted upon with this command /// @param[out] o_cmd the command packet to update /// -void setup_flash_commit_cmd(host_fw_command_struct& o_cmd) +fapi2::ReturnCode setup_flash_commit_cmd( + const fapi2::Target& i_target, + host_fw_command_struct& o_cmd) { memset(&o_cmd, 0, sizeof(host_fw_command_struct)); @@ -181,10 +189,10 @@ void setup_flash_commit_cmd(host_fw_command_struct& o_cmd) o_cmd.cmd_id = mss::exp::omi::EXP_FW_BINARY_UPGRADE; o_cmd.cmd_flags = 0; - // Host generated id number (returned in response packet) - // NOTE: This is arbitrarily chosen until it is decided how we want to - // use this field. - o_cmd.request_identifier = 0xfcfc; + // 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 = 0; o_cmd.cmd_crc = 0xffffffff; @@ -194,6 +202,9 @@ void setup_flash_commit_cmd(host_fw_command_struct& o_cmd) // Set the sub-command ID in the command argument field to FLASH_COMMIT o_cmd.command_argument[0] = bupg::SUB_CMD_COMMIT; + +fapi_try_exit: + return fapi2::current_err; } }//exp @@ -261,11 +272,11 @@ extern "C" buffer)); // Issue flash_write sub-command through EXP-FW request buffer + host_fw_command_struct flash_write_cmd; { - host_fw_command_struct flash_write_cmd; - // Set up the command packet FAPI_TRY(mss::exp::setup_flash_write_cmd( + i_target, i_image_sz, seq_num, block_crc, @@ -300,7 +311,7 @@ extern "C" mss::c_str(i_target), seq_num); // Check status in response packet - FAPI_TRY(mss::exp::bupg::check_response(i_target, response), + FAPI_TRY(mss::exp::bupg::check_response(i_target, response, flash_write_cmd), "exp_fw_update: error response for flash_write " "on %s! seq_num[%u]", mss::c_str(i_target), seq_num); @@ -322,10 +333,11 @@ extern "C" seq_num++; } + host_fw_command_struct flash_commit_cmd; // Issue the flash_commit sub-command through EXP-FW request buffer { - host_fw_command_struct flash_commit_cmd; - mss::exp::setup_flash_commit_cmd(flash_commit_cmd); + FAPI_TRY(mss::exp::setup_flash_commit_cmd(i_target, + flash_commit_cmd)); FAPI_TRY(mss::exp::ib::putCMD(i_target, flash_commit_cmd), "exp_fw_update: putCMD() failed for flash_commit on %s!", mss::c_str(i_target)); @@ -353,7 +365,7 @@ extern "C" mss::c_str(i_target) ); // Check if cmd was successful - FAPI_TRY(mss::exp::bupg::check_response(i_target, response), + FAPI_TRY(mss::exp::bupg::check_response(i_target, response, flash_commit_cmd), "exp_fw_update: error response for flash_commit on %s!", mss::c_str(i_target) ); } diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_fw_update.H b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_fw_update.H index f475cab0a8b..b6c1fbd0f01 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_fw_update.H +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_fw_update.H @@ -85,22 +85,26 @@ typedef enum sub_cmd_id /// @brief Checks explorer response argument for a successful command /// @param[in] i_target OCMB target /// @param[in] i_rsp response command +/// @param[in] i_cmd original command /// @return FAPI2_RC_SUCCESS iff okay /// fapi2::ReturnCode check_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); }// ns bupg /// /// @brief host_fw_command_struct structure setup for flash_write +/// @param[in] i_target OCMB target that will be acted upon with this command /// @param[in] i_binary_size the total size of the binary image /// @param[in] i_seq_number the sequence number of this command /// @param[in] i_cmd_data_crc the command data CRC /// @param[out] o_cmd the command packet to update /// @return FAPI2_RC_SUCCESS iff ok /// -fapi2::ReturnCode setup_flash_write_cmd(const uint32_t i_binary_size, +fapi2::ReturnCode setup_flash_write_cmd(const fapi2::Target& i_target, + const uint32_t i_binary_size, const uint16_t i_seq_number, const uint32_t i_cmd_data_crc, host_fw_command_struct& o_cmd); @@ -109,9 +113,12 @@ fapi2::ReturnCode setup_flash_write_cmd(const uint32_t i_binary_size, /// @brief Sets the command_argument fields for flash_commit sub-command /// in the correct endianness. /// +/// @param[in] i_target OCMB target that will be acted upon with this command /// @param[out] o_cmd the command packet to update +/// @return FAPI2_RC_SUCCESS iff ok /// -void setup_flash_commit_cmd(host_fw_command_struct& o_cmd); +fapi2::ReturnCode setup_flash_commit_cmd(const fapi2::Target& i_target, + host_fw_command_struct& o_cmd); }// ns exp }// ns mss 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 e8e8ddb66f0..843675d6e26 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; diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_draminit_utils.H b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_draminit_utils.H index 80c4f359e83..88d814edecd 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_draminit_utils.H +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_draminit_utils.H @@ -150,11 +150,14 @@ enum odt_fields /// /// @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 +/// @return FAPI2_RC_SUCCESS iff okay /// -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); @@ -1147,11 +1150,13 @@ namespace check /// /// @brief Checks explorer response argument for a successful command /// @param[in] i_target OCMB target -/// @param[in] i_rsp response command +/// @param[in] i_rsp response from command +/// @param[in] i_cmd original command /// @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 diff --git a/src/import/chips/ocmb/explorer/procedures/xml/error_info/mss_exp_errors.xml b/src/import/chips/ocmb/explorer/procedures/xml/error_info/mss_exp_errors.xml index 3e3586421c6..a081d1cc7c1 100644 --- a/src/import/chips/ocmb/explorer/procedures/xml/error_info/mss_exp_errors.xml +++ b/src/import/chips/ocmb/explorer/procedures/xml/error_info/mss_exp_errors.xml @@ -460,6 +460,8 @@ RSP_ID ERROR_CODE + EXPECTED_REQID + ACTUAL_REQID CODE MEDIUM diff --git a/src/import/chips/p9/procedures/xml/attribute_info/p9a_io_attributes.xml b/src/import/chips/p9/procedures/xml/attribute_info/p9a_io_attributes.xml index 70ba7923941..dd982c93f5d 100644 --- a/src/import/chips/p9/procedures/xml/attribute_info/p9a_io_attributes.xml +++ b/src/import/chips/p9/procedures/xml/attribute_info/p9a_io_attributes.xml @@ -5,7 +5,7 @@ - + @@ -31,7 +31,7 @@ An OMI target's relative logical postion to its OMIC parent target. - + pos | DL_GROUP_POS -----+-------------- 4 | 0 @@ -48,7 +48,7 @@ 15 | 0 10 | 1 11 | 2 - 8 | 0 + 8 | 0 9 | 1 @@ -63,7 +63,7 @@ TARGET_TYPE_OMI - An OMI target's logical DL number + An OMI target's logical DL number pos | DL_NUM -----+-------------- @@ -90,4 +90,17 @@ 0xFF + + ATTR_OCMB_COUNTER + + TARGET_TYPE_OCMB_CHIP + + + Tracks the sequence id for OCMB command transactions. The platform is + expected to guarantee a unique value on each read. + + uint32 + + 0 +