Skip to content

Commit

Permalink
Explorer_inband support: add response data buffer to getRSP
Browse files Browse the repository at this point in the history
getRSP can check if a data response exists and then grab that
data and load it into a vector.  The caller is responsible for
converting the data into big endian format for their expected
response structure.

Change-Id: Ie97488cde7036c230ab02610b5105e590c5d4249
RTC:186630
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/69533
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@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>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/69561
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
  • Loading branch information
mderkse1 authored and dcrowell77 committed Feb 16, 2019
1 parent 4097d46 commit 855fc5f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
///
/// @brief Initializes DRAM
/// @param[in] i_target the controller
/// @return FAPI2_RC_SUCCESS iff ok
/// @return FAPI2_RC_SUCCESS if ok
///
fapi2::ReturnCode exp_draminit(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target)
{
Expand All @@ -65,7 +65,8 @@ fapi2::ReturnCode exp_draminit(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>
// Read the response message from EXP-FW RESP buffer
{
host_fw_response_struct l_response;
FAPI_TRY( mss::exp::ib::getRSP(i_target, l_response),
std::vector<uint8_t> l_rsp_data;
FAPI_TRY( mss::exp::ib::getRSP(i_target, l_response, l_rsp_data),
"Failed getRSP() for %s", mss::c_str(i_target) );

// Check if cmd was successful
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,17 +454,33 @@ fapi_try_exit:
///
/// @param[in] i_target The Explorer chip to read data from
/// @param[out] o_rsp The response data read from the buffer
/// @param[out] o_data Raw (little-endian) response data buffer portion
///
/// @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)
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, 8, l_data));

FAPI_TRY(host_fw_response_struct_from_little_endian(i_target, l_data, o_rsp));

// 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_TRY( fapi2::getMMIO(i_target, EXPLR_IB_DATA_ADDR, 8, o_data) );
}
else
{
// make sure no buffer data is returned
o_data.clear();
}

fapi_try_exit:
FAPI_DBG("%s Exiting with return code : 0x%08X...", mss::c_str(i_target), (uint64_t) fapi2::current_err);
return fapi2::current_err;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,13 @@ fapi2::ReturnCode getOCCfg(
///
/// @param[in] i_target The Explorer chip to read data from
/// @param[out] o_rsp The response data read from the buffer
/// @param[out] o_data Raw (little-endian) response data buffer portion
/// The size of this buffer will be a multiple of 8
///
/// @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) ;
host_fw_response_struct& o_rsp, std::vector<uint8_t>& o_data) ;



Expand Down

0 comments on commit 855fc5f

Please sign in to comment.