From b1415469bdc0198f4a9398c43e9643f75b2c8629 Mon Sep 17 00:00:00 2001 From: Sunil Kumar Date: Mon, 29 Apr 2019 03:34:39 -0500 Subject: [PATCH] OCMB changes to suit PPE compilation. Change-Id: If1146defe839abe50a35daa633d8bfc2e9aa1bdf Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/76637 Tested-by: FSP CI Jenkins Tested-by: Jenkins Server Tested-by: PPE CI Tested-by: Hostboot CI Reviewed-by: Christian R Geddes Reviewed-by: MURULIDHAR NATARAJU Reviewed-by: RAJA DAS Tested-by: HWSV CI Reviewed-by: Jennifer A Stofer Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/77308 --- .../hwp/memory/lib/i2c/exp_i2c_fields.H | 15 ++++++- .../hwp/memory/lib/shared/exp_consts.H | 13 +++++- .../xml/error_info/mss_exp_errors.xml | 3 ++ .../generic/memory/lib/utils/endian_utils.H | 34 +++++++++++++--- .../generic/memory/lib/utils/mss_field.H | 40 ++++++++++++++----- .../memory/lib/utils/mss_generic_check.H | 25 ++++++++++-- .../lib/utils/shared/mss_generic_consts.H | 4 +- .../xml/error_info/generic_error.xml | 1 + 8 files changed, 109 insertions(+), 26 deletions(-) diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/i2c/exp_i2c_fields.H b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/i2c/exp_i2c_fields.H index c962bd678..41d83cc92 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/i2c/exp_i2c_fields.H +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/i2c/exp_i2c_fields.H @@ -36,9 +36,14 @@ #ifndef _MSS_EXP_I2C_FIELDS_H_ #define _MSS_EXP_I2C_FIELDS_H_ -#include -#include #include +#ifdef __PPE__ + #include + #include +#else + #include + #include +#endif namespace mss { @@ -241,6 +246,7 @@ inline fapi2::ReturnCode get_field(const fapi2::Target(i_target, i_data, EXP_I2C_GET_FIELD, o_value); } +#ifndef __PPE__ /// /// @brief Explorer I2C field setter /// @tparam IT Input type @@ -461,6 +467,8 @@ inline fapi2::ReturnCode set_fw_mode(const fapi2::Target(i_target, i_data, o_setting); } + /// /// @brief STATUS_CODE getter /// @param[in] i_target the OCMB target @@ -492,6 +501,7 @@ inline fapi2::ReturnCode get_status_code(const fapi2::Target(i_target, i_data, o_setting); } +#ifndef __PPE__ /// /// @brief CMD_ID getter /// @param[in] i_target the OCMB target @@ -505,6 +515,7 @@ inline fapi2::ReturnCode get_cmd_id(const fapi2::Target(i_target, i_data, o_setting); } +#endif }// status }// i2c diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/shared/exp_consts.H b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/shared/exp_consts.H index 813b9e5ba..c94d24d7e 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/shared/exp_consts.H +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/shared/exp_consts.H @@ -36,7 +36,9 @@ #ifndef MSS_EXP_CONSTS_H #define MSS_EXP_CONSTS_H -#include +#ifndef __PPE__ + #include +#endif namespace mss { @@ -46,6 +48,7 @@ namespace exp constexpr uint32_t OCMB_ADDR_SHIFT = 3; +#ifndef __PPE__ /// /// @brief enum list of explorer eff attributes to set /// @@ -83,6 +86,8 @@ enum sizes MAX_MRANK_PER_PORT = MAX_DIMM_PER_PORT * MAX_RANK_PER_DIMM, }; +#endif + /// /// @brief explorer ffdc codes /// @@ -197,6 +202,7 @@ enum status_codes FW_BUSY = 0xFE, }; +#ifndef __PPE__ /// /// @brief status codes for FW_BOOT_CONFIG /// @@ -214,6 +220,7 @@ enum fw_boot_cfg_status FW_BOOT_CFG_UNSUPPORTED_SERDES_FREQ = 0x04, }; +#endif /// /// @brief I2C boot stage options /// @note certain cmds work in certain boot stages @@ -261,9 +268,9 @@ enum addrSide RHS = 0x01 }; - }// i2c +#ifndef __PPE__ namespace omi { @@ -327,6 +334,8 @@ enum response_arg }; }// omi +#endif + }// exp }// mss 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 9838584ca..162cb9246 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 @@ -102,6 +102,7 @@ Explorer status code for command ID EXP_FW_STATUS did not return SUCCESS + TARGET STATUS_CODE CMD_ID @@ -123,6 +124,7 @@ Received FW_BUSY status after polling timeout for command ID EXP_FW_STATUS + TARGET STATUS_CODE CODE @@ -143,6 +145,7 @@ Received incorrect boot stage from command ID EXP_FW_STATUS + TARGET BOOT_STAGE EXPECTED_BOOT_STAGE diff --git a/src/import/generic/memory/lib/utils/endian_utils.H b/src/import/generic/memory/lib/utils/endian_utils.H index cbaf42895..00a3fe8ed 100644 --- a/src/import/generic/memory/lib/utils/endian_utils.H +++ b/src/import/generic/memory/lib/utils/endian_utils.H @@ -37,9 +37,14 @@ #ifndef _ENDIAN_UTILS_H_ #define _ENDIAN_UTILS_H_ -#include #include -#include + +#ifdef __PPE__ + #include +#else + #include + #include +#endif namespace mss { @@ -67,6 +72,7 @@ void forceLE(const T& i_input, std::vector& io_data) } } +#ifndef __PPE__ /// /// @brief Forces native data into LE order for an array /// @tparam T the data type to process @@ -82,7 +88,7 @@ inline void forceLEArray(const T* i_input, const uint64_t i_size, std::vector& io_data) std::vector l_tempBuffer; // This loop will put i_input into l_tempBuffer in BE order - for(size_t i = 0; i < sizeof(i_input); i++) + + for(size_t i = sizeof(i_input); i > 0; i--) { // Grab the lowest order byte and add it to the front of the vector const uint8_t l_byte = l_temp & 0xFF; - l_tempBuffer.insert(l_tempBuffer.begin(), l_byte); + l_tempBuffer.push_back(l_byte); // Shift higher byte value into lowest no matter existing endianness l_temp >>= BITS_PER_BYTE; } // Put the new BE formatted data at the end of the input buffer - io_data.insert(io_data.end(), l_tempBuffer.begin(), l_tempBuffer.end()); + + std::vector::iterator it = l_tempBuffer.end(); + --it; //Move iterator to the last element. + + for(uint8_t i = l_tempBuffer.size(); i > 0; --i) + { + io_data.push_back(*it); + --it; + } + } +#ifndef __PPE__ /// /// @brief Forces native data into BE order for an array /// @tparam T the data type to process @@ -127,6 +144,7 @@ inline void forceBEArray(const T* i_input, const uint64_t i_size, std::vector& i_input, uint32_t& io_idx, T& o_data) return true; } +#ifndef __PPE__ /// /// @brief Converts LE data into native order /// @tparam T the data type to output to @@ -188,6 +207,7 @@ bool readLEArray(const std::vector& i_input, const uint32_t i_size, uin return l_passing; } +#endif /// /// @brief Converts BE data into native order @@ -225,6 +245,7 @@ bool readBE(const std::vector& i_input, uint32_t& io_idx, T& o_data) return true; } +#ifndef __PPE__ /// /// @brief Converts BE data into native order /// @tparam T the data type to output to @@ -248,6 +269,7 @@ bool readBEArray(const std::vector& i_input, const uint32_t i_size, uin return l_passing; } +#endif } diff --git a/src/import/generic/memory/lib/utils/mss_field.H b/src/import/generic/memory/lib/utils/mss_field.H index a1220d4fd..4ea82fb32 100644 --- a/src/import/generic/memory/lib/utils/mss_field.H +++ b/src/import/generic/memory/lib/utils/mss_field.H @@ -37,8 +37,21 @@ #ifndef _MSS_FIELD_H_ #define _MSS_FIELD_H_ -#include -#include +#ifdef __PPE__ + #include +#else + #include + #include +#endif + +//Macro +#ifdef __PPE__ + #define TARGIDFORMAT "0x%08X" + #define TARGTID i_target.get() +#else + #define TARGIDFORMAT "%s" + #define TARGTID spd::c_str(i_target) +#endif namespace mss { @@ -190,18 +203,18 @@ inline fapi2::ReturnCode get_field(const fapi2::Target& i_target, .set_LIST_SIZE(i_data.size()) .set_FUNCTION(i_ffdc_codes) .set_TARGET(i_target), - "Out of bounds indexing (with %d) on a list of size %d for %s", + "Out of bounds indexing (with %d) on a list of size %d for " TARGIDFORMAT, BYTE, i_data.size(), - spd::c_str(i_target)); + TARGTID); { // Extracting desired bits const fapi2::buffer l_buffer(i_data[BYTE]); l_buffer.template extractToRight(o_value); - FAPI_DBG("%s data[%d] = 0x%02x. Field with start bit %d, bit len %d, has data 0x%02x.", - spd::c_str(i_target), + FAPI_DBG(TARGIDFORMAT " data[%d] = 0x%02x. Field with start bit %d, bit len %d, has data 0x%02x.", + TARGTID, BYTE, i_data[BYTE], F.get_start(), @@ -214,6 +227,7 @@ inline fapi2::ReturnCode get_field(const fapi2::Target& i_target, fapi_try_exit: return fapi2::current_err; } +#ifndef __PPE__ /// /// @brief Helper function to set byte field information @@ -274,6 +288,7 @@ inline fapi2::ReturnCode set_field(const fapi2::Target& i_target, fapi_try_exit: return fapi2::current_err; } +#endif /// /// @brief byte field reader @@ -303,7 +318,7 @@ inline fapi2::ReturnCode get_field( const fapi2::Target& i_target, { IT l_temp = 0; FAPI_TRY( (get_field(i_target, i_data, i_ffdc_codes, l_temp)), - "Failed get_field() for %s", spd::c_str(i_target) ); + "Failed get_field() for " TARGIDFORMAT, TARGTID ); // Test if retrieved data seems valid FAPI_TRY( check::invalid_value(i_target, @@ -313,29 +328,31 @@ inline fapi2::ReturnCode get_field( const fapi2::Target& i_target, F.get_byte(i_data), l_temp, i_ffdc_codes), - "Failed fail_for_invalid_value() for %s", spd::c_str(i_target) ); + "Failed fail_for_invalid_value() for " TARGIDFORMAT, TARGTID ); + // Output should only change if data check passes o_value = static_cast(l_temp); - FAPI_ASSERT( o_value == l_temp, fapi2::MSS_CONVERSION_ERROR() .set_ORIGINAL_VAL(l_temp) .set_CONVERTED_VAL(o_value) .set_TARGET(i_target) .set_FUNCTION(i_ffdc_codes), - "Conversion error between original %d to converted %d value for %s", - l_temp, o_value, spd::c_str(i_target) ); + "Conversion error between original %d to converted %d value for " TARGIDFORMAT, + l_temp, o_value, TARGTID); FAPI_DBG("%s: 0x%02x for %s", TT::FIELD_STR, o_value, spd::c_str(i_target)); + fapi_try_exit: return fapi2::current_err; } +#ifndef __PPE__ /// /// @brief byte field writer /// @tparam E endian type @@ -388,6 +405,7 @@ inline fapi2::ReturnCode set_field( const fapi2::Target& i_target, fapi_try_exit: return fapi2::current_err; } +#endif }// mss diff --git a/src/import/generic/memory/lib/utils/mss_generic_check.H b/src/import/generic/memory/lib/utils/mss_generic_check.H index 9bfa05157..11a7bb6d0 100644 --- a/src/import/generic/memory/lib/utils/mss_generic_check.H +++ b/src/import/generic/memory/lib/utils/mss_generic_check.H @@ -37,15 +37,18 @@ #define _MSS_GENERIC_CHECK_H_ #include -#include -#include -#include + +#ifndef __PPE__ + #include + #include + #include +#endif namespace mss { namespace check { - +#ifndef __PPE__ /// /// @brief Checks whether any FIRs have lit up on a target /// @tparam MC MC type for which to check FIR's @@ -175,6 +178,7 @@ fapi2::ReturnCode fir_or_pll_fail( const fapi2::Target& i_target, #endif } +#endif /// /// @brief Checks conditional passes and implements traces & exits if it fails /// @tparam T fapi2 target type @@ -196,6 +200,18 @@ inline fapi2::ReturnCode invalid_value(const fapi2::Target& i_target, const FFDC i_ffdc_codes, const char* i_err_str = "") { +#ifdef __PPE__ + FAPI_ASSERT(i_conditional, + fapi2::MSS_FAILED_DATA_INTEGRITY_CHECK(). + set_VALUE(i_data). + set_BYTE(i_byte_index). + set_TARGET(i_target). + set_FFDC_CODE(i_ffdc_codes), + "%s Byte %d, Data returned: %d.", + i_err_str, + i_byte_index, + i_data); +#else FAPI_ASSERT(i_conditional, fapi2::MSS_FAILED_DATA_INTEGRITY_CHECK(). set_VALUE(i_data). @@ -208,6 +224,7 @@ inline fapi2::ReturnCode invalid_value(const fapi2::Target& i_target, i_byte_index, i_data); +#endif return fapi2::FAPI2_RC_SUCCESS; fapi_try_exit: diff --git a/src/import/generic/memory/lib/utils/shared/mss_generic_consts.H b/src/import/generic/memory/lib/utils/shared/mss_generic_consts.H index bfe2edd70..5cafd98bb 100644 --- a/src/import/generic/memory/lib/utils/shared/mss_generic_consts.H +++ b/src/import/generic/memory/lib/utils/shared/mss_generic_consts.H @@ -38,7 +38,9 @@ #ifndef _MSS_GENERIC_CONSTS_H_ #define _MSS_GENERIC_CONSTS_H_ -#include +#ifndef __PPE__ + #include +#endif namespace mss { diff --git a/src/import/generic/procedures/xml/error_info/generic_error.xml b/src/import/generic/procedures/xml/error_info/generic_error.xml index 96e1228cc..20a6e82ae 100644 --- a/src/import/generic/procedures/xml/error_info/generic_error.xml +++ b/src/import/generic/procedures/xml/error_info/generic_error.xml @@ -390,6 +390,7 @@ Settings are incorrect for received data. This could be code problem (decoding) or bad data. + TARGET VALUE BYTE FFDC_CODE