diff options
| author | Nick Bofferding <bofferdn@us.ibm.com> | 2013-09-06 16:25:14 -0500 |
|---|---|---|
| committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2013-10-08 16:37:41 -0500 |
| commit | 31a07e2cc87a0a24099b6e8d7ccc5cb3d0729b67 (patch) | |
| tree | c0d1847802950d4ff41cdc1bc4eed8933a1f5774 /src/include/usr | |
| parent | 6b7a65cc7ec85b4937c444dd7f3bb8424b9255ab (diff) | |
| download | blackbird-hostboot-31a07e2cc87a0a24099b6e8d7ccc5cb3d0729b67.tar.gz blackbird-hostboot-31a07e2cc87a0a24099b6e8d7ccc5cb3d0729b67.zip | |
Support multinode targeting
- Added support for master processor type attributes
- Made attribute sync multinode aware
- Added platform properties constants
- Added multinode iterator support
- Extended default iterator to skip hidden system targets
- Added raw iterator to "see" hidden system targets
- Updated target service to be multinode aware
- Added new API to query master proc per node
- Modified MRW parser to support cross node peers
- Modified MRW parser to default master proc per node
- Removed cross node peer workarounds in node splitter script
- Added common support for master system targets
- Updated attribute compiler to serialize cross node peer targets
- Updated attribute compiler to generate attribute size map
- Updated attribute compiler to impose special ordering on target layout
- Inhibited XML merge script from merging itself in xmltohb makefile
- Inhibited duplicate weak symbol errors in trace statements
Change-Id: I661eca12f3a7cc16c0ff5476a7ae66cea3bad7d3
RTC: 63940
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/6103
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include/usr')
| -rw-r--r-- | src/include/usr/targeting/attrrp.H | 60 | ||||
| -rw-r--r-- | src/include/usr/targeting/common/iterators/iterators.H | 45 | ||||
| -rw-r--r-- | src/include/usr/targeting/common/iterators/rawtargetiterator.H | 140 | ||||
| -rw-r--r-- | src/include/usr/targeting/common/iterators/targetiterator.H | 3 | ||||
| -rw-r--r-- | src/include/usr/targeting/common/target.H | 21 | ||||
| -rw-r--r-- | src/include/usr/targeting/common/targetservice.H | 373 | ||||
| -rw-r--r-- | src/include/usr/targeting/common/util.H | 18 | ||||
| -rw-r--r-- | src/include/usr/targeting/targplatreasoncodes.H | 73 | ||||
| -rw-r--r-- | src/include/usr/targeting/targplatutil.H | 255 |
9 files changed, 906 insertions, 82 deletions
diff --git a/src/include/usr/targeting/attrrp.H b/src/include/usr/targeting/attrrp.H index 80394cb9b..f1d8388f3 100644 --- a/src/include/usr/targeting/attrrp.H +++ b/src/include/usr/targeting/attrrp.H @@ -40,7 +40,6 @@ #include <targeting/common/targetservice.H> #include <targeting/attrsync.H> - namespace TARGETING { @@ -61,14 +60,15 @@ struct AttrRP_Section; */ class AttrRP { - + // add some friends for the attribute sync features - friend bool TargetService::writeSectionData( + friend bool TargetService::writeSectionData( const std::vector<sectionRefData>& i_pages ); - friend void TargetService::readSectionData( + friend void TargetService::readSectionData( std::vector<sectionRefData>& o_pages, - const SECTION_TYPE i_sectionId); + const SECTION_TYPE i_sectionId, + const TARGETING::NODE_ID i_nodeId); public: @@ -76,10 +76,38 @@ class AttrRP * @brief Returns base address of the RO section containing the * targets * + * @param[in] i_nodeIdUnused + * Node ID to get base address for, ignored by Hostboot, which + * always gets base address of local node + * * @return Base address of the RO section containing the targets as * a void* */ - void* getBaseAddress(); + void* getBaseAddress(const NODE_ID i_nodeIdUnused); + + /** + * @brief Translates given address, according to the resource + * provider's translation algorithm + * + * @param[in] i_pAddress + * Address to translate + * + * @param[in] i_pUnused + * Node target used by common code, unused in Hostboot + * + * @return void* Returns the translated address. Common attribute + * code has a static, compile time check that is used to + * determine whether to call this function, however the Hostboot + * compiler complains when this is not provided. Therefore + * while this method exists, Hostboot will never call it, and if + * it does it will always get a no-op translation. + */ + void* translateAddr( + void* i_pAddress, + const Target* i_pUnused) + { + return i_pAddress; + } /** * @brief Translates given address, according to the resource @@ -88,6 +116,9 @@ class AttrRP * @param[in] i_pAddress * Address to translate * + * @param[in] i_unused + * Node ID used by common code, unused in Hostboot + * * @return void* Returns the translated address. Common attribute * code has a static, compile time check that is used to * determine whether to call this function, however the Hostboot @@ -96,7 +127,8 @@ class AttrRP * it does it will always get a no-op translation. */ void* translateAddr( - void* i_pAddress) + void* i_pAddress, + const TARGETING::NODE_ID i_unused) { return i_pAddress; } @@ -125,7 +157,7 @@ class AttrRP */ AttrRP() : iv_msgQ(NULL), iv_sections(NULL), iv_sectionCount(0) - { + { }; /** @@ -159,12 +191,16 @@ class AttrRP * for the data pages specified by the selected section * * @param[out] o_pages, vector of sectionRefData struct + * @param[in] i_sectionType + * Type of section to read + * @param[in] Node associated with the section, unused in HB * * @return void */ void readSectionData( - std::vector <sectionRefData>& o_pages, - const SECTION_TYPE i_sectionType); + std::vector <sectionRefData>& o_pages, + const SECTION_TYPE i_sectionType, + const NODE_ID i_nodeId = 0) const; private: @@ -203,7 +239,7 @@ class AttrRP * * @return errlHndl_t * Returns an error log handle that is NULL on success or !NULL - * on failure + * on failure */ errlHndl_t parseAttrSectHeader(); @@ -226,7 +262,7 @@ class AttrRP * * @par Detailed Description: * This function, being static, can be called from task_create - * and is used to enter the daemon thread's msgServiceTask + * and is used to enter the daemon thread's msgServiceTask * loop to process messages. * * @param[in] i_pInstance diff --git a/src/include/usr/targeting/common/iterators/iterators.H b/src/include/usr/targeting/common/iterators/iterators.H index 5339b33dd..85742c63c 100644 --- a/src/include/usr/targeting/common/iterators/iterators.H +++ b/src/include/usr/targeting/common/iterators/iterators.H @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/usr/targeting/common/iterators/iterators.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2012 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/targeting/common/iterators/iterators.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* 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. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __TARGETING_COMMON_ITERATORS_H #define __TARGETING_COMMON_ITERATORS_H @@ -31,6 +31,7 @@ */ #include <targeting/common/iterators/targetiterator.H> +#include <targeting/common/iterators/rawtargetiterator.H> #include <targeting/common/iterators/rangefilter.H> // please keep up to date... diff --git a/src/include/usr/targeting/common/iterators/rawtargetiterator.H b/src/include/usr/targeting/common/iterators/rawtargetiterator.H new file mode 100644 index 000000000..f7e9f192e --- /dev/null +++ b/src/include/usr/targeting/common/iterators/rawtargetiterator.H @@ -0,0 +1,140 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/targeting/common/iterators/rawtargetiterator.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* 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. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef __RAW_TARGETING_COMMON_TARGETITERATOR_H +#define __RAW_TARGETING_COMMON_TARGETITERATOR_H + +/** + * @file targeting/common/iterators/rawtargetiterator.H + * + * @brief Interface describing rawiterator/const rawiterator used to iterate + * through all target service targets + */ + +//****************************************************************************** +// Includes +//****************************************************************************** + +// STD +#include <stddef.h> + +// Other Host Boot Components +#include <builtins.h> + +// Targeting Component +#include <targeting/common/iterators/targetiterator.H> + +//****************************************************************************** +// Macros +//****************************************************************************** + +#undef TARG_NAMESPACE +#undef TARG_CLASS +#undef TARG_FUNC + +//****************************************************************************** +// Interface +//****************************************************************************** + +namespace TARGETING +{ + +#define TARG_NAMESPACE "TARGETING::" + +#define TARG_CLASS "_TargetRawIterator<T>::" + +class Target; + +/** + * @brief Class which iterates through targets managed by the target service. + * Provides "Target*" and "const Target*" versions via templates + */ +template<typename T> +class _TargetRawIterator : public _TargetIterator<T> +{ + public: + + /** + * @brief Maps type of iterated element to common alias (Target* or + * const Target*) + */ + typedef T iterator; + typedef T value_type; + + /** + * @brief Create an iterator to a (const/non-const) target handle. + * Defaults to end() + */ + ALWAYS_INLINE + _TargetRawIterator() + : iv_pCurrent(NULL) + { + } + + /** + * @brief Create an iterator to a (const/non-const) target handle + * + * @param[in] i_pTarget Target handle (pointer or const pointer + * depending on flavor) the iterator should reference + */ + ALWAYS_INLINE + explicit _TargetRawIterator(T i_pTarget) + : iv_pCurrent(i_pTarget) + { + } + + /** + * @brief Destroy an iterator to a (const/non-const) target handle + * + * @note Iterator does not own any resources to destroy + */ + ALWAYS_INLINE + ~_TargetRawIterator() + { + } + + + private: + + /** + * @brief Advance the iterator to point to the next item maintained by + * the target service (or end() if end of list) + */ + void advance(); + + T iv_pCurrent; // Pointer to current target +}; + +/** + * @brief Type aliases to simplify user code + */ +typedef _TargetRawIterator<Target*> TargetRawIterator; +typedef _TargetRawIterator<const Target*> ConstTargetRawIterator; + +#undef TARG_CLASS +#undef TARG_NAMESPACE + +} // End namespace TARGETING + +#endif // __RAW_TARGETING_COMMON_TARGETITERATOR_H + diff --git a/src/include/usr/targeting/common/iterators/targetiterator.H b/src/include/usr/targeting/common/iterators/targetiterator.H index 8b3463f70..65e80b8b5 100644 --- a/src/include/usr/targeting/common/iterators/targetiterator.H +++ b/src/include/usr/targeting/common/iterators/targetiterator.H @@ -95,6 +95,9 @@ class _TargetIterator * * @param[in] i_pTarget Target handle (pointer or const pointer * depending on flavor) the iterator should reference + * + * @note User should not assign a hidden system target to the iterator, + * as it does not support hidden targets */ ALWAYS_INLINE inline explicit _TargetIterator(T i_pTarget) diff --git a/src/include/usr/targeting/common/target.H b/src/include/usr/targeting/common/target.H index f3f9be002..ffeecd340 100644 --- a/src/include/usr/targeting/common/target.H +++ b/src/include/usr/targeting/common/target.H @@ -557,16 +557,17 @@ class Target static AttributeTank cv_overrideTank; static AttributeTank cv_syncTank; - friend class PnorBuilderService; - - // Friend functions to allow FAPI Attribute code to directly call - // _tryGetAttr and _trySetAttr for code size optimization - friend fapi::ReturnCode fapi::platAttrSvc::getTargetingAttr( - const fapi::Target *, TARGETING::ATTRIBUTE_ID, const uint32_t, - void *); - friend fapi::ReturnCode fapi::platAttrSvc::setTargetingAttr( - const fapi::Target *, TARGETING::ATTRIBUTE_ID, const uint32_t, - void *); + friend class PnorBuilderService; + friend class TargetCloner; + + // Friend functions to allow FAPI Attribute code to directly call + // _tryGetAttr and _trySetAttr for code size optimization + friend fapi::ReturnCode fapi::platAttrSvc::getTargetingAttr( + const fapi::Target *, TARGETING::ATTRIBUTE_ID, const uint32_t, + void *); + friend fapi::ReturnCode fapi::platAttrSvc::setTargetingAttr( + const fapi::Target *, TARGETING::ATTRIBUTE_ID, const uint32_t, + void *); /* * @brief allow targetattrbulksync access to the target class store. diff --git a/src/include/usr/targeting/common/targetservice.H b/src/include/usr/targeting/common/targetservice.H index 416aeff5d..6dd2cd2f0 100644 --- a/src/include/usr/targeting/common/targetservice.H +++ b/src/include/usr/targeting/common/targetservice.H @@ -44,9 +44,11 @@ // This component #include <targeting/common/attributes.H> +#include <attributetraits.H> #include <targeting/common/iterators/iterators.H> #include <targeting/common/predicates/predicates.H> #include <targeting/adapters/types.H> +#include <targeting/common/error.H> #include <pnortargeting.H> //****************************************************************************** @@ -61,6 +63,24 @@ namespace TARGETING { class TargetService; + /* + * @brief - typedef for node Id + */ + typedef uint8_t NODE_ID; + + /* Node 0 */ + static const NODE_ID NODE0 = 0x00; + + /* Invalid Node Id - to initialize struct variable*/ + static const NODE_ID INVALID_NODE = 0xFF; + + /* Invalid Section Id - to initialize struct variable */ + static const uint8_t INVALID_SECTIONID = 0xFF; + + // Special "not found" fabric node ID is the data type with all bits set + static const ATTR_FABRIC_NODE_ID_type FABRIC_NODE_ID_NOT_FOUND = + INVALID_NODE; + /** * @brief Struct specifying different parameters required for section data * update on the sectionId/NodePtr. @@ -71,6 +91,7 @@ namespace TARGETING * * Struct element details - * sectionId - Section Id + * nodeId - Node Id * pageNumber - PageNumber for the section. * padBytes - PadBytes to fill in 2 extra bytes * dataPtr - Data Ptr @@ -80,11 +101,21 @@ namespace TARGETING struct sectionRefData { - uint8_t sectionId; - uint8_t pageNumber; - uint8_t padBytes[2]; + sectionRefData() : + sectionId(0x00), + nodeId(INVALID_NODE), + pageNumber(0), + dataPtr(NULL), + pNodeTarget(NULL) + { + } + + uint8_t sectionId; + uint8_t nodeId; + uint8_t pageNumber; + uint8_t padBytes; uint8_t* dataPtr; - Target* pNodeTarget; + Target* pNodeTarget; }; @@ -178,15 +209,22 @@ class TargetService /** * @brief Initializes the target service * + * @par Detailed Description: * Initializes the target service, including determining maximum number - * of targets, setting up the target pool, etc. Should be called - * once PNOR is accessible can be mapped + * of targets, setting up the target pool, etc. for each node in the + * system blueprint local to the subsystem. Should be called once PNOR + * is accessible and can be mapped + * + * @param[in] i_maxNodes, max number of nodes to initialize within the + * targetservice. * * @pre N/A * - * @post Target service fully initialized with all possible targets + * @post Target service initialized with all possible targets. User + * would need to call targetservice().initDefaultMasterNode to make + * targetservice fully initialized and ready to be used. */ - void init(); + void init(const size_t i_maxNodes = 1); /** * @brief Returns whether target service has initialized or not @@ -204,48 +242,90 @@ class TargetService /** * @brief Map iterator types to common aliases */ - typedef TargetIterator iterator; - typedef ConstTargetIterator const_iterator; + typedef TargetIterator iterator; + typedef ConstTargetIterator const_iterator; + typedef TargetRawIterator rawiterator; + typedef ConstTargetRawIterator const_rawiterator; /** * @brief Return iterator which points to first target service target * (or end() if none) - * + * * @return Iterator pointing to first target service target */ iterator begin(); - + + /** + * @brief Return rawiterator which points to first target service + * target (or end() if none) + * + * @return RawIterator pointing to first target service target + */ + rawiterator raw_begin(); + /** * @brief Return iterator to const which points to first target service * target (or end() if none) - * + * * @return Iterator to const pointing to first target service target - */ + */ const_iterator begin() const; /** + * @brief Return rawiterator to const which points to first target + * service target (or end() if none) + * + * @return RawIterator to const pointing to first target service target + */ + const_rawiterator raw_begin() const; + + /** * @brief Return iterator which points to the "past the end of the * list" target maintained by the target service - * + * * @return Iterator pointing to the "past the end of the list" target * maintained by the target service */ iterator end(); - + + /** + * @brief Return rawiterator which points to the "past the end of the + * list" target maintained by the target service + * + * @return RawIterator pointing to the "past the end of the list" + * target maintained by the target service + */ + rawiterator raw_end(); + /** * @brief Return iterator to const which points to the "past the end of * the list" target maintained by the target service - * + * * @return Iterator to const pointing to the "past the end of the list" * target maintained by the target service */ const_iterator end() const; /** + * @brief Return rawiterator to const which points to the "past the end + * of the list" target maintained by the target service + * + * @return RawIterator to const pointing to the "past the end of the + * list" target maintained by the target service + */ + const_rawiterator raw_end() const; + + /** * @brief Allow iterator access to the target service's target store */ - friend class _TargetIterator<Target*>; - friend class _TargetIterator<const Target*>; + friend class _TargetIterator<Target*>; + friend class _TargetIterator<const Target*>; + + /** + * @brief Allow rawiterator access to the target service's target store + */ + friend class _TargetRawIterator<Target*>; + friend class _TargetRawIterator<const Target*>; /** * @brief Returns the top level physical target @@ -323,18 +403,56 @@ class TargetService * * @param[out] o_masterProcChipTarget Target handle referring to the * current master processor chip (the one connected to PNOR) - * @param[in] i_node Node that this master resides on (default - * is 0) + * @param[in] i_pNodeTarget + * Handle to the node target to search for the acting master + * processor. If NULL, HB will search whatever node it's + * running on, and FSP will search the physical drawer containing + * the lowest ordered fabric node ID. * + * @pre Target Service must be initialized + * + * @post Master processor chip target returned or NULL is returned if + * targetservice is not yet initialized or user passed an invalid node + * target to get the master proc handle + */ + void masterProcChipTargetHandle( + Target*& o_masterProcChipTargetHandle, + const Target* i_pNodeTarget = NULL) const; + + /** + * @brief Returns the master processor chip target handle + * + * Returns the master processor chip target handle for the given (or + * defaulted) node. On nodes without an alternate master, + * it returns a handle to the only master, if found (NULL otherwise). + * On nodes with multiple potential + * masters, it returns a target handle to the acting master (NULL + * otherwise). If targeting information is not yet accessible (very + * early in the host boot IPL), the returned target handle will be a + * sentinel value representing the master (whichever it may be) * - * @pre None + * @param[out] o_masterProcChipTarget + * Target handle of acting master processor chip for the given + * node (the one connected to PNOR) + * @param[in] i_pNodeTarget + * Target handle of node to search. If NULL, HB will search + * whatver node it's running on, andFSP will search the physical + * drawer containing the lowest orderd fabric node ID * - * @post Master processor chip targets returned or a dummy value + * @pre Target Service must be initialized + * + * @post Master processor chip target returned or a dummy value * representing the acting master processor chip if the targeting * information is not yet initialized + * + * @return Error log handle indicating the status of the request + * + * @retval NULL Success, Master Proc handle is returned to the user + * @retval !NULL Failure, Failed to find the Master Proc Handle & NULL + * is returned to user */ - void masterProcChipTargetHandle( - Target*& o_masterProcChipTargetHandle, - uint8_t i_node = 0) const; + errlHndl_t queryMasterProcChipTargetHandle( + Target*& o_masterProcChipTargetHandle, + const Target* i_pNodeTarget = NULL) const; /** * @brief Returns whether the specified entity path attribute exists @@ -391,10 +509,10 @@ class TargetService * @param[in] i_recursionLevel Whether to return candidate targets * immediately associated to the specified target or recursively * associated to it. - * @param[in] i_pPredicate Pointer to a predicate to be evaluated + * @param[in] i_pPredicate Pointer to a predicate to be evaluated * against each candidate target (as determined by the source * target, type, and recursion level parameters). If the predicate - * returns true, the target will be added to the result list. A + * returns true, the target will be added to the result list. A * value of NULL acts as a predicate that always returns true. * * @pre N/A @@ -423,7 +541,7 @@ class TargetService * This is the top level interface, would basically call the lower * level attribute resource provider interface. The lower level * interface would fetch each vector element and update each section - * with corresponding data from the offset specified. + * with corresponding data from the offset specified. * * @param[in] i_pages, vector of sectionRefData struct * @@ -450,6 +568,7 @@ class TargetService * * @param[out] o_pages, vector of sectionRefData struct * @param[in] i_sectionId, section type + * @param[in] i_nodeId, node Id * * @pre N/A * @@ -461,11 +580,167 @@ class TargetService */ void readSectionData(std::vector<sectionRefData>& o_pages, - const SECTION_TYPE i_sectionId); + const SECTION_TYPE i_sectionId, + const NODE_ID i_nodeId = NODE0); + + /** + * @brief Get the Next initialized node in the Target Service + * This is to support the iterator + * + * It takes the present node id as input and computes the next + * incremental caller-visible node available in the system and + * return it to the user + * + * @param[in] i_nodeId, present node Id + * + * @return returns uint8_t as next node + * + * @retval success case, Node Id, returns the next incremental + * initialized caller-visible node available + * @retval, Failure case, invalid node, if the present node is the + * last initialized caller-visible node available in incremental + * order or user passed an invalid nodeId + */ + NODE_ID getNextInitializedNode(const NODE_ID i_node) const; + + /** + * @brief Get the Next caller-visible Target Handle in incremental + * order. This is to support the iterator. + * + * It is take a target handle as input and compute the next incremental + * available caller-visible target handle in the system and return it + * to the user. + * + * @param[in] i_pTarget, non-NULL Target Handle + * + * @return Target Handle + * + * @retval Target*, returns the next incremental caller-visible + * Target Handle + * @retval NULL, if the target handle passed is the last visible + * target handle available in incremental order in the target service. + */ + Target* getNextTarget(const Target* i_pTarget) const; + + /** + * @brief Sets the isMasterNode Attribute to the Node Target handle + * Passed and takes care of syncing master node's system target handle + * with non-master system target handles. + * + * @par Detailed Description + * It takes the node target handle as input which is required to set as + * master node and sets the isMasterNode Attribute associated to true + * and also unset the isMasterNode associated with all current master + * node target handle. Along with this it also takes care of syncing + * master node's system target attributes with non-master node system + * target's attribute in the system. + * + * @param[in] i_pTarget, Non-Null Node Target handle + * + * @return error handle is return + * @retval Success case, NULL is returned means the master node set and + * sync is successful + * @return, Failure case, !NULL error handle is returned means the + * master node couldn't be set as desired. + */ + errlHndl_t setMasterNode(const Target* i_pTarget); + + /** + * @brief this gives the information whether a system target is + * master-node's system target or non-master-node's system target + * + * It is takes system target handle as input and checks whether the + * system target is from master-node target tree or non-master node + * target tree. + * + * @param[in] i_pTarget, Non-Null System Target handle + * + * @return true, means the system target passed is a non-master node's + * system target. + * @return false, means the system target passed is a master node's + * system target. + */ + bool isNonMasterNodeSystemTarget(const Target* i_pTarget) const; + + /* + * @brief give the total number of nodes in the targeting service + * for which node level binaries have been initialized . + * + * @return total number of nodes in the targeting model initiailized. + */ + uint8_t getNumInitializedNodes() const; + + /** + * @brief set the default Master Node and release the intialize flag + * for targetservice + * + * @par Detailed Description: + * Searches for previous instance of master node, else sets the default + * node (i.e. first initialized node) as master node. And then releases + * the initialized flag of targetservice, Intializing targetservice + * fully + * + * @pre targetservice().init() should have been called before this. + * + * @post Target servicei is fully initialized along with a default + * master node. + */ + + void initDefaultMasterNode(); + + /** + * @brief Returns the Node Target handle of the Master node in the + * system. + * + * @par Detailed Description: + * Returns the Node Target handle of the Master node in the system. + * Caller must check for NULL Target handle + * + * @param[out] o_masterNodeTarget node target handle of the master node + * in the system + * + * @pre TargetService must be initialized. + * + * @post Returns the node target handle of the master node. User + * will always get a valid target else targetservice will assert. + * + * @return void + */ + void getMasterNodeTarget(Target*& o_masterNodeTarget) const; + private: /** + * @brief Structure, Node information specific + */ + struct NodeSpecificInfo + { + + NodeSpecificInfo() : + nodeId(INVALID_NODE), + initialized(false), + isMasterNode(false), + targets(NULL), + maxTargets(0), + pPnor(NULL) + { + } + + NODE_ID nodeId; ///< Node Id for the binary file + bool initialized; ///< Is service initialized or not + bool isMasterNode; ///< Is this the master node + Target (*targets)[]; ///< Pointer to array of target objects + uint32_t maxTargets; ///< Maximum # target objects in the array + const void* pPnor; ///< Pointer to the PNOR targeting section + }; + + /** + * @brief Node Specific information container + */ + typedef std::vector< NodeSpecificInfo > NodeInfo_t; + + /** * @brief Enum specifying which direction to traverse associations * between targets * @@ -506,17 +781,36 @@ class TargetService typedef std::vector< AssociationAttrMap > AssociationMappings_t; /** + * @brief Returns the first Target from the first initialized node + * from the pool of targets. + * + * param[out] o_firstTargetPtr First Target handle + * + * @pre Target service must be initialized + * + * @post Target Service returns the first Target from the first + * initialized node. + * + * @returns void + */ + void _getFirstTargetForIterators (Target*& o_firstTargetPtr) const; + + /** * @brief Configures the pool of targets * * This function computes the maximum number of targets possible based * on the PNOR (or override) image, and updates the target service to * point to the start of the target array, wherever it may reside * + * @param[in] i_nodeInfoContainer, struct to contain all node + * specific information of the type NodeSpecificInfo. May refer to + * structure definition + * * @pre Target service must not be initialized * * @post Target service target pool configured for access */ - void _configureTargetPool(); + void _configureTargetPool(NodeSpecificInfo& i_nodeInfoContainer); /** * @brief Computes the maximum number of targets, caches the value @@ -525,14 +819,17 @@ class TargetService * Computes the maximum number of targets possible based on the PNOR * (or override) image and returns it to the caller * + * @param[in/out] io_nodeInfoContainer, struct to contain all node + * specific information of the type NodeSpecificInfo. May refer to + * structure definition + * * @pre Target service must not already be initialized * - * @post Target service updated with maximum target count. Count also - * returned to caller + * @post Target service updated with maximum target count in + * nodeContainer. * - * @return uint32_t indicating the maximum number of targets possible */ - uint32_t _maxTargets(); + void _maxTargets(NodeSpecificInfo & io_nodeInfoContainer); /** * @brief Returns handles to the targets associated to the @@ -608,11 +905,11 @@ class TargetService // Instance variables bool iv_initialized; ///< Is service initialized or not - Target (*iv_targets)[]; ///< Pointer to array of target objects - uint32_t iv_maxTargets; ///< Maximum # target objects in the array - const void* iv_pPnor; ///< Pointer to the PNOR targeting section + AssociationMappings_t iv_associationMappings; ///< Association map + NodeInfo_t iv_nodeInfo; + // Disable copy constructor / assignment operator TargetService( diff --git a/src/include/usr/targeting/common/util.H b/src/include/usr/targeting/common/util.H index d1e2cff0f..bb11c70f6 100644 --- a/src/include/usr/targeting/common/util.H +++ b/src/include/usr/targeting/common/util.H @@ -54,6 +54,24 @@ class Target; #define TARG_ADDR_TRANSLATION_REQUIRED (1) #endif +namespace PLAT +{ + +/** + * @brief PLAT::PROPERTIES namespace contains constants that control platform + * specific behaviors + */ +namespace PROPERTIES +{ +#ifdef __HOSTBOOT_MODULE + static const bool MULTINODE_AWARE = false; +#else + static const bool MULTINODE_AWARE = true; +#endif +} + +} + /** * @brief Checks to see if we are running in a hardware simulation * environment, i.e. VPO/VBU (not Simics) diff --git a/src/include/usr/targeting/targplatreasoncodes.H b/src/include/usr/targeting/targplatreasoncodes.H new file mode 100644 index 000000000..1f3d18dbc --- /dev/null +++ b/src/include/usr/targeting/targplatreasoncodes.H @@ -0,0 +1,73 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/targeting/targplatreasoncodes.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* 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. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef TARGPLATREASONCODES_H +#define TARGPLATREASONCODES_H + +/** + * @file targeting/targplatreasoncodes.H + * + * @brief Provides reason codes for various platform specific targeting errors + */ + +//****************************************************************************** +// Includes +//****************************************************************************** + +#include <targeting/adapters/types.H> + +//****************************************************************************** +// Constants +//****************************************************************************** + +namespace TARGETING +{ + +/** + * @brief Platform specific targeting module IDs + * + * @note Must always start @ 0x80, since common module IDs occupy 0x00 -> 0x7F + * range + */ +enum PlatTargetingModuleId +{ + TARG_MOD_QUERY_MASTER_PROC_CHIP = 0x80, + TARG_MOD_SET_MASTER_NODE = 0x81, +}; + +/** + * @brief Platform specific targeting reason codes + * + * @note Must always start @ 0x80, since common reasons codes occupy + * 0x00 -> 0x7F range + */ +enum PlatTargetingReasonCode +{ + TARG_RC_INVALID_NODE = TARG_COMP_ID | 0x80, + TARG_RC_TARGET_NOT_FOUND = TARG_COMP_ID | 0x81, +}; + +} // End TARGETING namespace + +#endif // TARGPLATREASONCODES_H + diff --git a/src/include/usr/targeting/targplatutil.H b/src/include/usr/targeting/targplatutil.H new file mode 100644 index 000000000..6f4ce5576 --- /dev/null +++ b/src/include/usr/targeting/targplatutil.H @@ -0,0 +1,255 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/targeting/targplatutil.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2013 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* 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. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef TARGPLATUTIL_H +#define TARGPLATUTIL_H + +/** + * @file targeting/targplatutil.H + * + * @brief Provides interface for general platform specific utilities + * and constants to support core functions. + */ + +//****************************************************************************** +// Includes +//****************************************************************************** + +// STD +#include <vector> + +// OTHER +#include <errl/errlentry.H> + +// TARG +#include <targeting/common/targreasoncodes.H> +#include <targeting/common/trace.H> +#include <targeting/common/target.H> + +namespace TARGETING +{ + +namespace UTIL +{ + +/** + * @brief Creates a standard error log of tracing type + * + * @par Detailed Description: + * Creates a standard error log of tracing type if it does not already + * exist, otherwise appends new SRC to the existing one. In both cases, + * the return code is updated to equal that of the reason code. + * + * @param[in] i_modId + * Module ID of the function that is attempting to create the error + * (see obj/ppc/hbfw/fsp/targeting/common/targreasoncodes.H + * and src/hbfw/fsp/targeting/targplatreasoncodes.H) + * + * @param[in] i_reasonCode + * Reason code of the function that is attempting to create the error + * (see obj/ppc/hbfw/fsp/targeting/common/targreasoncodes.H + * and src/hbfw/fsp/targeting/targplatreasoncodes.H) + * + * @param[in] i_userData1 + * Caller defined user data word 0 + * + * @param[in] i_userData2 + * Caller defined user data word 1 + * + * @param[in] i_userData3 + * Caller defined user data word 2 + * + * @param[in] i_userData4 + * Caller defined user data word 3 + * + * @param[out] io_pError + * On input: If NULL, function will ceate a new tracing error, else it + * will append new SRC to existing error + * On output: Handle will be updated to reflect the created or updated + * error log (never NULL) + * + * @return Not applicate / void + */ +void createTracingError( + const uint8_t i_modId, + const uint16_t i_reasonCode, + const uint32_t i_userData1, + const uint32_t i_userData2, + const uint32_t i_userData3, + const uint32_t i_userData4, + errlHndl_t& io_pError); + +/** + * @brief Sets the IS_MASTER_NODE attribute in the node target which is going + * to be the Master Node and unsets the IS_MASTER_NODE attribute in current + * master node target. Internally Syncs the New Master Node's System Target + * attributes to other non-master System Target's attribute. + * + * @par Detailed Description: + * It takes to be master node target handle as input, Finds the current + * master node handle, compares the two, if not equal then Simply sets/unsets + * the IS_MASTER_NODE Attr to the tobeMasterNode and currMasterNode Target + * respectively. Also Syncs all the System Target Attributes of the Master node + * to other system target attributes of the non-master node. If both the + * targets are equal it simply returns success. + * + * @param[in] i_pToBeMasterNodeTarget, Non-Null to be Master Node Target handle + * note that TYPE must be "NODE" (not control node) + * + * @return error handle indicating whether resuest was successful or not + * + * @retval error handle is null in successful scenario i.e. Master node's + * IS_MASTER_NODE attribute is Set and system targets synced-up. + * @retval error handle is not null, couldn't set the master node attribute + * or system target sync failed. + * Error log handle points to a valid error log object whose primary + * SRC reason code (pError->getSRC()->reasonCode()) may be set to one of, + * but not limited to, the following: + * TARG_RC_INVALID_NODE: Invalid Node Target + */ +inline errlHndl_t setMasterNode(Target* i_pToBeMasterNodeTarget) +{ + return NULL; +} + +/** + * @brief Sets the IS_MASTER_NODE attribute in the node target passed + * + * @par Detailed Description: + * This method should be used when targetService itself is not initiliazed yet + * This simply takes the node target handle of the node which is requird to be + * set as master node, sets the IS_MASTER_NODE Attribute field and returns. + * This method doesn't try to find out the current master node or any other + * sync related stuff. + * + * @param[in] i_pToBeMasterNodeTarget, Non-Null to be Master Node Target handle + * note that TYPE must be "NODE" (not control node) + * + * @return error handle indicating whether request was successful or not + * + * @retval error handle is null in successful scenario i.e. Master node's + * IS_MASTER_NODE attribute is Set. + * @retval error handle is not null, couldn't set the master node attribute + * Error log handle points to a valid error log object whose primary + * SRC reason code (pError->getSRC()->reasonCode()) may be set to one of, + * but not limited to, the following: + * TARG_RC_INVALID_NODE: Invalid Node Target + */ +inline errlHndl_t setDefaultMasterNodeWithoutSync( + Target* i_pToBeMasterNodeTarget) +{ + return NULL; +} + +/* @brief - returns whether a given target is a master node target or not + * + * @par Detailed Description: + * Takes a target and checks whether it is a master node target. If yes returns + * true to the user else false + * + * @param[in] i_pTarget - Non-Null node Target handle(class=enc, type=node) + * + * @return boolean indicating whether request was successful or not + * @retval, Returns true if the passed target is a master node target + * @retval, Returns false if the passed target is not a master node target. + */ +inline bool isThisMasterNodeTarget(const Target* const i_pTarget) +{ + return true; +} + +/* @brief - Syncs the master system target's attribute with non-master system + * targets. + * + * @par Detailed Description: + * Takes a master system target as input, internally find all the non-master + * system target and syncs the master system target's attribute over others. + * + * @param[in] i_pMasterSysTarget - Non-Null Master System Target + * + * @return error handle indicating whether request was successful or not + * @retval, NULL if it could sync all non-master system targets with the + * master system target. + * @retval, !NULL if the sync is failed. + * Error log handle points to a valid error log object whose primary + * SRC reason code (pError->getSRC()->reasonCode()) may be set to one of, + * but not limited to, the following: + * TARG_RC_MASTER_SYS_SYNC_FAILED: System Target Sync failed + */ +inline errlHndl_t SyncMasterSystemTarget(const Target* const i_pMasterSysTarget) +{ + return NULL; +} + +/* @brief - Tells whether the system target passed is non-master node + * system target + * + * @par Detailed Description: + * Takes non-null system target as input and tells whether it is a non-master + * node system target or master node system target + * + * @param[in] i_pSysTarget - Non-Null System Target + * + * @return boolean indicating whether the request was successful + * @retval, Returns true if system target is non-master node system target + * @retval, Returns false if system target is master node system target + */ +inline bool isNonMasterNodeSystemTarget(const Target* const i_pSysTarget) +{ + return false; +} + +/** + * @brief Returns the Node Target handle of the Master node in the + * system. + * + * @par Detailed Description: + * Returns the Node Target handle of the Master node in the system. + * Caller must check for NULL Target handle + * + * @param[out] o_masterNodeTarget node target handle of the master node + * in the system + * + * @return void + */ +void getMasterNodeTarget(Target*& o_masterNodeTarget); + +/** + * @brief Returns whether Hostboot subsystem is capable of selecting a node to + * act as a master node, whose system target is synchronized to other nodes + * + * @param[out] o_masterNodeCapable + * Indicates whether subsystem (Hostboot) is capable of selecting a node to + * act as a master node, whose system target is synchronized to other + * nodes. NOTE: When called in Hostboot, always returns false + */ +inline void subsystemIsMasterNodeCapable(bool& o_masterNodeCapable) +{ + o_masterNodeCapable = false; +} + +} // End namespace TARGETING::UTIL + +} // End namespace TARGETING + +#endif // TARGPLATUTIL_H |

