diff options
author | Stephen Cprek <smcprek@us.ibm.com> | 2014-07-07 10:24:06 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-09-15 17:14:29 -0500 |
commit | af6b57dcb79e522d6a4e140f7952f58b3419cee1 (patch) | |
tree | 26664810494f02ff76f4ac6955d1a017f4ddc14e /src/include | |
parent | 574d17e95e5f640054c0e11a6fb9206e61e4bc81 (diff) | |
download | blackbird-hostboot-af6b57dcb79e522d6a4e140f7952f58b3419cee1.tar.gz blackbird-hostboot-af6b57dcb79e522d6a4e140f7952f58b3419cee1.zip |
Add BMC Attr override support
Change-Id: I1a42fec21189c55c75e9073527867e4e95528794
RTC: 108376
CMVC-Corec: 931324
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/11995
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Tested-by: Jenkins Server
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/usr/errl/errlmanager.H | 5 | ||||
-rwxr-xr-x | src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H | 20 | ||||
-rw-r--r-- | src/include/usr/pnor/pnorif.H | 13 | ||||
-rw-r--r-- | src/include/usr/targeting/attrPlatOverride.H | 71 | ||||
-rw-r--r-- | src/include/usr/targeting/common/attributeTank.H | 19 | ||||
-rw-r--r-- | src/include/usr/targeting/common/predicates/predicateattrtanktargetpos.H | 149 | ||||
-rw-r--r-- | src/include/usr/targeting/common/target.H | 8 | ||||
-rw-r--r-- | src/include/usr/targeting/common/targreasoncodes.H | 45 |
8 files changed, 302 insertions, 28 deletions
diff --git a/src/include/usr/errl/errlmanager.H b/src/include/usr/errl/errlmanager.H index 309145af4..1063c6bff 100644 --- a/src/include/usr/errl/errlmanager.H +++ b/src/include/usr/errl/errlmanager.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,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. */ @@ -40,6 +42,7 @@ #include <hwas/common/hwasCallout.H> #include <mbox/mbox_queues.H> #include <mbox/mboxif.H> +#include <list> namespace ERRORLOG diff --git a/src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H b/src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H index 899a90d1f..fdcee3db8 100755 --- a/src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H +++ b/src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012,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. */ @@ -38,10 +40,18 @@ #include <mbox/mboxif.H> #include <fapiAttributeIds.H> #include <targeting/common/attributeTank.H> +#include <pnor/pnorif.H> //****************************************************************************** // Interface //****************************************************************************** +namespace TARGETING +{ + errlHndl_t getAttrOverrides(PNOR::SectionId section, + AttributeTank* io_tanks[AttributeTank::TANK_LAYER_LAST], + uint32_t i_pnorSecOffset); +} + namespace fapi { @@ -77,6 +87,13 @@ public: friend void directOverride(); /** + * @brief Allow a attribute override to directly access the override tank + */ + friend errlHndl_t TARGETING::getAttrOverrides(PNOR::SectionId section, + TARGETING::AttributeTank* io_tanks[TARGETING::AttributeTank::TANK_LAYER_LAST], + uint32_t i_pnorSecOffset); + + /** * @brief Maximum size of a direct attribute override */ static const size_t MAX_DIRECT_OVERRIDE_ATTR_SIZE_BYTES = 64; @@ -196,6 +213,7 @@ public: const fapi::Target * const i_pTarget, const uint32_t i_size, const void * i_pVal); + private: /** diff --git a/src/include/usr/pnor/pnorif.H b/src/include/usr/pnor/pnorif.H index 7db87e56c..37c17d424 100644 --- a/src/include/usr/pnor/pnorif.H +++ b/src/include/usr/pnor/pnorif.H @@ -53,7 +53,8 @@ enum SectionId HB_ERRLOGS, /**< Hostboot Error log Repository */ DIMM_JEDEC_VPD, /**< DIMM JEDEC VPD */ MODULE_VPD, /**< Module VPD */ - CENTAUR_VPD, /**< Centaur VPD */ + CENTAUR_VPD, /**< Centaur VPD */ + ATTR_OVER, /**< Attribute Override */ TEST, /**< Scratch space for PNOR test cases */ NUM_SECTIONS, /**< Number of defined sections */ @@ -77,9 +78,6 @@ struct SectionInfo_t bool sha512perEC; /**< Version Checking perEC */ }; - - - /** * @brief Return the size and address of a given section of PNOR data * @@ -109,6 +107,13 @@ bool usingL3Cache(); */ errlHndl_t validateAltMaster( void ); +/** @brief PNOR::TEST section offsets for test cases to prevent + * concurrency problems + */ +const uint32_t pnorTestSec_readwrite_offset = 0x100; +const uint32_t pnorTestSec_smartwrite_offset = 0x120; +const uint32_t pnorTestSec_BMCAttrOverride_offset = 0x200; + } diff --git a/src/include/usr/targeting/attrPlatOverride.H b/src/include/usr/targeting/attrPlatOverride.H new file mode 100644 index 000000000..61eccd8b5 --- /dev/null +++ b/src/include/usr/targeting/attrPlatOverride.H @@ -0,0 +1,71 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/targeting/attrPlatOverride.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 */ +#ifndef __ATTR_PLAT_OVERRIDE_H +#define __ATTR_PLAT_OVERRIDE_H + +#include <targeting/common/attributeTank.H> +#include <pnor/pnorif.H> + +namespace TARGETING +{ + +/** + * @struct AttrOverrideSection + * + * This structure defines the layout of the PNOR attribute override section + * + */ +struct AttrOverrideSection +{ + AttributeTank::TankLayer iv_layer; + size_t iv_size; + uint8_t iv_chunk[0]; +}; + +/** + * @brief This function gets any Attribute Overrides in PNOR + * + * This function reads attribute overrides in from PNOR and places them in + * the appropriate attribute tank. It also calls writePermAttributes() to write + * permanent attribute overrides. Currently there are 3 attribute tanks, + * FAPI, Targeting, and Permanent. + * + * @param[in] i_section PNOR::SectionId to look for overrides default + * ATTR_OVER + * @param[in] io_tanks Array of pointers to Attribute tanks, used for + * test cases, default set to NULL + * @param[in] i_pnorSecOffset Offset within section to read, used for test cases + * default set to 0 + * + * @return errlHndl_t Error log handle. + */ +errlHndl_t getAttrOverrides(PNOR::SectionId i_section = PNOR::ATTR_OVER, + AttributeTank* io_tanks[AttributeTank::TANK_LAYER_LAST] = NULL, + uint32_t i_pnorSecOffset = 0); +//errlCommit( err, TARG_COMP_ID); + +} // end of namespace + +#endif
\ No newline at end of file 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 |