diff options
| author | Nick Bofferding <bofferdn@us.ibm.com> | 2012-08-18 13:12:13 -0500 |
|---|---|---|
| committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-08-27 16:21:45 -0500 |
| commit | 8542d295bb993a74f5037e9d48258a49afe49071 (patch) | |
| tree | c2ed0de110ae8769ed902bdcfccf6dbe94c4425b /src/usr/targeting/common/predicates | |
| parent | 08b394126bfa79b46042ac1c101904a9ed133cf4 (diff) | |
| download | blackbird-hostboot-8542d295bb993a74f5037e9d48258a49afe49071.tar.gz blackbird-hostboot-8542d295bb993a74f5037e9d48258a49afe49071.zip | |
Support for HWAS state predicate
- Created new .C/.H for HWAS state predicate support
- Updated testcommontargeting.H with HWAS state predicate testcases
- Updated common makefile to include HWAS state predicate file
- Updated predicates.H to include the HWAS state predicate
RTC: 46236
Change-Id: If7552abab270f06ab538144cf299b27460e51394
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1563
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/targeting/common/predicates')
| -rw-r--r-- | src/usr/targeting/common/predicates/predicatehwas.C | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/src/usr/targeting/common/predicates/predicatehwas.C b/src/usr/targeting/common/predicates/predicatehwas.C new file mode 100644 index 000000000..d92536269 --- /dev/null +++ b/src/usr/targeting/common/predicates/predicatehwas.C @@ -0,0 +1,109 @@ +/* IBM_PROLOG_BEGIN_TAG + * This is an automatically generated prolog. + * + * $Source: src/usr/targeting/common/predicates/predicatehwas.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 targeting/common/predicates/predicatehwas.C + * + * @brief Implementation for a predicate which fiters a target based on its + * HWAS state + */ + +//****************************************************************************** +// Includes +//****************************************************************************** + +// STD +#include <string.h> + +// Other Host Boot Components + +// Targeting Component +#include <targeting/common/attributes.H> +#include <targeting/common/target.H> +#include <targeting/common/predicates/predicates.H> +#include <targeting/adapters/assertadapter.H> + +//****************************************************************************** +// Macros +//****************************************************************************** + +#undef TARG_NAMESPACE +#undef TARG_CLASS +#undef TARG_FN + +//****************************************************************************** +// Interface +//****************************************************************************** + +namespace TARGETING +{ + +#define TARG_NAMESPACE "TARGETING::" +#define TARG_CLASS "PredicateHwas::" + +//****************************************************************************** +// PredicateHwas::~PredicateHwas() +//****************************************************************************** + +PredicateHwas::~PredicateHwas() +{ + #define TARG_FUNC "~PredicateHwas()" + #undef TARG_FUNC +} + +//****************************************************************************** +// PredicateHwas::reset +//****************************************************************************** + +PredicateHwas& PredicateHwas::reset() +{ + memset(&iv_valid,0x00,sizeof(iv_valid)); + memset(&iv_desired,0x00,sizeof(iv_desired)); + return *this; +} + +//****************************************************************************** +// PredicateHwas::operator() +//****************************************************************************** + +bool PredicateHwas::operator()( + const Target* const i_pTarget) const +{ + #define TARG_FUNC "operator()(...)" + + hwasState actual = { rawValue: 0}; + CPPASSERT(sizeof(actual.attribute) <= sizeof(actual.rawValue)); + actual.attribute = i_pTarget->getAttr<ATTR_HWAS_STATE>(); + + return ( (actual.rawValue & iv_valid.rawValue) + == (iv_desired.rawValue & iv_valid.rawValue)); + + #undef TARG_FUNC +} + +#undef TARG_CLASS +#undef TARG_NAMESPACE + +} // End namespace TARGETING + |

