Skip to content

Commit

Permalink
Implement exp_check_for_ready
Browse files Browse the repository at this point in the history
Change-Id: Ic80b45e28cf4512ea37c9283108da97e9fddc660
Original-Change-Id: I11e80e70c411ec0f5a1891e078b669f176658c34
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/61972
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Reviewed-by: RYAN P. KING <rpking@us.ibm.com>
Reviewed-by: ANDRE A. MARIN <aamarin@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
  • Loading branch information
aamarin authored and Raja Das committed Jul 26, 2019
1 parent 17441d0 commit f52536b
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 21 deletions.
Expand Up @@ -149,6 +149,25 @@ fapi_try_exit:
return fapi2::current_err;
}

///
/// @brief Checks if the I2C interface returns an ACK
/// @param[in] i_target the OCMB target
/// @return FAPI2_RC_SUCCESS iff okay
///
inline fapi2::ReturnCode is_ready(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target)
{
// We send a simple but valid command to poll the I2C
// Arbitrarily send an EXP_FW_STATUS command id
size_t l_size = 0;
std::vector<uint8_t> l_cmd_id;
fw_status_setup(l_size, l_cmd_id);

// We just ignore the data. We'll see FAPI2_RC_SUCCESS if
// the I2C returns an ACK.
std::vector<uint8_t> l_data;
return fapi2::getI2c(i_target, l_size, l_cmd_id, l_data);
}

}// i2c
}// exp
}// mss
Expand Down
Expand Up @@ -60,4 +60,42 @@
</deconfigure>
</hwpError>

<hwpError>
<rc>RC_MSS_EXP_I2C_POLLING_TIMEOUT</rc>
<description>
Polling the explorer I2C slave interface for an ACK
timed out.
</description>
<callout>
<procedure>CODE</procedure>
<priority>MEDIUM</priority>
</callout>
<callout>
<target>TARGET</target>
<priority>HIGH</priority>
</callout>
<deconfigure>
<target>TARGET</target>
</deconfigure>
</hwpError>

<hwpError>
<rc>RC_MSS_EXP_STATUS_POLLING_TIMEOUT</rc>
<description>
Polling the explorer for successful return code
timed out.
</description>
<callout>
<procedure>CODE</procedure>
<priority>MEDIUM</priority>
</callout>
<callout>
<target>TARGET</target>
<priority>HIGH</priority>
</callout>
<deconfigure>
<target>TARGET</target>
</deconfigure>
</hwpError>

</hwpErrors>
57 changes: 36 additions & 21 deletions src/import/generic/memory/lib/utils/shared/mss_generic_consts.H
Expand Up @@ -42,6 +42,42 @@
namespace mss
{

///
/// @brief Common constants
///
enum common_consts
{
DEFAULT_POLL_LIMIT = 50, ///< the number of poll attempts in the event we can't calculate another
};

///
/// @brief Common timings
///
enum common_timings
{
DELAY_1NS = 1,
DELAY_10NS = 10 , ///< general purpose 10 ns delay for HW mode
DELAY_100NS = 100, ///< general purpose 100 ns delay for HW mode
DELAY_1US = 1000, ///< general purpose 1 usec delay for HW mode
DELAY_10US = 10000, ///< general purpose 1 usec delay for HW mode
DELAY_100US = 100000, ///< general purpose 100 usec delay for HW mode
DELAY_1MS = 1000000, ///< general purpose 1 ms delay for HW mode
};

///
/// @brief Common conversions
///
enum conversions
{
CONVERT_PS_IN_A_NS = 1000, ///< 1000 pico in an nano
CONVERT_PS_IN_A_US = 1000000, ///< 1000000 picos in a micro
MHZ_TO_KHZ = 1000,
SEC_IN_HOUR = 60 * 60, ///< seconds in an hour, used for scrub times
NIBBLES_PER_BYTE = 2,
BITS_PER_NIBBLE = 4,
BITS_PER_BYTE = 8,
};

///
/// @brief FFDC generic codes
///
Expand Down Expand Up @@ -191,27 +227,6 @@ enum guard_band : uint16_t

}// spd

enum conversions
{
NIBBLES_PER_BYTE = 2,
BITS_PER_NIBBLE = 4,
BITS_PER_BYTE = 8,

CONVERT_PS_IN_A_NS = 1000, ///< 1000 pico in an nano
CONVERT_PS_IN_A_US = 1000000, ///< 1000000 picos in a micro

DELAY_1NS = 1,
DELAY_10NS = 10 , ///< general purpose 10 ns delay for HW mode
DELAY_100NS = 100, ///< general purpose 100 ns delay for HW mode
DELAY_1US = 1000, ///< general purpose 1 usec delay for HW mode
DELAY_10US = 10000, ///< general purpose 1 usec delay for HW mode
DELAY_100US = 100000, ///< general purpose 100 usec delay for HW mode
DELAY_1MS = 1000000, ///< general purpose 1 ms delay for HW mode

MHZ_TO_KHZ = 1000,
SEC_IN_HOUR = 60 * 60, ///< seconds in an hour, used for scrub times
};

}// mss

#endif

0 comments on commit f52536b

Please sign in to comment.