From ccf869f4326e83aedf872b0c2ffbd8e26e604a0e Mon Sep 17 00:00:00 2001 From: Thi Tran Date: Thu, 23 Jul 2015 16:12:18 -0500 Subject: FAPI2 - Error/FFDC work related updates Change-Id: I2c153d4362791d885b85fee0f4891a9239c6aec7 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/19308 Tested-by: Jenkins Server Reviewed-by: Matt K. Light Reviewed-by: Richard J. Knight Reviewed-by: Jennifer A. Stofer --- import/hwpf/fapi2/include/buffer.H | 30 +- import/hwpf/fapi2/include/error_info_defs.H | 426 +++++++++++---------- .../hwpf/fapi2/include/fapi2_attribute_service.H | 25 +- import/hwpf/fapi2/include/fapi2_error_scope.H | 27 +- import/hwpf/fapi2/include/fapi2_target.H | 67 +++- import/hwpf/fapi2/include/target_types.H | 24 ++ 6 files changed, 335 insertions(+), 264 deletions(-) (limited to 'import/hwpf/fapi2') diff --git a/import/hwpf/fapi2/include/buffer.H b/import/hwpf/fapi2/include/buffer.H index 154ed4b2..7e604d20 100644 --- a/import/hwpf/fapi2/include/buffer.H +++ b/import/hwpf/fapi2/include/buffer.H @@ -26,7 +26,7 @@ #include #include -#include +#include namespace fapi2 { @@ -108,7 +108,7 @@ class buffer /// variable_buffer into a variable_buffer, use insert() /// template< typename OT> - inline fapi2::ReturnCode set(OT i_value, const bits_type i_offset = 0) + inline fapi2::ReturnCodes set(OT i_value, const bits_type i_offset = 0) { // Compile time check to make sure OT is integral static_assert( std::is_integral::value, @@ -192,8 +192,8 @@ class buffer /// @note 0 is left-most /// @return FAPI2_RC_SUCCESS if OK /// - inline fapi2::ReturnCode setBit(const bits_type& i_bit, - const bits_type& i_count = 1) + inline fapi2::ReturnCodes setBit(const bits_type& i_bit, + const bits_type& i_count = 1) { if ((i_count + i_bit - 1) >= TT::bits_per_unit()) { @@ -232,8 +232,8 @@ class buffer /// @note 0 is left-most /// @return FAPI2_RC_SUCCESS if OK /// - inline fapi2::ReturnCode clearBit(const bits_type& i_bit, - const bits_type& i_count = 1) + inline fapi2::ReturnCodes clearBit(const bits_type& i_bit, + const bits_type& i_count = 1) { if ((i_count + i_bit - 1) >= TT::bits_per_unit()) { @@ -509,8 +509,8 @@ class buffer /// @return FAPI2_RC_SUCCESS if successful /// template - fapi2::ReturnCode insert(const OT i_datain, const bits_type i_targetStart, - const bits_type i_len, const bits_type i_sourceStart = 0) + fapi2::ReturnCodes insert(const OT i_datain, const bits_type i_targetStart, + const bits_type i_len, const bits_type i_sourceStart = 0) { const bits_type target_length = parameterTraits::bit_length(); const bits_type source_length = parameterTraits::bit_length(); @@ -607,9 +607,9 @@ class buffer /// @note Data is assumed to be aligned on the word boundary of L /// template - fapi2::ReturnCode insertFromRight(const OT i_datain, - const bits_type i_targetStart, - const bits_type i_len) + fapi2::ReturnCodes insertFromRight(const OT i_datain, + const bits_type i_targetStart, + const bits_type i_len) { // Error if input data don't make sense if ((i_targetStart + i_len) > parameterTraits::bit_length()) @@ -684,8 +684,8 @@ class buffer /// @return FAPI2_RC_SUCCESS if ok /// template - fapi2::ReturnCode extract(OT& o_out, const bits_type i_sourceStart, - const bits_type i_len, const bits_type i_targetStart = 0) const + fapi2::ReturnCodes extract(OT& o_out, const bits_type i_sourceStart, + const bits_type i_len, const bits_type i_targetStart = 0) const { // Extraction is just an insert into o_out @@ -740,8 +740,8 @@ class buffer /// @return FAPI2_RC_SUCCESS if ok /// template - fapi2::ReturnCode extractToRight(OT& o_out, const bits_type i_sourceStart, - const bits_type i_len) const + fapi2::ReturnCodes extractToRight(OT& o_out, const bits_type i_sourceStart, + const bits_type i_len) const { return extract(o_out, i_sourceStart, i_len, parameterTraits::bit_length() - i_len); diff --git a/import/hwpf/fapi2/include/error_info_defs.H b/import/hwpf/fapi2/include/error_info_defs.H index 31fc3429..443f64b9 100644 --- a/import/hwpf/fapi2/include/error_info_defs.H +++ b/import/hwpf/fapi2/include/error_info_defs.H @@ -1,25 +1,19 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: $ */ +/* $Source: hwpf/fapi2/include/error_info_defs.H $ */ /* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ -/* [+] International Business Machines Corp. */ +/* IBM CONFIDENTIAL */ /* */ +/* EKB Project */ /* */ -/* 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 */ +/* COPYRIGHT 2011,2015 */ +/* [+] International Business Machines Corp. */ /* */ -/* 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. */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ /* */ /* IBM_PROLOG_END_TAG */ @@ -34,212 +28,228 @@ #include #include #include - -#include +#include namespace fapi2 { - /// - /// @brief Type to hold the ffdc element in the ffdc class - /// Needed so that the size can be squirled away before the - /// macro is called. - /// - class ffdc_t - { +/// +/// @brief Type to hold the ffdc element in the ffdc class +/// Needed so that the size can be squirled away before the +/// macro is called. +/// +class ffdc_t +{ public: ffdc_t(void) - {} + {} - operator const void*() const { return iv_value.first; } + operator const void* () const + { + return iv_value.first; + } operator uint8_t() const - { return *(reinterpret_cast(iv_value.first)); } - - int16_t size(void) const { return iv_value.second; } - int16_t& size(void) { return iv_value.second; } - - const void* ptr(void) const { return iv_value.first; } - const void*& ptr(void) { return iv_value.first; } + { + return *(reinterpret_cast(iv_value.first)); + } - private: - std::pair iv_value; - }; - - /// - /// @brief Enumeration of ErrorInfo FFDC sizes that are used to indicate a - /// special type that cannot simply be memcopied - enum ErrorInfoFfdcSize - { - EI_FFDC_SIZE_BUF = 0xffff, // fapi2::buffer - EI_FFDC_SIZE_TARGET = 0xfffe, // fapi2::Target - EI_FFDC_SIZE_VBUF = 0xfffd, // fapi2::variable_buffer - EI_FFDC_MAX_SIZE = 0x1000, // Limit regular FFDC capture to 4kb - }; - - /// - /// @brief Enumeration of error log severity. - /// - enum errlSeverity_t - { - FAPI2_ERRL_SEV_UNDEFINED = 0x00, /// Used internally by ffdc mechanism - FAPI2_ERRL_SEV_RECOVERED = 0x10, /// Not seen by customer - FAPI2_ERRL_SEV_PREDICTIVE = 0x20, /// Error recovered but customer will see - FAPI2_ERRL_SEV_UNRECOVERABLE = 0x40 /// Unrecoverable, general - }; - - /// - /// @brief Enumeration of ErrorInfo types - /// - enum ErrorInfoType - { - EI_TYPE_FFDC = 0, - EI_TYPE_HW_CALLOUT = 1, - EI_TYPE_PROCEDURE_CALLOUT = 2, - EI_TYPE_BUS_CALLOUT = 3, - EI_TYPE_CDG = 4, // Target Callout/Deconfig/GARD - EI_TYPE_CHILDREN_CDG = 5, // Children Callout/Deconfig/GARD - EI_TYPE_COLLECT_TRACE = 6, - EI_LAST_TYPE = EI_TYPE_COLLECT_TRACE + 1, - }; - - /// - /// @enum HwCallout - /// - /// This enumeration defines the possible Hardware Callouts that are not - /// represented by fapi2::Targets - /// - /// Note that platform code may depend on the enum values starting at 0 and - /// incrementing in order to efficiently convert to a platform callout value - /// so do not reorder without consulting all platforms - /// - namespace HwCallouts - { - enum HwCallout + int16_t size(void) const { - // Where indicated, a HW Callout in FAPI Error XML must include a - // reference target that is used to identify the HW. e.g. for - // TOD_CLOCK, the proc chip that the clock is attached to must be - // specified - TOD_CLOCK = 0, // Include proc-chip ref (or child chiplet) - MEM_REF_CLOCK = 1, // Include membuf-chip ref (or child chiplet) - PROC_REF_CLOCK = 2, // Include proc-chip ref (or child chiplet) - PCI_REF_CLOCK = 3, // Include proc-chip ref (or child chiplet) - FLASH_CONTROLLER_PART = 4, - PNOR_PART = 5, - SBE_SEEPROM_PART = 6, - VPD_PART = 7, - LPC_SLAVE_PART = 8, - GPIO_EXPANDER_PART = 9, - SPIVID_SLAVE_PART = 10, - }; - } - - /// - /// @enum ProcedureCallout - /// - /// This enumeration defines the possible Procedure Callouts - /// These instruct the customer/customer-engineer what to do - /// - /// Note that platform code may depend on the enum values starting at 0 and - /// incrementing in order to efficiently convert to a platform callout value - /// so do not reorder without consulting all platforms - /// - namespace ProcedureCallouts - { - enum ProcedureCallout + return iv_value.second; + } + int16_t& size(void) { - CODE = 0, // Code problem - LVL_SUPPORT = 1, // Call next level of support - MEMORY_PLUGGING_ERROR = 2, // DIMM Plugging error - BUS_CALLOUT = 3, // Bus Called Out - }; - } - - /// - /// @enum CalloutPriority - /// - /// This enumeration defines the possible Procedure and Target callout priorities - /// - /// Note that platform code may depend on the enum values starting at 0 and - /// incrementing in order to efficiently convert to a platform priority value - /// so do not reorder without consulting all platforms - /// - namespace CalloutPriorities - { - enum CalloutPriority + return iv_value.second; + } + + const void* ptr(void) const { - LOW = 0, - MEDIUM = 1, - HIGH = 2, - }; - } - - /// - /// @enum Collect Trace - /// - /// This enumeration defines the possible firmware traces to collect - /// - namespace CollectTraces - { - const uint32_t TRACE_SIZE = 256; // limit collected trace size - enum CollectTrace + return iv_value.first; + } + const void*& ptr(void) { - FSI = 1, - SCOM = 2, - SCAN = 3, - MBOX = 4, - }; - } - - /// - /// @brief Get FFDC Size - /// - /// This is called by the FAPI_SET_HWP_ERROR macro to find out the size of - /// FFDC data. If the data is of a special type that is handled differently - /// than types that are simply memcopied then it is handled by a template - /// specialization. - /// If this function template is instantiated with a pointer, the compile - /// will fail. - /// - /// @return uint16_t. Size of the FFDC data - /// - template - inline uint16_t getErrorInfoFfdcSize(const T &) - { - static_assert(sizeof(T) <= EI_FFDC_MAX_SIZE, - "FFDC too large to capture"); - return sizeof(T); - } - - /// - /// @brief Compile error if caller tries to get the FFDC size of a pointer - /// - template - inline uint16_t getErrorInfoFfdcSize(const T*) - { - static_assert(std::is_pointer::value, - "pointer passed to getErrorInfoFfdcSize"); - return 0; - } - - /// - /// @brief Get FFDC Size specialization for fapi2::Target - /// - template - inline uint16_t getErrorInfoFfdcSize(const fapi2::Target&) - { - return EI_FFDC_SIZE_TARGET; - } - - /// - /// @brief Get FFDC Size specialization for variable buffers - /// - template<> - inline uint16_t getErrorInfoFfdcSize(const fapi2::variable_buffer& i_thing) - { - // Limit a variable buffer to 4kb bytes, and we can memcpy the storage. - return std::min(static_cast(EI_FFDC_MAX_SIZE), - i_thing.getLength()); - } + return iv_value.first; + } + + private: + std::pair iv_value; +}; + +/// +/// @brief Enumeration of ErrorInfo FFDC sizes that are used to indicate a +/// special type that cannot simply be memcopied +enum ErrorInfoFfdcSize +{ + EI_FFDC_SIZE_BUF = 0xffff, // fapi2::buffer + EI_FFDC_SIZE_TARGET = 0xfffe, // fapi2::Target + EI_FFDC_SIZE_VBUF = 0xfffd, // fapi2::variable_buffer + EI_FFDC_MAX_SIZE = 0x1000, // Limit regular FFDC capture to 4kb +}; + +/// +/// @brief Enumeration of error log severity. +/// +enum errlSeverity_t +{ + FAPI2_ERRL_SEV_UNDEFINED = 0x00, /// Used internally by ffdc mechanism + FAPI2_ERRL_SEV_RECOVERED = 0x10, /// Not seen by customer + FAPI2_ERRL_SEV_PREDICTIVE = 0x20, /// Error recovered but customer will see + FAPI2_ERRL_SEV_UNRECOVERABLE = 0x40 /// Unrecoverable, general +}; + +/// +/// @brief Enumeration of ErrorInfo types +/// +enum ErrorInfoType +{ + EI_TYPE_FFDC = 0, + EI_TYPE_HW_CALLOUT = 1, + EI_TYPE_PROCEDURE_CALLOUT = 2, + EI_TYPE_BUS_CALLOUT = 3, + EI_TYPE_CDG = 4, // Target Callout/Deconfig/GARD + EI_TYPE_CHILDREN_CDG = 5, // Children Callout/Deconfig/GARD + EI_TYPE_COLLECT_TRACE = 6, + EI_LAST_TYPE = EI_TYPE_COLLECT_TRACE + 1, +}; + +/// +/// @enum HwCallout +/// +/// This enumeration defines the possible Hardware Callouts that are not +/// represented by fapi2::Targets +/// +/// Note that platform code may depend on the enum values starting at 0 and +/// incrementing in order to efficiently convert to a platform callout value +/// so do not reorder without consulting all platforms +/// +namespace HwCallouts +{ +enum HwCallout +{ + // Where indicated, a HW Callout in FAPI Error XML must include a + // reference target that is used to identify the HW. e.g. for + // TOD_CLOCK, the proc chip that the clock is attached to must be + // specified + TOD_CLOCK = 0, // Include proc-chip ref (or child chiplet) + MEM_REF_CLOCK = 1, // Include membuf-chip ref (or child chiplet) + PROC_REF_CLOCK = 2, // Include proc-chip ref (or child chiplet) + PCI_REF_CLOCK = 3, // Include proc-chip ref (or child chiplet) + FLASH_CONTROLLER_PART = 4, + PNOR_PART = 5, + SBE_SEEPROM_PART = 6, + VPD_PART = 7, + LPC_SLAVE_PART = 8, + GPIO_EXPANDER_PART = 9, + SPIVID_SLAVE_PART = 10, +}; +} + +/// +/// @enum ProcedureCallout +/// +/// This enumeration defines the possible Procedure Callouts +/// These instruct the customer/customer-engineer what to do +/// +/// Note that platform code may depend on the enum values starting at 0 and +/// incrementing in order to efficiently convert to a platform callout value +/// so do not reorder without consulting all platforms +/// +namespace ProcedureCallouts +{ +enum ProcedureCallout +{ + CODE = 0, // Code problem + LVL_SUPPORT = 1, // Call next level of support + MEMORY_PLUGGING_ERROR = 2, // DIMM Plugging error + BUS_CALLOUT = 3, // Bus Called Out +}; +} + +/// +/// @enum CalloutPriority +/// +/// This enumeration defines the possible Procedure and Target callout priorities +/// +/// Note that platform code may depend on the enum values starting at 0 and +/// incrementing in order to efficiently convert to a platform priority value +/// so do not reorder without consulting all platforms +/// +namespace CalloutPriorities +{ +enum CalloutPriority +{ + LOW = 0, + MEDIUM = 1, + HIGH = 2, +}; +} + +/// +/// @enum Collect Trace +/// +/// This enumeration defines the possible firmware traces to collect +/// +namespace CollectTraces +{ +const uint32_t TRACE_SIZE = 256; // limit collected trace size +enum CollectTrace +{ + FSI = 1, + SCOM = 2, + SCAN = 3, + MBOX = 4, +}; +} + +/// +/// @brief Get FFDC Size +/// +/// This is called by the FAPI_SET_HWP_ERROR macro to find out the size of +/// FFDC data. If the data is of a special type that is handled differently +/// than types that are simply memcopied then it is handled by a template +/// specialization. +/// If this function template is instantiated with a pointer, the compile +/// will fail. +/// +/// @return uint16_t. Size of the FFDC data +/// +template +inline uint16_t getErrorInfoFfdcSize(const T&) +{ + static_assert(sizeof(T) <= EI_FFDC_MAX_SIZE, + "FFDC too large to capture"); + return sizeof(T); +} + +/// +/// @brief Compile error if caller tries to get the FFDC size of a pointer +/// +template +inline uint16_t getErrorInfoFfdcSize(const T*) +{ + static_assert(std::is_pointer::value, + "pointer passed to getErrorInfoFfdcSize"); + return 0; +} + +/// +/// @brief Get FFDC Size specialization for fapi2::Target +/// +template +inline uint16_t getErrorInfoFfdcSize(const fapi2::Target&) +{ + return EI_FFDC_SIZE_TARGET; +} + +/// +/// @brief Get FFDC Size specialization for variable buffers +/// +template<> +inline uint16_t getErrorInfoFfdcSize(const fapi2::variable_buffer& i_thing) +{ + // Limit a variable buffer to 4kb bytes, and we can memcpy the storage. + return std::min(static_cast(EI_FFDC_MAX_SIZE), + i_thing.getLength()); +} }; diff --git a/import/hwpf/fapi2/include/fapi2_attribute_service.H b/import/hwpf/fapi2/include/fapi2_attribute_service.H index b031f6e8..768af2f4 100644 --- a/import/hwpf/fapi2/include/fapi2_attribute_service.H +++ b/import/hwpf/fapi2/include/fapi2_attribute_service.H @@ -1,3 +1,21 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: hwpf/fapi2/include/fapi2_attribute_service.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* EKB Project */ +/* */ +/* COPYRIGHT 2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* IBM_PROLOG_END_TAG */ /// /// @file src/include/usr/hwpf/fapi2/fapi2_attribute_service.H /// @@ -10,6 +28,7 @@ #define FAPI2ATTRIBUTESERVICE_H_ #include #include +#include #include #include #include @@ -95,7 +114,7 @@ namespace fapi2 template< TargetType K > ReturnCode getInitFileAttr(const AttributeId i_id, const Target& i_target, - uint64_t & o_val, + uint64_t& o_val, const uint32_t i_arrayIndex1 = 0, const uint32_t i_arrayIndex2 = 0, const uint32_t i_arrayIndex3 = 0, @@ -107,7 +126,7 @@ ReturnCode getInitFileAttr(const AttributeId i_id, * This is called by FAPI code to check at compile time that a FAPI attribute * access is using the correct data type and a valid AttributeId */ -template inline void checkIdType(AttributeId, T &) {} +template inline void checkIdType(AttributeId, T&) {} /** * @brief Fail if attribute privileged @@ -118,7 +137,7 @@ template inline void checkIdType(AttributeId, T &) {} class ErrorAccessingPrivilegedAttribute; template void failIfPrivileged() { - ErrorAccessingPrivilegedAttribute(); + ErrorAccessingPrivilegedAttribute(); } template <> inline void failIfPrivileged() {} diff --git a/import/hwpf/fapi2/include/fapi2_error_scope.H b/import/hwpf/fapi2/include/fapi2_error_scope.H index 43278c53..71f8c5a4 100644 --- a/import/hwpf/fapi2/include/fapi2_error_scope.H +++ b/import/hwpf/fapi2/include/fapi2_error_scope.H @@ -1,25 +1,19 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: $ */ +/* $Source: hwpf/fapi2/include/fapi2_error_scope.H $ */ /* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ -/* [+] International Business Machines Corp. */ +/* IBM CONFIDENTIAL */ /* */ +/* EKB Project */ /* */ -/* 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 */ +/* COPYRIGHT 2012,2015 */ +/* [+] International Business Machines Corp. */ /* */ -/* 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. */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ /* */ /* IBM_PROLOG_END_TAG */ /** @@ -32,7 +26,6 @@ #include #include -#include #include /// @cond @@ -61,9 +54,9 @@ /// FSP operational states. /// #ifdef DOXYGEN -#define FAPI_TRY(__operation__, ...) FAPI_TRY_IMPL + #define FAPI_TRY(__operation__, ...) FAPI_TRY_IMPL #else -#define FAPI_TRY(...) FAPI_TRY_IMPL(FAPI_VA_NARGS(__VA_ARGS__), __VA_ARGS__) + #define FAPI_TRY(...) FAPI_TRY_IMPL(FAPI_VA_NARGS(__VA_ARGS__), __VA_ARGS__) #endif /// diff --git a/import/hwpf/fapi2/include/fapi2_target.H b/import/hwpf/fapi2/include/fapi2_target.H index ad22fe7d..86568b4b 100644 --- a/import/hwpf/fapi2/include/fapi2_target.H +++ b/import/hwpf/fapi2/include/fapi2_target.H @@ -184,8 +184,29 @@ class Target /// inline constexpr bool isChip(void) const { - return ( (K == TARGET_TYPE_PROC_CHIP) || - (K == TARGET_TYPE_MEMBUF_CHIP) ); + return (isChip(K)); + } + + /// + /// @brief Static function check if a Target type value is that of + /// a chip. It will return false for compound types that + /// include non-chip Target type bits + /// + /// @param[in] i_type The value of the Target type. + /// @return Return true if this type is of a chip, false otherwise + /// + static inline bool isChip(const TargetType i_type) + { + bool l_retVal = false; + + // Target type must have only chip type bits set + if ( ((i_type & TARGET_TYPE_CHIPS) != 0) && + ((i_type & ~TARGET_TYPE_CHIPS) == 0) ) + { + l_retVal = true; + } + + return l_retVal; } /// @@ -194,25 +215,29 @@ class Target /// inline constexpr bool isChiplet(void) const { - return ( (K == TARGET_TYPE_EX) || - (K == TARGET_TYPE_MBA) || - (K == TARGET_TYPE_MCS) || - (K == TARGET_TYPE_XBUS) || - (K == TARGET_TYPE_ABUS) || - (K == TARGET_TYPE_L4) || - (K == TARGET_TYPE_CORE) || - (K == TARGET_TYPE_EQ) || - (K == TARGET_TYPE_MCA) || - (K == TARGET_TYPE_MCBIST) || - (K == TARGET_TYPE_MI) || - (K == TARGET_TYPE_DMI) || - (K == TARGET_TYPE_OBUS) || - (K == TARGET_TYPE_NV) || - (K == TARGET_TYPE_SBE) || - (K == TARGET_TYPE_PPE) || - (K == TARGET_TYPE_PERV) || - (K == TARGET_TYPE_PEC) || - (K == TARGET_TYPE_PHB) ); + return (isChiplet(K)); + } + + /// + /// @brief Static function check if a Target type value is that of + /// a chiplet. It will return false for compound types that + /// include non-chiplet Target type bits + /// + /// @param[in] i_type The value of the Target type. + /// @return Return true if this type is of a chiplet, false otherwise + /// + static inline bool isChiplet(const TargetType i_type) + { + bool l_retVal = false; + + // Target type must have only chiplet type bits set + if ( ((i_type & TARGET_TYPE_CHIPLETS) != 0) && + ((i_type & ~TARGET_TYPE_CHIPLETS) == 0) ) + { + l_retVal = true; + } + + return l_retVal; } /// diff --git a/import/hwpf/fapi2/include/target_types.H b/import/hwpf/fapi2/include/target_types.H index d75d5e45..9f22a691 100644 --- a/import/hwpf/fapi2/include/target_types.H +++ b/import/hwpf/fapi2/include/target_types.H @@ -66,6 +66,30 @@ enum TargetType TARGET_TYPE_ALL = 0xFFFFFFFF, ///< Any/All types + // Compound target types + TARGET_TYPE_CHIPS = TARGET_TYPE_PROC_CHIP | + TARGET_TYPE_MEMBUF_CHIP, + + TARGET_TYPE_CHIPLETS = TARGET_TYPE_EX | + TARGET_TYPE_MBA | + TARGET_TYPE_MCS | + TARGET_TYPE_XBUS | + TARGET_TYPE_ABUS | + TARGET_TYPE_L4 | + TARGET_TYPE_CORE | + TARGET_TYPE_EQ | + TARGET_TYPE_MCA | + TARGET_TYPE_MCBIST | + TARGET_TYPE_MI | + TARGET_TYPE_DMI | + TARGET_TYPE_OBUS | + TARGET_TYPE_NV | + TARGET_TYPE_SBE | + TARGET_TYPE_PPE | + TARGET_TYPE_PERV | + TARGET_TYPE_PEC | + TARGET_TYPE_PHB, + // Mappings to target types found in the error xml files TARGET_TYPE_EX_CHIPLET = TARGET_TYPE_EX, TARGET_TYPE_MBA_CHIPLET = TARGET_TYPE_MBA, -- cgit v1.2.1