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/include/usr/targeting/common/predicates | |
| parent | 08b394126bfa79b46042ac1c101904a9ed133cf4 (diff) | |
| download | talos-hostboot-8542d295bb993a74f5037e9d48258a49afe49071.tar.gz talos-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/include/usr/targeting/common/predicates')
| -rw-r--r-- | src/include/usr/targeting/common/predicates/predicatehwas.H | 262 | ||||
| -rw-r--r-- | src/include/usr/targeting/common/predicates/predicates.H | 47 |
2 files changed, 286 insertions, 23 deletions
diff --git a/src/include/usr/targeting/common/predicates/predicatehwas.H b/src/include/usr/targeting/common/predicates/predicatehwas.H new file mode 100644 index 000000000..07e623314 --- /dev/null +++ b/src/include/usr/targeting/common/predicates/predicatehwas.H @@ -0,0 +1,262 @@ +/* IBM_PROLOG_BEGIN_TAG + * This is an automatically generated prolog. + * + * $Source: src/include/usr/targeting/common/predicates/predicatehwas.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 __TARGETING_COMMON_PREDICATEHWAS_H +#define __TARGETING_COMMON_PREDICATEHWAS_H + +/** + * @file targeting/common/predicates/predicatehwas.H + * + * @brief Interface for a predicate which fiters a target based on its HWAS + * state + */ + +//****************************************************************************** +// Includes +//****************************************************************************** + +// STD + +// Other Host Boot Components + +// Targeting Component +#include <targeting/common/target.H> +#include <targeting/common/attributes.H> +#include <targeting/common/predicates/predicatebase.H> + +//****************************************************************************** +// Macros +//****************************************************************************** + +#undef TARG_NAMESPACE +#undef TARG_CLASS +#undef TARG_FN + +//****************************************************************************** +// Interface +//****************************************************************************** + +namespace TARGETING +{ + +#define TARG_NAMESPACE "TARGETING::" +#define TARG_CLASS "PredicateHWAS::" + +class Target; + +/** + * @brief Predicate class which filters a target based on its HWAS state + */ +class PredicateHwas : public PredicateBase +{ + public: + + /** + * @brief Create an HWAS state predicate + */ + PredicateHwas(); + + /** + * @brief Destroy an HWAS state predicate + */ + virtual ~PredicateHwas(); + + /** + * @brief Reset the predicate to match everything + * + * @return Reference to the predicate, for chaining + */ + PredicateHwas& reset(); + + /** + * @brief Configure predicate to look for the given powered on state + * + * @param[in] i_poweredOn Desired powered on state + * + * @return Reference to the predicate, for chaining + */ + PredicateHwas& poweredOn(const bool i_poweredOn); + + /** + * @brief Configure predicate to look for the given present state + * + * @param[in] i_present Desired present state + * + * @return Reference to the predicate, for chaining + */ + PredicateHwas& present(const bool i_present); + + /** + * @brief Configure predicate to look for the given functional state + * + * @param[in] i_functional Desired functional state + * + * @return Reference to the predicate, for chaining + */ + PredicateHwas& functional(const bool i_functional); + + /** + * @brief Configure predicate to look for the given changed since last + * IPL state + * + * @param[in] i_changedSinceLastIpl Desired changed since last IPL + * state + * + * @return Reference to the predicate, for chaining + */ + PredicateHwas& changedSinceLastIpl(const bool i_changedSinceLastIpl); + + /** + * @brief Configure predicate to look for the given dump functional + * state + * + * @param[in] i_dumpFunctional Desired dump functional state + * + * @return Reference to the predicate, for chaining + */ + PredicateHwas& dumpFunctional(const bool i_dumpFunctional); + + /** + * @brief Returns whether target matches the desired HWAS state + * + * @par Detailed Description: + * Returns whether target matches the desired HWAS state. Current + * HWAS sub-fields compared include poweredOn, present, functional, + * changedSinceLastIpl, and dumpFunctional. On construction, the + * predicate matches any state of those five fields. To make the + * filter more restrictive, call any combination of the state + * configuration functions with the desired values. The filter + * will make sure all the desired fields have requested values + * before returning a match. To reset the filter to match all + * targets, call reset(). See PredicateBase class for + * parameter/return description. + * + * @param[in] i_pTarget + * Target handle pointing to the target to compare to + * + * @return bool indicating whether the target matches or not + */ + virtual bool operator()( + const Target* i_pTarget) const; + + private: + + /** + * @brief Union that exposes raw value of an HWAS state attribute + * for purposes of bitwise comparison + * + * @warning ATTR_HWAS_STATE size must be <= uint64_t in size, otherwise + * code cannot guarantee that the required bitfields fit. This + * requirement is enforced by a compile-time assert + */ + union hwasState + { + ATTR_HWAS_STATE_type attribute; // Attribute + uint64_t rawValue; // Flattened representation + + }; + + hwasState iv_desired; ///< Desired states + hwasState iv_valid; ///< Validity of each field + + TARG_DISABLE_COPY_AND_ASSIGNMENT_OPERATORS(PredicateHwas); +}; + +//****************************************************************************** +// PredicateHwas::PredicateHwas +//****************************************************************************** + +inline PredicateHwas::PredicateHwas() +{ + // Ignore reference + reset(); +} + +//****************************************************************************** +// PredicateHwas::poweredOn +//****************************************************************************** + +inline PredicateHwas& PredicateHwas::poweredOn( + const bool i_poweredOn) +{ + iv_desired.attribute.poweredOn = i_poweredOn; + iv_valid.attribute.poweredOn = true; + return *this; +} + +//****************************************************************************** +// PredicateHwas::present +//****************************************************************************** + +inline PredicateHwas& PredicateHwas::present( + const bool i_present) +{ + iv_desired.attribute.present = i_present; + iv_valid.attribute.present = true; + return *this; +} + +//****************************************************************************** +// PredicateHwas::functional +//****************************************************************************** + +inline PredicateHwas& PredicateHwas::functional( + const bool i_functional) +{ + iv_desired.attribute.functional = i_functional; + iv_valid.attribute.functional = true; + return *this; +} + +//****************************************************************************** +// PredicateHwas::changedSinceLastIpl +//****************************************************************************** + +inline PredicateHwas& PredicateHwas::changedSinceLastIpl( + const bool i_changedSinceLastIpl) +{ + iv_desired.attribute.changedSinceLastIPL = i_changedSinceLastIpl; + iv_valid.attribute.changedSinceLastIPL = true; + return *this; +} + +//****************************************************************************** +// PredicateHwas::dumpFunctional +//****************************************************************************** + +inline PredicateHwas& PredicateHwas::dumpFunctional( + const bool i_dumpFunctional) +{ + iv_desired.attribute.dumpfunctional = i_dumpFunctional; + iv_valid.attribute.dumpfunctional = true; + return *this; +} + +#undef TARG_CLASS +#undef TARG_NAMESPACE + +} // End namespace TARGETING + +#endif // __TARGETING_COMMON_PREDICATEHWAS_H + diff --git a/src/include/usr/targeting/common/predicates/predicates.H b/src/include/usr/targeting/common/predicates/predicates.H index 5a7cf04d9..e0dbdf248 100644 --- a/src/include/usr/targeting/common/predicates/predicates.H +++ b/src/include/usr/targeting/common/predicates/predicates.H @@ -1,26 +1,26 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/usr/targeting/predicates/predicates.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/predicates/predicates.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 __TARGETING_COMMON_PREDICATES_H #define __TARGETING_COMMON_PREDICATES_H @@ -33,6 +33,7 @@ #include <targeting/common/predicates/predicatebase.H> #include <targeting/common/predicates/predicatectm.H> #include <targeting/common/predicates/predicateisfunctional.H> +#include <targeting/common/predicates/predicatehwas.H> #include <targeting/common/predicates/predicatepostfixexpr.H> // please keep up to date... |

