From 2315a070ebd8edeaac44df5d7a2d17ad7b44f1bb Mon Sep 17 00:00:00 2001 From: Greg Still Date: Sat, 30 May 2015 20:14:19 -0500 Subject: Round 3 PPE FAPI2 Sync with current FAPI2 base Change-Id: I16fe661deece510266e71bebea87ca546db2d252 Delete return_code.H in deference to base Change-Id: Ib8f11bc5eacbc64399de299d90f1698262967216 Remove plat_utils.C from fapi2ppefiles.mk Change-Id: Ie921e66b1d4b6972d5ad1d0ac2278c055d82ce19 Add include of pk_app_cfg.h to std_irq_config.h Change-Id: I488e43ea14a0ef1da927bcf010ff95c9349b08dd Image building updates to be more realistic Change-Id: I67084b96bb9e83b71fc732887955f115e7ed00db Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/18006 Reviewed-by: Derk Rembold Tested-by: Derk Rembold --- hwpf/plat/include/buffer.H | 423 ---------------------------------- hwpf/plat/include/error_scope.H | 147 ------------ hwpf/plat/include/fapi2.H | 2 +- hwpf/plat/include/hw_access.H | 1 - hwpf/plat/include/plat_target_parms.H | 35 ++- hwpf/plat/include/return_code.H | 187 --------------- hwpf/plat/src/fapi2ppefiles.mk | 3 +- 7 files changed, 19 insertions(+), 779 deletions(-) delete mode 100644 hwpf/plat/include/buffer.H delete mode 100644 hwpf/plat/include/error_scope.H delete mode 100644 hwpf/plat/include/return_code.H (limited to 'hwpf') diff --git a/hwpf/plat/include/buffer.H b/hwpf/plat/include/buffer.H deleted file mode 100644 index 382b9642..00000000 --- a/hwpf/plat/include/buffer.H +++ /dev/null @@ -1,423 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -/** - * @file buffer.H - * @brief definitions for fapi2 variable integral buffers - */ - -#ifndef __FAPI2_INTEGRAL_BUFFER__ -#define __FAPI2_INTEGRAL_BUFFER__ - -#include -#include - -namespace fapi2 -{ - /// @brief Class representing a FAPI buffer - /// @note Buffers support method chaining. So, rather than - /// this - /// @code - /// buffer mask; - /// mask.setBit(); - /// mask.invert(); - /// my_buffer &= mask; - /// @endcode - /// You can do - /// @code - /// my_buffer &= buffer().setBit.invert(); - /// @endcode - template - class buffer : public buffer_base - { - public: - /// Shortcut typedef to map to our traits class - typedef typename buffer_base::bits_type bits_type; - - /// - /// @brief Integral buffer assignment constructor - /// @param[in] i_value initial value of the buffer - /// Meaningless for variable types and thus protected. - /// - inline buffer(T i_value = 0) - { - // Why not an initializer list? That would force buffer_base - // to have a ctor which took a T, and I want to avoid that in - // the generic case: this makes it more clear that the two - // ctor's (integral and container) behave very differently. - // variable_buffers also have a ctor which takes a single - // numerical value, and that represents a bit count, not an - // initial value. - this->iv_data = i_value; - } - - - /// @name Bit/Word Manipulation Functions - ///@{ - - /// - /// @brief Return the length of the buffer in bits - /// @return Length in bits - /// - inline constexpr uint32_t getBitLength(void) const - { return bufferTraits::bit_length(this->iv_data); } - - /// - /// @brief Return the length of the buffer in OT units - /// @return Length in OT units rounded up - /// @tparam OT the type to get the length of. For example, if one - /// wanted the length in double words, OT would be uint64_t - /// (getLength().) Similarly, to get the length in words, - /// getLength(). - /// - template< typename OT > - inline constexpr uint32_t getLength(void) const - { - return bufferTraits::template size(this->iv_data); - } - - /// - /// @brief Templated setBit for integral types - /// @tparam B the bit number to set. - /// @return buffer& Useful for method chaining - /// @note 0 is left-most - /// @note Example: fapi2::buffer().setBit<3>(); - /// - template - inline buffer& setBit(void) - { - static_assert((B >= 0) && - (B < bufferTraits::bits_per_unit), "failed range check"); - - // Force iv_data to be dependent on the template type to force - // its look up in the second phase - this->iv_data |= (static_cast(1)) << (bufferTraits::bits_per_unit - B - 1); - return *this; - } - - /// - /// @brief Clear a bit in buffer - /// @tparam B Bit in buffer to clear. - /// @return buffer& Useful for method chaining - /// @note Asserting that all the parameters are known at - /// compile time so this can be templated only. If that is not - /// the case we can add a function parameter version. - /// - template< bits_type B > - inline buffer& clearBit(void) - { - static_assert((B >= 0) && - (B < bufferTraits::bits_per_unit), "failed range check"); - - this->iv_data &= buffer().setBit().invert(); - return *this; - } - - /// - /// @brief Invert bit - /// @tparam B Bit in buffer to invert. - /// @return buffer& Useful for method chaining - /// @note Asserting that all the parameters are known at - /// compile time so this can be templated only. If that is not - /// the case we can add a function parameter version. - /// - template< bits_type B > - inline buffer& flipBit(void) - { - static_assert((B >= 0) && - (B < bufferTraits::bits_per_unit), "failed range check"); - - this->iv_data ^= buffer().setBit(); - return *this; - } - - /// - /// @brief Set a bit in the buffer - /// @param[in] i_bit the bit number to set. - /// @note 0 is left-most - /// @return FAPI2_RC_SUCCESS if OK - /// - inline fapi2::ReturnCode setBit(const bits_type& i_bit) - { - if (i_bit >= bufferTraits::bits_per_unit) - { - return FAPI2_RC_INVALID_PARAMETER; - } - - // Force iv_data to be dependent on the template type to force - // its look up in the second phase - this->iv_data |= - (static_cast(1)) << (bufferTraits::bits_per_unit - i_bit - 1); - return FAPI2_RC_SUCCESS; - } - - /// - /// @brief Get the value of a bit in the buffer - /// @tparam B Bit in buffer to get. - /// @return true if bit is on, false if bit is off - /// - template< bits_type B > - inline bool getBit(void) const - { - return buffer().setBit() & this->iv_data; - } - - ///@} - - /// @name Buffer Manipulation Functions - ///@{ - - // Note: Many (all?) of these are not needed and the compiler complains - // as the cast to T yields a better operator. There are here mainly for - // documenation purposes. - - /// - /// @brief operator>>() - /// -#ifdef DOXYGEN - buffer& operator>>(bits_type i_shiftnum); -#endif - - /// - /// @brief operator<<() - /// -#ifdef DOXYGEN - buffer& operator<<(bits_type i_shiftnum); -#endif - - /// - /// @brief operator+() - /// -#ifdef DOXYGEN - buffer& operator+(const T& rhs); -#endif - - /// - /// @brief operator+=() - /// -#ifdef DOXYGEN - buffer& operator+=(const T& rhs); -#endif - - /// - /// @brief operator|=() - /// -#ifdef DOXYGEN - buffer& operator|=(const T& rhs); -#endif - - /// - /// @brief operator&=() - /// -#ifdef DOXYGEN - buffer& operator&=(const T& rhs); -#endif - - /// - /// @brief operator|() - /// -#ifdef DOXYGEN - buffer& operator|(const T& rhs); -#endif - - /// - /// @brief operator&() - /// -#ifdef DOXYGEN - buffer& operator&(const T& rhs); -#endif - - /// - /// @brief operator^=() - /// -#ifdef DOXYGEN - buffer& operator^=(const T& rhs); -#endif - - /// - /// @brief operator~() - /// -#ifdef DOXYGEN - buffer& operator~(const T& rhs) const; -#endif - - /// - /// @brief operator==() - /// -#ifdef DOXYGEN - bool operator==(const T& rhs) const; -#endif - - /// - /// @brief operator!=() - /// -#ifdef DOXYGEN - bool operator!=(const T& rhs) const; -#endif - - /// - /// @brief Copy part of a OT into the DataBuffer - /// @tparam TS Start bit to insert into (target start) - /// @tparam L Length of bits to insert - /// @tparam SS Start bit in source - /// @tparam OT the type of the incoming (origin) data - /// @param[in] i_datain OT value to copy into DataBuffer - /// - data is taken left aligned - /// @note Asserting that all the parameters are known at - /// compile time so this can be templated only. If that is not - /// the case we can add a function parameter version. - /// - template - inline void insert(const OT i_datain) - { - const bits_type target_length = parameterTraits::bit_length; - const bits_type source_length = parameterTraits::bit_length; - - // Error if input data don't make sense - static_assert((TS + L) <= target_length, - "insert(): (Target Start + Len) is out of bounds"); - static_assert((SS + L) <= source_length, - "insert(): (Source Start + Len) is out of bounds"); - static_assert(TS < target_length, - "insert(): Target Start is out of bounds"); - static_assert(SS < source_length, - "insert(): Source Start is out of bounds"); - - // Get mask value for Target buffer - // Note: Need "& ((T)-1) because bit shift left for Target buffer doesn't roll off - T mask =((T(~0) << (target_length - L)) & T(~0)) >> TS; - - // Calculate the equivalent position of the input Source start for the size of the Target buffer. - - // Assume OT is smaller (sizeof(T) > sizeof(OT)) - uint64_t sourceShift = abs(TS - ((target_length - source_length) + SS)); - uint64_t sourceAlign = T(i_datain) << sourceShift; - - if (sizeof(T) == sizeof(OT)) - { - sourceShift = abs(SS - TS); - sourceAlign = (SS > TS) ? ((T)i_datain) << sourceShift : ((T)i_datain) >> sourceShift; - } - - if (sizeof(T) < sizeof(OT)) - { - sourceShift = source_length - target_length; - if (SS <= sourceShift) - { - sourceShift = sourceShift + TS - SS; - sourceAlign = ((OT)i_datain) >> sourceShift; - } - - // (SS > sourceShift) - else - { - if (sourceShift > TS) - { - sourceShift = SS - sourceShift - TS; - sourceAlign = OT(i_datain) << sourceShift; - } - else - { - sourceShift = SS - sourceShift; - sourceAlign = (sourceShift < TS) ? OT(i_datain) >> sourceShift : OT(i_datain); - } - } - } - - this->iv_data = (this->iv_data & ~mask) | (sourceAlign & mask); - return; - } - - /// - /// @brief Copy in a right aligned value - /// @tparam SB Start bit to insert into - /// @tparam L Length of bits to insert - /// @tparam OT the type of the incoming (origin) data - /// @param[in] i_datain OT value to copy into DataBuffer - /// - data is taken right aligned - /// @note Data is assumed to be aligned on the word boundary of L - /// @note Asserting that all the parameters are known at - /// compile time so this can be templated only. If that is not - /// the case we can add a function parameter version. - /// - template - inline void insertFromRight(const OT i_datain) - { - // Error if input data don't make sense - static_assert(L <= parameterTraits::bit_length, - "insertFromRight(): Len >= input buffer"); - static_assert(TS < parameterTraits::bit_length, - "insertFromRight(): Target Start is out of bounds"); - static_assert((TS + L) <= parameterTraits::bit_length, - "InsertFromRight(): (Target Start + Len) is out of bounds"); - - this->insert::bit_length - L>(i_datain); - return; - } - - /// - /// @brief Copy data from this buffer into an OT - /// @tparam TS Start bit to insert into (target start) - /// @tparam L Length of bits to insert - /// @tparam SS Start bit in source - /// @tparam OT the type of the outgoing (target) - /// @param[out] o_out OT to copy into - data is placed left aligned - /// @note Asserting that all the parameters are known at - /// compile time so this can be templated only. If that is not - /// the case we can add a function parameter version. - /// - template - inline void extract(OT& o_out) - { - // Extraction is just an insert into o_out - - buffer out(o_out); - out.insert(this->iv_data); - o_out = out; - return; - } - -#if 0 - /// - /// @brief Copy data from this buffer into an OT and right justify - /// @tparam OT the type of the outgoing data - defaults to T - /// @tparam SB Start bit to insert into - defaults to 0 - /// @tparam SS Start bit in o_out - default value is zero - /// @tparam L Length of bits to copy - defaults to sizeof(OT) * 8 - /// @param[out] o_out OT to copy into - data is placed right aligned - /// @note Asserting that all the parameters are known at - /// compile time so this can be templated only. If that is not - /// the case we can add a function parameter version. - /// @post Data is copied from specified location to o_out, right - /// aligned. Data is only right aligned if L < sizeof(bits_type) - /// - template< typename OT = T, bits_type L = parameterTraits::bit_length, - bits_type SB = 0, bits_type SS = 0 > - void extractFromRight(OT& o_out); -#endif - ///@} - }; -}; - -#endif diff --git a/hwpf/plat/include/error_scope.H b/hwpf/plat/include/error_scope.H deleted file mode 100644 index ccd2f080..00000000 --- a/hwpf/plat/include/error_scope.H +++ /dev/null @@ -1,147 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -/** - * @file error_scope.H - * @brief definitions which create a scope for automatic error handling - */ - -#ifndef __FAPI2_ERROR_SCOPE__ -#define __FAPI2_ERROR_SCOPE__ - -#include -#include -#include -#include -#include - - -extern "C" -{ -#ifndef __noRC__ - extern fapi2::ReturnCode G_current_err; -#endif - extern uint64_t G_pib_error_mask; - extern uint64_t G_operational_state; -} - - -/// -/// @brief Place holder until more of the FAPI infrastructure -/// can be compiled with this file -/// @param[in] ... varargs, passed to a platform specific output function -/// @note This is skeleton implementation for prototype purposes. This -/// does not imply "printf" is used on any or all platforms. -/// -#define FAPI_INF( ... ) -#define FAPI_ERR( ... ) PK_TRACE( __VA_ARGS__ ) -//#define FAPI_DBG( ... ) PK_TRACE( __VA_ARGS__ ) -#define FAPI_DBG( ... ) - -/// @cond -#define FAPI_VA_NARGS_IMPL(_1, _2, _3, _4, _5, N, ...) N -#define FAPI_VA_NARGS(...) FAPI_VA_NARGS_IMPL(__VA_ARGS__, 5, 4, 3, 2, 1) - -//#define FAPI_TRY_IMPL2(...) FAPI_TRY_TRACE (__VA_ARGS__) -#define FAPI_TRY_IMPL2(count, ...) FAPI_TRY ## count (__VA_ARGS__) -#define FAPI_TRY_IMPL(count, ...) FAPI_TRY_IMPL2(count, __VA_ARGS__) - -#ifndef __noRC__ -#define FAPI_TRY_NO_TRACE( __operation__ ) \ - if ((fapi2::current_err = (__operation__)) != fapi2::FAPI2_RC_SUCCESS) \ - { \ - goto clean_up; \ - } -#else -#define FAPI_TRY_NO_TRACE( __operation__ ) \ - (__operation__); -#endif - -// Why debug? Because this isn't a mechanism to gather FFDC -// one should be using FAPI_ASSERT. However, it is nice to -// have a conditional trace in the event of a failure in the -// operation, so that's why this is here. -// if ((fapi2::current_err = (__operation__)) != fapi2::FAPI2_RC_SUCCESS) -#ifndef __noRC__ -#define FAPI_TRY_TRACE( __operation__, ... ) \ - if ((fapi2::current_err = (__operation__)) != fapi2::FAPI2_RC_SUCCESS) \ - { \ - FAPI_DBG(__VA_ARGS__); \ - goto clean_up; \ - } -#define FAPI_CLEANUP() \ -clean_up: -#else -/// @todo: something is wrong needed the goto_cleanup -#define FAPI_TRY_TRACE( __operation__, ... ) \ - FAPI_DBG(__VA_ARGS__); \ - (__operation__) - -#define FAPI_CLEANUP() - -#endif - -#define FAPI_TRY0 FAPI_TRY_NO_TRACE -#define FAPI_TRY1 FAPI_TRY_TRACE -#define FAPI_TRY2 FAPI_TRY_TRACE -#define FAPI_TRY3 FAPI_TRY_TRACE -#define FAPI_TRY4 FAPI_TRY_TRACE -#define FAPI_TRY5 FAPI_TRY_TRACE -/// @endcond - -/// -/// @brief Wrapper to check an operation for an error state -/// and jump to the label cleam_up if there is an error. -/// @param[in] __operation__ an operation which returns a fapi::ReturnCode -/// @param[in] Optional vararg format/agruments for trace output. -/// @note This implementation does not support PIB error masks or -/// FSP operational states. -/// @warning The trace information is only going to be seen during -/// debug, it's not an error or informational trace. This is because -/// traces might not be seen in the field. If you want information -/// you will see on a field error, use FAPI_ASSERT. -/// -#ifdef DOXYGEN -#define FAPI_TRY(__operation__, ...) FAPI_TRY_IMPL -#else -#define FAPI_TRY(...) FAPI_TRY_IMPL(FAPI_VA_NARGS(__VA_ARGS__), __VA_ARGS__) -#endif - -/// -/// @brief Assert a conditional is true. -/// If it is not, the FFDC gathering function is called and the -/// trace is output as a FAPI error trace. -/// @param[in] __conditional__ the condition to assert -/// @param[in] __ffdc__ the FFDC gathering function -/// @param[in] ... varargs, as input to FAPI_ERR -/// -#define FAPI_ASSERT( __conditional__, __ffdc__, ... ) \ - if (! (__conditional__)) \ - { \ - /* __ffdc__; */ \ - FAPI_ERR(__VA_ARGS__); \ - goto clean_up; \ - } - -#endif // __FAPI2_ERROR_SCOPE__ diff --git a/hwpf/plat/include/fapi2.H b/hwpf/plat/include/fapi2.H index 5e614e1b..c6197284 100644 --- a/hwpf/plat/include/fapi2.H +++ b/hwpf/plat/include/fapi2.H @@ -30,7 +30,7 @@ // In turn includes the needed generated headers (hwp_ffd_classes, etc.) #include #include // Generated file -#include +#include #include // Generated file diff --git a/hwpf/plat/include/hw_access.H b/hwpf/plat/include/hw_access.H index 1d27535f..591eab27 100644 --- a/hwpf/plat/include/hw_access.H +++ b/hwpf/plat/include/hw_access.H @@ -59,7 +59,6 @@ namespace fapi2 /// @return uint8_t The current PIB error mask uint8_t getPIBErrorMask(void) { - uint8_t o_pib_mask; PLAT_GET_PIB_ERROR_MASK(o_pib_mask); return o_pib_mask; } diff --git a/hwpf/plat/include/plat_target_parms.H b/hwpf/plat/include/plat_target_parms.H index 4931f790..6056dcf5 100644 --- a/hwpf/plat/include/plat_target_parms.H +++ b/hwpf/plat/include/plat_target_parms.H @@ -30,33 +30,32 @@ #ifndef __FAPI2_PPE_TARGET_PARMS__ #define __FAPI2_PPE_TARGET_PARMS__ +#include "fapi_sbe_common.H" -#ifndef __ASSEMBLER__ +CONST_UINT64_T(CHIPLET_COUNT, 0x38); -const uint64_t CHIPLET_COUNT = 0x38; +CONST_UINT64_T(CHIP_TARGET_COUNT , 1); +CONST_UINT64_T(CHIP_TARGET_OFFSET, 0); -const uint64_t CHIP_TARGET_COUNT = 1; -const uint64_t CHIP_TARGET_OFFSET = 0; +CONST_UINT64_T(PERV_TARGET_OFFSET, CHIP_TARGET_OFFSET + CHIP_TARGET_COUNT); +CONST_UINT64_T(PERV_CHIPLET_OFFSET, 0x1); +CONST_UINT64_T(PERV_TARGET_COUNT, 15); -const uint64_t PERV_TARGET_OFFSET = CHIP_TARGET_OFFSET + CHIP_TARGET_COUNT; -const uint64_t PERV_CHIPLET_OFFSET = 0x1; -const uint64_t PERV_TARGET_COUNT = 15; +CONST_UINT64_T(EQ_TARGET_OFFSET, PERV_TARGET_OFFSET + PERV_TARGET_COUNT); +CONST_UINT64_T( EQ_CHIPLET_OFFSET, 0x10); +CONST_UINT64_T(EQ_TARGET_COUNT, 6); -const uint64_t EQ_TARGET_OFFSET = PERV_TARGET_OFFSET + PERV_TARGET_COUNT; -const uint64_t EQ_CHIPLET_OFFSET = 0x10; -const uint64_t EQ_TARGET_COUNT = 6; +CONST_UINT64_T( CORE_TARGET_OFFSET, EQ_TARGET_OFFSET + EQ_TARGET_COUNT); +CONST_UINT64_T( CORE_CHIPLET_OFFSET, 0x20); +CONST_UINT64_T(CORE_TARGET_COUNT, 24); -const uint64_t CORE_TARGET_OFFSET = EQ_TARGET_OFFSET + EQ_TARGET_COUNT; -const uint64_t CORE_CHIPLET_OFFSET = 0x20; -const uint64_t CORE_TARGET_COUNT = 24; +CONST_UINT64_T( EX_TARGET_OFFSET, CORE_TARGET_OFFSET + CORE_TARGET_COUNT); +CONST_UINT64_T( EX_CHIPLET_OFFSET, 0x10); +CONST_UINT64_T(EX_TARGET_COUNT, 12); -const uint64_t EX_TARGET_OFFSET = CORE_TARGET_OFFSET + CORE_TARGET_COUNT; -const uint64_t EX_CHIPLET_OFFSET = 0x10; -const uint64_t EX_TARGET_COUNT = 12; +CONST_UINT64_T(TARGET_COUNT, EX_TARGET_OFFSET + EX_TARGET_COUNT); -const uint64_t TARGET_COUNT = EX_TARGET_OFFSET + EX_TARGET_COUNT; -#endif #endif // __FAPI2_PPE_TARGET_PARMS__ diff --git a/hwpf/plat/include/return_code.H b/hwpf/plat/include/return_code.H deleted file mode 100644 index 225f1b0a..00000000 --- a/hwpf/plat/include/return_code.H +++ /dev/null @@ -1,187 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ -/* [+] International Business Machines Corp. */ -/* */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ -/** - * @file return_code.H - * @brief definitions for fapi2 return codes - */ - -#ifndef __FAPI2_RETURN_CODE__ -#define __FAPI2_RETURN_CODE__ - -#include - -// Remove this for platforms which don't support FFDC -//#include - -/// -/// @brief Set HWP Error macro -/// -/// This macro should be used by a HWP to create an error. The ReturnCode's -/// internal return code is set and any error information in the Error XML file -/// is added to the ReturnCode -/// -#define FAPI_SET_HWP_ERROR(RC, ERROR) \ - RC._setHwpError(fapi2::ERROR); \ - ERROR##_CALL_FUNCS_TO_COLLECT_FFDC(RC); \ - ERROR##_CALL_FUNCS_TO_COLLECT_REG_FFDC(RC); \ - ERROR##_ADD_ERROR_INFO(RC) - -/// -/// @brief Add info to HWP Error macro -/// -/// This macro should be used by an FFDC HWP to add error information from an -/// Error XML file to an existing error. -/// -#define FAPI_ADD_INFO_TO_HWP_ERROR(RC, ERROR) \ - ERROR##_CALL_FUNCS_TO_COLLECT_FFDC(RC); \ - ERROR##_CALL_FUNCS_TO_COLLECT_REG_FFDC(RC); \ - ERROR##_ADD_ERROR_INFO(RC) - -namespace fapi2 -{ - /// - /// @brief Enumeration of return codes - /// - enum ReturnCodes - { - ///< Success - FAPI2_RC_SUCCESS = 0, - - // Flag bits indicating which code generated the error. - FAPI2_RC_FAPI2_MASK = 0x04000000, ///< FAPI2 mask - FAPI2_RC_PLAT_MASK = 0x02000000, ///< Platform mask - FAPI2_RC_HWP_MASK = 0x00000000, ///< HWP mask - - // - // FAPI generated return codes - // - - FAPI2_RC_INVALID_ATTR_GET = FAPI2_RC_FAPI2_MASK | 0x01, - ///< Initfile requested an attribute with an invalid attribute ID - - FAPI2_RC_INVALID_CHIP_EC_FEATURE_GET = FAPI2_RC_FAPI2_MASK | 0x02, - ///< HWP requested a chip EC feature with an invalid attribute ID - - FAPI2_RC_INVALID_MULTISCOM_LENGTH = FAPI2_RC_FAPI2_MASK | 0x03, - ///< Invalid multiscom parameters - - FAPI2_RC_INVALID_PARAMETER = FAPI2_RC_FAPI2_MASK | 0x04, - ///< Invalid parameters to a FAPI2 function - - FAPI2_RC_OVERFLOW = FAPI2_RC_FAPI2_MASK | 0x05, - ///< Overflow condition, typically a buffer operation - - // - // PLAT generated return codes. Additional details may be contained in - // ReturnCode platData (this can only be looked at by PLAT code) - // - - FAPI2_RC_PLAT_ERR_SEE_DATA = FAPI2_RC_PLAT_MASK | 0x01, - ///< Generic platform error - - FAPI2_RC_PLAT_ERR_ADU_LOCKED = FAPI2_RC_PLAT_MASK | 0x02, - ///< Operation to AlterDisplay unit failed because it is locked - - FAPI2_RC_PLAT_NOT_SUPPORTED_AT_RUNTIME = FAPI2_RC_PLAT_MASK | 0x03, - ///< Operation not supported by HB runtime - }; - - - /// - /// @brief Class representing a FAPI2 ReturnCode - /// - /// @note Remove the inheritance relationship with FirstFailureData if - /// the platform doesn't support FFDC. - class ReturnCode - { - public: - - /// - /// @brief Constructor. - /// @param[in] i_rc the rc to set - /// - ReturnCode(const uint32_t i_rc = FAPI2_RC_SUCCESS): - iv_rc(i_rc) - {}; - - /// - /// @brief integral type conversion function. Returns the error code - /// @return The error code - /// - inline operator uint32_t() const { return iv_rc; } - - /// - /// @brief Returns true iff iv_rc == SUCCESS - /// @return true or false - /// - inline operator bool() const { return iv_rc == FAPI2_RC_SUCCESS; } - - /// - /// @brief Assignement operator - /// - inline ReturnCode& operator=(const uint32_t& rhs) - { - iv_rc = rhs; - return *this; - } - - inline ReturnCode& operator=(const ReturnCodes& rhs) - { - iv_rc = rhs; - return *this; - } - - inline bool operator==(const uint32_t& rhs) const - { return rhs == iv_rc; } - - inline bool operator==(const ReturnCodes& rhs) const - { return rhs == iv_rc; } - - inline bool operator!=(const uint32_t& rhs) const - { return rhs != iv_rc; } - - inline bool operator!=(const ReturnCodes& rhs) const - { return rhs != iv_rc; } - - ReturnCode& insertPIBcode(const uint32_t& pibrc) - { - iv_rc = FAPI2_RC_PLAT_MASK | pibrc; - return *this; - } - - private: - uint32_t iv_rc; - }; - - /// This implementation assumes no exception handling and leverages thread-local - /// storage. For platforms without thread support, a global variable will - /// suffice for the error state. - extern thread_local ReturnCode current_err; /// the current error state - extern thread_local uint32_t pib_error_mask; /// the pib mask - extern thread_local uint32_t operational_state; /// the operational mode - -}; - -#endif diff --git a/hwpf/plat/src/fapi2ppefiles.mk b/hwpf/plat/src/fapi2ppefiles.mk index 968abb56..debd93f5 100644 --- a/hwpf/plat/src/fapi2ppefiles.mk +++ b/hwpf/plat/src/fapi2ppefiles.mk @@ -18,8 +18,7 @@ ########################################################################## -FAPI2-C-SOURCES += fapi2PlatAttributeService.C \ - plat_utils.C +FAPI2-C-SOURCES += fapi2PlatAttributeService.C FAPI2-S-SOURCES = -- cgit v1.2.1