diff options
author | Brad Bishop <bradleyb@us.ibm.com> | 2012-07-10 20:33:56 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-08-15 12:40:47 -0500 |
commit | 564bd490f2c9db01c5553d5b2b6a00cc43f828d0 (patch) | |
tree | 9a6a556277667179313e619ddc679da5ab70f296 /src | |
parent | 47a63204d4cdd822db51dbc53a61cf0b1fed5d59 (diff) | |
download | talos-hostboot-564bd490f2c9db01c5553d5b2b6a00cc43f828d0.tar.gz talos-hostboot-564bd490f2c9db01c5553d5b2b6a00cc43f828d0.zip |
Attention handler target service wrapper.
RTC: 43206
Change-Id: Ic7f80c518a1801dcd53d36df0dca4c0d88e77832
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1352
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/diag/attn/attnfwd.H | 9 | ||||
-rw-r--r-- | src/usr/diag/attn/attntarget.C | 170 | ||||
-rw-r--r-- | src/usr/diag/attn/attntarget.H | 355 | ||||
-rw-r--r-- | src/usr/diag/attn/makefile | 2 |
4 files changed, 535 insertions, 1 deletions
diff --git a/src/usr/diag/attn/attnfwd.H b/src/usr/diag/attn/attnfwd.H index 4a0fd25a3..4ec84019e 100644 --- a/src/usr/diag/attn/attnfwd.H +++ b/src/usr/diag/attn/attnfwd.H @@ -53,6 +53,8 @@ class PrdWrapper; class PrdImpl; class ResolverWrapper; class Resolver; +class TargetService; +class TargetServiceImpl; enum { @@ -94,6 +96,13 @@ PrdWrapper & getPrdWrapper(); ResolverWrapper & getResolverWrapper(); /** + * @brief getTargetService TargetService singleton access. + * + * @return TargetService Singleton instance. + */ +TargetService & getTargetService(); + +/** * @brief compare compare two PRDF::AttnData structures. * * @param[in] i_l one of two AttnData structures. diff --git a/src/usr/diag/attn/attntarget.C b/src/usr/diag/attn/attntarget.C new file mode 100644 index 000000000..6b2e17c92 --- /dev/null +++ b/src/usr/diag/attn/attntarget.C @@ -0,0 +1,170 @@ +/* IBM_PROLOG_BEGIN_TAG + * This is an automatically generated prolog. + * + * $Source: src/usr/diag/attn/attntarget.C $ + * + * 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_TAG + */ +/** + * @file attntarget.C + * + * @brief HBATTN Target service wrapper class method definitions. + */ + +#include "attntarget.H" +#include "targeting/common/predicates/predicates.H" +#include "targeting/common/utilFilter.H" +#include <util/singleton.H> + +using namespace TARGETING; + +namespace ATTN +{ + +void TargetServiceImpl::getMcsList( + TargetHandle_t i_proc, + TargetHandleList & o_list) +{ + getChildChiplets(o_list, i_proc, TYPE_MCS); +} + +TargetHandle_t TargetServiceImpl::getProc( + TargetHandle_t i_membuf) +{ + TargetHandle_t proc = NULL; + + TargetHandleList list; + PredicateCTM pred(CLASS_CHIP, TYPE_PROC); + + targetService().getAssociated( + list, + i_membuf, + TARGETING::TargetService::PARENT_BY_AFFINITY, + TARGETING::TargetService::ALL, + &pred); + + if(list.size() == 1) + { + proc = list[0]; + } + + return proc; +} + +TargetHandle_t TargetServiceImpl::getMcs( + TargetHandle_t i_membuf) +{ + TargetHandle_t mcs = NULL; + + TargetHandleList list; + PredicateCTM pred(CLASS_UNIT, TYPE_MCS); + + targetService().getAssociated( + list, + i_membuf, + TARGETING::TargetService::PARENT_BY_AFFINITY, + TARGETING::TargetService::IMMEDIATE, + &pred); + + if(list.size() == 1) + { + mcs = list[0]; + } + + return mcs; +} + +TargetHandle_t TargetServiceImpl::getMcs( + TargetHandle_t i_proc, + uint64_t i_pos) +{ + class ChipUnitMatch : public PredicateBase + { + uint64_t iv_pos; + + public: + + bool operator()(const Target * i_target) const + { + return i_target->getAttr<ATTR_CHIP_UNIT>() == iv_pos; + } + + explicit ChipUnitMatch(uint64_t i_pos) : iv_pos(i_pos) {} + + } chipUnitMatch(i_pos); + + PredicateCTM classTypeMatch(CLASS_UNIT, TYPE_MCS); + PredicateIsFunctional functionalMatch; + + PredicatePostfixExpr pred; + + pred.push(&chipUnitMatch).push(&classTypeMatch).And().push( + &functionalMatch).And(); + + TargetHandleList list; + TargetHandle_t mcs = NULL; + + targetService().getAssociated( + list, + i_proc, + TARGETING::TargetService::CHILD_BY_AFFINITY, + TARGETING::TargetService::IMMEDIATE, + &pred); + + if(list.size() == 1) + { + mcs = list[0]; + } + + return mcs; +} + +void TargetServiceImpl::getMcsPos( + TargetHandle_t i_mcs, + uint64_t & o_pos) +{ + o_pos = i_mcs->getAttr<ATTR_CHIP_UNIT>(); +} + +TargetHandle_t TargetServiceImpl::getMembuf( + TargetHandle_t i_mcs) +{ + TargetHandle_t membuf = NULL; + + TargetHandleList list; + getAffinityChips(list, i_mcs, TYPE_MEMBUF); + + if(list.size() == 1) + { + membuf = list[0]; + } + + return membuf; +} + +TYPE TargetServiceImpl::getType(TargetHandle_t i_target) +{ + return i_target->getAttr<ATTR_TYPE>(); +} + +TargetService & getTargetService() +{ + return Singleton<TargetService>::instance(); +} +} diff --git a/src/usr/diag/attn/attntarget.H b/src/usr/diag/attn/attntarget.H new file mode 100644 index 000000000..344f02bb4 --- /dev/null +++ b/src/usr/diag/attn/attntarget.H @@ -0,0 +1,355 @@ +/* IBM_PROLOG_BEGIN_TAG + * This is an automatically generated prolog. + * + * $Source: src/usr/diag/attn/attntarget.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_TAG + */ +#ifndef __ATTN_ATTNTARGET_H +#define __ATTN_ATTNTARGET_H + +/** + * @file attntarget.H + * + * @brief HBATTN Target service wrapper class definitions. + */ + +#include "attnfwd.H" +#include <map> + +namespace ATTN +{ + +/** + * @brief TargetService Hold the installed target service implementation. + */ +class TargetService +{ + public: + + /** + * @brief getMcsList Obtain the list of MCS unit targets + * for the given proc chip target. + * + * @param[in] i_proc The proc chip target for which a + * list of MCS unit targets should be obtained. + * @param[out] o_list The populated list of MCS unit targets. + */ + void getMcsList( + TARGETING::TargetHandle_t i_proc, + TARGETING::TargetHandleList & o_list); + + /** + * @brief getProc Find the requested membuf chip + * target parent proc chip target. + * + * @param[in] i_membuf The membuf chip target + * for which the parent proc chip target + * should be found. + * + * @retval[0] Did not find any associated proc chip target. + * @retval[!0] Associated proc chip parent target. + */ + TARGETING::TargetHandle_t getProc( + TARGETING::TargetHandle_t i_membuf); + + /** + * @brief getMcs Find the requested membuf chip + * target parent MCS unit target. + * + * @param[in] i_membuf The membuf chip target + * for which the parent MCS unit target + * should be found. + * + * @retval[0] Did not find any associated MCS unit target. + * @retval[!0] Associated MCS unit parent target. + */ + TARGETING::TargetHandle_t getMcs( + TARGETING::TargetHandle_t i_membuf); + + /** + * @brief getMcs Find the MCS unit target given + * the proc chip parent target and MCS position. + * + * @param[in] i_proc The proc chip target for which the + * MCS unit target should be found. + * @param[in] i_pos The MCS unit position for which the MCS + * unit target should be found. + * + * @retval[0] Did not find any associated MCS unit target. + * @retval[!0] Associated MCS unit target. + */ + TARGETING::TargetHandle_t getMcs( + TARGETING::TargetHandle_t i_proc, + uint64_t i_pos); + + /** + * @brief getMcsPos Find the MCS unit position given + * the MCS unit target. + * + * @param[in] i_mcs The MCS unit target for which the + * MCS unit position should be found. + * @param[out] o_pos The MCS unit position. + */ + void getMcsPos( + TARGETING::TargetHandle_t i_mcs, + uint64_t & o_pos); + + /** + * @brief getMembuf Find the requested MCS unit target + * child membuf chip target. + * + * @param[in] i_mcs The MCS unit target + * for which the child membuf chip target + * should be found. + * + * @retval[0] Did not find any associated membuf chip target. + * @retval[!0] Associated membuf chip target. + */ + TARGETING::TargetHandle_t getMembuf( + TARGETING::TargetHandle_t i_mcs); + + /** + * @brief getType Obtain the type of the provided target. + * + * @param[in] i_target The target for which the type + * should be obtained. + * + * @return The type of the provided target. + */ + TARGETING::TYPE getType( + TARGETING::TargetHandle_t i_target); + + /** + * @brief setImpl Set the active target service implementation. + * + * @param[in] i_impl The target service implementation to make active. + */ + void setImpl(TargetServiceImpl & i_impl); + + /** + * @brief ctor + */ + TargetService(); + + private: + + /** + * @brief iv_impl The active targete service implementation. + */ + TargetServiceImpl * iv_impl; + + /** + * @brief copy Disabled. + */ + TargetService(const TargetService &); + + /** + * @brief assignment Disabled. + */ + TargetService & operator=(const TargetService &); +}; + +/** + * @brief TargetServiceImpl Target Service + * implementation interface requirement. + * + * Default implementation forwards calls to + * the real target service. + */ +class TargetServiceImpl +{ + public: + + /** + * @brief getMcsList Obtain the list of MCS unit targets + * for the given proc chip target. + * + * @param[in] i_proc The proc chip target for which a + * list of MCS unit targets should be obtained. + * @param[out] o_list The populated list of MCS unit targets. + */ + virtual void getMcsList( + TARGETING::TargetHandle_t i_proc, + TARGETING::TargetHandleList & o_list); + + /** + * @brief getProc Find the requested membuf chip + * target parent proc chip target. + * + * @param[in] i_membuf The membuf chip target + * for which the parent proc chip target + * should be found. + * + * @retval[0] Did not find any associated proc chip target. + * @retval[!0] Associated proc chip parent target. + */ + virtual TARGETING::TargetHandle_t getProc( + TARGETING::TargetHandle_t i_membuf); + + /** + * @brief getMcs Find the requested membuf chip + * target parent MCS unit target. + * + * @param[in] i_membuf The membuf chip target + * for which the parent MCS unit target + * should be found. + * + * @retval[0] Did not find any associated MCS unit target. + * @retval[!0] Associated MCS unit parent target. + */ + virtual TARGETING::TargetHandle_t getMcs( + TARGETING::TargetHandle_t i_membuf); + + /** + * @brief getMcs Find the MCS unit target given + * the proc chip parent target and MCS position. + * + * @param[in] i_proc The proc chip target for which the + * MCS unit target should be found. + * @param[in] i_pos The MCS unit position for which the MCS + * unit target should be found. + * + * @retval[0] Did not find any associated MCS unit target. + * @retval[!0] Associated MCS unit target. + */ + virtual TARGETING::TargetHandle_t getMcs( + TARGETING::TargetHandle_t i_proc, + uint64_t i_pos); + + /** + * @brief getMcsPos Find the MCS unit position given + * the MCS unit target. + * + * @param[in] i_mcs The MCS unit target for which the + * MCS unit position should be found. + * @param[out] o_pos The MCS unit position. + */ + virtual void getMcsPos( + TARGETING::TargetHandle_t i_mcs, + uint64_t & o_pos); + + /** + * @brief getMembuf Find the requested MCS unit target + * child membuf chip target. + * + * @param[in] i_mcs The MCS unit target + * for which the child membuf chip target + * should be found. + * + * @retval[0] Did not find any associated membuf chip target. + * @retval[!0] Associated membuf chip target. + */ + virtual TARGETING::TargetHandle_t getMembuf( + TARGETING::TargetHandle_t i_mcs); + + /** + * @brief getType Obtain the type of the provided target. + * + * @param[in] i_target The target for which the type + * should be obtained. + * + * @return The type of the provided target. + */ + virtual TARGETING::TYPE getType( + TARGETING::TargetHandle_t i_target); + + /** + * @brief installTargetService + * + * Make this the active target service implementation. + */ + void installTargetService(); + + /** + * @brief dtor + */ + virtual ~TargetServiceImpl() {} + + /** + * @brief ctor + */ + TargetServiceImpl(); +}; + +inline void TargetService::getMcsList( + TARGETING::TargetHandle_t i_proc, + TARGETING::TargetHandleList & o_list) +{ + return iv_impl->getMcsList(i_proc, o_list); +} + +inline TARGETING::TargetHandle_t TargetService::getProc( + TARGETING::TargetHandle_t i_membuf) +{ + return iv_impl->getProc(i_membuf); +} + +inline TARGETING::TargetHandle_t TargetService::getMcs( + TARGETING::TargetHandle_t i_membuf) +{ + return iv_impl->getMcs(i_membuf); +} + +inline TARGETING::TargetHandle_t TargetService::getMcs( + TARGETING::TargetHandle_t i_proc, + uint64_t i_pos) +{ + return iv_impl->getMcs(i_proc, i_pos); +} + +inline void TargetService::getMcsPos( + TARGETING::TargetHandle_t i_mcs, + uint64_t & o_pos) +{ + iv_impl->getMcsPos(i_mcs, o_pos); +} + +inline TARGETING::TargetHandle_t TargetService::getMembuf( + TARGETING::TargetHandle_t i_mcs) +{ + return iv_impl->getMembuf(i_mcs); +} + +inline TARGETING::TYPE TargetService::getType( + TARGETING::TargetHandle_t i_target) +{ + return iv_impl->getType(i_target); +} + +inline void TargetService::setImpl(TargetServiceImpl & i_impl) +{ + iv_impl = &i_impl; +} + +inline TargetService::TargetService() : + iv_impl(&Singleton<TargetServiceImpl>::instance()) +{ + // by default call the real target service +} + +inline void TargetServiceImpl::installTargetService() +{ + getTargetService().setImpl(*this); +} + +inline TargetServiceImpl::TargetServiceImpl() {} + +} +#endif diff --git a/src/usr/diag/attn/makefile b/src/usr/diag/attn/makefile index 39ebee1a9..a91eda158 100644 --- a/src/usr/diag/attn/makefile +++ b/src/usr/diag/attn/makefile @@ -26,7 +26,7 @@ EXTRAINCDIR += ${ROOTPATH}/src/include/usr/diag MODULE = attn -OBJS = attntrace.o attn.o attnsvc.o attnlist.o attnbits.o +OBJS = attntrace.o attn.o attnsvc.o attnlist.o attnbits.o attntarget.o SUBDIRS = test.d |