diff options
author | Sunil Kumar <skumar8j@in.ibm.com> | 2019-04-29 03:34:39 -0500 |
---|---|---|
committer | Christian R Geddes <crgeddes@us.ibm.com> | 2019-07-24 10:46:05 -0500 |
commit | 6b03894470e30343885917d3db131b091ef6e7c7 (patch) | |
tree | d10257baea91ad44817c1e9f875a1c93442a0633 /src/import/generic | |
parent | 18aa5d9e32a32ddb70d038507774a88ed7f644fc (diff) | |
download | talos-hostboot-6b03894470e30343885917d3db131b091ef6e7c7.tar.gz talos-hostboot-6b03894470e30343885917d3db131b091ef6e7c7.zip |
OCMB changes to suit PPE compilation.
Change-Id: If1146defe839abe50a35daa633d8bfc2e9aa1bdf
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/76637
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Christian R Geddes <crgeddes@us.ibm.com>
Reviewed-by: MURULIDHAR NATARAJU <murulidhar@in.ibm.com>
Reviewed-by: RAJA DAS <rajadas2@in.ibm.com>
Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
Reviewed-by: Jennifer A Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/77309
Diffstat (limited to 'src/import/generic')
5 files changed, 83 insertions, 23 deletions
diff --git a/src/import/generic/memory/lib/utils/endian_utils.H b/src/import/generic/memory/lib/utils/endian_utils.H index 20bfd7caa..94b9dbc0d 100644 --- a/src/import/generic/memory/lib/utils/endian_utils.H +++ b/src/import/generic/memory/lib/utils/endian_utils.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ +/* Contributors Listed Below - COPYRIGHT 2018,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -37,9 +37,14 @@ #ifndef _ENDIAN_UTILS_H_ #define _ENDIAN_UTILS_H_ -#include <cstdint> #include <vector> -#include <generic/memory/lib/utils/shared/mss_generic_consts.H> + +#ifdef __PPE__ + #include <mss_generic_consts.H> +#else + #include <cstdint> + #include <generic/memory/lib/utils/shared/mss_generic_consts.H> +#endif namespace mss { @@ -67,6 +72,7 @@ void forceLE(const T& i_input, std::vector<uint8_t>& 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<ui forceLE(i_input[i], io_data); } } - +#endif /// /// @brief Forces native data into BE order /// @tparam T the data type to process @@ -98,20 +104,31 @@ void forceBE(const T& i_input, std::vector<uint8_t>& io_data) std::vector<uint8_t> 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<uint8_t>::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<ui forceBE(i_input[i], io_data); } } +#endif /// /// @brief Converts LE data into native order @@ -165,6 +183,7 @@ bool readLE(const std::vector<uint8_t>& 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<uint8_t>& 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<uint8_t>& 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<uint8_t>& 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 122086b9d..d6bdeaaed 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 <generic/memory/lib/utils/shared/mss_generic_consts.H> -#include <generic/memory/lib/utils/mss_generic_check.H> +#ifdef __PPE__ + #include <mss_generic_check.H> +#else + #include <generic/memory/lib/utils/shared/mss_generic_consts.H> + #include <generic/memory/lib/utils/mss_generic_check.H> +#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<T>& 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<OT> l_buffer(i_data[BYTE]); l_buffer.template extractToRight<F.get_start(), F.get_length()>(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<T>& 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<T>& 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<T>& i_target, { IT l_temp = 0; FAPI_TRY( (get_field<E, F>(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<T>& 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<OT>(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<T>& 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 f31440e14..45428b8c3 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 <fapi2.H> -#include <generic/memory/lib/utils/shared/mss_generic_consts.H> -#include <generic/memory/lib/utils/scom.H> -#include <generic/memory/lib/utils/c_str.H> + +#ifndef __PPE__ + #include <generic/memory/lib/utils/shared/mss_generic_consts.H> + #include <generic/memory/lib/utils/scom.H> + #include <generic/memory/lib/utils/c_str.H> +#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<T>& 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<T>& 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<T>& 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 37901f21b..72970ae63 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 <cstdint> +#ifndef __PPE__ + #include <cstdint> +#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 eed7aff57..d1930edfa 100644 --- a/src/import/generic/procedures/xml/error_info/generic_error.xml +++ b/src/import/generic/procedures/xml/error_info/generic_error.xml @@ -687,6 +687,7 @@ Settings are incorrect for received data. This could be code problem (decoding) or bad data. </description> + <ffdc>TARGET</ffdc> <ffdc>VALUE</ffdc> <ffdc>BYTE</ffdc> <ffdc>FFDC_CODE</ffdc> |