diff options
Diffstat (limited to 'src/include/usr/targeting/common')
4 files changed, 199 insertions, 22 deletions
diff --git a/src/include/usr/targeting/common/attributeTank.H b/src/include/usr/targeting/common/attributeTank.H index ff89ab5fc..94cb69716 100644 --- a/src/include/usr/targeting/common/attributeTank.H +++ b/src/include/usr/targeting/common/attributeTank.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ +/* Contributors Listed Below - COPYRIGHT 2013,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. */ @@ -33,6 +35,7 @@ #include <list> #include <vector> #include <targeting/adapters/mutexadapter.H> +#include <targeting/common/error.H> namespace TARGETING { @@ -81,6 +84,8 @@ public: TANK_LAYER_NONE, TANK_LAYER_FAPI, TANK_LAYER_TARG, + TANK_LAYER_PERM, + TANK_LAYER_LAST = TANK_LAYER_PERM, }; /** @@ -155,6 +160,9 @@ public: uint8_t * iv_pAttributes; // Pointer to chunk of memory }; + + typedef std::vector<AttributeTank::AttributeSerializedChunk> + AttributeSerializedChunks_t; /** * @brief Default constructor */ @@ -337,6 +345,15 @@ public: */ virtual bool attributeExists(const uint32_t i_attrId) const; + /** + * @brief This function writes attributes in an AttributeTank to targeting + * + * This is called for the permanent AttributeTank in getAttrOverrides() + * + * @return errlHndl_t Error log handle. + */ + errlHndl_t writePermAttributes(); + private: // Copy constructor and assignment operator disabled AttributeTank(const AttributeTank & i_right); diff --git a/src/include/usr/targeting/common/predicates/predicateattrtanktargetpos.H b/src/include/usr/targeting/common/predicates/predicateattrtanktargetpos.H new file mode 100644 index 000000000..f9f3d3ecc --- /dev/null +++ b/src/include/usr/targeting/common/predicates/predicateattrtanktargetpos.H @@ -0,0 +1,149 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/targeting/common/predicates/predicateattrtanktargetpos.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 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 targeting/common/predicates/predicateattrtanktargetpos.H + * + * @brief Interface and implementation for a predicate which filters a target + * based on whether it matches a given node, pos, and unit pos + */ + +#ifndef __TARGETING_COMMON_PREDICATEATTRTANKTARGETPOS_H +#define __TARGETING_COMMON_PREDICATEATTRTANKTARGETPOS_H + +//****************************************************************************** +// Includes +//****************************************************************************** + +// STD + +// Other Host Boot Components + +// Targeting Component +#include <targeting/common/target.H> +#include <targeting/common/attributes.H> +#include <targeting/common/predicates/predicatebase.H> +#include <targeting/common/trace.H> + +//****************************************************************************** +// Interface and implementation +//****************************************************************************** + +namespace TARGETING +{ + +#define TARG_NAMESPACE "TARGETING::" +#define TARG_CLASS "PredicateAttrTankTargetPos::" + +class Target; + +/** + * @brief Templated predicate class which filters a target based on whether + * it matches a given node, pos, and unit pos + * + * ** It is important to know what this predicate is being applied to. + * The getAttrTankTargetPosData() call in the operator() overloader will + * assert if the target is compatible. + */ + +class PredicateAttrTankTargetPos : public PredicateBase +{ + public: + + /** + * @brief Constructor which configures the predicate to filter targets + * on whether it matches the input node, pos, and unit pos + * + * @param[in] i_pos Attribute tank position + * @param[in] i_unitPos Attribute tank unit position + * @param[in] i_node Attribute tank node position + * + */ + PredicateAttrTankTargetPos( + const uint16_t i_pos, + const uint8_t i_unitPos, + const uint8_t i_node + ) + : iv_pos(i_pos), iv_unitPos(i_unitPos), iv_node(i_node) {} + + /** + * @brief Destroys the attribute tank target pos predicate + */ + virtual ~PredicateAttrTankTargetPos(){} + + /** + * @brief Returns whether target mathces the specified node, pos, and + * unitPos. + * + * @par Detailed Description: if a wild card was specified in the + * constructor (i.e. ATTR_NODE_NA) then the target matches the + * corresponding position. + * + * @param[in] i_pTarget + * Target handle pointing to the target to compare to. Must + * not be NULL. + * + * @return bool indicating whether the target matches or not + */ + virtual bool operator()(const Target* i_pTarget) const + { + uint16_t l_pos; + uint8_t l_unitPos; + uint8_t l_node; + i_pTarget->getAttrTankTargetPosData(l_pos, l_unitPos, l_node); + + // Check if target position matches that + if ( (iv_pos != AttributeTank::ATTR_POS_NA) && (iv_pos != l_pos) ) + { + return false; + } + if ( (iv_unitPos != AttributeTank::ATTR_UNIT_POS_NA) && + (iv_unitPos != l_unitPos) ) + { + return false; + } + if ( (iv_node != AttributeTank::ATTR_NODE_NA) && + (iv_node != l_node) ) + { + return false; + } + return true; + } + + private: + + // Postion info to compare with that of a target + uint16_t iv_pos; + uint8_t iv_unitPos; + uint8_t iv_node; + + TARG_DISABLE_COPY_AND_ASSIGNMENT_OPERATORS(PredicateAttrTankTargetPos); +}; + +#undef TARG_CLASS +#undef TARG_NAMESPACE + +} // End namespace TARGETING + +#endif // __TARGETING_COMMON_PREDICATEATTRTANKTARGETPOS_H diff --git a/src/include/usr/targeting/common/target.H b/src/include/usr/targeting/common/target.H index e0f6dee4f..04599859f 100644 --- a/src/include/usr/targeting/common/target.H +++ b/src/include/usr/targeting/common/target.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* 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. */ @@ -48,7 +50,6 @@ // This component #include <targeting/common/attributes.H> -#include <targeting/common/attributeTank.H> //****************************************************************************** // Forward declarations to allow friend functions to work @@ -78,7 +79,7 @@ namespace TARGETING //****************************************************************************** // Type Aliases //****************************************************************************** - +class AttributeTank; class Target; typedef const Target* ConstTargetHandle_t; typedef Target* TargetHandle_t; @@ -570,6 +571,7 @@ class Target friend class TargetCloner; friend class TargetService; friend class AssociationManager; + friend class AttributeTank; // Friend functions to allow FAPI Attribute code to directly call // _tryGetAttr and _trySetAttr for code size optimization diff --git a/src/include/usr/targeting/common/targreasoncodes.H b/src/include/usr/targeting/common/targreasoncodes.H index 0a68693c9..63da83bf3 100644 --- a/src/include/usr/targeting/common/targreasoncodes.H +++ b/src/include/usr/targeting/common/targreasoncodes.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* 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. */ @@ -36,27 +38,34 @@ namespace TARGETING enum TargetingModuleId { - TARG_MOD_TEST = 0x01, - TARG_MOD_ATTRRP = 0x02, - TARG_MOD_ATTR_SYNC = 0x03, - TARG_RT_GET_RT_TARGET = 0x04, - TARG_RT_GET_HB_TARGET = 0x05, + TARG_MOD_TEST = 0x01, + TARG_MOD_ATTRRP = 0x02, + TARG_MOD_ATTR_SYNC = 0x03, + TARG_RT_GET_RT_TARGET = 0x04, + TARG_RT_GET_HB_TARGET = 0x05, + TARG_GET_ATTR_OVER = 0x06, + TARG_WRITE_PERM_ATTR = 0x07, + }; enum TargetingReasonCode { - TARG_RC_TEST_TARGET_FFDC = TARG_COMP_ID | 0x01, - TARG_RC_BAD_EYECATCH = TARG_COMP_ID | 0x02, - TARG_RC_MM_BLOCK_FAIL = TARG_COMP_ID | 0x03, - TARG_RC_MM_PERM_FAIL = TARG_COMP_ID | 0x04, - TARG_RC_ATTR_MSG_FAIL = TARG_COMP_ID | 0x05, - TARG_RC_UNHANDLED_ATTR_SEC_TYPE = TARG_COMP_ID | 0x06, - TARG_RC_ATTR_SYNC_TO_FSP_FAIL = TARG_COMP_ID | 0x07, - TARG_RC_ATTR_SYNC_REQUEST_TO_HB_FAIL = TARG_COMP_ID | 0x08, - TARG_RC_ATTR_SYNC_TO_HB_FAIL = TARG_COMP_ID | 0x09, - TARG_RT_UNIT_TARGET_NOT_FOUND = TARG_COMP_ID | 0x0a, - TARG_RT_NO_PROC_TARGET = TARG_COMP_ID | 0x0b, - TARG_RT_TARGET_TYPE_NOT_SUPPORTED = TARG_COMP_ID | 0x0c, + TARG_RC_TEST_TARGET_FFDC = TARG_COMP_ID | 0x01, + TARG_RC_BAD_EYECATCH = TARG_COMP_ID | 0x02, + TARG_RC_MM_BLOCK_FAIL = TARG_COMP_ID | 0x03, + TARG_RC_MM_PERM_FAIL = TARG_COMP_ID | 0x04, + TARG_RC_ATTR_MSG_FAIL = TARG_COMP_ID | 0x05, + TARG_RC_UNHANDLED_ATTR_SEC_TYPE = TARG_COMP_ID | 0x06, + TARG_RC_ATTR_SYNC_TO_FSP_FAIL = TARG_COMP_ID | 0x07, + TARG_RC_ATTR_SYNC_REQUEST_TO_HB_FAIL = TARG_COMP_ID | 0x08, + TARG_RC_ATTR_SYNC_TO_HB_FAIL = TARG_COMP_ID | 0x09, + TARG_RT_UNIT_TARGET_NOT_FOUND = TARG_COMP_ID | 0x0a, + TARG_RT_NO_PROC_TARGET = TARG_COMP_ID | 0x0b, + TARG_RT_TARGET_TYPE_NOT_SUPPORTED = TARG_COMP_ID | 0x0c, + TARG_RC_ATTR_OVER_PNOR_SEC_SPACE_FAIL = TARG_COMP_ID | 0x0d, + TARG_RC_ATTR_OVER_ATTR_DATA_SIZE_FAIL = TARG_COMP_ID | 0x0e, + TARG_RC_WRITE_PERM_ATTR_FAIL = TARG_COMP_ID | 0x0f, + TARG_RC_WRITE_PERM_ATTR_TARGET_FAIL = TARG_COMP_ID | 0x10, }; }; // End TARGETING namespace |

