summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/usr/targeting/common/predicates/predicatehwas.H110
-rw-r--r--src/include/usr/targeting/common/predicates/predicatehwaschanged.H212
-rw-r--r--src/include/usr/targeting/common/predicates/predicates.H1
-rw-r--r--src/include/usr/targeting/common/util.H59
4 files changed, 293 insertions, 89 deletions
diff --git a/src/include/usr/targeting/common/predicates/predicatehwas.H b/src/include/usr/targeting/common/predicates/predicatehwas.H
index 07e623314..48ff3304c 100644
--- a/src/include/usr/targeting/common/predicates/predicatehwas.H
+++ b/src/include/usr/targeting/common/predicates/predicatehwas.H
@@ -1,26 +1,25 @@
-/* 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
- */
+/* 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,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_PREDICATEHWAS_H
#define __TARGETING_COMMON_PREDICATEHWAS_H
@@ -46,7 +45,7 @@
#include <targeting/common/predicates/predicatebase.H>
//******************************************************************************
-// Macros
+// Macros
//******************************************************************************
#undef TARG_NAMESPACE
@@ -54,7 +53,7 @@
#undef TARG_FN
//******************************************************************************
-// Interface
+// Interface
//******************************************************************************
namespace TARGETING
@@ -66,7 +65,7 @@ namespace TARGETING
class Target;
/**
- * @brief Predicate class which filters a target based on its HWAS state
+ * @brief Predicate class which filters a target based on its HWAS state
*/
class PredicateHwas : public PredicateBase
{
@@ -80,8 +79,8 @@ class PredicateHwas : public PredicateBase
/**
* @brief Destroy an HWAS state predicate
*/
- virtual ~PredicateHwas();
-
+ virtual ~PredicateHwas();
+
/**
* @brief Reset the predicate to match everything
*
@@ -103,7 +102,7 @@ class PredicateHwas : public PredicateBase
*
* @param[in] i_present Desired present state
*
- * @return Reference to the predicate, for chaining
+ * @return Reference to the predicate, for chaining
*/
PredicateHwas& present(const bool i_present);
@@ -112,44 +111,33 @@ class PredicateHwas : public PredicateBase
*
* @param[in] i_functional Desired functional state
*
- * @return Reference to the predicate, for chaining
+ * @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
+ * @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
+ * @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
+ * HWAS sub-fields compared include poweredOn, present, functional
+ * and dumpFunctional. On construction, the
+ * predicate matches any state of those 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
+ * targets, call reset(). See PredicateBase class for
* parameter/return description.
*
* @param[in] i_pTarget
@@ -161,7 +149,7 @@ class PredicateHwas : public PredicateBase
const Target* i_pTarget) const;
private:
-
+
/**
* @brief Union that exposes raw value of an HWAS state attribute
* for purposes of bitwise comparison
@@ -172,7 +160,7 @@ class PredicateHwas : public PredicateBase
*/
union hwasState
{
- ATTR_HWAS_STATE_type attribute; // Attribute
+ ATTR_HWAS_STATE_type attribute; // Attribute
uint64_t rawValue; // Flattened representation
};
@@ -203,7 +191,7 @@ inline PredicateHwas& PredicateHwas::poweredOn(
iv_desired.attribute.poweredOn = i_poweredOn;
iv_valid.attribute.poweredOn = true;
return *this;
-}
+}
//******************************************************************************
// PredicateHwas::present
@@ -215,7 +203,7 @@ inline PredicateHwas& PredicateHwas::present(
iv_desired.attribute.present = i_present;
iv_valid.attribute.present = true;
return *this;
-}
+}
//******************************************************************************
// PredicateHwas::functional
@@ -227,20 +215,8 @@ inline PredicateHwas& PredicateHwas::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
//******************************************************************************
diff --git a/src/include/usr/targeting/common/predicates/predicatehwaschanged.H b/src/include/usr/targeting/common/predicates/predicatehwaschanged.H
new file mode 100644
index 000000000..6d0144623
--- /dev/null
+++ b/src/include/usr/targeting/common/predicates/predicatehwaschanged.H
@@ -0,0 +1,212 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/targeting/common/predicates/predicatehwaschanged.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 __TARGETING_COMMON_PREDICATEHWASCHANGED_H
+#define __TARGETING_COMMON_PREDICATEHWASCHANGED_H
+
+/**
+ * @file targeting/common/predicates/predicatehwaschanged.H
+ *
+ * @brief Interface for a predicate which fiters a target based on its HWAS
+ * changed flag
+ */
+
+//******************************************************************************
+// 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 "PredicateHWASChanged::"
+
+class Target;
+
+/**
+ * @brief Predicate class which filters a target based on HWAS changed flag
+ */
+class PredicateHwasChanged : public PredicateBase
+{
+ public:
+
+ /**
+ * @brief Create an HWAS changed flag predicate
+ */
+ PredicateHwasChanged();
+
+ /**
+ * @brief Destroy an HWAS changed flag predicate
+ */
+ virtual ~PredicateHwasChanged();
+
+ /**
+ * @brief Reset the predicate to match everything
+ *
+ * @return Reference to the predicate, for chaining
+ */
+ PredicateHwasChanged& reset();
+
+ /**
+ * @brief Configure predicate to look for the setting of a particular
+ * bit in the HWAS_CHANGED_STATE_FLAG
+ *
+ * @param[in] i_bit HWAS_CHANGED_BIT
+ * @param[in] i_changed Desired changed setting of that bit
+ *
+ * @return Reference to the predicate, for chaining
+ */
+ PredicateHwasChanged& changedBit(
+ const HWAS_CHANGED_BIT i_bit, const bool i_changed);
+
+ /**
+ * @brief Configure predicate to look for the particular state of
+ * bits in the HWAS_CHANGED_STATE_FLAG
+ *
+ * @param[in] i_changed Desired changed setting of all bits
+ *
+ * @return Reference to the predicate, for chaining
+ */
+ PredicateHwasChanged& allChangesApplied(
+ const bool i_changed);
+
+ /**
+ * @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 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 changed flag
+ * 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 hwasStateChangedFlag
+ {
+ ATTR_HWAS_STATE_CHANGED_FLAG_type attribute; // Attribute
+ uint64_t rawValue; // Flattened representation
+ };
+
+ hwasStateChangedFlag iv_desired; ///< Desired bits
+ hwasStateChangedFlag iv_valid; ///< mask of bits to check
+
+ TARG_DISABLE_COPY_AND_ASSIGNMENT_OPERATORS(PredicateHwasChanged);
+};
+
+//******************************************************************************
+// PredicateHwasChanged::PredicateHwasChanged
+//******************************************************************************
+
+inline PredicateHwasChanged::PredicateHwasChanged()
+{
+ // Ignore reference
+ reset();
+}
+
+//******************************************************************************
+// PredicateHwasChanged::changedBit
+//******************************************************************************
+
+inline PredicateHwasChanged& PredicateHwasChanged::changedBit(
+ const HWAS_CHANGED_BIT i_bit, const bool i_changed)
+{
+ if (i_changed)
+ {
+ iv_desired.rawValue |= i_bit; // turn bit on
+ }
+ else
+ {
+ iv_desired.rawValue &= ~i_bit; // turn bit off
+ }
+ iv_valid.rawValue |= i_bit; // turn this bit on to check
+ return *this;
+}
+
+//******************************************************************************
+// PredicateHwasChanged::allChangesApplied
+//******************************************************************************
+
+inline PredicateHwasChanged& PredicateHwasChanged::allChangesApplied(
+ const bool i_changed)
+{
+ if (i_changed)
+ {
+ iv_desired.rawValue = 0xFFFFFFFFFFFFFFFFull; // turn all bits on
+ }
+ else
+ {
+ iv_desired.rawValue = 0x0ull; // turn all bits off
+ }
+ iv_valid.rawValue = 0xFFFFFFFFFFFFFFFFull; // turn all bits on to check
+ return *this;
+}
+
+#undef TARG_CLASS
+#undef TARG_NAMESPACE
+
+} // End namespace TARGETING
+
+#endif // __TARGETING_COMMON_PREDICATEHWASCHANGED_H
+
diff --git a/src/include/usr/targeting/common/predicates/predicates.H b/src/include/usr/targeting/common/predicates/predicates.H
index 85b75d1f9..8c422b036 100644
--- a/src/include/usr/targeting/common/predicates/predicates.H
+++ b/src/include/usr/targeting/common/predicates/predicates.H
@@ -33,6 +33,7 @@
#include <targeting/common/predicates/predicatectm.H>
#include <targeting/common/predicates/predicateisfunctional.H>
#include <targeting/common/predicates/predicatehwas.H>
+#include <targeting/common/predicates/predicatehwaschanged.H>
#include <targeting/common/predicates/predicatepostfixexpr.H>
#include <targeting/common/predicates/predicateattrval.H>
diff --git a/src/include/usr/targeting/common/util.H b/src/include/usr/targeting/common/util.H
index 4851dd87b..69f302df8 100644
--- a/src/include/usr/targeting/common/util.H
+++ b/src/include/usr/targeting/common/util.H
@@ -1,25 +1,25 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/usr/targeting/util.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/util.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_UTIL_H
#define __TARGETING_COMMON_UTIL_H
@@ -30,6 +30,8 @@
* @brief Targeting utility functions
*/
+#include <attributeenums.H>
+
namespace TARGETING
{
@@ -67,6 +69,19 @@ bool is_vpo( void );
*/
uint32_t get_huid( const Target* i_target );
+/**
+ * @brief Set HWAS Changed Mask to subscription mask
+ * @param[in] Pointer to a Target
+ */
+void update_hwas_changed_mask(Target * i_target);
+
+/**
+ * @brief Set HWAS Changed Mask to subscription mask
+ * @param[in] Pointer to a Target
+ * @param[in] bit to clear
+ */
+void clear_hwas_changed_bit(Target * i_target, const HWAS_CHANGED_BIT i_bit);
+
}
#endif // __TARGETING_COMMON_UTIL_H
OpenPOWER on IntegriCloud