summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/diag/prdf/common/util')
-rwxr-xr-xsrc/usr/diag/prdf/common/util/CcAutoDeletePointer.h307
-rwxr-xr-xsrc/usr/diag/prdf/common/util/CcAutoDeletePointer.inl87
-rwxr-xr-xsrc/usr/diag/prdf/common/util/CcSynch.h202
-rwxr-xr-xsrc/usr/diag/prdf/common/util/CcSynch.inl62
-rwxr-xr-xsrc/usr/diag/prdf/common/util/UtilFunct.H153
-rwxr-xr-xsrc/usr/diag/prdf/common/util/UtilHash.H99
-rwxr-xr-xsrc/usr/diag/prdf/common/util/UtilMapX.H197
-rwxr-xr-xsrc/usr/diag/prdf/common/util/UtilSMap.H181
-rwxr-xr-xsrc/usr/diag/prdf/common/util/UtilTree.C344
-rwxr-xr-xsrc/usr/diag/prdf/common/util/UtilTree.H181
-rwxr-xr-xsrc/usr/diag/prdf/common/util/UtilTreeX.H171
-rwxr-xr-xsrc/usr/diag/prdf/common/util/iipbits.h24
-rwxr-xr-xsrc/usr/diag/prdf/common/util/iipbtlst.h25
-rwxr-xr-xsrc/usr/diag/prdf/common/util/iipdgtb.C294
-rwxr-xr-xsrc/usr/diag/prdf/common/util/iipdgtb.h324
-rwxr-xr-xsrc/usr/diag/prdf/common/util/iipdigit.C181
-rwxr-xr-xsrc/usr/diag/prdf/common/util/iipdigit.h477
-rwxr-xr-xsrc/usr/diag/prdf/common/util/iipfltr.h26
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfAssert.C103
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfAssert.h41
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfBitKey.C362
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfBitKey.H301
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfBitString.C899
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfBitString.H796
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfErrlSmartPtr.C53
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfErrlSmartPtr.H167
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfErrorSignature.H175
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfFilters.C218
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfFilters.H459
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfFlyWeight.C151
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfFlyWeight.H138
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfFlyWeightS.C306
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfFlyWeightS.H75
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfHeapBucketSize.H81
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfRegisterData.C37
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfRegisterData.H97
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfTimer.H244
-rwxr-xr-xsrc/usr/diag/prdf/common/util/xspprdFilterLink.h26
-rwxr-xr-xsrc/usr/diag/prdf/common/util/xspprdScanCommFilter.h26
39 files changed, 8090 insertions, 0 deletions
diff --git a/src/usr/diag/prdf/common/util/CcAutoDeletePointer.h b/src/usr/diag/prdf/common/util/CcAutoDeletePointer.h
new file mode 100755
index 000000000..22560e0fb
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/CcAutoDeletePointer.h
@@ -0,0 +1,307 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/CcAutoDeletePointer.h $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 1995,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 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 CcAutoDeletePointer_h
+#define CcAutoDeletePointer_h
+
+// Class Specification *************************************************
+//
+// Class name: CcAutoDeletePointer
+// Parent class: None.
+//
+// Summary: This class is used to implement an automatic delete on a
+// pointer to memory obtained via new for a single instance.
+// Its primary purpose is for use in functions that create a
+// single instance dynamically and then perform some operations
+// that may throw an exception.
+//
+// This class should be used as a local variable so that when the
+// varaible goes out of scope, the destructor is called and the
+// memory pointer is deleted. Because the variable is local, if
+// an exception is thrown, it is guaranteed that the destructor
+// for this variable will be run and the memory pointer will be
+// deleted properly.
+//
+// Access to the pointer is available through the pointer
+// dereference operators, operator->() and
+// operator*(). The normal delete syntax is used
+// (i.e. "delete ptr;").
+//
+// Cardinality: N
+//
+// Performance/Implementation:
+// Space Complexity: Constant
+// Time Complexity: Constant
+//
+// Usage Examples:
+//
+// struct MyType
+// {
+// void bar(void);
+// };
+//
+// void foo(void)
+// {
+// CcAutoDeletePointer<MyType> ptr(new MyType());
+//
+// // Operations that may throw an exception
+//
+// ptr->bar(); // Using the pointer
+//
+// (*ptr).bar(); // Dereferencing
+// }
+//
+//
+// End Class Specification *********************************************
+
+// Includes
+
+template <class T>
+class CcAutoDeletePointer
+ {
+ public: // public member functions
+
+ CcAutoDeletePointer(T * ptr);
+ // Function Specification ********************************************
+ //
+ // Purpose: Initialization
+ // Parameters: ptr: Pointer to auto-delete
+ // Returns: No value returned
+ // Requirements: None.
+ // Promises: All data members are initialized.
+ // Exceptions: None.
+ // Concurrency: N/A
+ //
+ // End Function Specification ****************************************
+
+ ~CcAutoDeletePointer(void);
+ // Function Specification ********************************************
+ //
+ // Purpose: Destruction
+ // Parameters: None.
+ // Returns: No value returned
+ // Requirements: None.
+ // Promises: None.
+ // Exceptions: None.
+ // Concurrency: N/A
+ // Notes: The function deletes the data member pointer.
+ //
+ // End Function Specification ****************************************
+
+ T * operator->(void) const;
+ // Function Specification ********************************************
+ //
+ // Purpose: Provide access to pointer.
+ // Parameters: None.
+ // Returns: Pointer to template type.
+ // Requirements: None.
+ // Promises: None.
+ // Exceptions: None.
+ // Concurrency: Reentrant
+ //
+ // End Function Specification ****************************************
+
+ T & operator*(void) const;
+ // Function Specification ********************************************
+ //
+ // Purpose: Provide access to pointer.
+ // Parameters: None.
+ // Returns: Reference to template type.
+ // Requirements: None.
+ // Promises: None.
+ // Exceptions: None.
+ // Concurrency: Reentrant
+ //
+ // End Function Specification ****************************************
+
+ private:
+
+ CcAutoDeletePointer(const CcAutoDeletePointer<T> & e);
+ // Function Specification ********************************************
+ //
+ // Purpose: Copy
+ // Parameters: e: Reference to instance to copy
+ // Returns: No value returned.
+ // Requirements: None.
+ // Promises: All data members are initialized.
+ // Exceptions: None.
+ // Concurrency: N/A.
+ // Notes: This copy constructor is declared private and not defined
+ // to prohibit copying.
+ //
+ // End Function Specification ****************************************
+
+ CcAutoDeletePointer<T> & operator=(const CcAutoDeletePointer<T> & e);
+ // Function Specification ********************************************
+ //
+ // Purpose: Assigment
+ // Parameters: e: Reference to instance to assign from
+ // Returns: Reference to this instance
+ // Requirements: None.
+ // Promises: All data members will be assigned.
+ // Exceptions: N/A.
+ // Concurrency: N/A.
+ // Notes: This assignment operator is declared private and not defined
+ // to prohibit copying.
+ //
+ // End Function Specification ****************************************
+
+ T * pointer;
+
+ };
+
+// Class Specification *************************************************
+//
+// Class name: CcAutoDeletePointerVector
+// Parent class: None.
+//
+// Summary: This class is used to implement an automatic delete on a
+// pointer to memory obtained via new for multiple instances.
+// Its primary purpose is for use in functions that allocate
+// multiple instances dynamically (e.g. "T * ptr = new T[5];")
+// and then perform some operations that may throw an
+// exception.
+//
+// This class should be used as a local variable so that when the
+// varaible goes out of scope, the destructor is called and the
+// memory pointer is deleted. Because the variable is local, if
+// an exception is thrown, it is guaranteed that the destructor
+// for this variable will be run and the memory pointer will be
+// deleted properly.
+//
+// Access to the pointer is available through operator(). The
+// vector delete syntax is used (e.g. "delete [] ptr;").
+//
+// Cardinality: N
+//
+// Performance/Implementation:
+// Space Complexity: Constant
+// Time Complexity: Constant
+//
+// Usage Examples:
+//
+// void foo(void)
+// {
+// CcAutoDeletePointerVector<char> ptr(new char[4]);
+//
+// // Operations that may throw an exception
+//
+// strcpy(ptr(), "abc"); // Using the Pointer
+// }
+//
+//
+// End Class Specification *********************************************
+
+template <class T>
+class CcAutoDeletePointerVector
+ {
+ public: // public member functions
+
+ CcAutoDeletePointerVector(T * ptr);
+ // Function Specification ********************************************
+ //
+ // Purpose: Initialization
+ // Parameters: ptr: Pointer to auto-delete
+ // Returns: No value returned
+ // Requirements: None.
+ // Promises: All data members are initialized.
+ // Exceptions: None.
+ // Concurrency: N/A
+ //
+ // End Function Specification ****************************************
+
+ ~CcAutoDeletePointerVector(void);
+ // Function Specification ********************************************
+ //
+ // Purpose: Destruction
+ // Parameters: None.
+ // Returns: No value returned
+ // Requirements: None.
+ // Promises: None.
+ // Exceptions: None.
+ // Concurrency: N/A
+ // Notes: The function deletes the data member pointer.
+ //
+ // End Function Specification ****************************************
+
+ T * operator()(void) const;
+ // Function Specification ********************************************
+ //
+ // Purpose: Provide access to pointer.
+ // Parameters: None.
+ // Returns: Pointer to template type.
+ // Requirements: None.
+ // Promises: None.
+ // Exceptions: None.
+ // Concurrency: Reentrant
+ //
+ // End Function Specification ****************************************
+
+ private:
+
+ CcAutoDeletePointerVector(const CcAutoDeletePointerVector<T> & e);
+ // Function Specification ********************************************
+ //
+ // Purpose: Copy
+ // Parameters: e: Reference to instance to copy
+ // Returns: No value returned.
+ // Requirements: None.
+ // Promises: All data members are initialized.
+ // Exceptions: None.
+ // Concurrency: N/A.
+ // Notes: This copy constructor is declared private and not defined
+ // to prohibit copying.
+ //
+ // End Function Specification ****************************************
+
+ CcAutoDeletePointerVector<T> & operator=(
+ const CcAutoDeletePointerVector<T> & e);
+ // Function Specification ********************************************
+ //
+ // Purpose: Assigment
+ // Parameters: e: Reference to instance to assign from
+ // Returns: Reference to this instance
+ // Requirements: None.
+ // Promises: All data members will be assigned.
+ // Exceptions: N/A.
+ // Concurrency: N/A.
+ // Notes: This assignment operator is declared private and not defined
+ // to prohibit copying.
+ //
+ // End Function Specification ****************************************
+
+ T * pointer;
+
+ };
+#include <CcAutoDeletePointer.inl>
+
+// Change Log **********************************************************
+//
+// Flag PTR/DCR# Userid Date Description
+// ---- -------- -------- -------- -----------
+// n/a n/a JST 09/12/95 Created.
+//
+// End Change Log ******************************************************
+
+#endif
+
diff --git a/src/usr/diag/prdf/common/util/CcAutoDeletePointer.inl b/src/usr/diag/prdf/common/util/CcAutoDeletePointer.inl
new file mode 100755
index 000000000..d8b5c656e
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/CcAutoDeletePointer.inl
@@ -0,0 +1,87 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/CcAutoDeletePointer.inl $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 1995,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 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 CcAutoDeletePointer_inl
+#define CcAutoDeletePointer_inl
+
+// Includes
+
+template<class T>
+inline
+CcAutoDeletePointer<T>::CcAutoDeletePointer(T * ptr) :
+ pointer(ptr)
+ {
+ }
+
+template<class T>
+inline
+CcAutoDeletePointer<T>::~CcAutoDeletePointer(void)
+ {
+ delete pointer;
+ }
+
+template<class T>
+inline
+T * CcAutoDeletePointer<T>::operator->(void) const
+ {
+ return(pointer);
+ }
+
+template<class T>
+inline
+T & CcAutoDeletePointer<T>::operator*(void) const
+ {
+ return(*pointer);
+ }
+
+template<class T>
+inline
+CcAutoDeletePointerVector<T>::CcAutoDeletePointerVector(T * ptr) :
+ pointer(ptr)
+ {
+ }
+
+template<class T>
+inline
+CcAutoDeletePointerVector<T>::~CcAutoDeletePointerVector(void)
+ {
+ delete [] pointer;
+ }
+
+template<class T>
+inline
+T * CcAutoDeletePointerVector<T>::operator()(void) const
+ {
+ return(pointer);
+ }
+
+// Change Log **********************************************************
+//
+// Flag PTR/DCR# Userid Date Description
+// ---- -------- -------- -------- -----------
+// n/a n/a JST 09/12/95 Created.
+//
+// End Change Log ******************************************************
+
+#endif
+
diff --git a/src/usr/diag/prdf/common/util/CcSynch.h b/src/usr/diag/prdf/common/util/CcSynch.h
new file mode 100755
index 000000000..8be57bb65
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/CcSynch.h
@@ -0,0 +1,202 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/CcSynch.h $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 1995,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 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 CcSynch_h
+#define CcSynch_h
+
+// Class Specification *************************************************
+//
+// Class name: CcSynch
+// Parent class: None.
+//
+// Summary: This class is used as a synchronization mechanism. A
+// static step counter is maintained and incremented via the
+// static member function Advance(). An internal step counter
+// is also maintained. The member function IsCurrent()
+// compares the two values to indicate if this instance is
+// "in synch". Calling the IsCurrent() functiona also updates
+// the internal counter to the static counter.
+//
+// The primary use is to ensure that an operation is performed
+// only once over a given time interval. The time interval
+// is controlled by successive calls to Advance(). If an
+// instance is not current, then the operation is performed
+// and the instance will then be current.
+//
+// The parameterized type STEP_TYPE is used for the type of
+// the counters. This type should be selected according to
+// the necessary granularity. For example, an 8 bit integer
+// value allows for 256 unique counter values.
+//
+// The parameterized type ID is used to diferentiate an
+// instantiation of this tmeplate from other instantiations.
+// This class relies on a unique static data member which is
+// generated for each unique instantiation.
+//
+// Cardinality: N
+//
+// Performance/Implementation:
+// Space Complexity: Constant
+// Time Complexity: Constant
+//
+// Usage Examples:
+//
+// struct mytype {};
+//
+// void foo(CcSynch<int, mytpe> & synch)
+// {
+// synch.Advance();
+//
+// if(synch.IsCurrent())
+// {
+// // Operation is performed
+// }
+//
+// if(synch.IsCurrent())
+// {
+// // Operation is not performed
+// }
+// }
+//
+//
+// End Class Specification *********************************************
+
+// Includes
+
+
+template <class STEP_TYPE, class ID>
+class CcSynch
+ {
+ public: // public member functions
+
+ typedef STEP_TYPE StepType;
+
+ enum
+ {
+ STATIC_INITIAL_VALUE = 1,
+ INSTANCE_INITIAL_VALUE = 0
+ };
+
+ static void Advance(void);
+ // Function Specification ********************************************
+ //
+ // Purpose: Advances the static data member step.
+ // Parameters: None.
+ // Returns: No value returned.
+ // Requirements: None.
+ // Promises: Static data member step will be incremented.
+ // Exceptions: None.
+ // Concurrency: Reentrant.
+ //
+ // End Function Specification ****************************************
+
+ CcSynch(void);
+ // Function Specification ********************************************
+ //
+ // Purpose: Initialization
+ // Parameters: No parameters
+ // Returns: No value returned
+ // Requirements: None.
+ // Promises: All data members are initialized.
+ // Exceptions: None.
+ // Concurrency: N/A
+ //
+ // End Function Specification ****************************************
+
+ // CcSynch(const CcSynch & e);
+ // Function Specification ********************************************
+ //
+ // Purpose: Copy
+ // Parameters: e: Reference to instance to copy
+ // Returns: No value returned.
+ // Requirements: None.
+ // Promises: All data members are initialized.
+ // Exceptions: None.
+ // Concurrency: N/A.
+ // Notes: The compiler generated copy constructor is sufficient.
+ //
+ // End Function Specification ****************************************
+
+ // ~CcSynch(void);
+ // Function Specification ********************************************
+ //
+ // Purpose: Destruction
+ // Parameters: None.
+ // Returns: No value returned
+ // Requirements: None.
+ // Promises: None.
+ // Exceptions: None.
+ // Concurrency: N/A
+ // Notes: The compiler generated default destructor is sufficient.
+ //
+ // End Function Specification ****************************************
+
+ // CcSynch & operator=(const CcSynch & e);
+ // Function Specification ********************************************
+ //
+ // Purpose: Assigment
+ // Parameters: e: Reference to instance to assign from
+ // Returns: Reference to this instance
+ // Requirements: None.
+ // Promises: All data members will be assigned.
+ // Exceptions: N/A.
+ // Concurrency: N/A.
+ // Notes: The compiler generated default assignment operator is
+ // sufficient.
+ //
+ // End Function Specification ****************************************
+
+ bool IsCurrent(void);
+ // Function Specification ********************************************
+ //
+ // Purpose: Determines if myStep is current with step.
+ // Parameters: None.
+ // Returns: TRUE if myStep is current with step. Otherewise,
+ // FALSE.
+ // Requirements: None.
+ // Promises: myStep will be current with step.
+ // Exceptions: None..
+ // Concurrency: Reenetrant.
+ //
+ // End Function Specification ****************************************
+
+ private:
+
+ static StepType step;
+
+ StepType myStep;
+ };
+
+#include "CcSynch.inl"
+
+// Change Log **********************************************************
+//
+// Flag PTR/DCR# Userid Date Description
+// ---- -------- -------- -------- -----------
+// n/a n/a JST 04/06/95 Created.
+// D24747.4 JFP 02/23/96 Added #ifndef BOOL_H
+//
+// End Change Log ******************************************************
+
+#endif
+
diff --git a/src/usr/diag/prdf/common/util/CcSynch.inl b/src/usr/diag/prdf/common/util/CcSynch.inl
new file mode 100755
index 000000000..09371b95d
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/CcSynch.inl
@@ -0,0 +1,62 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/CcSynch.inl $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 1995,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 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 CcSynch_inl
+#define CcSynch_inl
+
+// Includes
+
+template <class STEP_TYPE, class ID>
+inline
+void CcSynch<STEP_TYPE, ID>::Advance(void)
+ {
+ step++;
+ }
+
+template <class STEP_TYPE, class ID>
+inline
+CcSynch<STEP_TYPE, ID>::CcSynch(void) :
+ myStep(INSTANCE_INITIAL_VALUE)
+ {
+ }
+
+template <class STEP_TYPE, class ID>
+bool CcSynch<STEP_TYPE, ID>::IsCurrent(void)
+ {
+ bool rc = (step == myStep);
+
+ myStep = step;
+
+ return(rc);
+ }
+
+// Change Log **********************************************************
+//
+// Flag PTR/DCR# Userid Date Description
+// ---- -------- -------- -------- -----------
+// n/a n/a JST 04/06/95 Created.
+//
+// End Change Log ******************************************************
+
+#endif
+
diff --git a/src/usr/diag/prdf/common/util/UtilFunct.H b/src/usr/diag/prdf/common/util/UtilFunct.H
new file mode 100755
index 000000000..07e113326
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/UtilFunct.H
@@ -0,0 +1,153 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/UtilFunct.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2005,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+/** @file UtilFunct.H
+ * Utility template classes for doing functional-style programming across
+ * iterators.
+ */
+#ifndef __UTIL_UTILFUNCT_H
+#define __UTIL_UTILFUNCT_H
+
+#include <functional>
+
+namespace Util
+{
+ /**
+ * @class unary_input
+ * Functor that will read a value from a stream; useful for "generate"
+ * algorithms such as std::generate_n.
+ */
+ template <typename Type,
+ typename Stream>
+ struct unary_input :
+ public std::unary_function<void, Type>
+ {
+ Stream & stream;
+
+ /**
+ * @fn unary_input(Stream & i)
+ * Constructor
+ *
+ * @param i : The stream to read from.
+ */
+ unary_input(Stream & i) : stream(i) {};
+
+ /**
+ * @fn operator()
+ * Read instance of 'Type' from stream.
+ *
+ * Overloaded () operator to implement the functor-style behavior.
+ */
+ Type operator() ()
+ {
+ Type t;
+ stream >> t;
+ return t;
+ };
+
+ };
+
+ /**
+ * @class unary_compose
+ * Functor that will compose two functors as in: 'f(g(x))'.
+ *
+ * This template is an SGI extension to the STL, not currently in the C++
+ * standard. Since it is currently an extension, define it in our Util
+ * namespace for portability.
+ *
+ * Note: This is a clean implementation of the template, not a copy of the
+ * SGI code, based on the SGI::STL documentation.
+ */
+ template <typename Unary1,
+ typename Unary2>
+ struct unary_compose :
+ public std::unary_function<typename Unary2::argument_type,
+ typename Unary1::result_type>
+ {
+ Unary1 u1;
+ Unary2 u2;
+
+ /**
+ * @fn unary_compose(Unary1 & i1, Unary2 & i2)
+ * Constructor
+ *
+ * @param i1 : f functor in f(g(x)).
+ * @param i2 : g functor in f(g(x)).
+ */
+ unary_compose(const Unary1 & i1,
+ const Unary2 & i2) : u1(i1), u2(i2) {};
+
+ /**
+ * @fn operator()
+ * Execute f(g(x)).
+ *
+ * Overloaded () operator to implement the functor-style behavior.
+ */
+ typename Unary1::result_type
+ operator() (typename Unary2::argument_type x)
+ {
+ return u1(u2(x));
+ };
+
+ };
+
+ /**
+ * @fn unary_compose
+ * Utility template function to automatically create a composition functor.
+ */
+ template <typename Unary1,
+ typename Unary2>
+ inline
+ unary_compose<Unary1, Unary2> compose1(const Unary1 & i1,
+ const Unary2 & i2)
+ {
+ return unary_compose<Unary1, Unary2>(i1, i2);
+ };
+
+ /**
+ * @class unary_null.
+ * Functor that will do nothing.
+ *
+ * Useful in combination with compose for dropping a return from another
+ * functor.
+ */
+ template <typename Type>
+ struct unary_null :
+ public std::unary_function<Type, void>
+ {
+ unary_null() {};
+ void operator() (Type i) {};
+ };
+
+};
+
+
+#endif
+
+// Change Log *********************************************************
+//
+// Flag Reason Vers Date Coder Description
+// ---- -------- ---- -------- -------- -------------------------------
+// F510901 f300 07/15/05 iawillia Initial file creation.
+// End Change Log *****************************************************
+
diff --git a/src/usr/diag/prdf/common/util/UtilHash.H b/src/usr/diag/prdf/common/util/UtilHash.H
new file mode 100755
index 000000000..da03cf2d9
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/UtilHash.H
@@ -0,0 +1,99 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/UtilHash.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2004,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 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 __UTIL_UTILHASH_H
+#define __UTIL_UTILHASH_H
+
+#include <stdint.h>
+
+namespace Util
+{
+ inline uint32_t hashString(const char * i_str)
+ {
+ // This hash is a simple "n*s[0] + (n-1)*s[1] + ... + s[n-1]" algorithm,
+ // where s[i] is a two byte chunk of the input string. It is currently
+ // intended to return a 16-bit hash of the input string.
+
+ uint32_t sumA = 0;
+ uint32_t sumB = 0;
+ uint32_t pos = 0;
+ uint32_t val = 0;
+
+ const uint32_t bytes = sizeof(uint16_t); // 16-bit hashing
+
+ i_str--; // This looks weird but it is because of the do-while loop. We
+ // want it to loop through one more time when we have reached
+ // the end of the string (i.e. with the '\0' character).
+
+ do
+ {
+ i_str++;
+
+ if ('\0' != *i_str)
+ {
+ val <<= 8;
+ val |= (uint8_t) *i_str;
+ pos++;
+ }
+ else
+ {
+ while (bytes != pos)
+ {
+ val <<= 8;
+ pos++;
+ }
+ }
+
+ if (bytes == pos)
+ {
+ pos = 0;
+ sumA += val;
+ sumB += sumA;
+ val = 0;
+ }
+
+ } while ('\0' != *i_str);
+
+ return (sumB & 0xffff); // 16-bit hashing
+ };
+
+ inline uint32_t hashAdler32(const char * i_str)
+ {
+ uint32_t sumA = 1;
+ uint32_t sumB = 0;
+ while ('\0' != *i_str)
+ {
+ sumA += *i_str;
+ sumB += sumA;
+
+ sumA %= 65521;
+ sumB %= 65521;
+
+ i_str++;
+ }
+ return ((sumB << 16) | sumA) & 0x7FFFFFFF;
+ };
+};
+
+#endif
+
diff --git a/src/usr/diag/prdf/common/util/UtilMapX.H b/src/usr/diag/prdf/common/util/UtilMapX.H
new file mode 100755
index 000000000..208d7f784
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/UtilMapX.H
@@ -0,0 +1,197 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/UtilMapX.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2004,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 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 __UTIL_UTILMAPX_H
+#define __UTIL_UTILMAPX_H
+
+#include "UtilTree.H"
+#include <algorithm>
+
+template <class _A, class _B>
+class UtilMapX
+{
+ public:
+ UtilMapX();
+ UtilMapX(const UtilMapX<_A,_B> &);
+
+
+ void insert(const _A &, const _B &);
+ void insert(const std::pair<_A,_B> &);
+ void remove(const _A &);
+ bool find(const _A &);
+ const std::pair<_A,_B>& peek();
+ void empty() { cv_tree.empty(); };
+ _B & operator[] (const _A &);
+
+ private:
+ UtilTree cv_tree;
+
+ class mapXComparator : public UtilTree::comparator
+ {
+ public:
+ virtual int operator() (void * _a, void * _b) const
+ {
+ std::pair<_A,_B>* a;
+ std::pair<_A,_B>* b;
+
+ a = static_cast<std::pair<_A,_B>*>(_a);
+ b = static_cast<std::pair<_A,_B>*>(_b);
+
+ return (a->first < b->first ? -1 :
+ (a->first == b->first ? 0 : 1));
+ };
+ };
+
+ class mapXCleanup : public UtilTree::cleanup
+ {
+ public:
+ virtual void operator() (void * _a) const
+ {
+ std::pair<_A,_B>* a = static_cast<std::pair<_A,_B>*>(_a);
+ delete a;
+ };
+ };
+
+ class mapXCopier : public UtilTree::copier
+ {
+ public:
+ virtual void * operator() (void * _a) const
+ {
+ std::pair<_A,_B>* a = static_cast<std::pair<_A,_B>*>(_a);
+ return (void *) new std::pair<_A,_B>(*a);
+ };
+ };
+
+ mapXComparator cv_compare;
+ mapXCleanup cv_clean;
+ mapXCopier cv_copy;
+
+ public:
+ class iterator
+ {
+ private:
+ UtilTree::iterator _pos;
+ public:
+ iterator(UtilTree::iterator i) { _pos = i; };
+ iterator & operator++()
+ { ++_pos; return *this; };
+ iterator & operator--()
+ { --_pos; return *this; };
+ bool operator==(const iterator& i) const
+ { return _pos == i._pos; };
+ bool operator!=(const iterator& i) const
+ { return _pos != i._pos; };
+ std::pair<_A, _B> operator*()
+ {
+ std::pair<_A, _B> * a =
+ static_cast<std::pair<_A, _B> *>(*_pos);
+ if (NULL == a)
+ return std::pair<_A, _B>();
+ return *a;
+ };
+ };
+ iterator end() const { return iterator(cv_tree.end()); };
+ iterator begin() const { return iterator(cv_tree.begin()); };
+
+};
+
+template <class _A, class _B>
+UtilMapX<_A,_B>::UtilMapX()
+{
+ cv_tree.setComparator(&cv_compare);
+ cv_tree.setCleanup(&cv_clean);
+ cv_tree.setCopier(&cv_copy);
+};
+
+template <class _A, class _B>
+UtilMapX<_A,_B>::UtilMapX(const UtilMapX<_A,_B> & i_copy)
+{
+ cv_tree = i_copy.cv_tree;
+ cv_tree.setComparator(&cv_compare);
+ cv_tree.setCleanup(&cv_clean);
+ cv_tree.setCopier(&cv_copy);
+};
+
+template <class _A, class _B>
+void UtilMapX<_A,_B>::insert(const _A & a, const _B & b)
+{
+ cv_tree.insert(new std::pair<_A,_B>(a,b));
+};
+
+template <class _A, class _B>
+void UtilMapX<_A,_B>::insert(const std::pair<_A,_B> & i)
+{
+ cv_tree.insert(new std::pair<_A,_B>(i));
+};
+
+template <class _A, class _B>
+void UtilMapX<_A,_B>::remove(const _A & a)
+{
+ std::pair<_A,_B> p(a,_B());
+ cv_tree.remove(&p);
+};
+
+template <class _A, class _B>
+bool UtilMapX<_A,_B>::find(const _A & a)
+{
+ std::pair<_A,_B> p(a,_B());
+ return (NULL != cv_tree.find(&p));
+};
+
+template <class _A, class _B>
+const std::pair<_A,_B> & UtilMapX<_A,_B>::peek()
+{
+ void * tmp = cv_tree.peek();
+ if (NULL == tmp)
+ {
+ static const std::pair<_A,_B> l;
+ return l;
+ }
+ return *static_cast<const std::pair<_A,_B> *>(tmp);
+};
+
+template <class _A, class _B>
+_B & UtilMapX<_A, _B>::operator[] (const _A & a)
+{
+ std::pair<_A,_B> p(a,_B());
+ std::pair<_A, _B> * l_node =
+ static_cast<std::pair<_A, _B> *>(cv_tree.find(&p));
+
+ if (NULL == l_node)
+ {
+ this->insert(p);
+ l_node = static_cast<std::pair<_A, _B> *>(cv_tree.find(&p));
+ }
+
+ return l_node->second;
+};
+
+#endif
+
+// Change Log *********************************************************
+//
+// Flag Reason Vers Date Coder Description
+// ---- -------- ---- -------- -------- -------------------------------
+// F494911 f310 03/04/05 iawillia Initial File Creation
+//
+// End Change Log *****************************************************
diff --git a/src/usr/diag/prdf/common/util/UtilSMap.H b/src/usr/diag/prdf/common/util/UtilSMap.H
new file mode 100755
index 000000000..c47f36c19
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/UtilSMap.H
@@ -0,0 +1,181 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/UtilSMap.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2007,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+/** @file UtilSMap.H
+ * An optimized implementation of the STL Map meant for small maps that do not
+ * need to be sorted.
+ */
+
+#ifndef __UTIL_UTILSMAP_H
+#define __UTIL_UTILSMAP_H
+
+#include <stddef.h>
+#include <stdlib.h>
+
+template <typename _First, typename _Second> class UtilSMap_Iterator;
+template <typename _First, typename _Second> UtilSMap_Iterator<_First, _Second>
+ operator+(UtilSMap_Iterator<_First,_Second>& l, size_t i);
+
+template <typename _First, typename _Second>
+class UtilSMap_Iterator
+{
+ protected:
+ char * iv_position;
+ public:
+ UtilSMap_Iterator(char * i_position) : iv_position(i_position) {};
+
+ bool operator==(const UtilSMap_Iterator & r)
+ { return iv_position == r.iv_position; };
+
+ bool operator!=(const UtilSMap_Iterator & r)
+ { return iv_position != r.iv_position; };
+
+ UtilSMap_Iterator<_First, _Second>& operator++();
+
+ _First & first() { return *(_First *) iv_position; };
+ _Second & second();
+
+ friend UtilSMap_Iterator<_First, _Second>
+ operator+<>(UtilSMap_Iterator<_First,_Second>& l,
+ size_t i);
+};
+
+template <typename _First, typename _Second>
+class UtilSMap
+{
+ public:
+ typedef _First key_type;
+ typedef _Second data_type;
+ typedef size_t size_type;
+ typedef UtilSMap_Iterator<_First,_Second> iterator;
+
+ private:
+ char * iv_memblock;
+ size_type iv_size;
+ size_type iv_blockCount;
+
+ public:
+ static const
+ size_type cv_firstSize = 4 * (sizeof(_First) / 4 +
+ (0 == (sizeof(_First) % 4) ? 0 :
+ 4 - (sizeof(_First) % 4)));
+ static const
+ size_type cv_secondSize = 4 * (sizeof(_Second) / 4 +
+ (0 == (sizeof(_Second) % 4) ? 0 :
+ 4 - (sizeof(_Second) % 4)));
+
+ static const
+ size_type cv_blockSize = cv_firstSize + cv_secondSize;
+
+ public:
+ UtilSMap() : iv_memblock(NULL), iv_size(0), iv_blockCount(2) {};
+ ~UtilSMap() { this->clear(); };
+
+ inline size_type size() const { return iv_size;};
+ inline bool empty() const { return 0 == iv_size;};
+ inline iterator begin() const
+ { return UtilSMap_Iterator<_First,_Second>(iv_memblock); };
+ inline iterator end() const
+ { return UtilSMap_Iterator<_First,_Second>(
+ &iv_memblock[iv_size * cv_blockSize]);
+ };
+
+ void clear()
+ {
+ if (NULL != iv_memblock) free(iv_memblock);
+ iv_memblock = NULL;
+ iv_size = 0;
+ iv_blockCount = 2;
+ };
+
+ data_type * insert(const key_type & k, const data_type & v)
+ {
+ if (NULL == iv_memblock)
+ {
+ iv_memblock = (char *) malloc(cv_blockSize * iv_blockCount);
+ }
+ if (iv_size == iv_blockCount)
+ {
+ iv_blockCount <<= 1;
+ iv_memblock = (char *)
+ realloc(iv_memblock, cv_blockSize * iv_blockCount);
+ }
+ (*(key_type *)&iv_memblock[cv_blockSize * iv_size]) = k;
+ data_type * l_rc = (data_type *)
+ &iv_memblock[cv_blockSize * iv_size + cv_firstSize];
+
+ (*l_rc) = v;
+
+ iv_size++;
+
+ return l_rc;
+ };
+ data_type & operator[](const key_type & i)
+ {
+ data_type * l_rc = find(i);
+
+ if (NULL == l_rc)
+ l_rc = insert(i, data_type());
+
+ return *l_rc;
+ };
+
+ private:
+ data_type * find(const key_type & k)
+ {
+ if (NULL == iv_memblock)
+ return NULL;
+
+ for (size_type i = 0; i < iv_size; i++)
+ if ((*(key_type *)&iv_memblock[i * cv_blockSize]) == k)
+ return ((data_type *)
+ &iv_memblock[i * cv_blockSize + cv_firstSize]);
+
+ return NULL;
+ };
+};
+
+template <typename _First, typename _Second>
+UtilSMap_Iterator<_First,_Second>&
+ UtilSMap_Iterator<_First,_Second>::operator++()
+ {
+ iv_position =
+ &iv_position[UtilSMap<_First,_Second>::cv_blockSize];
+ return *this;
+ };
+template <typename _First, typename _Second>
+_Second& UtilSMap_Iterator<_First,_Second>::second()
+ {
+ return *(_Second *)
+ &iv_position[UtilSMap<_First, _Second>::cv_firstSize];
+ };
+template <typename _First, typename _Second>
+UtilSMap_Iterator<_First,_Second>
+ operator+(UtilSMap_Iterator<_First, _Second>& l, size_t i)
+ {
+ return UtilSMap_Iterator<_First,_Second>(&l.iv_position[
+ UtilSMap<_First,_Second>::cv_blockSize * i]);
+ };
+
+
+#endif
diff --git a/src/usr/diag/prdf/common/util/UtilTree.C b/src/usr/diag/prdf/common/util/UtilTree.C
new file mode 100755
index 000000000..5eeaf3e43
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/UtilTree.C
@@ -0,0 +1,344 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/UtilTree.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2004,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#include "UtilTree.H"
+UtilTree::defaultComparator UtilTree::defComparator;
+UtilTree::defaultCleanup UtilTree::defCleanup;
+UtilTree::defaultCopier UtilTree::defCopy;
+
+void UtilTree::printTree()
+{
+ this->printTree(0,root);
+};
+
+UtilTree::UtilTree()
+ : root(NULL), comp(&defComparator), clean(&defCleanup), copy(&defCopy)
+{
+};
+
+UtilTree::~UtilTree()
+{
+ cleanTree(root);
+ root = NULL;
+};
+
+void UtilTree::empty()
+{
+ cleanTree(root);
+};
+
+void UtilTree::cleanTree(Node * root)
+{
+ if (NULL == root)
+ return;
+
+ cleanTree(root->left);
+ cleanTree(root->right);
+
+ (*clean)(root->value);
+ delete root;
+
+ return;
+};
+
+void * UtilTree::peek() const
+{
+ if (NULL == root)
+ return NULL;
+ return root->value;
+};
+
+void * UtilTree::find(void * v) const
+{
+ return (NULL != find(v, root) ? (find(v, root)->value) : NULL);
+};
+
+UtilTree::Node * UtilTree::find(void * v, Node * t) const
+{
+ if (NULL == t)
+ return NULL;
+
+ if (0 == (*comp)(v, t->value))
+ return t;
+
+ return find(v, (-1 == (*comp)(v, t->value) ? t->left : t->right));
+};
+
+void UtilTree::insert(void * v)
+{
+ insert(v, root);
+ while (NULL != root->parent)
+ root = root->parent;
+ if (Node::RED == root->color)
+ root->color = Node::BLACK;
+};
+
+void UtilTree::insert(void * v, Node *& t)
+{
+ if (NULL == t)
+ {
+ t = new Node(v);
+ t->color = Node::RED;
+ }
+ else if (0 == (*comp)(v, t->value))
+ {
+ (*clean)(t->value);
+ t->value = v;
+ }
+ else
+ {
+ Node *& temp = (-1 == (*comp)(v, t->value) ? t->left : t->right);
+ if (NULL == temp)
+ {
+ insert(v, temp);
+ temp->parent = t;
+ balance_i(temp);
+ }
+ else
+ {
+ insert(v, temp);
+ }
+ }
+};
+
+
+void UtilTree::balance_i(Node * t)
+{
+ if (NULL == t) // Hmm...
+ ;
+ else if (NULL == t->parent) // root node, fix color.
+ t->color = Node::BLACK;
+ else if (Node::BLACK == t->parent->color) // parent black, leave alone.
+ ;
+ else // parent red.
+ {
+ bool parentLeft = t->parent->parent->left == t->parent;
+ bool meLeft = t->parent->left == t;
+
+ if (parentLeft != meLeft) // rotate LR or RL case (from grandparent).
+ {
+ if (!meLeft) // right of parent.
+ {
+ if (t->left)
+ t->left->parent = t->parent;
+ t->parent->right = t->left;
+ t->left = t->parent;
+ t->parent->parent->left = t;
+ t->parent = t->parent->parent;
+ t->left->parent = t;
+ balance_i(t->left);
+ }
+ else // left of parent.
+ {
+ if (t->right)
+ t->right->parent = t->parent;
+ t->parent->left = t->right;
+ t->right = t->parent;
+ t->parent->parent->right = t;
+ t->parent = t->parent->parent;
+ t->right->parent = t;
+ balance_i(t->right);
+ }
+ }
+ else
+ {
+ bool hasRedUncle = false;
+ if ((parentLeft ? t->parent->parent->right
+ : t->parent->parent->left) != NULL)
+ {
+ if ((parentLeft ? t->parent->parent->right
+ : t->parent->parent->left)->color == Node::RED)
+ {
+ hasRedUncle = true;
+ }
+ }
+
+ if (hasRedUncle)
+ {
+ t->parent->color = Node::BLACK;
+ (parentLeft ? t->parent->parent->right
+ : t->parent->parent->left)->color = Node::BLACK;
+ t->parent->parent->color = Node::RED;
+ balance_i(t->parent->parent);
+ }
+ else
+ {
+ t = t->parent;
+ if (NULL != t->parent->parent)
+ parentLeft = t->parent->parent->left == t->parent;
+ meLeft = t->parent->left == t;
+
+ if (meLeft)
+ {
+ if (t->right)
+ t->right->parent = t->parent;
+ t->parent->left = t->right;
+ t->right = t->parent;
+ if (NULL != t->parent->parent)
+ if (parentLeft)
+ t->parent->parent->left = t;
+ else
+ t->parent->parent->right = t;
+ t->parent = t->parent->parent;
+ t->right->parent = t;
+ t->color = Node::BLACK;
+ t->right->color = Node::RED;
+ }
+ else
+ {
+ if (t->left)
+ t->left->parent = t->parent;
+ t->parent->right = t->left;
+ t->left = t->parent;
+ if (NULL != t->parent->parent)
+ if (parentLeft)
+ t->parent->parent->left = t;
+ else
+ t->parent->parent->right = t;
+ t->parent = t->parent->parent;
+ t->left->parent = t;
+ t->color = Node::BLACK;
+ t->left->color = Node::RED;
+ }
+ }
+ }
+ }
+}
+
+UtilTree::UtilTree(const UtilTree & i_copy)
+{
+ comp = i_copy.comp;
+ clean = i_copy.clean;
+ copy = i_copy.copy;
+
+ if (NULL == i_copy.root)
+ root = NULL;
+ else
+ {
+ root = new Node(NULL);
+ copyNode(root, i_copy.root, NULL);
+ }
+};
+
+void UtilTree::copyNode(Node * i_dest, Node * const i_src, Node * i_parent)
+{
+ i_dest->parent = i_parent;
+ i_dest->color = i_src->color;
+ i_dest->value = (*copy)(i_src->value);
+ if (NULL == i_src->left)
+ i_dest->left = NULL;
+ else
+ {
+ i_dest->left = new Node(NULL);
+ copyNode(i_dest->left, i_src->left, i_dest);
+ }
+ if (NULL == i_src->right)
+ i_dest->right = NULL;
+ else
+ {
+ i_dest->right = new Node(NULL);
+ copyNode(i_dest->right, i_src->right, i_dest);
+ };
+};
+
+UtilTree::iterator & UtilTree::iterator::operator++()
+{
+ if (NULL == _cur)
+ return *(this);
+
+ if (NULL == _cur->right)
+ {
+ while (_cur != NULL)
+ {
+ if (NULL != _cur->parent)
+ if (_cur == _cur->parent->right)
+ _cur = _cur->parent;
+ else
+ {
+ _cur = _cur->parent;
+ break;
+ }
+ else
+ _cur = _cur->parent;
+ }
+ }
+ else
+ {
+ _cur = _cur->right;
+ while (NULL != _cur->left)
+ _cur = _cur->left;
+ }
+
+ return *(this);
+};
+
+UtilTree::iterator & UtilTree::iterator::operator--()
+{
+ if (NULL == _cur)
+ return *(this);
+
+ if (NULL == _cur->left)
+ {
+ while (_cur != NULL)
+ {
+ if (NULL != _cur->parent)
+ if (_cur == _cur->parent->left)
+ _cur = _cur->parent;
+ else
+ {
+ _cur = _cur->parent;
+ break;
+ }
+ else
+ _cur = _cur->parent;
+ }
+ }
+ else
+ {
+ _cur = _cur->left;
+ while (NULL != _cur->right)
+ _cur = _cur->right;
+ }
+
+ return *(this);
+};
+
+UtilTree::iterator UtilTree::begin() const
+{
+ if (NULL == root)
+ return end();
+
+ Node * tmp = root;
+ while (NULL != tmp->left)
+ tmp = tmp->left;
+
+ return iterator(tmp, this);
+};
+
+// Change Log *********************************************************
+//
+// Flag Reason Vers Date Coder Description
+// ---- -------- ---- -------- -------- -------------------------------
+// F494911 f310 03/04/05 iawillia Initial File Creation
+//
+// End Change Log *****************************************************
diff --git a/src/usr/diag/prdf/common/util/UtilTree.H b/src/usr/diag/prdf/common/util/UtilTree.H
new file mode 100755
index 000000000..b8c18e67e
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/UtilTree.H
@@ -0,0 +1,181 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/UtilTree.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2004,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 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 __UTIL_UTILTREE_H
+#define __UTIL_UTILTREE_H
+
+#include <stdint.h>
+#include <stddef.h>
+
+#include <functional>
+
+#include <iostream>
+
+namespace UtilTreeSTD
+{
+ template <class _A, class _B>
+ class unary_operator : public std::unary_function<_A,_B>
+ {
+ public:
+ virtual _B operator() (_A) const { return _B(); };
+ };
+
+ template <class _A, class _B, class _C>
+ class binary_operator : public std::binary_function<_A,_B,_C>
+ {
+ public:
+ virtual _C operator() (_A,_B) const { return _C(); };
+ };
+};
+
+class UtilTree
+{
+ public:
+ UtilTree();
+ UtilTree(const UtilTree &);
+ virtual ~UtilTree();
+
+ void insert(void *);
+ void remove(void *);
+ void * find(void *) const;
+ void * peek() const;
+ void empty();
+
+ // temp...
+ void printTree();
+
+ typedef UtilTreeSTD::binary_operator<void *, void *, int>
+ comparator;
+ typedef UtilTreeSTD::unary_operator<void *, void>
+ cleanup;
+ typedef UtilTreeSTD::unary_operator<void *, void *>
+ copier;
+
+ void setComparator(comparator * i) { comp = i; };
+ void setCleanup(cleanup * i) { clean = i; };
+ void setCopier(copier * i) { copy = i; };
+
+ protected:
+ class defaultComparator : public comparator
+ {
+ public:
+ virtual int operator()(void * _a, void * _b) const
+ { return (_a < _b ? -1 : (_a == _b ? 0 : 1)); };
+ };
+
+ class defaultCleanup : public cleanup
+ {
+ public:
+ virtual void operator()(void * _a) const { return; };
+ };
+
+ class defaultCopier : public copier
+ {
+ public:
+ virtual void * operator()(void * _a) const { return _a; };
+ };
+
+ class Node;
+ class Node
+ {
+ public:
+ Node * left;
+ Node * right;
+ Node * parent;
+ bool color; // false = black, true = red.
+ static const bool BLACK = false;
+ static const bool RED = true;
+ void * value;
+
+ // Null pointers, set to red.
+ Node(void * v) :
+ left(NULL), right(NULL), parent(NULL), color(true),
+ value(v) {};
+ };
+
+ Node * root;
+ comparator * comp;
+ cleanup * clean;
+ copier * copy;
+
+ private:
+ static defaultComparator defComparator;
+ static defaultCleanup defCleanup;
+ static defaultCopier defCopy;
+
+ void cleanTree(Node *);
+ Node * find(void *, Node *) const;
+ void insert(void *, Node *&);
+ void balance_i(Node *);
+
+ void copyNode(Node *, Node * const, Node *);
+
+ void printTree(int d, Node *t)
+ {
+ if (NULL == t) return;
+ printTree(d+1, t->left);
+ for (int i = 0; i < d; i++)
+ std::cout << "\t";
+ std::cout << (t->color ? "R" : "B") << *(int *)t->value << std::endl;
+ printTree(d+1, t->right);
+ };
+
+ public:
+ class iterator
+ {
+ public:
+ iterator() : _cur(NULL), _tree(NULL) {};
+ iterator(const UtilTree * const t)
+ : _cur(NULL), _tree(t) {};
+ iterator(Node * i, const UtilTree * const t)
+ : _cur(i), _tree(t) {};
+ iterator & operator++();
+ iterator & operator--();
+ void * operator*() { return _cur->value; };
+
+ bool operator==(const iterator& i) const
+ { return _cur == i._cur; };
+ bool operator!=(const iterator& i) const
+ { return _cur != i._cur; };
+
+ iterator & operator=(const iterator& i)
+ { _cur = i._cur; _tree = i._tree; return *this;};
+
+ private:
+ Node * _cur;
+ const UtilTree * _tree;
+ };
+
+ iterator end() const { return iterator(this); };
+ iterator begin() const;
+};
+
+#endif
+
+// Change Log *********************************************************
+//
+// Flag Reason Vers Date Coder Description
+// ---- -------- ---- -------- -------- -------------------------------
+// F494911 f310 03/04/05 iawillia Initial File Creation
+//
+// End Change Log *****************************************************
diff --git a/src/usr/diag/prdf/common/util/UtilTreeX.H b/src/usr/diag/prdf/common/util/UtilTreeX.H
new file mode 100755
index 000000000..820adf251
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/UtilTreeX.H
@@ -0,0 +1,171 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/UtilTreeX.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2004,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 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 __UTIL_UTILTREEX_H
+#define __UTIL_UTILTREEX_H
+
+#include "UtilTree.H"
+
+template <class _T>
+class UtilTreeX
+{
+ public:
+ UtilTreeX();
+ UtilTreeX(const UtilTreeX<_T> &);
+
+ void insert(_T &);
+ void remove(_T &);
+ bool find(_T &);
+ const _T & peek();
+ void empty() { cv_tree.empty(); };
+
+ void printTree()
+ {
+ cv_tree.printTree();
+ };
+
+ private:
+ UtilTree cv_tree;
+
+ class treeXComparator : public UtilTree::comparator
+ {
+ public:
+ virtual int operator() (void * _a, void * _b) const
+ {
+ _T * a;
+ _T * b;
+
+ a = static_cast<_T *>(_a);
+ b = static_cast<_T *>(_b);
+
+ return (*a < *b ? -1 : (*a == *b ? 0 : 1));
+ }
+ };
+
+ class treeXCleanup : public UtilTree::cleanup
+ {
+ public:
+ virtual void operator() (void * _a) const
+ {
+ _T * a = static_cast<_T *>(_a);
+ delete a;
+ };
+ };
+
+ class treeXCopier : public UtilTree::copier
+ {
+ public:
+ virtual void * operator() (void * _a) const
+ {
+ _T * a = static_cast<_T *>(_a);
+ return (void *) new _T(*a);
+ };
+ };
+
+ treeXComparator cv_compare;
+ treeXCleanup cv_clean;
+ treeXCopier cv_copy;
+
+ public:
+ class iterator
+ {
+ private:
+ UtilTree::iterator _pos;
+ public:
+ iterator(UtilTree::iterator i) { _pos = i; };
+ iterator & operator++()
+ { ++_pos; return *this; };
+ iterator & operator--()
+ { --_pos; return *this; };
+ bool operator==(const iterator& i) const
+ { return _pos == i._pos; };
+ bool operator!=(const iterator& i) const
+ { return _pos != i._pos; };
+ _T operator*()
+ {
+ _T * a = static_cast<_T *>(*_pos);
+ if (NULL == a)
+ return _T();
+ return *a;
+ };
+ };
+ iterator end() const { return iterator(cv_tree.end()); };
+ iterator begin() const { return iterator(cv_tree.begin()); };
+};
+
+template <class _T>
+UtilTreeX<_T>::UtilTreeX()
+{
+ cv_tree.setComparator(&cv_compare);
+ cv_tree.setCleanup(&cv_clean);
+ cv_tree.setCopier(&cv_copy);
+};
+
+template <class _T>
+UtilTreeX<_T>::UtilTreeX(const UtilTreeX<_T> & i_copy)
+{
+ cv_tree = i_copy.cv_tree;
+ cv_tree.setComparator(&cv_compare);
+ cv_tree.setCleanup(&cv_clean);
+ cv_tree.setCopier(&cv_copy);
+};
+
+
+template <class _T>
+void UtilTreeX<_T>::insert(_T & i)
+{
+ cv_tree.insert((void *)new _T(i));
+};
+
+template <class _T>
+void UtilTreeX<_T>::remove(_T & i)
+{
+ cv_tree.remove((void *)&i);
+};
+
+template <class _T>
+bool UtilTreeX<_T>::find(_T & i)
+{
+ return (NULL != cv_tree.find((void *)&i));
+};
+
+template <class _T>
+const _T & UtilTreeX<_T>::peek()
+{
+ static const _T l = _T();
+ void * tmp = cv_tree.peek();
+ if (NULL == tmp)
+ return l;
+ return *static_cast<const _T *>(tmp);
+};
+
+
+#endif
+
+// Change Log *********************************************************
+//
+// Flag Reason Vers Date Coder Description
+// ---- -------- ---- -------- -------- -------------------------------
+// F494911 f310 03/04/05 iawillia Initial File Creation
+//
+// End Change Log *****************************************************
diff --git a/src/usr/diag/prdf/common/util/iipbits.h b/src/usr/diag/prdf/common/util/iipbits.h
new file mode 100755
index 000000000..4d00b5cc3
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/iipbits.h
@@ -0,0 +1,24 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/iipbits.h $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 1993,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#include<prdfBitString.H>
diff --git a/src/usr/diag/prdf/common/util/iipbtlst.h b/src/usr/diag/prdf/common/util/iipbtlst.h
new file mode 100755
index 000000000..6f0f5d840
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/iipbtlst.h
@@ -0,0 +1,25 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/iipbtlst.h $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 1993,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#include <prdfBitKey.H>
+
diff --git a/src/usr/diag/prdf/common/util/iipdgtb.C b/src/usr/diag/prdf/common/util/iipdgtb.C
new file mode 100755
index 000000000..c405c9adb
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/iipdgtb.C
@@ -0,0 +1,294 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/iipdgtb.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 1993,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#define IIPDGTB_CPP
+
+/* Module Description *************************************************/
+/* */
+/* Name: iipdgtb.cpp */
+/* */
+/* Description: This module provides the Digit String Byte class
+ implementation. */
+/* */
+/* End Module Description *********************************************/
+
+/* Change Log *********************************************************/
+/* */
+/* Flag PTR/DCR# Userid Date Description */
+/* ---- -------- -------- -------- ----------- */
+/* JST 10/20/93 Initial Creation */
+/* */
+/* End Change Log *****************************************************/
+
+/*--------------------------------------------------------------------*/
+/* Emit the virtual function tables and inline function defintions in
+ this translation unit. */
+/*--------------------------------------------------------------------*/
+#ifdef __GNUC__
+#endif
+
+/*--------------------------------------------------------------------*/
+/* Includes */
+/*--------------------------------------------------------------------*/
+
+#include <string.h> // for memcpy
+#include <iipdgtb.h>
+
+/*--------------------------------------------------------------------*/
+/* User Types */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Constants */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Macros */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Internal Function Prototypes */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Global Variables */
+/*--------------------------------------------------------------------*/
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Set String (Virtual)
+ //
+ // Purpose: This function allocates memory for the string
+ // representation. Any memory that has been previously
+ // allocated is deallocated.
+ //
+ // Side-effects: Memory is allocated.
+ //
+ // Dependencies: This function must be called at least once prior
+ // to the first DIgit read or write.
+ //
+ // End Function Specification //////////////////////////////////////
+
+void DIGIT_STRING_BYTE_CLASS::SetString
+ (
+ void
+ /*!i No parameters */
+ )
+ /*!o No value returned */
+ {
+ delete [] xbuffer;
+ xbuffer = new uint8_t[GetLength()];
+ }
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: DIGIT_STRING_BYTE_CLASS (Base Class Copy Constructor)
+ //
+ // Purpose: This function initializes the data members. The digit
+ // string values are also copied.
+ //
+ // Side-effects: This instance is initialized.
+ // Memory is allocated.
+ //
+ // Dependencies: All Digit String values must be less than or equal
+ // to 255.
+ //
+ // Time Complexity: Dominated by time complexity of the functions
+ // called.
+ //
+ // End Function Specification //////////////////////////////////////
+
+DIGIT_STRING_BYTE_CLASS::DIGIT_STRING_BYTE_CLASS
+ (
+ const DIGIT_STRING_CLASS & string
+ /*!i Digit String instance to copy */
+ ) :
+ /*!o No value returned */
+ DIGIT_STRING_CLASS(string),
+ xbuffer(NULL)
+ {
+ SetString();
+ SetValues(string);
+ }
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: DIGIT_STRING_BYTE_CLASS (Copy Constructor)
+ //
+ // Purpose: This function initializes the data members. The digit
+ // string values are also copied.
+ //
+ // Side-effects: This instance is initialized.
+ //
+ // Dependencies: None.
+ //
+ // Time Complexity: 0(m) where m is the length of the string being
+ // copied.
+ //
+ // End Function Specification //////////////////////////////////////
+
+DIGIT_STRING_BYTE_CLASS::DIGIT_STRING_BYTE_CLASS
+ (
+ const DIGIT_STRING_BYTE_CLASS & string
+ /*!i Digit String instance to copy */
+ ) :
+ /*!o Reference to this Digit String instance */
+ DIGIT_STRING_CLASS(string),
+ xbuffer(NULL)
+ {
+ SetString();
+
+ // Use direct copy of buffer since the lengths are equal
+ memcpy(xbuffer, string.xbuffer, GetLength());
+ }
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: ~DIGIT_STRING_BYTE_CLASS (Virtual destructor)
+ //
+ // Purpose: This function deallocates the digit string
+ // representation.
+ //
+ // Side-effects: Memory is deallocated.
+ //
+ // Dependencies: None.
+ //
+ // End Function Specification //////////////////////////////////////
+
+DIGIT_STRING_BYTE_CLASS::~DIGIT_STRING_BYTE_CLASS
+ (
+ void
+ /*!i No paramters */
+ )
+ /*!o No value returned */
+ {
+ delete [] xbuffer;
+ }
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Assingment operator
+ //
+ // Purpose: This function assigns the data members with the values
+ // from the Digit String reference. The digit string
+ // values are also assigned.
+ //
+ // Side-effects: Data members are modified.
+ //
+ // Dependencies: None.
+ //
+ // Time Complexity: Dominated by time complexity of the functions
+ // called.
+ //
+ // End Function Specification //////////////////////////////////////
+
+DIGIT_STRING_BYTE_CLASS & DIGIT_STRING_BYTE_CLASS::operator=
+ (
+ const DIGIT_STRING_CLASS & string
+ /*!i Digit string instance to assign from */
+ )
+ /*!o Reference to this Digit String instance */
+ {
+ // Check for assignment to self
+ if(this != &string)
+ {
+ // Assign the base class part
+ DIGIT_STRING_CLASS::operator=(string);
+
+ // Assign the derived class part
+ SetString();
+ SetValues(string);
+ }
+
+ return(*this);
+ }
+
+DIGIT_STRING_BYTE_CLASS & DIGIT_STRING_BYTE_CLASS::operator=
+ (
+ const DIGIT_STRING_BYTE_CLASS & string
+ /*!i Digit string instance to assign from */
+ )
+ /*!o Reference to this Digit String instance */
+ {
+ // Check for assignment to self
+ if(this != &string)
+ {
+ // Assign the base class part
+ DIGIT_STRING_CLASS::operator=(string);
+
+ // Assign the derived class part
+ SetString();
+ SetValues(string);
+ }
+
+ return(*this);
+ }
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Get Value (Virtual)
+ //
+ // Purpose: This function returns the value of a digit at the
+ // specified position.
+ //
+ // Side-effects: None.
+ //
+ // Dependencies: Position must be in the string.
+ //
+ // End Function Specification //////////////////////////////////////
+
+uint32_t DIGIT_STRING_BYTE_CLASS::GetValue
+ (
+ uint32_t offset
+ /*!i Digit offset */
+ ) const
+ /*!o Digit value */
+ {
+ return(xbuffer[offset]);
+ }
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Set Value (Pure virtual)
+ //
+ // Purpose: This function sets the value of the digit at the
+ // specified position. No other digits are affected.
+ //
+ // Side-effects: A digit in the string is modified.
+ //
+ // Dependencies: Position must be in the string.
+ //
+ // End Function Specification //////////////////////////////////////
+
+void DIGIT_STRING_BYTE_CLASS::SetValue
+ (
+ uint32_t offset,
+ /*!i Digit offset */
+ uint32_t value
+ /*!i Digit value to set */
+ )
+ /*!o No value returned */
+ {
+ xbuffer[offset] = value;
+ }
+
+#undef IIPDGTB_CPP
diff --git a/src/usr/diag/prdf/common/util/iipdgtb.h b/src/usr/diag/prdf/common/util/iipdgtb.h
new file mode 100755
index 000000000..94aaa6c56
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/iipdgtb.h
@@ -0,0 +1,324 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/iipdgtb.h $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 1993,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 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 IIPDGTB_H
+#define IIPDGTB_H
+
+/* Module Description *************************************************/
+/* */
+/* Name: iipdgtb.h */
+/* */
+/* Description: This module provides the Digit String Byte class
+ declaration. */
+/* */
+/* End Module Description *********************************************/
+
+/* Change Log *********************************************************/
+/* */
+/* Flag PTR/DCR# Userid Date Description */
+/* ---- -------- -------- -------- ----------- */
+/* JST 10/20/93 Initial Creation */
+/* */
+/* End Change Log *****************************************************/
+
+/*--------------------------------------------------------------------*/
+/* Reference the virtual function tables and inline function
+ defintions in another translation unit. */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Includes */
+/*--------------------------------------------------------------------*/
+
+#include <iipdigit.h>
+
+/*--------------------------------------------------------------------*/
+/* Forward References */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* User Types */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Constants */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Macros */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Global Variables */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Function Prototypes */
+/*--------------------------------------------------------------------*/
+
+/* Class Specification ************************************************/
+/* */
+/* Name: DIGIT_STRING_BYTE_CLASS */
+/* */
+/* Title: Byte Digit String */
+/* */
+/* Purpose: DIGIT_STRING_BYTE_CLASS provides an efficient
+ representation using a byte (8 bits) for each digit in
+ the string. */
+/* */
+/* Usage: This is general purpose base class. */
+/* */
+/* Side-effects: Memory is allocated. */
+/* */
+/* Dependencies: None. */
+/* */
+/* Notes: The Compact Digit String represents each digit in the
+ string using a byte. This limits the maximum_digit_value
+ that can be represented to 255. If an attempt is made
+ to set a digit to a value greater than 255, then the
+ contents and behaviour of the Digit String are undefined. */
+/* */
+/* Cardinality: N */
+/* */
+/* Metaclass: None. */
+/* */
+/* Space Complexity: O(m) where m is the number of digits in the
+ string. */
+/* */
+/* End Class Specification ********************************************/
+
+class DIGIT_STRING_BYTE_CLASS : public DIGIT_STRING_CLASS
+ {
+ private:
+
+ // Data Specification //////////////////////////////////////////////
+ //
+ // Purpose: This buffer is dynamically allocated for digits.
+ //
+ // End Data Specification //////////////////////////////////////////
+
+ uint8_t * xbuffer;
+
+ protected:
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Set String (Virtual)
+ //
+ // Purpose: This function allocates memory for the string
+ // representation. Any memory that has been previously
+ // allocated is deallocated.
+ //
+ // Side-effects: Memory is allocated.
+ //
+ // Dependencies: This function must be called at least once prior
+ // to the first Digit read or write.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ virtual void SetString
+ (
+ void
+ /*!i No parameters */
+ );
+ /*!o No value returned */
+
+ public:
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: DIGIT_STRING_BYTE_CLASS (Constructor)
+ //
+ // Purpose: This function initializes the data members.
+ //
+ // Side-effects: This instance is initialized.
+ // Memory is allocated.
+ //
+ // Dependencies: None.
+ //
+ // Time Complexity: Dominated by time complexity of SetString().
+ //
+ // End Function Specification //////////////////////////////////////
+
+ DIGIT_STRING_BYTE_CLASS
+ (
+ uint32_t mdv,
+ /*!i Maximum digit value */
+ uint32_t l
+ /*!i String length */
+ ) :
+ /*!o No value returned */
+ DIGIT_STRING_CLASS(mdv, l),
+ xbuffer(NULL)
+ {
+ SetString();
+ }
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: DIGIT_STRING_BYTE_CLASS (Base Class Copy Constructor)
+ //
+ // Purpose: This function initializes the data members. The digit
+ // string values are also copied.
+ //
+ // Side-effects: This instance is initialized.
+ // Memory is allocated.
+ //
+ // Dependencies: All Digit String values must be less than or equal
+ // to 255.
+ //
+ // Time Complexity: Dominated by time complexity of the functions
+ // called.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ DIGIT_STRING_BYTE_CLASS
+ (
+ const DIGIT_STRING_CLASS & string
+ /*!i Digit String reference to copy */
+ );
+ /*!o No value returned */
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: DIGIT_STRING_BYTE_CLASS (Copy Constructor)
+ //
+ // Purpose: This function initializes the data members. The digit
+ // string values are also copied.
+ //
+ // Side-effects: This instance is initialized.
+ // Memory is allocated.
+ //
+ // Dependencies: None.
+ //
+ // Time Complexity: Dominated by time complexity of the functions
+ // called.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ DIGIT_STRING_BYTE_CLASS
+ (
+ const DIGIT_STRING_BYTE_CLASS & string
+ /*!i Digit String Compact reference to copy */
+ );
+ /*!o No value returned */
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: ~DIGIT_STRING_BYTE_CLASS (Virtual destructor)
+ //
+ // Purpose: This function deallocates the digit string
+ // representation.
+ //
+ // Side-effects: Memory is deallocated.
+ //
+ // Dependencies: None.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ virtual ~DIGIT_STRING_BYTE_CLASS
+ (
+ void
+ /*!i No paramters */
+ );
+ /*!o No value returned */
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Assingment operator
+ //
+ // Purpose: This function assigns the data members with the values
+ // from the Digit String reference. The digit string
+ // values are also assigned.
+ //
+ // Side-effects: Data members are modified.
+ // Memory is reallocated.
+ //
+ // Dependencies: All Digit String values must be less than or equal
+ // to 255.
+ //
+ // Time Complexity: Dominated by time complexity of the functions
+ // called.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ DIGIT_STRING_BYTE_CLASS & operator=
+ (
+ const DIGIT_STRING_CLASS & string
+ /*!i Digit string instance to assign from */
+ );
+ /*!o Reference to this Digit String instance */
+
+ DIGIT_STRING_BYTE_CLASS & operator=
+ (
+ const DIGIT_STRING_BYTE_CLASS & string
+ /*!i Digit string instance to assign from */
+ );
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Get Value (Virtual)
+ //
+ // Purpose: This function returns the value of a digit at the
+ // specified position.
+ //
+ // Side-effects: None.
+ //
+ // Dependencies: Position must be in the string.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ virtual uint32_t GetValue
+ (
+ uint32_t offset
+ /*!i Digit offset */
+ ) const;
+ /*!o Digit value */
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Set Value (Virtual)
+ //
+ // Purpose: This function sets the value of the digit at the
+ // specified position. No other digits are affected.
+ //
+ // Side-effects: A digit in the string is modified.
+ //
+ // Dependencies: Position must be in the string.
+ // Digit value must be less than or equal to 255.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ virtual void SetValue
+ (
+ uint32_t offset,
+ /*!i Digit offset */
+ uint32_t value
+ /*!i Digit value to set */
+ );
+ /*!o No value returned */
+
+ };
+
+
+#endif
diff --git a/src/usr/diag/prdf/common/util/iipdigit.C b/src/usr/diag/prdf/common/util/iipdigit.C
new file mode 100755
index 000000000..5fc676844
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/iipdigit.C
@@ -0,0 +1,181 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/iipdigit.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 1993,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#define IIPDIGIT_CPP
+
+/* Module Description *************************************************/
+/* */
+/* Name: iipdigit.cpp */
+/* */
+/* Description: This module provides the Digit String class
+ implementation. */
+/* */
+/* End Module Description *********************************************/
+
+/* Change Log *********************************************************/
+/* */
+/* Flag PTR/DCR# Userid Date Description */
+/* ---- -------- -------- -------- ----------- */
+/* JST 06/07/93 Initial Creation */
+/* */
+/* End Change Log *****************************************************/
+
+/*--------------------------------------------------------------------*/
+/* Emit the virtual function tables and inline function defintions in
+ this translation unit. */
+/*--------------------------------------------------------------------*/
+#ifdef __GNUC__
+#endif
+
+/*--------------------------------------------------------------------*/
+/* Includes */
+/*--------------------------------------------------------------------*/
+
+#include <iipdigit.h>
+
+/*--------------------------------------------------------------------*/
+/* User Types */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Constants */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Macros */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Internal Function Prototypes */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Global Variables */
+/*--------------------------------------------------------------------*/
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Set Values
+ //
+ // Purpose: This function sets the values of the string at
+ // corresponding positions. If one of the Digit Strings
+ // is larger, than the extra digits are ignored. If a
+ // value from the string is larger than the
+ // maximum_digit_value, then the digit is set to the
+ // maximum_digit_value.
+ //
+ // Side-effects: Digits in string are modified.
+ //
+ // Dependencies: None.
+ //
+ // Time Complexity: O(m) where m is the length
+ //
+ // End Function Specification //////////////////////////////////////
+
+void DIGIT_STRING_CLASS::SetValues
+ (
+ const DIGIT_STRING_CLASS & string
+ /*!i Reference to Digit string set set values from */
+ )
+ /*!o No value returned */
+ {
+ for(unsigned int i = 0;i < length;i++)
+ {
+ if(i < string.length)
+ {
+ SetValue(i, string.GetValue(i));
+ }
+ }
+ }
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Fill
+ //
+ // Purpose: This function sets the value of each digit in the
+ // string with the same specified value.
+ //
+ // Side-effects: All digits in the string is modified.
+ //
+ // Dependencies: None.
+ //
+ // Time Complexity: O(m) where m is the length
+ //
+ // End Function Specification //////////////////////////////////////
+
+void DIGIT_STRING_CLASS::Fill
+ (
+ uint32_t value
+ /*!i Digit value for each position */
+ )
+ /*!o No value returned */
+ {
+ for(unsigned int i = 0;i < length;i++)
+ {
+ SetValue(i, value);
+ }
+ }
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Equality operator
+ //
+ // Purpose: This function determines if the specified string is
+ // equal two this one. If the lengths are equal and the
+ // corresponding values at every position are equal, then
+ // the Digit strings are equal.
+ //
+ // Side-effects: None.
+ //
+ // Dependencies: None.
+ //
+ // Time Complexity: O(m) where m is the length
+ //
+ // End Function Specification //////////////////////////////////////
+
+bool DIGIT_STRING_CLASS::operator==
+(
+ const DIGIT_STRING_CLASS & string
+ /*!i Digit string instance to compare */
+ ) const
+/*!o Non-zero if digit strings are equal, otherwise zero */
+{
+ bool rc = (length == string.length);
+
+ if(rc)
+ {
+ for(unsigned int i = 0;i < length;i++)
+ {
+ if(GetValue(i) != string.GetValue(i))
+ {
+ rc = false;
+ break;
+ }
+ }
+ }
+
+ return(rc);
+}
+
+
+#undef IIPDIGIT_CPP
diff --git a/src/usr/diag/prdf/common/util/iipdigit.h b/src/usr/diag/prdf/common/util/iipdigit.h
new file mode 100755
index 000000000..b81d2e1a9
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/iipdigit.h
@@ -0,0 +1,477 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/iipdigit.h $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 1993,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 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 IIPDIGIT_H
+#define IIPDIGIT_H
+
+/* Module Description *************************************************/
+/* */
+/* Name: iipdigit.h */
+/* */
+/* Description: This module provides the Digit String class
+ hierarchy definition. */
+/* */
+/* End Module Description *********************************************/
+
+/* Change Log *********************************************************/
+/* */
+/* Flag PTR/DCR# Userid Date Description */
+/* ---- -------- -------- -------- ----------- */
+/* JST 06/04/93 Initial Creation */
+/* D24694.3 JST 06/13/94 I1 Review changes */
+/* */
+/* End Change Log *****************************************************/
+
+/*--------------------------------------------------------------------*/
+/* Reference the virtual function tables and inline function
+ defintions in another translation unit. */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Includes */
+/*--------------------------------------------------------------------*/
+
+#include <prdf_types.h>
+
+/*--------------------------------------------------------------------*/
+/* Forward References */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* User Types */
+/*--------------------------------------------------------------------*/
+
+// Type Specification //////////////////////////////////////////////////
+//
+// Title: CPU_WORD
+//
+// Purpose: This type is used to take advantage of the most efficient
+// memory reference size for a specific CPU architecture.
+// This type defintion is provided only to handle the case
+// where no previous defintions exists.
+//
+// End Type Specification //////////////////////////////////////////////
+
+#ifndef CPU_WORD
+
+typedef uint32_t CPU_WORD;
+
+#endif
+
+/*--------------------------------------------------------------------*/
+/* Constants */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Macros */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Global Variables */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Function Prototypes */
+/*--------------------------------------------------------------------*/
+
+/* Class Specification ************************************************/
+/* */
+/* Name: DIGIT_STRING_CLASS */
+/* */
+/* Title: Digit String */
+/* */
+/* Purpose: DIGIT_STRING_CLASS provides the representation and
+ access to a sequence of digits in a specified range. */
+/* */
+/* Usage: This is an abstract base class. */
+/* */
+/* Side-effects: None. */
+/* */
+/* Dependencies: Access operations must specify position less than
+ the length. */
+/* */
+/* Notes: The Digit String maintains a sequence of digits in the
+ range of 0 to maximum_digit_value. If a value that is
+ being written is is larger than the maximum_digit_value,
+ then the digit is set to the maximum_digit_value. A
+ length of 0 is allowed, but no digits can be accessed. If
+ length is greater than 0, then the Digit positions are
+ specified 0 to (length - 1) from left to right.
+
+ 0 1 2 3 .... (length - 1)
+
+ D D D D .... D */
+/* */
+/* Cardinality: 0 */
+/* */
+/* Space Complexity: Constant */
+/* */
+/* End Class Specification ********************************************/
+
+class DIGIT_STRING_CLASS
+ {
+ public:
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: ~DIGIT_STRING_CLASS (Virtual destructor)
+ //
+ // Purpose: This function performs no special action.
+ //
+ // Side-effects: This instance is no longer valid.
+ //
+ // Dependencies: None.
+ //
+ // Notes: This function performs the same action as a default
+ // defintion. It is included because the virtual
+ // declaration is required for this base class.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ virtual ~DIGIT_STRING_CLASS
+ (
+ void
+ /*!i No paramters */
+ )
+ /*!o No value returned */
+ {
+ }
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Assingment operator
+ //
+ // Purpose: This function assigns the data members with the values
+ // from the Digit String reference.
+ //
+ // Side-effects: Data members are modified.
+ //
+ // Dependencies: None.
+ //
+ // Notes: This function performs the same action as a default
+ // defintion. It is included here to emphasize the actions
+ // performed and the need for an explicit definition in each
+ // derived class.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ DIGIT_STRING_CLASS & operator=
+ (
+ const DIGIT_STRING_CLASS & string
+ /*!i Digit string instance to assign from */
+ )
+ /*!o Reference to this Digit String instance */
+ {
+ // No check for assignment to self is required
+
+ maximum_digit_value = string.maximum_digit_value;
+ length = string.length;
+
+ return(*this);
+ }
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Get Value (Pure virtual)
+ //
+ // Purpose: This function returns the value of a digit at the
+ // specified position.
+ //
+ // Side-effects: None.
+ //
+ // Dependencies: Position must be in the string.
+ //
+ // Notes: This function has no definition.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ virtual uint32_t GetValue
+ (
+ uint32_t position
+ /*!i Digit position */
+ ) const = 0;
+ /*!o Digit value */
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Set Value (Pure virtual)
+ //
+ // Purpose: This function sets the value of the digit at the
+ // specified position. No other digits are affected.
+ //
+ // Side-effects: A digit in the string is modified.
+ //
+ // Dependencies: Position must be in the string.
+ //
+ // Notes: This function has no definition.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ virtual void SetValue
+ (
+ uint32_t position,
+ /*!i Digit position */
+ uint32_t value
+ /*!i Digit value to set */
+ ) = 0;
+ /*!o No value returned */
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Fill
+ //
+ // Purpose: This function sets the value of each digit in the
+ // string with the same specified value.
+ //
+ // Side-effects: All digits in the string is modified.
+ //
+ // Dependencies: None.
+ //
+ // Time Complexity: O(m) where m is the length
+ //
+ // End Function Specification //////////////////////////////////////
+
+ void Fill
+ (
+ uint32_t value
+ /*!i Digit value for each position */
+ );
+ /*!o No value returned */
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Equality operator
+ //
+ // Purpose: This function determines if the specified string is
+ // equal two this one. If the lengths are equal and the
+ // corresponding values at every position are equal, then
+ // the Digit strings are equal.
+ //
+ // Side-effects: None.
+ //
+ // Dependencies: None.
+ //
+ // Time Complexity: O(m) where m is the length
+ //
+ // End Function Specification //////////////////////////////////////
+
+ bool operator==
+ (
+ const DIGIT_STRING_CLASS & string
+ /*!i Digit string instance to compare */
+ ) const;
+ /*!o Non-zero if digit strings are equal, otherwise zero */
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Get Maximum Digit Value
+ //
+ // Purpose: This function returns the maximum digit value.
+ //
+ // Side-effects: None.
+ //
+ // Dependencies: None.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ uint32_t GetMaximumDigitValue
+ (
+ void
+ /*!i No parameters */
+ ) const
+ /*!o Maximum allowable digit value in the string */
+ {
+ return(maximum_digit_value);
+ }
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Get Length
+ //
+ // Purpose: This function returns the length.
+ //
+ // Side-effects: None.
+ //
+ // Dependencies: None.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ uint32_t GetLength
+ (
+ void
+ /*!i No parameters */
+ ) const
+ /*!o Digit string length */
+ {
+ return(length);
+ }
+
+ protected:
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: DIGIT_STRING_CLASS (Constructor)
+ //
+ // Purpose: This function initializes the data members.
+ //
+ // Side-effects: This instance is initialized.
+ //
+ // Dependencies: None.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ DIGIT_STRING_CLASS
+ (
+ uint32_t mdv,
+ /*!i Maximum digit value */
+ uint32_t le
+ /*!i Digit length */
+ ) :
+ /*!o No value returned */
+ maximum_digit_value(mdv),
+ length(le)
+ {
+ }
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: DIGIT_STRING_CLASS (Copy constructor)
+ //
+ // Purpose: This function initializes the data members from the
+ // Digit String reference.
+ //
+ // Side-effects: This instance is initialized.
+ //
+ // Dependencies: None.
+ //
+ // Notes: This function performs the same action as a default
+ // defintion. It is included here to emphasize the actions
+ // performed and the need for an explicit definition in each
+ // derived class.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ DIGIT_STRING_CLASS
+ (
+ const DIGIT_STRING_CLASS & string
+ /*!i Digit string reference to copy */
+ ) :
+ /*!o No value returned */
+ maximum_digit_value(string.maximum_digit_value),
+ length(string.length)
+ {
+ }
+
+ // Function Specification ///////////////////////////////////////////
+ //
+ // Title: Set String (Pure virtual)
+ //
+ // Purpose: This function performs any required representation
+ // actions.
+ //
+ // Side-effects: The Digit String is valid.
+ //
+ // Dependencies: This function must be called at least once prior
+ // to the first DIgit read or write.
+ //
+ // Notes: This function has no definition.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ virtual void SetString
+ (
+ void
+ /*!i No parameters */
+ ) = 0;
+ /*!o No value returned */
+
+ // Function Specification ///////////////////////////////////////////
+ //
+ // Title: Set String
+ //
+ // Purpose: This function assigns the data members and calls
+ // SetString() to perform any required representation
+ // actions.
+ //
+ // Side-effects: The Digit String is valid.
+ //
+ // Dependencies: None.
+ //
+ // End Function Specification //////////////////////////////////////
+
+ void SetString
+ (
+ uint32_t mdv,
+ /*!i Maximum digit value */
+ uint32_t le
+ /*!i Digit length */
+ )
+ /*!o No value returned */
+ {
+ maximum_digit_value = mdv;
+ length = le;
+
+ SetString();
+ }
+
+ // Function Specification //////////////////////////////////////////
+ //
+ // Title: Set Values
+ //
+ // Purpose: This function sets the values of the string at
+ // corresponding positions. If one of the Digit Strings
+ // is larger, than the extra digits are ignored. If a
+ // value from the string is larger than the
+ // maximum_digit_value, then the digit is set to the
+ // maximum_digit_value.
+ //
+ // Side-effects: Digits in string are modified.
+ //
+ // Dependencies: None.
+ //
+ // Time Complexity: O(m) where m is the length
+ //
+ // End Function Specification //////////////////////////////////////
+
+ virtual void SetValues
+ (
+ const DIGIT_STRING_CLASS & string
+ /*!i Reference to Digit string set set values from */
+ );
+ /*!o No value returned */
+
+ private:
+
+ // Data Specification //////////////////////////////////////////////
+ //
+ // Purpose: This data is used to maintain the Digit String.
+ //
+ // End Data Specification //////////////////////////////////////////
+
+ uint32_t maximum_digit_value;
+ uint32_t length;
+
+ };
+
+
+#endif
diff --git a/src/usr/diag/prdf/common/util/iipfltr.h b/src/usr/diag/prdf/common/util/iipfltr.h
new file mode 100755
index 000000000..182bd4ac4
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/iipfltr.h
@@ -0,0 +1,26 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/iipfltr.h $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 1993,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#if !defined(PRDFFILTER_H)
+#include <prdfFilters.H>
+#endif
diff --git a/src/usr/diag/prdf/common/util/prdfAssert.C b/src/usr/diag/prdf/common/util/prdfAssert.C
new file mode 100755
index 000000000..4762e11da
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfAssert.C
@@ -0,0 +1,103 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfAssert.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2004,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+//----------------------------------------------------------------------
+// Includes
+//----------------------------------------------------------------------
+
+#define prdfAssert_C
+
+#include <prdfAssert.h>
+#include <iipglobl.h>
+#include <stdlib.h>
+#include <errlentry.H>
+#include <prdf_service_codes.H>
+#include <prdfMain.H>
+
+#ifdef __HOSTBOOT_MODULE
+ #include <assert.h>
+ #include <stdio.h>
+#else
+ #include <perc.H>
+#endif
+
+#undef prdfAssert_C
+
+using namespace PRDF;
+
+//---------------------------------------------------------------------
+// Member Function Specifications
+//---------------------------------------------------------------------
+
+void prdfAssert( const char * i_exp, const char * i_file, int i_line )
+{
+ PRDF_ERR( "prdfAssert(%s) in %s line %d", i_exp, i_file, i_line );
+
+ errlHndl_t errl = NULL;
+
+ /*@
+ * @errortype
+ * @subsys EPUB_FIRMWARE_SP
+ * @reasoncode PRDF_CODE_FAIL
+ * @moduleid PRDF_ASSERT
+ * @userdata1 0
+ * @userdata2 Line number of the assert
+ * @userdata3 0
+ * @userdata4 PRD Return code
+ * @devdesc PRD assert
+ * @procedure EPUB_PRC_SP_CODE
+ */
+ PRDF_CREATE_ERRL(errl,
+ ERRL_SEV_PREDICTIVE, // error on diagnostic
+ ERRL_ETYPE_NOT_APPLICABLE,
+ SRCI_ERR_INFO,
+ SRCI_NO_ATTR,
+ PRDF_ASSERT, // module id
+ FSP_DEFAULT_REFCODE, // refcode
+ PRDF_CODE_FAIL, // Reason code
+ 0, // user data word 1
+ i_line, // user data word 2
+ 0, // user data word 3
+ PRD_ASSERT); // user data word 4
+
+ PRDF_ADD_PROCEDURE_CALLOUT(errl, SRCI_PRIORITY_MED, EPUB_PRC_SP_CODE);
+ PRDF_SET_RC(errl, PRD_ASSERT);
+ PRDF_COLLECT_TRACE(errl, 256);
+ PRDF_COMMIT_ERRL(errl, ERRL_ACTION_SA);
+
+ #ifdef __HOSTBOOT_MODULE
+
+ assert(0);
+
+ #else
+
+ const size_t sz_msg = 160;
+ char msg[sz_msg];
+ errlslen_t msize = snprintf( msg, sz_msg, "prdfAssert(%s) in %s line %d",
+ i_exp, i_file, i_line );
+
+ percAbend(PRDF_COMP_ID, msg, msize+1, 0, 0);
+ abort();
+
+ #endif
+}
diff --git a/src/usr/diag/prdf/common/util/prdfAssert.h b/src/usr/diag/prdf/common/util/prdfAssert.h
new file mode 100755
index 000000000..5e5b83e15
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfAssert.h
@@ -0,0 +1,41 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfAssert.h $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2004,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 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 PRDFASSERT_H
+#define PRDFASSERT_H
+
+/**
+ * @file prdfAssert.h
+ */
+
+#define PRDF_ASSERT(x) { if(!(x)) { prdfAssert(#x,__FILE__,__LINE__); } }
+
+/**
+ * @brief PRD implementation of assert().
+ * @param i_exp A boolean expression.
+ * @param i_file The file calling assert().
+ * @param i_line The line of the file in which assert() is called.
+ */
+void prdfAssert( const char * i_exp, const char * i_file, int i_line );
+
+#endif /* PRDFASSERT_H */
diff --git a/src/usr/diag/prdf/common/util/prdfBitKey.C b/src/usr/diag/prdf/common/util/prdfBitKey.C
new file mode 100755
index 000000000..0245d26b3
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfBitKey.C
@@ -0,0 +1,362 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfBitKey.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2004,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+//----------------------------------------------------------------------
+// Includes
+//----------------------------------------------------------------------
+#define prdfBitKey_C
+
+//#include <prdfAssert.h>
+#include <prdfBitKey.H>
+#include <prdfBitString.H>
+#include <string.h>
+
+#undef prdfBitKey_C
+
+//-------------------------------------------------------------------------------------------------
+// Local
+//-------------------------------------------------------------------------------------------------
+inline uint32_t getWordSize(uint32_t bitCount) // # of bit32's needed for this bit_count
+{
+ return (bitCount/32) + ((bitCount%32)? 1:0);
+}
+
+//-------------------------------------------------------------------------------------------------
+// member function definitions
+//-------------------------------------------------------------------------------------------------
+
+prdfBitKey::prdfBitKey(void)
+: iv_Capacity(0), iv_storage1(0)
+{
+ iv_rep.storage2 = 0;
+}
+
+//-------------------------------------------------------------------------------------------------
+
+prdfBitKey::prdfBitKey(uint32_t i_bitPos)
+: iv_Capacity(0), iv_storage1(0)
+{
+ iv_rep.storage2 = 0;
+ setBit(i_bitPos);
+}
+
+//-------------------------------------------------------------------------------------------------
+
+prdfBitKey::prdfBitKey(const uint8_t * i_array,uint8_t i_size)
+: iv_Capacity(0), iv_storage1(0)
+{
+ iv_rep.storage2 = 0;
+ while(i_size)
+ {
+ setBit(*i_array);
+ --i_size;
+ ++i_array;
+ }
+}
+
+//-------------------------------------------------------------------------------------------------
+
+prdfBitKey::prdfBitKey(const char * i_ble)
+: iv_Capacity(0), iv_storage1(0)
+{
+ iv_rep.storage2 = 0;
+ while(*i_ble != 0)
+ {
+ setBit((*i_ble) - 1);
+ ++i_ble;
+ }
+}
+
+//-------------------------------------------------------------------------------------------------
+
+prdfBitKey::~prdfBitKey(void)
+{
+ if(!IsDirect()) delete [] iv_rep.buffer;
+}
+
+//-------------------------------------------------------------------------------------------------
+
+prdfBitKey::prdfBitKey (const prdfBitKey & bit_list)
+: iv_Capacity(bit_list.iv_Capacity), iv_storage1(bit_list.iv_storage1)
+{
+ if(IsDirect())
+ {
+ iv_rep.storage2 = bit_list.iv_rep.storage2;
+ }
+ else
+ {
+ uint32_t size = getWordSize(iv_Capacity);
+ iv_rep.buffer = new uint32_t[size];
+ memcpy(iv_rep.buffer,bit_list.iv_rep.buffer,4*size);
+ }
+}
+
+//-------------------------------------------------------------------------------------------------
+
+prdfBitKey & prdfBitKey::operator=(const prdfBitKey & bit_list)
+{
+ if(iv_Capacity)
+ {
+ prdfBitString bs(iv_Capacity,DataPtr());
+ bs.Pattern(0x00000000);
+ }
+ ReAllocate(bit_list.iv_Capacity);
+ if(IsDirect()) // implies bit_list is also direct
+ {
+ iv_storage1 = bit_list.iv_storage1;
+ iv_rep.storage2 = bit_list.iv_rep.storage2;
+ }
+ else
+ {
+ const uint32_t * dataPtr = NULL;
+ if(bit_list.IsDirect())
+ {
+ dataPtr = &bit_list.iv_storage1;
+ } else
+ {
+ dataPtr = bit_list.iv_rep.buffer;
+ }
+ memcpy(iv_rep.buffer,dataPtr,4*getWordSize(bit_list.iv_Capacity));
+ }
+ return(*this);
+}
+
+//-------------------------------------------------------------------------------------------------
+
+prdfBitKey & prdfBitKey::operator=(const prdfBitString & bit_string)
+{
+ if(iv_Capacity)
+ {
+ prdfBitString bs(iv_Capacity,DataPtr());
+ bs.Pattern(0x00000000);
+ }
+ ReAllocate(bit_string.GetLength());
+ prdfBitString dbs(iv_Capacity,DataPtr());
+ dbs.SetBits(bit_string);
+ return(*this);
+}
+
+//-------------------------------------------------------------------------------------------------
+
+prdfBitKey & prdfBitKey::operator=(const char * string_ptr)
+{
+ if(iv_Capacity)
+ {
+ prdfBitString bs(iv_Capacity,DataPtr());
+ bs.Pattern(0x00000000);
+ }
+
+ while(*string_ptr != '\0')
+ {
+ uint32_t bit_position = (uint32_t) ((*string_ptr) - 1);
+ setBit(bit_position);
+ ++string_ptr;
+ }
+ return(*this);
+}
+
+//-------------------------------------------------------------------------------------------------
+
+bool prdfBitKey::operator==(const prdfBitKey & that) const
+{
+ bool result = true;
+ const uint32_t * mydata = cDataPtr();
+ const uint32_t * yodata = that.cDataPtr();
+ uint32_t mysize = getWordSize(iv_Capacity);
+ uint32_t yosize = getWordSize(that.iv_Capacity);
+ uint32_t smsize = (yosize < mysize)? yosize : mysize;
+
+ // If size is different than the extra must be zero
+ for(uint32_t i = 0; (i < smsize) && (result == true); ++i,++mydata,++yodata)
+ {
+ result = (*mydata == *yodata);
+ }
+ if(result && (yosize > mysize))
+ {
+ for(yosize -= mysize; yosize != 0 && result; --yosize, ++yodata)
+ {
+ result = *yodata == 0x00000000;
+ }
+ }
+ else if (result && (mysize > yosize))
+ {
+ for(mysize -= yosize; mysize != 0 && result; --mysize, ++mydata)
+ {
+ result = *mydata == 0x00000000;
+ }
+ }
+
+ return result;
+}
+
+
+//-------------------------------------------------------------------------------------------------
+
+// Candidate funciton for bs class
+bool prdfBitKey::isSubset(const prdfBitKey & that) const
+{
+ bool result = true;
+ const uint32_t * mydata = cDataPtr();
+ const uint32_t * yodata = that.cDataPtr();
+ uint32_t mysize = getWordSize(iv_Capacity);
+ uint32_t yosize = getWordSize(that.iv_Capacity);
+ uint32_t smsize = (yosize < mysize)? yosize : mysize;
+ // size can be non-zero with no bits on - so if that has no bits than use operator==
+ prdfBitKey zero;
+ if(that == zero) result = operator==(that); // only true if both are empty - eg not bits on"
+ // if yosize <= mysize than just match smallest amount of data
+ // if yozize > mysize than extra yodata must be zero
+ for(uint32_t i = 0; (i < smsize) && (result == true); ++i,++mydata,++yodata)
+ {
+ result = (*mydata & *yodata) == *yodata;
+ }
+ if(result && (yosize > mysize))
+ {
+ for(yosize -= mysize; yosize != 0 && result; --yosize, ++yodata)
+ {
+ result = *yodata == 0x00000000;
+ }
+ }
+
+ return result;
+}
+
+//-------------------------------------------------------------------------------------------------
+
+// get bit position of nth bit that is set
+uint32_t prdfBitKey::getListValue(uint32_t n) const
+{
+ ++n;
+ uint32_t setCount = 0;
+ uint32_t bitPos = 0xffffffff;
+
+ prdfBitString bs(iv_Capacity,(CPU_WORD *)cDataPtr());
+ for(uint32_t i = 0; i < iv_Capacity; ++i)
+ {
+ if(bs.IsSet(i)) ++setCount;
+ if(setCount == n)
+ {
+ bitPos = i;
+ break;
+ }
+ }
+ return bitPos;
+}
+
+//-------------------------------------------------------------------------------------------------
+
+uint32_t prdfBitKey::size(void) const
+{
+ const prdfBitString bs(iv_Capacity,(CPU_WORD *)cDataPtr());
+ return bs.GetSetCount();
+}
+
+//-------------------------------------------------------------------------------------------------
+
+void prdfBitKey::removeBit(uint32_t n)
+{
+ if(n < size())
+ {
+ prdfBitString bs(iv_Capacity,DataPtr());
+ bs.Clear(getListValue(n));
+ }
+}
+
+//-------------------------------------------------------------------------------------------------
+
+void prdfBitKey::removeBit(void)
+{
+ prdfBitString bs(iv_Capacity,DataPtr());
+ uint32_t i = iv_Capacity;
+ while(i != 0)
+ {
+ --i;
+ if(bs.IsSet(i))
+ {
+ bs.Clear(i);
+ break;
+ }
+ }
+}
+
+//-------------------------------------------------------------------------------------------------
+
+void prdfBitKey::removeBits(const prdfBitKey & i_bk)
+{
+ prdfBitString mybs(iv_Capacity,(CPU_WORD *)DataPtr());
+ const prdfBitString yobs(i_bk.iv_Capacity,(CPU_WORD *)i_bk.cDataPtr());
+ mybs.Mask(yobs);
+}
+
+//-------------------------------------------------------------------------------------------------
+
+void prdfBitKey::setBit(uint32_t i_bitValue)
+{
+ if(i_bitValue >= iv_Capacity)
+ {
+ ReAllocate(i_bitValue+1);
+ }
+ prdfBitString bs(iv_Capacity,DataPtr());
+ bs.Set(i_bitValue);
+}
+
+//-------------------------------------------------------------------------------------------------
+
+void prdfBitKey::ReAllocate(uint32_t i_len)
+{
+ if(i_len > iv_Capacity) // never shrink
+ {
+ bool wasDirect = IsDirect();
+ uint32_t oldSize = iv_Capacity;
+ uint32_t * oldPtr = DataPtr();
+
+ uint32_t wordsize = getWordSize(i_len);
+ iv_Capacity = 32*wordsize;
+
+ bool isDirect = IsDirect();
+
+ if(!isDirect) // to indirect
+ {
+ uint32_t * newBuffer = new uint32_t[wordsize];
+ prdfBitString dbs(iv_Capacity,newBuffer);
+ dbs.Pattern(0x00000000);
+ prdfBitString sbs(oldSize,oldPtr);
+ dbs.SetBits(sbs);
+ iv_storage1 = 0;
+ if(!wasDirect) // from indirect
+ {
+ delete [] iv_rep.buffer;
+ }
+ iv_rep.buffer = newBuffer;
+ }
+ }
+}
+
+
+// Change Log *************************************************************************************
+//
+// Flag Reason Vers Date Coder Description
+// ---- -------- ---- -------- -------- ---------------------------------------------------------
+// dgilbert Initial Creation
+//
+// End Change Log *********************************************************************************
diff --git a/src/usr/diag/prdf/common/util/prdfBitKey.H b/src/usr/diag/prdf/common/util/prdfBitKey.H
new file mode 100755
index 000000000..de2f4b8e9
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfBitKey.H
@@ -0,0 +1,301 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfBitKey.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2004,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+/*! /file prdfBitKey.H
+ * /brief prdfBitKey class Declairation
+ *
+ */
+#ifndef PRDFBITLKEY_H
+#define PRDFBITLKEY_H
+
+#include <prdf_types.h>
+
+/*--------------------------------------------------------------------*/
+/* Forward References */
+/*--------------------------------------------------------------------*/
+
+class prdfBitString;
+
+//! prdfBitKey
+/*!
+ prdfBitKey provides the representation of bit positions that are
+ set ('1') In a string of bits. It has the same iterface as the prdfBitList or BIT_LIST_CLASS.
+
+\remarks The object this class creates is meant to be used as a key in a map or table and
+ as such represents the "typical" key as efficiently as possible. It can,
+ however, represent large lists without penalizing the size of all the
+ keys in a map or table. This implementation assumes the standard bit string capacity
+ is 64 bits, but supports sized up to 2^32 bits. The size of the object is always 12 bytes.
+
+\notes
+ This class is a replacement of a BitListClass which is meant be viewed as a list of bit positions,
+ though BitKey is not implemented that way internally. The following shows how a BitString and a
+ BitList represent that same bit string. (ie BitString == BitList)
+\verbatim
+ BitString representation -> '001011001'b
+ BitList representation -> {2,4,5,8}
+ BitList.getListValue(0) returns 2;
+ BitList.getListValue(1) returns 4;
+ BitList.getListValue(3) returns 5; etc
+ BitList.getListValue(n) returns the bit position of the nth bit that is set
+\endverbatim
+
+ The setBit() and/or assignment operators are used to place
+ values (bit positions) in the list. Values can be assigned directly from
+ Bit String bit positions (0 to n from left to right). The
+ maximum value (bit position) that can be stored in BitKey is 2^32.
+\verbatim
+
+ 0 1 2 3 .... n
+
+ B B B B .... B
+\endverbatim
+
+ The assingment operator is overloaded to provide setting
+ the bit positions form a NULL terminated character
+ string. Since the string is NULL terminated with 0 and
+ this a valid bit position, each character value is
+ converted to an unsigned character and decremented to
+ obtain the actual bit position. The character string
+ assignment is limited to the maximum bit position (254)
+ that can be represented. As an example, the following
+ are equivalent Bit Lists.
+
+ Bit String: 10010001
+ Character String: "\x01\x04\x08"
+
+ The equality operator and isSubset() function are used to
+ compare Bit Lists. An empty Bit List can be
+ represented and two empty Bit Lists are considered equal.
+
+\par Space Complexity: Linear.
+ K + Mn where K and M are constants and n is the
+ number of bit psotions in the list
+
+\sa prdfBitString
+*/
+class prdfBitKey
+ {
+ public:
+
+ //! Default Constructor
+ /*!
+ This function initializes the string to NULL (empty bit list)
+ */
+ prdfBitKey(void);
+
+ //! Constructor
+ /*!
+ This function initializes the bit list with one value;
+ */
+ prdfBitKey(uint32_t i_bitPos);
+
+ //! Constructor
+ /*!
+ This function initializes an bit list from an array of uint8_t
+ \param i_array ptr to array of bit list values
+ \param i_size size of the array
+ */
+ prdfBitKey(const uint8_t * i_array,uint8_t i_size);
+
+ /*!
+ Constructor - from a bit list encoding
+ \param i_ble ptr to Bit list encoding
+ */
+ prdfBitKey(const char * i_ble);
+
+ //! Copy Constructor
+ prdfBitKey (const prdfBitKey & bit_list);
+
+ //! Destructor
+ ~prdfBitKey(void);
+
+ //! Assignment operator from prdfBitKey
+ /*!
+ \post *this == bit_list
+ */
+ prdfBitKey & operator=(const prdfBitKey & bit_list);
+
+ //! Assignment operator from prdfBitString
+ /*!
+ This function assigns the specified Bit String bit
+ positions to this Bit List. Bit positions are set
+ from left to right.
+ */
+ prdfBitKey & operator=(const prdfBitString & bit_string);
+
+ //! Assignment operator from c string (char *)
+ /*!
+ This function assigns the specified pointer to
+ character string representation of a Bit List to this
+ Bit List. Since the string is NULL terminated with 0
+ and thus a valid bit position, each character value is
+ decremented to obtain the actual bit position.
+ */
+ prdfBitKey & operator=(const char * string_ptr);
+
+ //! Equality operator
+ /*!
+ This function determines if the specified Bit List
+ is equal to this Bit List. The associated string
+ representations are tested for equality. The lists
+ must have the same length and corresponding bit
+ positions. If both Bit Lists are empty, they are
+ considered equal.
+ */
+ bool operator==(const prdfBitKey & bit_list) const;
+
+ //! Is Subset
+ /*!
+ This function determines if the specified Bit List
+ is a subset of this Bit List. If this Bit List
+ contains every bit position that is contained in the
+ specified Bit List, then it is a subset.
+
+ \verbatim
+ Examples:
+ ("1") IS a subset of ("1", "5", "31");
+ ("1") IS NOT a subset of ("5", "31");
+ ("2", "7") IS NOT a subset of ("2", "5", "31");
+ ("2", "7") IS a subset of ("2", "7", "31");
+ An empty list is a subset of an empty list.
+ An empty list is NOT a subset of a non-empty list
+ A non-empty list is NOT as subset of an empty list
+ \endverbatim
+ */
+ bool isSubset(const prdfBitKey & bit_list) const;
+
+ //! Get Bit List Value
+ /*!
+ This function returns the bit position of the nth bit that is set
+ \pre bit_list_offset < size(), size() > 0
+ \post None.
+ */
+ uint32_t getListValue(uint32_t n) const;
+
+ //! Get Bit List Length
+ /*!
+ \return the # of bits set (Length of list of set bits positions)
+ \pre None.
+ \post None.
+ */
+ uint32_t size(void) const ;
+
+ /*!
+ This function removes the nth set bit from the Bit List.
+
+ \pre bit_list_offset < size()
+ */
+ void removeBit(uint32_t n);
+
+ /*!
+ Remove the highest bitpos that is set
+ \pre none
+ \post none
+ \ if this is already empty then nothing happens
+ */
+ void removeBit(void);
+
+ /*!
+ Remove the bit positions from this list specified in the paramter list
+ \pre none
+ \post bit list may be modified
+ */
+ void removeBits(const prdfBitKey & i_bk);
+
+
+ /*!
+ Add a bit to the bit position List
+ */
+ void setBit(uint32_t i_bitValue);
+
+ private: // DATA
+
+ uint32_t iv_Capacity;
+ uint32_t iv_storage1;
+ /*!
+ \union REPRESENTATION_UNION
+ Representation stored in representaion.value when IsDirect() == true
+ otherwise additional storage allocated and pointed to by buffer
+ */
+ union REPRESENTATION_UNION
+ {
+ uint32_t storage2;
+ uint32_t * buffer;
+ } iv_rep;
+
+
+
+ enum
+ {
+ REPRESENTATION_BIT_POSTION_COUNT = 64
+ };
+
+ private: // Functions
+ //! Is Direct
+ /*!
+ This function indicates if the direct representation can be used.
+ */
+ bool IsDirect(void) const
+ {
+ return( iv_Capacity <= REPRESENTATION_BIT_POSTION_COUNT);
+ }
+
+ //! Set String
+ /*!
+ This function allocates storage for keys bigger keys (IsDirect() == false)
+ \return number of uint32_t words allocated
+ \post
+ If the string is NULL, then it is allocated.
+ If the string length is not equal to the specified
+ length, then the string is re-allocated.
+ */
+ void ReAllocate(uint32_t bit_pos);
+
+ uint32_t * DataPtr(void)
+ {
+ uint32_t * ptr = NULL;
+ if(IsDirect()) ptr = &iv_storage1;
+ else ptr = iv_rep.buffer;
+ return ptr;
+ }
+
+ const uint32_t * cDataPtr(void) const
+ {
+ const uint32_t * ptr = NULL;
+ if(IsDirect()) ptr = &iv_storage1;
+ else ptr = iv_rep.buffer;
+ return ptr;
+ }
+
+ };
+
+#endif
+
+// Change Log *************************************************************************************
+//
+// Flag Reason Vers Date Coder Description
+// ---- -------- ---- -------- -------- ---------------------------------------------------------
+// dgilbert Initial Creation
+//
+// End Change Log *********************************************************************************
diff --git a/src/usr/diag/prdf/common/util/prdfBitString.C b/src/usr/diag/prdf/common/util/prdfBitString.C
new file mode 100755
index 000000000..bc9fa8907
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfBitString.C
@@ -0,0 +1,899 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfBitString.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2004,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+/** @file prdfBitString.C
+ * @brief prdfBitString and prdfBitStringBuffer class Definitions
+ */
+
+/*--------------------------------------------------------------------*/
+/* Includes */
+/*--------------------------------------------------------------------*/
+
+#define PRDFBITSTRING_CPP
+
+#include <prdfBitString.H>
+
+#undef PRDFBITSTRING_CPP
+
+#include <algorithm>
+
+/*--------------------------------------------------------------------*/
+/* User Types */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Constants */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Macros */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Internal Function Prototypes */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Global Variables */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Static Variables */
+/*--------------------------------------------------------------------*/
+
+
+prdfBitString::~prdfBitString(void)
+{
+}
+
+// ------------------------------------------------------------------------------------------------
+
+uint32_t prdfBitString::GetSetCount(uint32_t bit_position,
+ uint32_t leng
+ ) const
+{
+ uint32_t end_position = bit_position + leng;
+
+ PRDF_ASSERT(end_position <= ivLength);
+
+ uint32_t count = 0;
+
+ while(bit_position < end_position)
+ {
+ if(IsSet(bit_position))
+ {
+ count++;
+ }
+
+ bit_position++;
+ }
+
+ return(count);
+}
+
+// ------------------------------------------------------------------------------------------------
+
+CPU_WORD prdfBitString::GetField
+(
+ uint32_t iBitPos,
+ uint32_t iLen
+ ) const
+{
+ PRDF_ASSERT((iBitPos + iLen) <= ivLength);
+ PRDF_ASSERT(iLen <= WORD_BIT_LENGTH);
+ CPU_WORD value = 0; //dg02a
+ if(GetMemoryAddress() != NULL) //dg02a
+ { //dg02a
+ CPU_WORD * address = GetRelativePosition(iBitPos,iBitPos);
+ value = *address << iBitPos;
+
+ if(iBitPos + iLen > WORD_BIT_LENGTH) // we need the rest of the value
+ {
+ ++address;
+ value |= *address >> (WORD_BIT_LENGTH - iBitPos);
+ }
+ if(iLen < WORD_BIT_LENGTH) // GNUC does not handle shift overflow as expected
+ { // zero bits outside desired field
+ value &= ((((CPU_WORD) 1) << iLen) - 1) << (WORD_BIT_LENGTH - iLen);
+ }
+ } //dg02a
+
+ return(value);
+}
+
+// ------------------------------------------------------------------------------------------------
+
+CPU_WORD prdfBitString::GetFieldJustify
+(
+ uint32_t bit_position,
+ uint32_t length
+ ) const
+{
+ CPU_WORD value = GetField(bit_position, length);
+
+ value = RIGHT_SHIFT(length, value);
+
+ return(value);
+}
+
+// ------------------------------------------------------------------------------------------------
+
+void prdfBitString::SetField
+(
+ uint32_t bit_position,
+ uint32_t iLen,
+ CPU_WORD value
+ )
+{
+ PRDF_ASSERT((bit_position + iLen) <= ivLength);
+ PRDF_ASSERT(iLen <= WORD_BIT_LENGTH);
+
+ if(ivBuffer != NULL || value != 0) //dg02a
+ { //dg02a
+ CPU_WORD * address = GetRelativePositionAlloc(bit_position,bit_position); // dg02c
+ CPU_WORD mask = (CPU_WORD) -1;
+
+ mask <<= (WORD_BIT_LENGTH - iLen);
+
+ value &= mask;
+
+ *address &= ~(mask >> bit_position); // clear field
+ *address |= value >> bit_position; // set field
+
+ if(bit_position + iLen > WORD_BIT_LENGTH) // we overflowed into the next CPU_WORD
+ {
+ address++;
+ *address &= ~(mask << (WORD_BIT_LENGTH - bit_position));
+ *address |= (value << (WORD_BIT_LENGTH - bit_position));
+ }
+ } //dg02a
+}
+
+// ------------------------------------------------------------------------------------------------
+
+void prdfBitString::SetFieldJustify
+(
+ uint32_t bit_position,
+ uint32_t length,
+ CPU_WORD value
+ )
+{
+ value = LEFT_SHIFT(length, value);
+
+ SetField(bit_position, length, value);
+}
+
+// ------------------------------------------------------------------------------------------------
+
+void prdfBitString::SetBits
+(
+ const prdfBitString & string, // source string
+ unsigned int iPos, // source start pos
+ unsigned int iLen, // length
+ unsigned int iDpos // dest start pos
+ )
+{
+ const prdfBitString * source = &string;
+ bool copyforward = true;
+
+ // How Much to really move
+ iLen = std::min(iLen,string.GetLength() - iPos);
+ iLen = std::min(iLen,GetLength() - iDpos);
+
+ // copy the right direction to prevent overlapping
+ uint32_t sRelativeOffset = 0;
+ uint32_t dRelativeOffset = 0;
+ CPU_WORD * sourceAddress = NULL; //dg02a
+ CPU_WORD * destAddress = NULL; //dg02a
+ if(string.GetMemoryAddress() != NULL) //dg02a
+ { //dg02a
+ sourceAddress = string.GetRelativePosition(sRelativeOffset,iPos);
+ } // else assume source is all zeros dg02a
+ if(GetMemoryAddress() != NULL) //dg02a
+ { //dg02a
+ destAddress = GetRelativePosition(dRelativeOffset,iDpos);
+ } //dg02a
+ if((sourceAddress < destAddress) ||
+ ((sourceAddress == destAddress) && (sRelativeOffset < dRelativeOffset)))
+ {
+ copyforward = false;
+ }
+ // else copyforward
+
+ if(copyforward)
+ {
+ while(iLen)
+ {
+ uint32_t len = std::min(iLen,(uint32_t)WORD_BIT_LENGTH);
+ CPU_WORD value = string.GetField(iPos,len);
+ SetField(iDpos,len,value);
+ iLen -= len;
+ iPos += len;
+ iDpos += len;
+ }
+ } else
+ {
+ iPos += iLen;
+ iDpos += iLen;
+ while(iLen)
+ {
+ uint32_t len = std::min(iLen,(uint32_t)WORD_BIT_LENGTH);
+ iPos -= len;
+ iDpos -= len;
+ CPU_WORD value = source->GetField(iPos,len);
+ SetField(iDpos,len,value);
+ iLen -= len;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+
+// Function Specification //////////////////////////////////////////
+//
+// Title: Pattern
+//
+// Purpose: This function sets the the specified bits with the
+// specifed pattern. The number of bits sets is
+// specified by the length and begins at the specified
+// offest. The pattern is repeated as often as necessary
+// as specified by the pattern_bit_length.
+//
+// Side-effects: Bit String may be modified.
+//
+// Dependencies: Parameters must specifiy valid bits in both the
+// bit string and the pattern.
+//
+// Time Complexity: O(m) where m is the number of bits to modify
+// (paramter l)
+//
+// Examples: o(0), l(10), pattern(0xA), pattern_bit_length(4)
+// Old String: 0000000000
+// New String: 1010101010
+//
+// o(3), l(4), pattern(0x3), pattern_bit_length(3)
+// Old String: 0001001000
+// New String: 0000110000
+//
+// End Function Specification //////////////////////////////////////
+
+void prdfBitString::Pattern
+(
+ uint32_t o,
+ uint32_t l,
+ CPU_WORD pattern,
+ uint32_t pattern_bit_length
+ )
+{
+ PRDF_ASSERT(((o + l) <= ivLength) &&
+ (pattern_bit_length <= WORD_BIT_LENGTH));
+
+ uint32_t current_offset;
+
+ // current_offset = offset + o;
+ current_offset = o;
+ while(true)
+ {
+ if(l > pattern_bit_length)
+ {
+ /* Set values using full CPU_WORDs */
+ SetField(current_offset, pattern_bit_length, pattern);
+ l -= pattern_bit_length;
+ current_offset += pattern_bit_length;
+ }
+ else
+ {
+ /* Set value in remainder of last CPU_WORD */
+ SetField(current_offset, l, pattern);
+ break;
+ }
+ }
+}
+
+// Function Specification //////////////////////////////////////////
+//
+// Title: Is Set
+//
+// Purpose: This function determines if the specified bit position
+// in the string is set(1).
+//
+// Side-effects: None.
+//
+// Dependencies: bit_position must be in the string
+//
+// End Function Specification //////////////////////////////////////
+
+bool prdfBitString::IsSet
+(
+ uint32_t bit_position
+ ) const
+{
+ return (GetField(bit_position,1) != 0);
+}
+
+// Function Specification //////////////////////////////////////////////
+//
+// Title: Set
+//
+// Purpose: This function sets(1) the specified bit position in
+// the string.
+//
+// Side-effects: Bit String may be modified.
+//
+// Dependencies: bit_position must be in the string
+//
+// End Function Specification //////////////////////////////////////////
+
+void prdfBitString::Set
+(
+ uint32_t bit_position
+ )
+{
+ SetField(bit_position,1,(CPU_WORD)-1);
+}
+
+// Function Specification //////////////////////////////////////////////
+//
+// Title: Clear
+//
+// Purpose: This function clears(0) the specified bit position in
+// the string.
+//
+// Side-effects: Bit String may be modified.
+//
+// Dependencies: bit_position must be in the string
+//
+// End Function Specification //////////////////////////////////////////
+
+void prdfBitString::Clear
+(
+ uint32_t bit_position
+ )
+{
+ SetField(bit_position,1,0);
+}
+
+// Function Specification //////////////////////////////////////////
+//
+// Title: Is Equal
+//
+// Purpose: This function compares the values of the Bit String
+// memory for each bit position in the string. If the
+// Bit String lengths do not match, then the Bit Strings
+// are not equal.
+//
+// Side-effects: None.
+//
+// Dependencies: None.
+//
+// Time Complexity: O(m) where m is the length
+//
+// End Function Specification //////////////////////////////////////
+
+bool prdfBitString::IsEqual
+(
+ const prdfBitString& string
+ ) const
+{
+ uint32_t o;
+ uint32_t l;
+
+ bool equal = false;
+
+ if(ivLength == string.ivLength)
+ {
+ o = 0;
+ l = ivLength;
+ while(true)
+ {
+ if(l < WORD_BIT_LENGTH)
+ {
+ equal = (GetField(o, l) == string.GetField(o, l));
+ break;
+ }
+
+ if(!(equal = (GetField(o, WORD_BIT_LENGTH) ==
+ string.GetField(o, WORD_BIT_LENGTH))))
+ {
+ break;
+ }
+
+ o += WORD_BIT_LENGTH;
+ l -= WORD_BIT_LENGTH;
+ }
+ }
+
+ return(equal);
+}
+
+// Function Specification //////////////////////////////////////////
+//
+// Title: Is Zero
+//
+// Purpose: This function compares the values of the Bit String
+// with zero.
+//
+// Side-effects: None.
+//
+// Dependencies: None.
+//
+// Time Complexity: O(m) where m is the length
+//
+// End Function Specification //////////////////////////////////////
+
+bool prdfBitString::IsZero(void) const
+{
+ uint32_t o = 0;
+ uint32_t l = ivLength;
+
+ bool zero;
+
+ while(true)
+ {
+ if(l < WORD_BIT_LENGTH)
+ {
+ zero = (GetField(o, l) == 0);
+ break;
+ }
+
+ if(!(zero = (GetField(o, WORD_BIT_LENGTH) == 0)))
+ {
+ break;
+ }
+
+ o += WORD_BIT_LENGTH;
+ l -= WORD_BIT_LENGTH;
+ }
+
+ return(zero);
+}
+
+// Function Specification //////////////////////////////////////////
+//
+// Title: Mask
+//
+// Purpose: This function masks the bits in the string with the
+// corresponding bits in the specified Bit String. For
+// each corresponding position, if the bit in the
+// parameter Bit String is set(1), the bit in this string
+// is cleared(0). If the length of the parameter string
+// is greater than the length of this string, then the
+// extra bits are ignored. If the length of the
+// parameter string are less than this the length of
+// this string, then the extra bits in this string are
+// not modified.
+//
+// Side-effects: Bit String may be modified.
+//
+// Dependencies: None.
+//
+// Time Complexity: O(m) where m is the length
+//
+// Examples: Paramter String: 1001
+// Old String: 1100
+// New String: 0100
+//
+// Paramter String: 100111
+// Old String: 1100
+// New String: 0100
+//
+// Paramter String: 1001
+// Old String: 110001
+// New String: 010001
+//
+// End Function Specification //////////////////////////////////////
+
+void prdfBitString::Mask
+(
+ const prdfBitString & string
+ )
+{
+ CPU_WORD value, string_value;
+ uint32_t current_offset;
+ uint32_t l;
+
+ /* Use smaller length */
+ l = std::min(ivLength, string.ivLength);
+
+ current_offset = 0;
+ while(true)
+ {
+ if(l > WORD_BIT_LENGTH)
+ {
+ /* Set values using full CPU_WORDs */
+ value = GetField(current_offset, WORD_BIT_LENGTH);
+ string_value = string.GetField(current_offset, WORD_BIT_LENGTH);
+ SetField(current_offset, WORD_BIT_LENGTH,
+ value & (~string_value));
+ l -= WORD_BIT_LENGTH;
+ current_offset += WORD_BIT_LENGTH;
+ }
+ else
+ {
+ /* Set value in remainder of last CPU_WORD */
+ value = GetField(current_offset, l);
+ string_value = string.GetField(current_offset, l);
+ SetField(current_offset, l, value & (~string_value));
+ break;
+ }
+ }
+}
+
+//-------------------------------------------------------------------------------------------------
+
+CPU_WORD * prdfBitString::GetRelativePosition(uint32_t & oBitOffset, uint32_t iBitPos) const
+{
+ PRDF_ASSERT(ivBuffer != NULL);
+ oBitOffset = iBitPos % WORD_BIT_LENGTH;
+ return ivBuffer + (iBitPos/WORD_BIT_LENGTH);
+}
+
+//-------------------------------------------------------------------------------------------------
+// dg02a - start
+CPU_WORD * prdfBitStringBuffer::GetRelativePositionAlloc(uint32_t & oBitOffset, uint32_t iBitPos)
+{
+ // The non-constant version of GetRelativePostion
+ if(GetMemoryAddress() == NULL) SetBuffer(); // alocate memory
+ return GetRelativePosition(oBitOffset, iBitPos);
+}
+// dg02a - end
+//-------------------------------------------------------------------------------------------------
+
+CPU_WORD * prdfBitStringOffset::GetRelativePosition(uint32_t & oBitOffset, uint32_t iBitPos) const
+{
+ iBitPos += ivOffset;
+ return prdfBitString::GetRelativePosition(oBitOffset,iBitPos);
+}
+
+//dg04a -start
+CPU_WORD * prdfBitStringOffset::GetRelativePositionAlloc(uint32_t & oBitOffset, uint32_t iBitPos)
+{
+ iBitPos += ivOffset;
+ return prdfBitString::GetRelativePosition(oBitOffset, iBitPos);
+}
+//dg04a - end
+
+//-------------------------------------------------------------------------------------------------
+
+prdfBitStringOffset::~prdfBitStringOffset(void) {}
+
+//-------------------------------------------------------------------------------------------------
+
+prdfBitStringOffset & prdfBitStringOffset::operator=(const prdfBitStringOffset & i_bs)
+{
+ prdfBitString::operator=(i_bs);
+ ivOffset = i_bs.ivOffset;
+ return *this;
+}
+
+//-------------------------------------------------------------------------------------------------
+
+prdfBitStringOffset & prdfBitStringOffset::operator=(const prdfBitString & i_bs)
+{
+ prdfBitString::operator=(i_bs);
+ ivOffset = 0;
+ return *this;
+}
+
+// Function Specification //////////////////////////////////////////
+//
+// Title: Do a bitwise NOT of the bitstring
+//
+// Purpose: This function returns the NOT'd value of the bitstring.
+//
+// Side-effects: None.
+//
+// Dependencies: None.
+//
+// Time Complexity: O(m) where m is the length of Bit String
+//
+// End Function Specification //////////////////////////////////////
+
+prdfBitStringBuffer operator~(const prdfBitString & bs)
+{
+ prdfBitStringBuffer bsb(bs);
+ for(uint32_t pos = 0; pos < bsb.GetLength(); pos += prdfBitString::WORD_BIT_LENGTH)
+ {
+ uint32_t len = bsb.GetLength() - pos;
+ len = std::min(len,(uint32_t)prdfBitString::WORD_BIT_LENGTH);
+ CPU_WORD value = ~(bsb.GetField(pos,len));
+ bsb.SetField(pos,len,value);
+ }
+
+ return bsb;
+}
+
+//-------------------------------------------------------------------------------------------------
+
+prdfBitStringBuffer prdfBitString::operator&(const prdfBitString & bs) const
+{
+ prdfBitStringBuffer bsb(std::min(this->GetLength(), bs.GetLength()));
+ for(uint32_t pos = 0;
+ pos < std::min(this->GetLength(), bs.GetLength());
+ pos += prdfBitString::WORD_BIT_LENGTH)
+ {
+ uint32_t len = std::min(this->GetLength(), bs.GetLength()) - pos;
+ len = std::min(len,(uint32_t)prdfBitStringBuffer::WORD_BIT_LENGTH);
+ CPU_WORD value = this->GetField(pos,len) & bs.GetField(pos,len);
+ bsb.SetField(pos,len,value);
+ }
+
+ return bsb;
+}
+
+//-------------------------------------------------------------------------------------------------
+
+prdfBitStringBuffer prdfBitString::operator|(const prdfBitString & bs) const
+{
+ prdfBitStringBuffer bsb(std::min(this->GetLength(), bs.GetLength()));
+ for(uint32_t pos = 0;
+ pos < std::min(this->GetLength(), bs.GetLength());
+ pos += prdfBitString::WORD_BIT_LENGTH)
+ {
+ uint32_t len = std::min(this->GetLength(), bs.GetLength()) - pos;
+ len = std::min(len,(uint32_t)prdfBitStringBuffer::WORD_BIT_LENGTH);
+ CPU_WORD value = this->GetField(pos,len) | bs.GetField(pos,len);
+ bsb.SetField(pos,len,value);
+ }
+
+ return bsb;
+}
+
+//-------------------------------------------------------------------------------------------------
+
+prdfBitStringBuffer prdfBitString::operator>>(uint32_t count) const
+{
+ prdfBitStringBuffer l_bsb(this->GetLength());
+ prdfBitString * l_bsbp = &l_bsb; // dg03a - stupid trick to get to GetRelativePositionAlloc()
+ // l_bsb.Clear();
+ if(count < this->GetLength())
+ {
+ //bso overlays bsb at offset = count
+ uint32_t l_dummy;
+ prdfBitStringOffset bso(count,l_bsb.GetLength() - count,
+ l_bsbp->GetRelativePositionAlloc(l_dummy,0)); //dg03c
+ bso.SetBits(*this);
+ }
+ return l_bsb;
+}
+
+//-------------------------------------------------------------------------------------------------
+
+prdfBitStringBuffer prdfBitString::operator<<(uint32_t count) const
+{
+ prdfBitStringBuffer l_bsb(this->GetLength());
+ // l_bsb.Clear();
+ if(count < this->GetLength())
+ {
+ // bso overlays *this at offset = count
+ prdfBitStringOffset bso(count,this->GetLength() - count,this->GetMemoryAddress());
+ l_bsb.SetBits(bso);
+ }
+ return l_bsb;
+}
+
+// Function Specification //////////////////////////////////////////
+//
+// Title: prdfBitStringBuffer (Constructor)
+//
+// Purpose: This constuctor initializes the data members.
+//
+// Side-effects: This instance is initialized.
+// Memory is allocated.
+// Bit String values are undefined.
+//
+// Dependencies: None.
+//
+// End Function Specification //////////////////////////////////////
+
+prdfBitStringBuffer::prdfBitStringBuffer
+(
+ uint32_t iLen,
+ unsigned int ibc
+ )
+:
+prdfBitString(iLen, NULL),
+ivByteCapacity(ibc)
+{
+// SetBuffer(); //dg02d
+}
+
+// Function Specification ///////////////////////////////////////////
+//
+// Title: prdfBitStringBuffer (Copy constructor)
+//
+// Purpose: This constuctor initializes the data members. This copy
+// constructor uses a "deep" copy. This constructor will
+// also handle any class derived from the Bit String base
+// class.
+//
+// Side-effects: This instance is initialized.
+// Bit String values are are copied.
+//
+// Dependencies: None.
+//
+// Time Complexity: Dominated by the time complexity of SetBits()
+//
+// End Function Specification //////////////////////////////////////
+
+prdfBitStringBuffer::prdfBitStringBuffer(const prdfBitString & string)
+:
+prdfBitString(string.GetLength(),NULL),
+ivByteCapacity(0)
+{
+ if(!string.IsZero()) //dg02a - only allocate if bits are on
+ { //dg02a
+ SetBuffer();
+ SetBits(string);
+ } //dg02a
+}
+
+// The True copy constructor mk00a
+prdfBitStringBuffer::prdfBitStringBuffer(const prdfBitStringBuffer & string)
+:
+prdfBitString(string.GetLength(),NULL),
+ivByteCapacity(string.ivByteCapacity)
+{
+ if(!string.IsZero()) //dg02a - only allocate if bits are on
+ { //dg02a
+ SetBuffer();
+ SetBits(string);
+ } //dg02a
+}
+
+// Function Specification ///////////////////////////////////////////
+//
+// Title: ~prdfBitStringBuffer (Virtual Destructor)
+//
+// Purpose: This destructor deallocates the buffer memory.
+//
+// Side-effects: Memory is deallocated.
+//
+// Dependencies: None.
+//
+// End Function Specification //////////////////////////////////////
+
+prdfBitStringBuffer::~prdfBitStringBuffer(void)
+{
+ delete [] GetMemoryAddress();
+}
+
+// Function Specification ///////////////////////////////////////////
+//
+// Title: operator= (Assignment operator)
+//
+// Purpose: This assignment operator assigns the offset and length
+// data members. A new buffer is allocated for the and
+// the assinged Bit String contents are assigned.
+//
+// Side-effects: Data members are modified.
+// Memory is allocated.
+//
+// Dependencies: None.
+//
+// Time Complexity: Proportional to time complexity of SetBits()
+//
+// End Function Specification //////////////////////////////////////
+
+prdfBitStringBuffer & prdfBitStringBuffer::operator=
+(
+ const prdfBitStringBuffer & string
+ )
+{
+ // Check for assignment to self
+ if(this != &string)
+ {
+ delete[] GetMemoryAddress();
+ // Assign base class part
+ prdfBitString::operator=(string);
+ SetMemoryAddress(NULL);
+
+ // Assign derived class part
+ ivByteCapacity = string.ivByteCapacity;
+
+ // Allocate memory and copy the Bits
+ if(!string.IsZero()) //dg02a - only allocate if bits are on
+ { //dg02a
+ SetBuffer();
+ SetBits(string);
+ } //dg02a
+ }
+
+ return(*this);
+}
+
+prdfBitStringBuffer & prdfBitStringBuffer::operator=(const prdfBitString & string)
+{
+ delete [] GetMemoryAddress();
+
+ // Assign base class part
+ prdfBitString::operator=(string); //copy it to this
+ SetMemoryAddress(NULL);
+
+ // Assign derived class part
+ ivByteCapacity = 0;
+
+ // Allocate memory and copy the Bits
+ if(!string.IsZero()) //dg02a - only allocate if bits are on
+ { //dg02a
+ SetBuffer();
+ SetBits(string);
+ } //dg02a
+
+ return(*this);
+}
+// Function Specification //////////////////////////////////////////
+//
+// Title: Set Buffer
+//
+// Purpose: This function allocates memory for the buffer. Any
+// memory that has been previously allocated is
+// deallocated.
+//
+// Side-effects: Memory is allocated.
+//
+// Dependencies: This function must be called at least once prior
+// to the first Bit String access.
+//
+// End Function Specification //////////////////////////////////////
+
+void prdfBitStringBuffer::SetBuffer(void)
+{
+ uint32_t byte_count = GetLength() / (sizeof(CPU_WORD) * 8);
+
+ // Account for remainder of division with an additional byte
+ if((GetLength() % (sizeof(CPU_WORD) * 8)) != 0)
+ {
+ byte_count++;
+ }
+
+ byte_count = std::max(ivByteCapacity, byte_count);
+
+ delete [] GetMemoryAddress();
+ SetMemoryAddress(new CPU_WORD[byte_count]);
+ Clear();
+}
+/*--------------------------------------------------------------------*/
+/* IO Stream Conditional Support */
+/*--------------------------------------------------------------------*/
+
+#ifdef _USE_IOSTREAMS_
+
+std::ostream & operator<<(std::ostream & out,
+ const prdfBitString & bit_string )
+{
+ const uint32_t bit_field_length = sizeof(CPU_WORD) * 8;
+ out << std::hex;
+ for(uint32_t pos = 0; pos < bit_string.GetLength(); pos += bit_field_length)
+ {
+ uint32_t len = bit_string.GetLength() - pos;
+ len = std::min(len,bit_field_length);
+ CPU_WORD value = bit_string.GetField(pos,len);
+ out << std::setw(bit_field_length/4) << std::setfill('0') << value << " ";
+ }
+
+ return(out);
+}
+
+#endif
+
diff --git a/src/usr/diag/prdf/common/util/prdfBitString.H b/src/usr/diag/prdf/common/util/prdfBitString.H
new file mode 100755
index 000000000..4062f0e8a
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfBitString.H
@@ -0,0 +1,796 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfBitString.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2004,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 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 PRDFBITSTRING_H
+#define PRDFBITSTRING_H
+
+/** @file prdBitString.H
+ * @brief prdfBitString and prdfBitStringBuffer class declarations
+ */
+
+/*--------------------------------------------------------------------*/
+/* Includes */
+/*--------------------------------------------------------------------*/
+
+#if !defined(PRDF_TYPES_H)
+#include <prdf_types.h>
+#endif
+
+#if defined(ESW_SIM_COMPILE)
+#define _USE_IOSTREAMS_
+#endif
+
+#ifdef _USE_IOSTREAMS_
+ #include <iostream>
+ #include <iomanip>
+#endif
+
+#if defined(NO_FSP)
+ // Can not use PRD implementation of assert() in error log parsing code.
+ #include <assert.h>
+ #define PRDF_ASSERT(x) assert(x)
+#else
+ #include <prdfAssert.h>
+#endif
+
+/*--------------------------------------------------------------------*/
+/* Forward References */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* User Types */
+/*--------------------------------------------------------------------*/
+
+// Type Specification //////////////////////////////////////////////////
+//
+// Title: CPU_WORD
+//
+// Purpose: This type is used to take advantage of the most efficient
+// memory reference size for a specific CPU architecture.
+// This type defintion is provided only to handle the case
+// where no previous defintions exists.
+//
+// End Type Specification //////////////////////////////////////////////
+
+#ifndef CPU_WORD
+
+typedef uint32_t CPU_WORD;
+
+#endif
+
+/*--------------------------------------------------------------------*/
+/* Constants */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Macros */
+/*--------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------*/
+/* Global Variables */
+/*--------------------------------------------------------------------*/
+
+//--------------------------------------------------------------------
+// Forward References
+//--------------------------------------------------------------------
+class prdfBitStringBuffer;
+
+/*--------------------------------------------------------------------*/
+/* Function Prototypes */
+/*--------------------------------------------------------------------*/
+
+//! prdfBitString
+/*!
+ prdfBitString is general purpose class providing access to a bit string in memory.
+ \remarks
+ The Bit String models a contiguous sequence of bits in memory from 0 to n.
+ In the prdfBitString class the start of the string is aligned with the memory
+ address provided. The prdfBitStringOffset class allows the starting bit string
+ to occur on any bit in memory. The length of the bit string may be any length up to
+ the value a uint32_t can hold. ( the prdfBitStringOffset limits the length such that
+ the start bit offset + length must not exceed the max value of a uint32_t).
+
+ The prdfBitString and prdfBitStringOffset classes do not own the memory storage used to hold
+ the bitstring data, it only accesses and manipulate the bits in the range specified.
+ The prdfBitStringBuffer is a version of the bits string class that manages its' own storage.
+ Operations are performed on the Bit String using either a single bit or a field.
+
+ The CPU_WORD type is used internally to reference memory
+ and as the interface type for the field. This interface
+ allows normal interaction with the builtin types.
+ Accessing the Bit String is accomplished in units of n
+ bits where n equals (sizeof(CPU_WORD) * 8). This CPU_WORD
+ type is defined to take advantage of the target CPU's
+ most efficient memory access instructions. However, the
+ semantics of the Bit String class are identical
+ regardless of the actual type of CPU_WORD.
+
+ \verbatim
+ Bit positions are specified 0 to (length - 1) from left to right.
+
+ 0 1 2 3 .... (length - 1)
+
+ B B B B .... B
+ \endverbatim
+
+ \remarks
+ When the CPU_WORD is used in SetField() and GetField uses
+ an identical bit order. For example, if only 16 bits of
+ the CPU_WORD were used, then the 16 left most bits would
+ contain the field data and the remaining bits would be
+ zero.
+
+ \verbatim
+ 0 1 2 3 .... 15 16 17 .... (sizeof(CPU_WORD) - 1)
+
+ B B B B .... B 0 0 .... 0
+ \endverbatim
+
+ \remarks
+ A static member function RIGHT_SHIFT() is provided for
+ shifting the bits the apppropriate number of positions so
+ that the resulting value is right justified. For example,
+ after using RIGHT_SHIFT() on the above field the result
+ would be as follows.
+
+ \verbatim
+ 0 1 2 3 .... .... (sizeof(CPU_WORD) - 1)
+
+ 0 0 0 0 .... B B B B B .... B
+ \endverbatim
+
+ \remarks
+ The static member function LEFT_SHIFT() performs the
+ inverse operation. The resulting value is left justified.
+
+ \remarks
+ The length of a Bit String is only limited by the amount
+ of memory that contains the bits and the representation
+ of length (16-bits).
+*/
+class prdfBitString
+{
+public:
+
+ /*!
+ Constructor
+ \param Length of bitstring
+ \param memory address of bit string storage
+ \pre None.
+ \post None.
+ */
+ prdfBitString(uint32_t i_length, CPU_WORD * i_address)
+ :
+ ivLength(i_length),
+ ivBuffer(i_address)
+ {
+ }
+
+ /*!
+ Destructor
+ \notes This destructor does nothing. It is requred for proper desctruction
+ of derived classes.
+ */
+ virtual ~prdfBitString(void);
+
+ /*!
+ Comparison
+ \remarks The bitstrings must be the same length and have the same bits set to be equal
+ */
+ int operator==(const prdfBitString & string) const
+ {
+ return(IsEqual(string));
+ }
+
+ /*!
+ Get the number of bits in the bitstring
+ \returns length of bitstring
+ \pre None
+ \pos None
+ */
+ uint32_t GetLength(void) const { return ivLength; }
+
+ /*!
+ Get the number of bits that are set ("1")
+ */
+ uint32_t GetSetCount(void) const;
+
+ /*!
+ Get the number of bits that are set ("1") in a specific range
+ \param starting bit position
+ \param # of bits in the range
+ \pre bit_position + leng <= GetLength();
+ \post none
+ */
+ uint32_t GetSetCount(uint32_t bit_position, uint32_t leng) const;
+
+ /*!
+ Get a copy of a subfield withing the bitstring
+ \param starting bit position
+ \param # of bits in the field
+ \return Returned value is left justified (See GetFieldJustified)
+ \pre (bit_position + length) <= GetLength(); length <= sizeof(CPU_WORD)*8
+ \post none
+ */
+ CPU_WORD GetField(uint32_t bit_position,uint32_t length) const;
+
+ /*!
+ Get a copy of a subfield withing the bitstring
+ \param starting bit position
+ \param # of bits in the field
+ \return Returned value is right justified (See GetField)
+ \pre (bit_position + length) <= GetLength(); length <= sizeof(CPU_WORD)*8
+ \post none
+ */
+ CPU_WORD GetFieldJustify(uint32_t bit_position,uint32_t length) const;
+
+ /*!
+ Set value into a subfield withing the bitstring
+ \param starting bit position
+ \param # of bits in the field
+ \pre (bit_position + length) <= GetLength(); length <= sizeof(CPU_WORD)*8
+ \post The bits are set from value (value assumed left justified)
+ \verbatim
+ this -> '00100110011....'b
+ SetField(3,5,0xf8000000)
+ result -> '00111111011....'b
+ \endverbatim
+ */
+ void SetField(uint32_t bit_position,uint32_t length,CPU_WORD value);
+
+
+ /*!
+ Set value into a subfield withing the bitstring
+ \param starting bit position
+ \param # of bits in the field
+ \pre (bit_position + length) <= GetLength(); length <= sizeof(CPU_WORD)*8
+ \post The bits are set from value (value assumed right justified)
+ \verbatim
+ this -> '00100110011....'b
+ SetField(3,5,0x0000001f)
+ result -> '00111111011....'b
+ \endverbatim
+ */
+ void SetFieldJustify(uint32_t bit_position,uint32_t length,CPU_WORD value);
+
+ /*!
+ Set bits in this string based on provided string
+ \param source string
+ \post source bits are copied to this
+ \notes if source len > this len than extra source bits ignored.
+ if source len < this len than extra bits in this are uneffected
+ Bit strings may specify overlapping memory
+ */
+ void SetBits(const prdfBitString & string);
+
+ /*!
+ Set bits in this string based on provided string
+ \param string: source string
+ \param pos: bit pos in source to start copy from
+ \param len: # of bits to copy
+ \param dpos: start bit pos in this string to copy to (def = 0)
+ \post source bits in given range are copied to this starting at dpos
+ \notes only bit in the given range are effected. if more source bits are
+ given than space in this string than the extra source bit are ignored.
+ Bit strings may specify overlapping memory.
+ */
+ void SetBits(const prdfBitString & string,
+ unsigned int pos,
+ unsigned int len,
+ unsigned int dpos = 0);
+
+ /*!
+ Set bits in this string based on the range and pattern provided
+ \param iPos: bit pos in this string to start
+ \param iLen: # of bits to modify
+ \param iPattern: Pattern to set
+ \param iPatternLen: # of bit in pattern to use (right justfied)
+ \pre (iPos + iLen) <= GetLength()
+ \post Range of specified bits filled with pattern. The pattern is repeated as needed
+ \verbatim
+ Examples: iPos(0), iLen(10), iPattern(0xA), iPatternLen(4)
+ Old String: 0000000000
+ New String: 1010101010
+
+ iPos(3), iLen(4), iPattern(0x3), iPatternLen(3)
+ Old String: 0001001000
+ New String: 0000110000
+ \endverbatim
+ */
+ void Pattern(uint32_t iPos,
+ uint32_t iLen,
+ CPU_WORD iPattern,
+ uint32_t pattern_bit_length);
+
+ /*!
+ Set entire string based on the pattern provided
+ \param iPattern: Pattern to set
+ \param iPatternLen: # of bit in pattern to use (right justfied)
+ \post BitString is filled with pattern. The pattern is repeated/truncated as needed
+ */
+ void Pattern(CPU_WORD iPattern,
+ uint32_t iPatternLen);
+
+ /*!
+ Set entire string based on the pattern provided
+ \param iPattern: Pattern to set
+ \post BitString is filled with pattern. The pattern is repeated/truncated as needed
+ */
+ void Pattern(CPU_WORD pattern);
+
+ /*!
+ Query if bit is set (1)
+ \returns [true|false]
+ \param iPos: bit position to test
+ */
+ bool IsSet(uint32_t iPos) const;
+
+ /*!
+ Set a bit (1) at the specified position
+ \param iPos: bit position to test
+ \post IsSet(iPos) == true
+ */
+ void Set( uint32_t iPos);
+
+ /*!
+ Clear or ReSet a bit (0) at the specified position
+ \param iPos: bit position to clear
+ \post IsSet(iPos) == false
+ */
+ void Clear(uint32_t bit_position);
+
+ /*!
+ Clear the entire bit string
+ \post IsZero() == true
+ */
+ void Clear(void) { Pattern(0); }
+
+ /*!
+ Test equivalence
+ \returns [true | false]
+ \notes Both strings must be of equal length and have same values to be equal
+ */
+ bool IsEqual( const prdfBitString & string) const;
+
+ /*!
+ Query state of no bits set(1)
+ \returns [true | false]
+ */
+ bool IsZero(void) const;
+
+ /*!
+ Mask off (Clear) bits positions in this string that are Set in the string provided
+ \param bitString containing the mask
+ \post Set bit positions in string provded are cleared in this string
+ \notes If the paramter string is longer than this string than extra bits are ignored.
+ If the paramter string is shorter than this string than extra bits in this string
+ are not modified.
+ \verbatim
+ Examples: Paramter String: 1001
+ Old String: 1100
+ New String: 0100
+
+ Paramter String: 100111
+ Old String: 1100
+ New String: 0100
+
+ Paramter String: 1001
+ Old String: 110001
+ New String: 010001
+
+ \endverbatim
+ */
+ void Mask(const prdfBitString & string);
+
+ /*!
+ Utility to Right justify a "Left-justified" value
+ \param iLen: length of bit field to justify
+ \param iValue: the value to justify
+ \pre iLen <= sizeof(CPU_WORD)*8
+ */
+ static CPU_WORD RIGHT_SHIFT(uint32_t iLen,
+ CPU_WORD iValue);
+
+ /*!
+ Utility to Left justify a "right-justified" value
+ \param iLen: length of bit field to justify
+ \param iValue: the value to justify
+ \pre iLen <= sizeof(CPU_WORD)*8
+ */
+ static CPU_WORD LEFT_SHIFT(uint32_t l,
+ CPU_WORD value);
+
+ /*!
+ bitwise NOT
+ \returns a bit-wise inverted copy of the specified bit string
+ */
+
+ friend prdfBitStringBuffer operator~(const prdfBitString & bs);
+ prdfBitStringBuffer operator&(const prdfBitString & bs) const;
+ prdfBitStringBuffer operator|(const prdfBitString & bs) const;
+
+ /*!
+ Left shift
+ \returns bitstring left shifted by count
+ \note: the returned bit string is the same length as the source.
+ \verbatim
+ Example:
+ |---|---|---|---|---|---|---|---|
+ BitString content: | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
+ |---|---|---|---|---|---|---|---|
+ bit offset 0 1 2 3 4 5 6 7
+
+ operator>>(5)
+
+ |---|---|---|---|---|---|---|---|
+ BitString result: | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
+ |---|---|---|---|---|---|---|---|
+
+
+ \endverbatim
+ */
+ prdfBitStringBuffer operator>>(uint32_t count) const;
+
+ /*!
+ Right shift
+ \returns a bitstring left shifted by count
+ \note: the returned bit string is the same length as the source.
+ \verbatim
+ Example:
+ |---|---|---|---|---|---|---|---|
+ BitString content: | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 |
+ |---|---|---|---|---|---|---|---|
+ bit offset 0 1 2 3 4 5 6 7
+
+ operator<<(4)
+
+ |---|---|---|---|---|---|---|---|
+ BitString result: | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
+ |---|---|---|---|---|---|---|---|
+
+ \endverbatim
+ */
+ prdfBitStringBuffer operator<<(uint32_t count) const;
+
+
+protected:
+
+ /*!
+ Assignment operator
+ \param string Reference bit string
+ */
+ virtual prdfBitString & operator=(const prdfBitString & string);
+
+ /*!
+ Gets the CPU_WORD bounded memory address and the relative bit offset within the CPU_WORD
+ that corresponds to the provided bit position in the bit string.
+ \returns memory address of CPU_WORD
+ \returns relative bit offset in the CPU_WORD
+ \param iBitPos Bit position in the bit string
+ */
+ virtual CPU_WORD * GetRelativePosition(uint32_t & oBitOffset, uint32_t iBitPos) const;
+ virtual CPU_WORD * GetRelativePositionAlloc(uint32_t & oBitOffset, uint32_t iBitPos);//dg02a
+
+
+ /*!
+ Proides address of the bit string storage
+ @NOTE: WARNING!! this may return NULL if there is no storage on a BitStringBuffer because bits
+ have not yet been set. - use GetRelativePositionAlloc() to force storage allocation
+ */
+ CPU_WORD * GetMemoryAddress(void) const { return ivBuffer; }
+
+ /*!
+ Set the memory address of the string representation
+ */
+ void SetMemoryAddress(CPU_WORD *iBuffer) { ivBuffer = iBuffer; }
+
+ // Enum Specification //////////////////////////////////////////////
+ //
+ // Purpose: This enummerated constant is used for member function
+ // implementation.
+ //
+ // End Enum Specification //////////////////////////////////////////
+
+ enum
+ {
+ WORD_BIT_LENGTH = sizeof(CPU_WORD) * 8
+ };
+
+private:
+
+
+
+ uint32_t ivLength;
+ CPU_WORD * ivBuffer;
+
+};
+
+
+//! prdfBitStringBuffer
+/*!
+ prdfBitStringBuffer provides a Bit String in an associated buffer in memory.
+ \remarks
+ The Bit String Buffer provides all of the functionality
+ of the base class along with the maintenance of memory
+ allocated to hold the Bit String. The buffer is "owned"
+ by the Bit String Buffer. Sufficient memory
+ is allocated and deallocted in the constructor and
+ destructor, respectively. In addtion, the assignemnt
+ operator will adjust the amount of memory needed as
+ necessary for the assignment. A byte capacity value is also maintained.
+ The internal buffer is always guaranteed to have this capacity of bytes.
+*/
+class prdfBitStringBuffer : public prdfBitString
+{
+public:
+
+ /*!
+ Constructor
+ \param iLen: Number of bits in the string
+ \param iByteCapacity: The minimum storage size to be allocated. default=0
+ \notes If iByteCapcity is zero or too small than the storage size is calculated
+ from iLen, rounded up to the nearest CPU_WORD.
+ */
+ prdfBitStringBuffer(uint32_t iLen,
+ unsigned int iByteCapacity = 0);
+
+ /*!
+ Copy Constructor
+ \param reference bits string
+ */
+ prdfBitStringBuffer(const prdfBitString & string);
+
+ /*!
+ Copy Constructor
+ \param reference bits string
+ */
+ prdfBitStringBuffer (const prdfBitStringBuffer & string);
+
+ /*!
+ Destructor
+ */
+ virtual ~prdfBitStringBuffer(void);
+
+ /*!
+ Assignment
+ \param reference bit string
+ */
+ prdfBitStringBuffer & operator=(const prdfBitStringBuffer & string);
+
+ /*!
+ Assignment
+ \param reference bit string
+ */
+ virtual prdfBitStringBuffer & operator=(const prdfBitString & string);
+
+protected: // functions dg02a
+
+ virtual CPU_WORD * GetRelativePositionAlloc(uint32_t & oBitOffset, uint32_t iBitPos);//dg02a
+
+private: // functions
+
+ /*!
+ allocate or re-allocate buffer
+ */
+ void SetBuffer(void);
+
+private: // data
+
+ unsigned int ivByteCapacity;
+
+};
+
+//! prdfBitStringOffset
+/*!
+ prdfBitStringOffset provides a Bit String that allows a starting position that
+ is not limited to a memory alligned boundary.
+ \remarks
+ The Bit String Offset provides the ability to specify a start bit offset from the
+ address provided as the start position of the bit string. The class will
+ not modify memory outside the bit string range.
+*/
+class prdfBitStringOffset:public prdfBitString
+{
+public:
+ /*!
+ Constructor
+ \param i_offset The bit offset from address of the start of the bitstring
+ \param i_len The number of bits in the bitstring
+ \param i_address The memory address to base the bitstring on
+ */
+ prdfBitStringOffset(uint32_t i_offset, uint32_t i_len, CPU_WORD * i_address)
+ : prdfBitString(i_len,i_address), ivOffset(i_offset) {}
+
+ /*!
+ Destructor - this class does not own it's storage
+ */
+ virtual ~prdfBitStringOffset(void);
+
+ /*!
+ Copy Constructor
+ */
+ prdfBitStringOffset(const prdfBitStringOffset &i_bs);
+
+ /*!
+ Assignment
+ */
+ prdfBitStringOffset & operator=(const prdfBitStringOffset & i_bs);
+
+ /*!
+ Assignment
+ */
+ virtual prdfBitStringOffset & operator=(const prdfBitString & i_bs);
+
+
+protected: // functions
+
+ /*!
+ Gets the CPU_WORD bounded memory address and the relative bit offset within the CPU_WORD
+ that corresponds to the provided bit position in the bit string.
+ \returns memory address of CPU_WORD
+ \returns relative bit offset in the CPU_WORD
+ \param iBitPos Bit position in the bit string
+ */
+ virtual CPU_WORD * GetRelativePosition(uint32_t & oBitOffset, uint32_t iBitPos) const;
+ virtual CPU_WORD * GetRelativePositionAlloc(uint32_t & oBitOffset, uint32_t iBitPos); //dg04a
+private: // data
+
+ uint32_t ivOffset;
+};
+
+
+/*--------------------------------------------------------------------*/
+/* IO Stream Conditional Support */
+/*--------------------------------------------------------------------*/
+
+#ifdef _USE_IOSTREAMS_
+
+
+std::ostream & operator<<( std::ostream & out,
+ const prdfBitString & bit_string);
+
+#endif
+
+/*--------------------------------------------------------------------*/
+/* Inline Member Function Definitions */
+/*--------------------------------------------------------------------*/
+
+// Function Specification ///////////////////////////////////////////
+//
+// Title: RIGHT_SHIFT
+//
+// Purpose: This function shifts the bit field right so that the
+// specified number of bits are contained in the right most
+// bits in the value. The resulting value is right
+// justified.
+//
+// Side-effects: None.
+//
+// Dependencies: Parameter length(l) must be less than
+// sizeof(CPU_WORD) for proper results.
+//
+// End Function Specification //////////////////////////////////////
+
+inline
+CPU_WORD prdfBitString::RIGHT_SHIFT
+(
+ uint32_t l,
+ /*!i Length of bit field */
+ CPU_WORD value
+ /*!i Bit field value to shift */
+ )
+/*!o Bit field value */
+{
+ // assert(l <= WORD_BIT_LENGTH);
+
+ return(value >> (WORD_BIT_LENGTH - l));
+}
+
+// Function Specification ///////////////////////////////////////////
+//
+// Title: LEFT_SHIFT
+//
+// Purpose: This function shifts the bit field left so that the
+// specified number of bits are contained in the left most
+// bits in the value. The resulting value is left
+// justified.
+//
+// Side-effects: None.
+//
+// Dependencies: Parameter length(l) must be less than
+// sizeof(CPU_WORD) for proper results.
+//
+// End Function Specification //////////////////////////////////////
+
+inline
+CPU_WORD prdfBitString::LEFT_SHIFT
+(
+ uint32_t l,
+ CPU_WORD value
+ )
+{
+ return(value << (WORD_BIT_LENGTH - l));
+}
+
+inline
+prdfBitString & prdfBitString::operator=
+(
+ const prdfBitString & string
+ )
+{
+ ivLength = string.ivLength;
+ ivBuffer = string.ivBuffer;
+ return(*this);
+}
+
+inline
+CPU_WORD * prdfBitString::GetRelativePositionAlloc(uint32_t & oBitOffset, uint32_t iBitPos)
+{
+ return prdfBitString::GetRelativePosition(oBitOffset,iBitPos);
+}
+
+// Function Specification //////////////////////////////////////////
+//
+// Title: Pattern
+//
+// Purpose: This function sets this entire Bit String with the
+// specifed pattern. The pattern is repeated as often as
+// necessary as specified by the pattern_bit_length.
+//
+// Side-effects: Bit String is be modified.
+//
+// Dependencies: None.
+//
+// Time Complexity: O(m) where m is the number of bits to modify
+// (paramter l)
+//
+// Examples: See Pattern(uint32_t, uint32_t, CPU_WORD, uint32_t)
+//
+// End Function Specification //////////////////////////////////////
+
+inline
+void prdfBitString::Pattern(CPU_WORD pattern,uint32_t pattern_bit_length)
+{
+ Pattern(0, GetLength(), pattern, pattern_bit_length);
+}
+
+
+inline
+void prdfBitString::Pattern(CPU_WORD pattern)
+{
+ Pattern(0, GetLength(), pattern, sizeof(CPU_WORD));
+}
+
+
+inline uint32_t prdfBitString::GetSetCount(void) const
+{
+ return(GetSetCount(0, GetLength()));
+}
+
+inline void prdfBitString::SetBits(const prdfBitString & string)
+{
+ SetBits(string, 0, string.GetLength());
+}
+
+
+#endif
diff --git a/src/usr/diag/prdf/common/util/prdfErrlSmartPtr.C b/src/usr/diag/prdf/common/util/prdfErrlSmartPtr.C
new file mode 100755
index 000000000..8a6e74cff
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfErrlSmartPtr.C
@@ -0,0 +1,53 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfErrlSmartPtr.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2004,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#include <prdfErrlSmartPtr.H>
+#include <iipglobl.h>
+
+/* void add_src()
+ * Add special SRC to error log specifying commited from smart
+ * pointer.
+ */
+void PrdfErrlSmartPtr::add_src()
+{
+
+ if (iv_errl)
+ {
+ PRDF_ADD_SW_ERR(iv_errl, 0, PRDF_ERRLSMARTPTR, __LINE__);
+ PRDF_ADD_PROCEDURE_CALLOUT(iv_errl, SRCI_PRIORITY_MED, EPUB_PRC_SP_CODE);
+ }
+};
+
+/* void commit_errl()
+ * Commit error log and delete.
+ */
+void PrdfErrlSmartPtr::commit_errl()
+{
+ if (iv_errl)
+ {
+ this->add_src();
+
+ PRDF_COMMIT_ERRL(iv_errl, ERRL_ACTION_REPORT);
+ }
+};
+
diff --git a/src/usr/diag/prdf/common/util/prdfErrlSmartPtr.H b/src/usr/diag/prdf/common/util/prdfErrlSmartPtr.H
new file mode 100755
index 000000000..51782117c
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfErrlSmartPtr.H
@@ -0,0 +1,167 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfErrlSmartPtr.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2003,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 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 __PRDFERRLSMARTPTR_H
+#define __PRDFERRLSMARTPTR_H
+
+#include <errlentry.H>
+#include <prdf_service_codes.H>
+
+/**
+ * @class PrdfErrlSmartPtr
+ * This is a smart pointer class for errlHndl_t objects, especially for
+ * the g_prd_errl variable. Currently, programmers can accidentially
+ * overwrite g_prd_errl and we leak a error log. This class will keep
+ * track of the error logs and commit/delete it if it goes out of context.
+ */
+class PrdfErrlSmartPtr
+{
+ public:
+
+ class INVALID_TYPE_CONVERSION___SEE_COMMENTS_FOR_RELEASE_FUNCTION {};
+
+ /* ctor - Initialize ptr to NULL */
+ PrdfErrlSmartPtr() : iv_errl(NULL) {};
+ /* dtor - Commit remaining error log */
+ ~PrdfErrlSmartPtr() { commit_errl(); };
+
+ /* operator =
+ * Someone attempted to overwrite the error log, commit if needed.
+ */
+ PrdfErrlSmartPtr & operator=(errlHndl_t i_errl)
+ {
+ this->commit_errl();
+ iv_errl = i_errl;
+
+ return *this;
+ };
+
+ /* operator ->
+ * Used to do standard errlHndl_t->func() operations:
+ * errl->commit().
+ */
+ errlHndl_t operator->() const
+ {
+ return iv_errl;
+ };
+
+ /* operator*
+ * Used when dereferencing the errlHndl_t, for instance to get
+ * at the rc value:
+ * (uint32_t) *errl;
+ */
+ /* FIXME : Hostboot ErrorLog disallow this operation but it also doesn't seem to get used
+ ErrlEntry operator*() const
+ {
+ return *iv_errl;
+ };
+ */
+
+ /* operator ==
+ * Compare with NULL or other ptr values:
+ * if (errl == NULL)...
+ */
+ bool operator==(const errlHndl_t i_errl) const
+ {
+ return iv_errl == i_errl;
+ };
+
+ /* operator !=
+ * Compare with NULL or other ptr values:
+ * if (errl != NULL)...
+ */
+ bool operator!=(const errlHndl_t i_errl) const
+ {
+ return iv_errl != i_errl;
+ };
+
+ /* friend operator ==
+ * Compare with NULL or other ptr values:
+ * if (NULL == errl)
+ */
+ friend bool operator==(const errlHndl_t i_errl,
+ const PrdfErrlSmartPtr & i_smrtptr)
+ {
+ return i_smrtptr == i_errl;
+ };
+
+ /* friend operator =!
+ * Compare with NULL or other ptr values:
+ * if (NULL =! errl)
+ */
+ friend bool operator!=(const errlHndl_t i_errl,
+ const PrdfErrlSmartPtr & i_smrtptr)
+ {
+ return i_smrtptr != i_errl;
+ };
+
+ /* operator errlHndl_t
+ * Cast to errlHndl_t object. (needed?)
+ */
+ operator errlHndl_t()
+ {
+ return iv_errl;
+ };
+
+ operator INVALID_TYPE_CONVERSION___SEE_COMMENTS_FOR_RELEASE_FUNCTION *()
+ {
+ return NULL;
+ };
+
+ /* errlHndl_t release
+ * Used when error log is leaving PRD's context (returned to
+ * cecserver):
+ * return errl.release();
+ * instead of:
+ * return errl;
+ *
+ * Or, to delete the error log:
+ * delete errl.release();
+ *
+ * This prevent the error log from being deleted twice or commited
+ * by the wrong component.
+ */
+ errlHndl_t release()
+ {
+ errlHndl_t l_tmp = iv_errl;
+ iv_errl = NULL;
+ return l_tmp;
+ };
+
+ protected:
+ errlHndl_t iv_errl;
+
+ /* void add_src()
+ * Add special SRC to error log specifying commited from smart
+ * pointer.
+ */
+ void add_src();
+
+ /* void commit_errl()
+ * Commit error log and delete.
+ */
+ void commit_errl();
+
+};
+
+#endif
diff --git a/src/usr/diag/prdf/common/util/prdfErrorSignature.H b/src/usr/diag/prdf/common/util/prdfErrorSignature.H
new file mode 100755
index 000000000..a0bf1bb19
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfErrorSignature.H
@@ -0,0 +1,175 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfErrorSignature.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 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 ErrorSignature_h
+#define ErrorSignature_h
+
+/** @file prdfErrorSignature.H
+ * @brief PRD error signature
+ */
+
+#include <iipconst.h>
+#include <prdfTrace.H>
+
+// FIXME - Should this class be scoped in PRDF namspace?
+
+/** @class ErrorSignature
+ *
+ * A complete error signature is a 64-bit number where:
+ * The 1st 32-bits is representation of a chip.
+ * The 2nd 32-bits is the signature ID.
+ * The signature ID is defined the following:
+ * The 1st 16-bits is the register ID.
+ * The 2nd 16-bits is the error code.
+ */
+class ErrorSignature
+{
+ public:
+
+ /**
+ * @brief Constructor
+ */
+ ErrorSignature() : iv_chipId(0), iv_regId(0), iv_errCode(0) {}
+
+ /**
+ * @brief operator==
+ */
+ int operator==( const ErrorSignature & r ) const
+ {
+ return ( iv_chipId == r.iv_chipId &&
+ iv_regId == r.iv_regId &&
+ iv_errCode == r.iv_errCode );
+ }
+
+ /**
+ * @brief operator!=
+ */
+ int operator!=( const ErrorSignature & r ) const
+ {
+ return ( iv_chipId != r.iv_chipId ||
+ iv_regId != r.iv_regId ||
+ iv_errCode != r.iv_errCode );
+ }
+
+ /**
+ * @brief operator<
+ */
+ bool operator<( const ErrorSignature & r ) const
+ {
+ if ( iv_chipId == r.iv_chipId )
+ {
+ if ( iv_regId == r.iv_regId )
+ return ( iv_errCode < r.iv_errCode );
+ else
+ return ( iv_regId < r.iv_regId );
+ }
+ else
+ return ( iv_chipId < r.iv_chipId );
+ };
+
+ /**
+ * @brief Clears the signature.
+ */
+ void clear()
+ {
+ iv_chipId = 0;
+ iv_regId = 0;
+ iv_errCode = 0;
+ TraceSignature();
+ }
+
+ /**
+ * @brief Sets the chip ID.
+ * @note Clears signature ID.
+ * @param i_chipId The chip's ID.
+ */
+ void setChipId( uint32_t i_chipId )
+ {
+ iv_chipId = i_chipId;
+ iv_regId = 0;
+ iv_errCode = 0;
+ TraceSignature();
+ }
+
+ /**
+ * @brief Sets the signature ID.
+ * @param i_sigId The signature ID.
+ */
+ void setSigId( uint32_t i_sigId )
+ {
+ iv_regId = (uint16_t)(i_sigId >> 16);
+ iv_errCode = (uint16_t)(i_sigId & 0xffff);
+ TraceSignature();
+ }
+
+ /**
+ * @brief Sets the signature's register ID.
+ * @param i_regId The signature's register ID.
+ */
+ void setRegId( uint16_t i_regId )
+ {
+ iv_regId = i_regId;
+ iv_errCode = 0;
+ TraceSignature();
+ }
+
+ /**
+ * @brief Sets the signature's error code.
+ * @param i_errCode The signature's error code.
+ */
+ void setErrCode( uint16_t i_errCode )
+ {
+ iv_errCode = i_errCode;
+ TraceSignature();
+ }
+
+ /**
+ * @return The chip ID.
+ */
+ uint32_t getChipId() const { return iv_chipId; }
+
+ /**
+ * @return The signature ID.
+ */
+ uint32_t getSigId() const
+ {
+ return ((uint32_t)iv_regId << 16) | (uint32_t)iv_errCode;
+ }
+
+ private:
+
+ /**
+ * @brief Create a trace statement for the current signature.
+ */
+ void TraceSignature() const
+ {
+ PRDF_INF( "PRD Signature %08X %08X", getChipId(), getSigId() );
+ }
+
+ uint32_t iv_chipId; ///< 32-bit representation of a chip
+ uint16_t iv_regId; ///< 16-bit register ID
+ uint16_t iv_errCode; ///< 16-bit error code
+};
+
+#endif
+
diff --git a/src/usr/diag/prdf/common/util/prdfFilters.C b/src/usr/diag/prdf/common/util/prdfFilters.C
new file mode 100755
index 000000000..ae5b294e7
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfFilters.C
@@ -0,0 +1,218 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfFilters.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 1996,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+/**
+ @file iipFilters.C
+ @brief Definition of SingleBitFilter, PrioritySingleBitFilter, FilterLink,
+ and ScanCommFilter classes.
+*/
+
+//----------------------------------------------------------------------
+// Includes
+//----------------------------------------------------------------------
+#define iipFilters_C
+
+#include <prdfBitKey.H>
+#include <prdfFilters.H>
+//#include <xspprdScanCommFilter.h>
+#include <iipscr.h>
+//#include <xspprdFilterLink.h>
+
+#undef iipFilters_C
+//----------------------------------------------------------------------
+// User Types
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+// Constants
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+// Macros
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+// Internal Function Prototypes
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+// Global Variables
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+// Member Function Specifications
+//----------------------------------------------------------------------
+
+prdfFilter::~prdfFilter(void)
+{}
+
+//-------------------------------------------------------------------------------------------------
+
+bool prdfFilterPriority::Apply(prdfBitKey & ioBitList)
+{
+ bool modified = false;
+ if(ioBitList.isSubset(ivBitKey))
+ {
+ ioBitList = ivBitKey;
+ modified = true;
+ }
+ return modified;
+}
+
+
+//-------------------------------------------------------------------------------------------------
+
+bool SingleBitFilter::Apply(prdfBitKey & bit_list)
+{
+ bool rc = false;
+ uint32_t list_length = bit_list.size();
+ if(list_length > 1)
+ {
+ rc = true;
+ while(--list_length)
+ {
+ bit_list.removeBit();
+ }
+ }
+ return(rc);
+}
+
+
+//-------------------------------------------------------------------------------------------------
+
+bool PrioritySingleBitFilter::Apply(prdfBitKey & bit_list)
+{
+ bool l_modified = false;
+
+ // Do priority bit.
+ for (size_t i = 0; i < iv_bitList.size(); i++)
+ {
+ prdfBitKey l_key = iv_bitList[i];
+ if (bit_list.isSubset(l_key))
+ {
+ l_modified = true;
+ bit_list = l_key;
+ break;
+ }
+ }
+ // Do single bit filter portion.
+ if (!l_modified)
+ {
+ while (1 < bit_list.size())
+ {
+ l_modified = true;
+ bit_list.removeBit();
+ }
+ }
+ return l_modified;
+}
+
+//-------------------------------------------------------------------------------------------------
+
+bool prdfFilterTranspose::Apply(prdfBitKey & iBitList)
+{
+ bool result = false;
+ if(iBitList == ivBitKey)
+ {
+ prdfBitKey bk(ivSingleBitPos);
+ iBitList = bk;
+ result = true;
+ }
+ return result;
+}
+
+bool prdfFilterTranspose::Undo(prdfBitKey & iBitList)
+{
+ bool result = false;
+ prdfBitKey testbl(ivSingleBitPos);
+ if(iBitList.isSubset(testbl))
+ {
+ iBitList = ivBitKey;
+ result = true;
+ }
+
+ return result;
+}
+
+//-------------------------------------------------------------------------------------------------
+
+bool FilterLink::Apply(prdfBitKey & bit_list)
+{
+ bool rc = xFilter1.Apply(bit_list);
+ rc = rc || xFilter2.Apply(bit_list);
+ return rc;
+}
+
+bool FilterLink::Undo(prdfBitKey & bit_list)
+{
+ bool rc = xFilter1.Undo(bit_list);
+ rc = rc || xFilter2.Undo(bit_list);
+ return rc;
+}
+
+//-------------------------------------------------------------------------------------------------
+
+bool ScanCommFilter::Apply(prdfBitKey & bitList)
+{
+ // Read HW register
+ scr.Read();
+
+ // local copy of bit string from scan comm register
+ BIT_STRING_BUFFER_CLASS bsb(*scr.GetBitString());
+ prdfBitKey bl;
+ bool rc = false;
+
+ // Invert if necessary
+ if (xInvert)
+ {
+ bsb = ~bsb;
+ }
+
+ // Create bit list
+ bl = bsb;
+ uint32_t bsize = bitList.size();
+ bitList.removeBits(bl);
+ if(bsize != bitList.size())
+ {
+ rc = true;
+ }
+
+ return(rc);
+}
+
+// Change Log *************************************************************************************
+//
+// Flag Reason Vers Date Coder Description
+// ---- -------- ------- -------- -------- ------------------------------
+// v4r1 09/05/96 DGILBERT Initial Creation
+// v4r3 01/27/98 SERAFIN Add PrioritySingleBitFilter
+// dg00 v4r5 06/30/99 DGILBERT fix PrioritySingleBitFilter
+// mk01 P4904712 v4r5 10/21/99 mkobler really fix PrioritySingleBitFilter
+// 490420.x v5r2 07/06/00 mkobler Add ScanCommFilter
+// 490420.x v5r2 07/06/00 dgilbert added FilterLink
+// fips 03/19/04 dgilbert rename to prdfFilters.C;rewrote PrioritySingleBitFilter
+// changed to use prdfBitKey
+// 558003 fips310 06/21/06 dgilbert Add Undo()
+// 582595 fips310 12/12/06 iawillia Update priority sb filter to maintain bit order.
+//
+// End Change Log *********************************************************************************
diff --git a/src/usr/diag/prdf/common/util/prdfFilters.H b/src/usr/diag/prdf/common/util/prdfFilters.H
new file mode 100755
index 000000000..3fd5da02d
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfFilters.H
@@ -0,0 +1,459 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfFilters.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2004,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 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 PRDFFILTER_H
+#define PRDFFILTER_H
+
+/**
+ @file prdfFilter.H
+ @brief FILTER_CLASSes selectivly remove bits from a prdfBitKey type object
+*/
+
+/*--------------------------------------------------------------------*/
+/* Includes */
+/*--------------------------------------------------------------------*/
+
+#if !defined(PRDFBITLKEY_H)
+#include <prdfBitKey.H>
+#endif
+
+#include <vector>
+
+/*--------------------------------------------------------------------*/
+/* Forward References */
+/*--------------------------------------------------------------------*/
+
+class prdfBitKey;
+
+/*--------------------------------------------------------------------*/
+/* User Types */
+/*--------------------------------------------------------------------*/
+
+/**
+ prdfFilter Specifies and interface for removing unwanted bits from a prdfBitKey.
+ Abstract base class
+ @see prdfBitKey
+*/
+class prdfFilter
+{
+public:
+
+
+ /**
+ Destructor. This implementation does nothing
+ */
+ virtual ~prdfFilter(void);
+
+
+ /**
+ Apply filter to the prdfBitKey.
+ @post bit_list may be modified
+ @return true if bit_list was modified, otherwise false
+ */
+ virtual bool Apply(prdfBitKey & io_bit_list) = 0;
+
+ /**
+ * Undo the filter effect (if possible)
+ * @post bit_list may be modified
+ * @Return tru if bit_list was modified, otherwise false
+ * @note: bit_lists are sometimes used to reset an error register based on the bit that was
+ * analyzed. If the Apply() function modifes the bit_list in such a way that make it unusable
+ * to reset the error register (eg. moves a bit to a new postition) than the Undo() function
+ * should put the bit_list back into a state that can be used to reset an error register.
+ */
+ virtual bool Undo(prdfBitKey & io_bit_list) { return false; }
+
+protected:
+
+ /**
+ Default Constructor
+ @note The default compiler generated copy constructor and assignment operator
+ are adaquate.
+ */
+ prdfFilter(void) {}
+
+};
+
+//! prdfFilterPriority
+/*!
+ prdfFilterPriority maintains a "subset" BitKey or a "priority" set of bits.
+ When this filter is applied to a BitKey, If the "priority" BitKey is a subset of the
+ BitKey than the BitKey becomes the priorty BitKey. (The non-priority bits are turned off);
+ Otherwise the BitKey remains unchanged.
+
+ \verbatim
+ Examples:
+ Priority BitKey: ("1")
+ Original BitKey: ("1", "5", "31")
+ Filtered BitKey: ("1")
+
+ Priority BitKey: ("1")
+ Original BitKey: ("5", "31")
+ Filtered BitKey: ("5", "31")
+
+ Priority BitKey: ("2", "7")
+ Original BitKey: ("2", "5", "31")
+ Filtered BitKey: ("2", "5", "31")
+
+ Priority BitKey: ("2", "7")
+ Original BitKey: ("2", "7", "31")
+ Filtered BitKey: ("2", "7")
+ \endverbatim
+ */
+class prdfFilterPriority : public prdfFilter
+{
+public:
+
+ /*!
+ Constructor
+ \param i_bld ptr bit list string encoding
+ */
+ prdfFilterPriority(const char * i_ble)
+ : ivBitKey(i_ble)
+ {}
+
+
+ /*!
+ Constructor
+ \param iBitList BitKey
+ */
+ prdfFilterPriority(const prdfBitKey & iBitList)
+ : ivBitKey(iBitList)
+ {}
+
+ /*!
+ Apply the filter to a bit list
+ \param ioBitList to apply filter to
+ \returns true if iBitList modified otherwise false
+ */
+ virtual bool Apply(prdfBitKey & ioBitList);
+
+protected:
+
+
+ prdfBitKey ivBitKey;
+
+};
+
+//! PrioritySingleBitFilter
+/*!
+ PrioritySingleBitFilter removes all but one bit from a prdfBitKey object.
+ Priority (to not be removed) is given to the bits specified and in the order
+ specified.
+ @par Example
+ @code
+ const char * const BIT_LIST_STRING_31_26 = "\x20\x1B"; // priority bits
+ PrioritySingleBitFilter psbFilter(BIT_LIST_STRING_31_26);
+ ScanCommRegisterChip scr(...); // see iipScanCommRegisterChip.h
+ ResolutionMap resMap(...); // see iipResolutionMap.h
+
+ // when the error register is read, the resulting list of bits on
+ // is passed to psbFilter. the result is used to look up a resolution
+ // in the ResultionMapa resMap and the resolution is called
+ ErrorRegisterMask ereg(scr,resMap,&psbFilter);
+ ...
+ rc = ereg.Analyze(serviceData); // See iipErrorRegisterMask.h
+ // ereg will apply filter prioritizing bit 31 then bit 26
+ // and finally any remaining bits
+ @endcode
+ @par functionality
+ - if no priority bits exist in prdfBitKey object then
+ - eliminate all but first entry in list
+ - else if priority bits exist then
+ - eliminate all non-priority bit entries
+ - if multiple priority bit entries exist then elminate all but one,
+ favoring the first qualified entry found in the list.
+*/
+class PrioritySingleBitFilter : public prdfFilter
+{
+public:
+
+ /**
+ Constructor
+ @param pbls Priority bit list string: list of bit positions that have priority
+ @note bit position priority values in pbls are the bit position + 1 of the bit list,
+ thus to prioritize bit positions 0,1, & 2 in the bit list, pbls would = "\x01\x02\x03";
+ */
+ PrioritySingleBitFilter(const char * pbls = NULL)
+ {
+ if (NULL != pbls)
+ {
+ while('\0' != pbls[0])
+ {
+ iv_bitList.push_back(pbls[0]+1);
+ pbls++;
+ }
+ }
+ };
+
+ PrioritySingleBitFilter(const std::vector<uint8_t> & pbls)
+ {
+ iv_bitList = pbls;
+ };
+
+
+ /**
+ Apply filter to bit list
+ @param bit_list : the bit list to filter
+ @pre none
+ @post Bit list will only have one value - the one with the highest
+ priority. If multiple values have equally highest priority then the first
+ value in the list is used.
+ @return true of bit list was modified otherwise false
+ @note If the bit list is empty then it will be left empty.
+ */
+ virtual bool Apply(prdfBitKey & bit_list);
+
+private: // functions
+private: // Data
+
+ std::vector<uint8_t> iv_bitList;
+
+};
+
+//! prdfFilterTranspose
+/*!
+ prdfFilterTranspose transposes an exactly matching key to a single bit. If there is not an
+ exact match, the key is not modified.
+*/
+class prdfFilterTranspose : public prdfFilterPriority
+{
+public:
+
+ /**
+ Constructor
+ \param i_bitKey bit list key
+ \param iBitPos bit to set if i_bitKey matches target.
+ */
+ prdfFilterTranspose(const prdfBitKey &i_bitKey,uint32_t iBitPos)
+ : prdfFilterPriority(i_bitKey),ivSingleBitPos(iBitPos)
+ {}
+
+ /**
+ Apply filter to bit list
+ \param bit_list : the bit list to filter
+ \pre none
+ \post If the provide BitList exactly matches the internal BitList than the provided
+ bitlist is modified such that all bits are cleared and ivSingleBitPos is set.
+ \return true of bit list was modified otherwise false
+ */
+ virtual bool Apply(prdfBitKey & iBitList);
+
+ /**
+ * Undo the filter Apply()
+ * @post bit_list may be modified
+ * @Return true if bit_list was modified, otherwise false
+ * @Note This function will only Undo the transposition if the transposed result bit is on
+ */
+ virtual bool Undo(prdfBitKey & iBitList);
+
+private: // functions
+private: // Data
+
+ uint32_t ivSingleBitPos;
+
+};
+
+//! SingleBitFilter
+/*!
+ Reduces a BitKey to single bit
+ \code
+ // usually in chip class header file
+ SingleBitFilter sbFilter;
+ ScanCommRegisterChip scr; // @see iipScanCommRegisterChip.h
+ ResolutionMap resMap; // @see prdfResolutionMap.H
+
+ // in ctor of chip class definition
+ ErrorRegisterMask ereg(scr,resMap,&sbFilter);
+ // ...
+ rc = ereg.Analyze(serviceData); // See iipErrorRegisterMask.h
+ // ereg will apply filter before analyzing the error
+ \endcode
+ */
+class SingleBitFilter: public prdfFilter
+{
+public:
+ /*!
+ Constructor
+ */
+ SingleBitFilter(): prdfFilter() {}
+
+ /*!
+ Remove all but one bit from bit_list
+ \param ioBitList Target bit list
+ \returns true if ioBitList was modified otherwise false
+ */
+ virtual bool Apply(prdfBitKey & ioBitList);
+
+private: // functions
+private: // Data
+
+};
+
+
+//! FilterLink
+/*!
+ FilterLink links two FILTER_CLASS types together allowing two filters
+ to act on a single prdfBitKey object.
+ @code
+
+ prdfFilter * foo(prdfFilter & f1, prdfFilter & f2)
+ {
+ prdfFilter * joint = new FilterLink(f1,f2);
+ return joint;
+ }
+ @endcode
+ */
+class FilterLink: public prdfFilter
+{
+public:
+ /**
+ Constructor
+ <ul>
+ <br><b>Parameters: </b> Two Filters to be linked
+ <br><b>Requirements:</b> parm filters objects must exist and be valid
+ <br><b>Promises: </b> Object created
+ <br><b>Exceptions: </b> N/A
+ <br><b>Notes: </b>
+ </ul><br>
+ */
+ FilterLink(prdfFilter & f1, prdfFilter & f2);
+
+ /*
+ Destructor
+ <ul>
+ <br><b>Parameters: </b> None.
+ <br><b>Returns: </b> No value returned
+ <br><b>Requirements:</b> None.
+ <br><b>Promises: </b> None.
+ <br><b>Exceptions: </b> None.
+ <br><b>Notes: </b> Default is sufficient
+ </ul><br>
+ */
+ // ~xspprdFilterLink();
+
+ /**
+ Apply Filter(s)
+ <ul>
+ <br><b>Parameters: </b> reference to a BIT_LIST (see iipbtlst.h)
+ <br><b>Returns: </b> [TRUE | FALSE] - was bit list modified?
+ <br><b>Requirements:</b> None.
+ <br><b>Promises: </b> bit_list is modified (if rc == TRUE)
+ <br><b>Exceptions: </b> N/A
+ <br><b>Notes: </b> calls all the other associated filters
+ </ul><br>
+ */
+ virtual bool Apply ( prdfBitKey & bit_list );
+
+ /**
+ * Undo the filter Apply()
+ * @post bit_list may be modified
+ * @Return true if bit_list was modified, otherwise false
+ */
+ virtual bool Undo(prdfBitKey & iBitList);
+
+private: // functions
+private: // Data
+
+ // may be extended to use a vector if needed
+ prdfFilter & xFilter1;
+ prdfFilter & xFilter2;
+};
+
+
+class SCAN_COMM_REGISTER_CLASS;
+
+//! ScanCommFilter
+/*!
+ ScanCommFilter reads a HW scom register to determin which bits to
+ removes bits from a prdfBitKey object
+ @par Base class prdfFilter
+ @code
+ // This class is useful for Error registers whose bits can be
+ // configured to report different ways depending on another
+ // enable register.
+
+ ScanCommRegister enableScr(...); // see iipScanCommRegisterChip.h
+ ScanCommFilter scfFirXstop(enableScr,INVERT);
+ ScanCommFilter scfFirRer(enableScr,NONINVERT);
+ ScanCommRegister scr(...); // see iipScanCommRegisterChip.h
+ ResolutionMap resMap(...); // see iipResolutionMap.h
+ ErrorRegisterMask eregFirXstop(scr,resMap,&scfFirXstop);
+ ErrorRegisterMask eregFirRer(scr,resMap,&scfFirRer);
+ ...
+ rc = eregFirXstop.Analyze(serviceData); // See iipErrorRegisterMask.h
+ // ereg will apply filter
+ @endcode
+ */
+class ScanCommFilter: public prdfFilter
+{
+public:
+
+ // Enum for use as the second parameter in the constructor.
+ enum InvertValue {
+ NONINVERT = 0x0,
+ INVERT = 0x1
+ };
+
+ /*!
+ Constructor
+ \param r Reference to a scan comm register
+ \param invert whether or not to bit-wise invert the value from the scan comm read
+ */
+ ScanCommFilter(SCAN_COMM_REGISTER_CLASS & i_r, InvertValue invert = NONINVERT)
+ :
+ prdfFilter(),
+ scr(i_r),
+ xInvert(invert)
+ { }
+
+ /*!
+ Turn off bits in bit list based on contents of scan com register
+ @post bit_list may be modified
+ @return true if bit_list was modified, otherwise false
+ */
+ virtual bool Apply(prdfBitKey & bit_list);
+
+private: // functions
+private: // Data
+ SCAN_COMM_REGISTER_CLASS & scr;
+ InvertValue xInvert;
+};
+
+
+inline FilterLink::FilterLink(prdfFilter & f1, prdfFilter & f2)
+: xFilter1(f1), xFilter2(f2) {}
+
+
+#endif
+// Change Log *************************************************************************************
+//
+// Flag Reason Vers Date Coder Description
+// ---- -------- ------- -------- -------- -------------------------------------------------------
+// V400 09/12/94 JST Initial Creation
+// fips 03/19/04 dgilbert Rename to prdfFilter.H added doxygen comments
+// 558003 fips310 06/21/06 dgilbert Add Undo() to filter
+// 582595 fips310 12/12/06 iawillia Update priority sb filter to maintain bit order.
+// End Change Log ********************************************************************************
+
+
diff --git a/src/usr/diag/prdf/common/util/prdfFlyWeight.C b/src/usr/diag/prdf/common/util/prdfFlyWeight.C
new file mode 100755
index 000000000..1df6f46f5
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfFlyWeight.C
@@ -0,0 +1,151 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfFlyWeight.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2000,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+// Module Description **************************************************
+//
+// Description:
+//
+// End Module Description **********************************************
+
+//----------------------------------------------------------------------
+// Includes
+//----------------------------------------------------------------------
+#define prdfFlyWeight_C
+
+#include <prdfFlyWeight.H>
+#include <tracinterface.H>
+#include <iipglobl.h>
+#include <prdfHeapBucketSize.H>
+
+#undef prdfFlyWeight_C
+//----------------------------------------------------------------------
+// User Types
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+// Constants
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+// Macros
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+// Internal Function Prototypes
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+// Global Variables
+//----------------------------------------------------------------------
+
+//---------------------------------------------------------------------
+// Member Function Specifications
+//---------------------------------------------------------------------
+template < class T , uint32_t S >
+FlyWeight<T,S>::~FlyWeight()
+{
+ clear();
+}
+
+//---------------------------------------------------------------------
+
+template < class T, uint32_t S >
+void FlyWeight<T,S>::clear()
+{
+ for(typename HeapType::const_iterator i = iv_heap.begin(); i != iv_heap.end(); ++i)
+ {
+ delete[] (T*)*i;
+ }
+ iv_heap.erase(iv_heap.begin(),iv_heap.end());
+ iv_nextOpen = NULL;
+}
+
+//---------------------------------------------------------------------
+
+template < class T , uint32_t S >
+T & FlyWeight<T,S>::get(const T & key)
+{
+ T * result = NULL;
+ T * current_array = NULL;
+
+ // search to see if we already have one
+ for(typename HeapType::const_iterator i = iv_heap.begin();
+ i != iv_heap.end() && (result == NULL); ++i)
+ {
+ current_array = (T*)*i;
+ for(T * p = current_array;
+ p != (current_array + RoundBucketSize<T,S>::value); ++p)
+ {
+ if (p == iv_nextOpen)
+ break;
+
+ if(*p == key)
+ {
+ result = p;
+ break;
+ }
+ }
+ }
+ if(result == NULL) // didn't find it - add it
+ {
+ if(iv_nextOpen == NULL) // need a new array
+ {
+ current_array = new T[RoundBucketSize<T,S>::value];
+ if(current_array == NULL) // dg00a
+ { // dg00a
+ PRDF_TRAC("PRDF Could not get requested memory"); // dg00a
+ } // dg00a
+ // if the heap of array ptrs is full(or non-existant) then increase capacity by S dg00a
+ if(iv_heap.size() == iv_heap.capacity()) // dg00a
+ { // dg00a
+ iv_heap.reserve(iv_heap.capacity() + RoundBucketSize<T,S>::value); // dg00a
+ } // dg01a
+ iv_heap.push_back(current_array);
+ iv_nextOpen = current_array;
+ }
+
+ *iv_nextOpen = key;
+ result = iv_nextOpen;
+ ++iv_nextOpen;
+ if((current_array != NULL) && // Done to fix BEAM error
+ (iv_nextOpen == (current_array + RoundBucketSize<T,S>::value))) // this array is full
+ {
+ iv_nextOpen = NULL;
+ }
+ }
+ return *result;
+}
+
+#if defined(ESW_SIM_COMPILE)
+#include <iostream>
+#include <iomanip>
+
+//FlyWeightBase::FlyWeightList FlyWeightBase::cv_fwlist; //mp01d
+
+template < class T , uint32_t S >
+void FlyWeight<T,S>::printStats(void)
+{
+ using namespace std;
+ cout << "FlyWeight Memory allowcated = " << (iv_heap.size() * sizeof(T) * RoundBucketSize<T,S>::value) << endl;
+}
+#endif
diff --git a/src/usr/diag/prdf/common/util/prdfFlyWeight.H b/src/usr/diag/prdf/common/util/prdfFlyWeight.H
new file mode 100755
index 000000000..ec9eae1a6
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfFlyWeight.H
@@ -0,0 +1,138 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfFlyWeight.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2002,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 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 PRDFFLYWEIGHT_H
+#define PRDFFLYWEIGHT_H
+/**
+ @file prdfFlyWeight.H
+ @brief Description
+*/
+
+
+//--------------------------------------------------------------------
+// Includes
+//--------------------------------------------------------------------
+
+#include <stdint.h>
+#include <vector>
+
+//--------------------------------------------------------------------
+// Forward References
+//--------------------------------------------------------------------
+//
+//
+
+#if defined(ESW_SIM_COMPILE)
+class FlyWeightBase
+{
+ public:
+ FlyWeightBase() { cv_fwlist.push_back(this); }
+ virtual ~FlyWeightBase() {}
+ virtual void printStats(void) = 0;
+
+ static void report(void)
+ {
+ for(FlyWeightList::iterator i = cv_fwlist.begin(); i != cv_fwlist.end(); ++i)
+ {
+ (*i)->printStats();
+ }
+ }
+
+ typedef std::vector<FlyWeightBase *> FlyWeightList;
+ static FlyWeightList cv_fwlist;
+};
+#endif
+
+/**
+ **One line Class description**
+ @author Doug Gilbert
+ @par T is the type of object to flyweight, S is the size (# of T's) in an allocation
+ unit (minimum number of T's to reserve space for when more storage is needed)
+ @code
+ @endcode
+*/
+template <class T, uint32_t S>
+class FlyWeight
+#if defined(ESW_SIM_COMPILE)
+ : public FlyWeightBase
+#endif
+{
+public:
+ /**
+ Constructor
+ @param
+ @returns
+ @pre
+ @post
+ @see
+ @note
+ */
+ FlyWeight() : iv_nextOpen(NULL) {}
+
+ /**
+ Destructor
+ */
+ ~FlyWeight();
+
+ /**
+ clear all entries
+ @param - none
+ @pre none
+ @post all instances of T are deleted.
+ @note any ponters or references to any of the instances should be reset
+ */
+ void clear();
+
+ /**
+ Get the flyweight version of T - add it if it does not yet exist
+ @param key to search for
+ @returns Reference to T in the flyweight
+ @pre none
+ @post FlyWeight contains one instance of key
+ */
+ T & get(const T & key);
+
+#if defined(ESW_SIM_COMPILE)
+ virtual void printStats(void);
+#endif
+
+private: // functions
+private: // Data
+
+ typedef std::vector< void* > HeapType;
+
+ HeapType iv_heap; // vector of arrays of T
+ T * iv_nextOpen;
+};
+
+
+#endif /* PRDFFLYWEIGHT_H */
+
+// Change Log *****************************************************************
+//
+// Flag Reason Vers Date Coder Description
+// ---- --------- ------- -------- -------- ------------------------------------
+// dgilbert Initial Creation
+// fips222 09/14/04 dgilbert Add clear()
+//
+// End Change Log *************************************************************
diff --git a/src/usr/diag/prdf/common/util/prdfFlyWeightS.C b/src/usr/diag/prdf/common/util/prdfFlyWeightS.C
new file mode 100755
index 000000000..76e001d25
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfFlyWeightS.C
@@ -0,0 +1,306 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfFlyWeightS.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2007,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#include <prdfFlyWeightS.H>
+#include <algorithm>
+#include <prdfHeapBucketSize.H>
+
+//---------------------------------------------------------------------
+// Member Function Specifications
+//---------------------------------------------------------------------
+
+template <typename T, uint32_t S>
+void FlyWeightS<T,S>::clear()
+{
+ for (NeutralV::iterator i = iv_heaps.begin();
+ i != iv_heaps.end();
+ ++i)
+ {
+ delete [] static_cast<HeapType>(*i);
+ }
+ iv_heaps.clear();
+
+ for (NeutralV::iterator i = iv_rows.begin();
+ i != iv_rows.end();
+ ++i)
+ {
+ delete static_cast<RowType*>(*i);
+ }
+ iv_rows.clear();
+
+ iv_size = 0;
+ iv_nextPos = NULL;
+ iv_rowSize = 2;
+ iv_colSize = S;
+}
+
+template <typename T, uint32_t S>
+T & FlyWeightS<T,S>::get(const T & key)
+{
+ HintType l_hint;
+ T * l_val = find(key,l_hint);
+ return (NULL == l_val ? *insert(key,l_hint) : *l_val);
+}
+
+template <typename T, uint32_t S>
+T * FlyWeightS<T,S>::find(const T & key, HintType & o_hint)
+{
+ T * l_rc = NULL;
+
+ // Check for empty case.
+ if (NULL == iv_nextPos)
+ {
+ return NULL;
+ }
+
+ // Search rows for possible entry.
+ NeutralV::iterator rowBegin = iv_rows.begin(),
+ rowEnd = iv_rows.end() - 1;
+
+ while (rowBegin != rowEnd)
+ {
+ size_t l_d = std::distance(rowBegin, rowEnd);
+ l_d /= 2; l_d += 1; // now it is the mid-point.
+
+ if (key >=
+ *static_cast<T *>(*static_cast<RowType *>(rowBegin[l_d])->begin()))
+ {
+ rowBegin += l_d;
+ }
+ else
+ {
+ rowEnd = rowBegin;
+ rowEnd += (l_d - 1);
+ }
+ }
+ o_hint.row = rowEnd;
+
+ // Search column for possible entry.
+ NeutralV * l_row = static_cast<NeutralV*>(*o_hint.row);
+ NeutralV::iterator colBegin = l_row->begin(),
+ colEnd = l_row->end() - 1;
+
+ while (colBegin != colEnd)
+ {
+ size_t l_d = std::distance(colBegin, colEnd);
+ l_d /= 2; l_d += 1; // now it is the mid-point.
+
+ if (key >=
+ *static_cast<T *>(colBegin[l_d]))
+ {
+ colBegin += l_d;
+ }
+ else
+ {
+ colEnd = colBegin;
+ colEnd += (l_d - 1);
+ }
+ }
+ o_hint.col = colBegin;
+
+ // Check if we found one.
+ if (key == *static_cast<T *>(*o_hint.col))
+ l_rc = static_cast<T *>(*o_hint.col);
+
+ // Hint is now pointing to the cell either containing the key or
+ // immediately preceeding where this key would go... unless it is the
+ // first item in the column.
+
+ return l_rc;
+};
+
+template <typename T, uint32_t S>
+T * FlyWeightS<T,S>::insert(const T & key, HintType & i_hint)
+{
+ // Check for new array.
+ if (NULL == iv_nextPos)
+ {
+ HeapType p = this->getHeap();
+ (*p) = key;
+
+ NeutralV::iterator l_row = iv_rows.begin();
+ this->insertRow(l_row, p);
+
+ return p;
+ }
+
+ // Otherwise, hint contains the position immediately preceeding
+ // where this key should go... unless it is the first item in the column.
+
+ // Assign into heap, get pointer to position.
+ HeapType p = this->getHeap();
+ (*p) = key;
+
+ // Check if current row has enough room.
+ if (static_cast<NeutralV *>(*i_hint.row)->size() < iv_colSize)
+ {
+ if (*static_cast<T *>(*i_hint.col) < key)
+ i_hint.col++;
+ static_cast<NeutralV *>(*i_hint.row)->insert(i_hint.col, p);
+ }
+ else // not enough room.
+ {
+ T * l_nextElement = NULL;
+ // Should it go on next list?
+ if (*static_cast<T *>(static_cast<NeutralV *>(*i_hint.row)->back())
+ < key)
+ {
+ l_nextElement = p;
+ }
+ else
+ {
+ l_nextElement =
+ static_cast<T *>(static_cast<NeutralV *>(*i_hint.row)->back());
+ static_cast<NeutralV *>(*i_hint.row)->pop_back();
+
+ if (*static_cast<T *>(*i_hint.col) < key)
+ i_hint.col++;
+ static_cast<NeutralV *>(*i_hint.row)->insert(i_hint.col, p);
+ }
+
+ i_hint.row++;
+ if (i_hint.row == iv_rows.end())
+ this->insertRow(i_hint.row, l_nextElement);
+ else if (static_cast<NeutralV *>(*i_hint.row)->size() < iv_colSize)
+ static_cast<NeutralV *>(*i_hint.row)->insert(
+ static_cast<NeutralV *>(*i_hint.row)->begin(), l_nextElement);
+ else
+ this->insertRow(i_hint.row, l_nextElement);
+
+ }
+
+ return p;
+};
+
+template <typename T, uint32_t S>
+T * FlyWeightS<T,S>::getHeap()
+{
+ iv_size++;
+
+ if (NULL == iv_nextPos)
+ {
+ iv_heaps.push_back(iv_nextPos = new T[RoundBucketSize<T,S>::value]);
+ }
+
+ T * l_rc = iv_nextPos;
+
+ iv_nextPos++;
+ if ((static_cast<T*>(*(iv_heaps.end()-1)) + RoundBucketSize<T,S>::value) == iv_nextPos)
+ {
+ iv_heaps.push_back(iv_nextPos = new T[RoundBucketSize<T,S>::value]);
+ }
+
+ return l_rc;
+};
+
+template <typename T, uint32_t S>
+void FlyWeightS<T,S>::insertRow(FlyWeightS<T,S>::NeutralV::iterator & io_pos,
+ HeapType p)
+{
+ io_pos = iv_rows.insert(io_pos, new RowType);
+ //static_cast<NeutralV *>(*io_pos)->reserve(iv_colSize);
+ static_cast<NeutralV *>(*io_pos)->push_back(p);
+
+ if (iv_rows.size() > iv_rowSize)
+ this->increaseSize();
+};
+
+template <typename T, uint32_t S>
+void FlyWeightS<T,S>::increaseSize()
+{
+ iv_rowSize *= 2;
+ iv_colSize += S;
+
+ // Resize columns.
+ /*
+ for (NeutralV::iterator i = iv_rows.begin();
+ i != iv_rows.end();
+ i++)
+ {
+ static_cast<NeutralV *>(*i)->reserve(iv_colSize);
+ }*/
+
+ // Merge columns.
+ for (NeutralV::iterator i = iv_rows.begin();
+ i != iv_rows.end();
+ i++)
+ {
+ if (*i == NULL)
+ continue;
+
+ bool l_merged = false;
+ NeutralV::iterator i_next = i;
+
+ do
+ {
+ l_merged = false;
+ i_next++;
+
+ while ((*i_next == NULL) && (i_next != iv_rows.end()))
+ i_next++;
+
+ if (i_next == iv_rows.end())
+ continue;
+
+ // If (I0 + I1 < previousCol), merge.
+ if ((iv_colSize - S) >= (static_cast<NeutralV *>(*i)->size() +
+ static_cast<NeutralV *>(*i_next)->size()))
+ {
+ static_cast<NeutralV *>(*i)->insert(
+ static_cast<NeutralV *>(*i)->end(),
+ static_cast<NeutralV *>(*i_next)->begin(),
+ static_cast<NeutralV *>(*i_next)->end());
+
+ delete static_cast<NeutralV *>(*i_next);
+ *i_next = NULL;
+
+ l_merged = true;
+ }
+ } while(l_merged);
+ }
+
+ iv_rows.erase(std::remove(iv_rows.begin(), iv_rows.end(), (void *) NULL),
+ iv_rows.end());
+
+};
+
+/*
+template <typename T, uint32_t S>
+void FlyWeightS<T,S>::print()
+{
+ std::cout << "Size = " << iv_size << std::endl;
+ for (NeutralV::iterator i = iv_rows.begin();
+ i != iv_rows.end();
+ i++)
+ {
+ for (NeutralV::iterator j = static_cast<NeutralV *>(*i)->begin();
+ j != static_cast<NeutralV *>(*i)->end();
+ j++)
+ {
+ std::cout << *static_cast<T *>(*j) << " ";
+ }
+ std::cout << std::endl;
+ }
+
+}
+*/
diff --git a/src/usr/diag/prdf/common/util/prdfFlyWeightS.H b/src/usr/diag/prdf/common/util/prdfFlyWeightS.H
new file mode 100755
index 000000000..3a571e95d
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfFlyWeightS.H
@@ -0,0 +1,75 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfFlyWeightS.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2007,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 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 __PRDF_PRDFFLYWEIGHTS_H
+#define __PRDF_PRDFFLYWEIGHTS_H
+
+#include <stdint.h>
+#include <vector>
+
+template<class T, uint32_t S>
+class FlyWeightS
+{
+ public:
+
+ FlyWeightS() : iv_rowSize(2), iv_colSize(S), iv_nextPos(NULL),
+ iv_size(0)
+ { iv_rows.reserve(iv_rowSize); iv_heaps.reserve(iv_rowSize); };
+
+ ~FlyWeightS() { this->clear(); };
+
+ void clear();
+
+ T & get(const T & key);
+
+ //void print();
+
+ private:
+
+ typedef std::vector<void *> NeutralV;
+ typedef std::vector<void *> RowType;
+ typedef T* ColType;
+ typedef T* HeapType;
+
+ typedef struct { NeutralV::iterator row; NeutralV::iterator col;}
+ HintType;
+
+ size_t iv_rowSize;
+ size_t iv_colSize;
+ NeutralV iv_rows;
+ NeutralV iv_heaps;
+ HeapType iv_nextPos;
+
+ size_t iv_size;
+
+ private:
+
+ T * find(const T & key, HintType & o_hint);
+ T * insert(const T & key, HintType & i_hint);
+ T * getHeap();
+ void insertRow(NeutralV::iterator & io_pos, HeapType p);
+
+ void increaseSize();
+};
+
+#endif
diff --git a/src/usr/diag/prdf/common/util/prdfHeapBucketSize.H b/src/usr/diag/prdf/common/util/prdfHeapBucketSize.H
new file mode 100755
index 000000000..cd66d0f72
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfHeapBucketSize.H
@@ -0,0 +1,81 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfHeapBucketSize.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 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 PRDFHEAPBUCKETSIZE_H
+#define PRDFHEAPBUCKETSIZE_H
+
+
+//--------------------------------------------------------------------
+// Includes
+//--------------------------------------------------------------------
+#ifdef __HOSTBOOT_MODULE
+ #include <kernel/heapmgr.H>
+#endif
+
+
+
+#ifdef __HOSTBOOT_MODULE
+template <uint32_t bucket>
+struct HeapBucketSize
+{
+ static const size_t value = HeapBucketSize<bucket-1>::value +
+ HeapBucketSize<bucket-2>::value;
+};
+
+template <>
+struct HeapBucketSize<0>
+{
+ static const size_t value = HeapManager::BUCKET_SIZE0;
+};
+
+template <>
+struct HeapBucketSize<1>
+{
+ static const size_t value = HeapManager::BUCKET_SIZE1;
+};
+
+template <typename T, uint32_t S, uint32_t bucket = 0>
+struct RoundBucketSize
+{
+ static const size_t value =
+ (sizeof(T) * S > (HeapBucketSize<bucket>::value - sizeof(uint64_t))) ?
+ (RoundBucketSize<T,S, bucket+1>::value) :
+ ((HeapBucketSize<bucket>::value - sizeof(uint64_t)) / sizeof(T));
+};
+
+template <typename T, uint32_t S>
+struct RoundBucketSize<T,S,HeapManager::BUCKETS>
+{
+ static const size_t value = S;
+};
+
+#else
+template <typename T, uint32_t S>
+struct RoundBucketSize
+{
+ static const size_t value = S;
+};
+#endif
+
+
+#endif // define PRDFHEAPBUCKETSIZE_H
diff --git a/src/usr/diag/prdf/common/util/prdfRegisterData.C b/src/usr/diag/prdf/common/util/prdfRegisterData.C
new file mode 100755
index 000000000..04aaa6208
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfRegisterData.C
@@ -0,0 +1,37 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfRegisterData.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2005,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#include <prdfRegisterData.H>
+
+PrdrRegIdTable & prdfGetRegisterIdTable()
+{
+ static PrdrRegIdTable l_idTable = PrdrRegIdTable();
+ return l_idTable;
+}
+
+PrdrErrSigTable & prdfGetErrorSigTable()
+{
+ static PrdrErrSigTable l_sigTable = PrdrErrSigTable();
+ return l_sigTable;
+}
+
diff --git a/src/usr/diag/prdf/common/util/prdfRegisterData.H b/src/usr/diag/prdf/common/util/prdfRegisterData.H
new file mode 100755
index 000000000..80f073384
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfRegisterData.H
@@ -0,0 +1,97 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfRegisterData.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2005,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 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 __PRDRERRLPLUGINSUPT_H
+#define __PRDRERRLPLUGINSUPT_H
+
+#define __PRDR_PLUGIN_HOMTYPE uint32_t
+#define __PRDR_PLUGIN_IDTYPE uint32_t
+
+#define __PRDR_PLUGIN_XY(X,Y,Z) X##Y##_##Z
+#define __PRDR_PLUGIN_MAKENAME(X,Y,Z) __PRDR_PLUGIN_XY(X,Y,Z)
+
+#ifndef PRDR_REGISTER_ID_TABLE_START
+ #define PRDR_REGISTER_ID_TABLE_START( homtype, offset) \
+ class __PRDR_PLUGIN_MAKENAME(PrdrPlugin_RegTable_Reg_, homtype, offset)\
+ { \
+ public: \
+ __PRDR_PLUGIN_MAKENAME(PrdrPlugin_RegTable_Reg_, \
+ homtype, offset)(); \
+ private: \
+ struct __table_struct \
+ { \
+ uint32_t id; \
+ char * name; \
+ char * brief; \
+ uint32_t address; \
+ }; \
+ static __table_struct cv_table[]; \
+ }; \
+ __PRDR_PLUGIN_MAKENAME(PrdrPlugin_RegTable_Reg_, homtype, offset) \
+ __PRDR_PLUGIN_MAKENAME(g_PrdrPlugin_RegTable_Reg_, homtype, offset);\
+ __PRDR_PLUGIN_MAKENAME(PrdrPlugin_RegTable_Reg_, homtype, offset)::\
+ __PRDR_PLUGIN_MAKENAME(PrdrPlugin_RegTable_Reg_, homtype, offset)() \
+ { \
+ __PRDR_PLUGIN_HOMTYPE l_homtype = homtype; \
+ __table_struct * l_tablePtr = cv_table; \
+ while (NULL != l_tablePtr->name) \
+ { \
+ prdfGetRegisterIdTable()[l_homtype][l_tablePtr->id].name = \
+ l_tablePtr->name; \
+ prdfGetRegisterIdTable()[l_homtype][l_tablePtr->id].addr = \
+ l_tablePtr->address; \
+ l_tablePtr++; \
+ } \
+ } \
+ __PRDR_PLUGIN_MAKENAME(PrdrPlugin_RegTable_Reg_, homtype, offset):: \
+ __table_struct \
+ __PRDR_PLUGIN_MAKENAME(PrdrPlugin_RegTable_Reg_, homtype, offset):: \
+ cv_table[] = \
+ {
+
+ #define PRDR_REGISTER_ID( id , name, brief, address ) \
+ { id , #name , brief, address } ,
+
+ #define PRDR_REGISTER_ID_TABLE_END \
+ { 0, NULL, NULL, 0 } \
+ };
+#endif
+
+#include <map>
+#include <stdint.h>
+
+typedef std::map<__PRDR_PLUGIN_IDTYPE, const char *> PrdrErrSigEntries;
+typedef std::map<__PRDR_PLUGIN_HOMTYPE, PrdrErrSigEntries> PrdrErrSigTable;
+
+struct PrdrRegIdStruct
+{
+ const char * name;
+ uint32_t addr;
+};
+
+typedef std::map<__PRDR_PLUGIN_IDTYPE, PrdrRegIdStruct> PrdrRegIdEntries;
+typedef std::map<__PRDR_PLUGIN_HOMTYPE, PrdrRegIdEntries> PrdrRegIdTable;
+
+PrdrRegIdTable & prdfGetRegisterIdTable();
+
+#endif
diff --git a/src/usr/diag/prdf/common/util/prdfTimer.H b/src/usr/diag/prdf/common/util/prdfTimer.H
new file mode 100755
index 000000000..30b369e7f
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/prdfTimer.H
@@ -0,0 +1,244 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/prdfTimer.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2002,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 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 PRDFTIMER_H
+#define PRDFTIMER_H
+/*!
+ @file prdfTimer.H
+ @brief PRD timer support
+*/
+
+
+//--------------------------------------------------------------------
+// Includes
+//--------------------------------------------------------------------
+
+
+#if !defined(__GNUC__)
+ typedef unsigned int uint32_t;
+
+ #include <xsptodtypes.h>
+
+ #if __IBMCPP__ < 500
+
+ #include <bool.h>
+
+ #endif
+
+#endif
+
+
+//--------------------------------------------------------------------
+// Forward References
+//--------------------------------------------------------------------
+
+/**
+ PrdTimer
+ @author Doug Gilbert
+ @par A PrdTimer holds the number of seconds since the beginning
+ of the year
+*/
+class PrdTimer
+{
+public:
+ enum
+ {
+ SEC_IN_DAY = 86400,
+ HALF_YEAR = 15768000, //
+ YEAR = 31536000 // except leap year - put we don't that kind of accuracy
+// HALF_WEEK = 302400, // seconds in a half week
+// WEEK = 604800
+ };
+
+ struct prdftm_t
+ {
+ int sec;
+ int min;
+ int hour;
+ int wday;
+ int mday;
+ int yday;
+ int mon;
+ int year;
+
+ prdftm_t() :
+ sec(0), min(0), hour(0), wday(0),
+ mday(0), yday(0), mon(0), year(0) {}
+ prdftm_t(int i_sec,int i_min,int i_hour,int i_wday,
+ int i_mday,int i_yday,int i_mon,int i_year) :
+ sec(i_sec), min(i_min), hour(i_hour), wday(i_wday),
+ mday(i_mday), yday(i_yday), mon(i_mon), year(i_year) {}
+ };
+
+ /**
+ Default Constructor
+ */
+ PrdTimer() :xSec(0),ivTm()
+ {
+ }
+
+
+ /**
+ Ctor from uint32 seconds since the beginning of the year
+ @param seconds since the beginning of the year
+ @note If seconds > seconds_in_year then reduced by seconds_in_year
+ until seconds < seconds_in_year
+ */
+ PrdTimer(unsigned int seconds)
+ : xSec(seconds % YEAR) {}
+
+#if !defined(__GNUC__)
+ /**
+ Constructor from a BIN_TIME_TYPE
+ @see xsptodtypes.h
+ */
+ PrdTimer(const BIN_TIME_TYPE & b)
+ :xSec( b.seconds +
+ (b.minutes * 60) +
+ (b.hours * 3600) +
+ (b.day_of_month * SEC_IN_DAY +
+ month_base[b.month])
+ )
+ {}
+#endif
+
+
+ /**
+ Copy Constructor
+ */
+ PrdTimer(const PrdTimer & t) : xSec(t.xSec), ivTm(t.ivTm) {}
+
+ /**
+ Assignment from another PrdTime object
+ */
+ const PrdTimer & operator=(const PrdTimer & t)
+ { xSec = t.xSec; ivTm = t.ivTm; return *this; }
+
+#if !defined(__GNUC__)
+ /**
+ Assignment from a BIN_TIME_TYPE.
+ @see xsptodtypes.h
+ */
+ const PrdTimer & operator=(const BIN_TIME_TYPE & b)
+ {
+ xSec = b.seconds + (b.minutes * 60) +
+ (b.hours * 3600) + (b.day_of_month*SEC_IN_DAY) + month_base[b.month];
+ return *this;
+ }
+#else
+ /**
+ Assignment from a uint64
+ If seconds > seconds_in_year then reduced by seconds_in_year
+ until seconds < seconds_in_year
+ */
+ const PrdTimer & operator=(const uint64_t & b)
+ {
+ xSec = b % YEAR;
+ return *this;
+ }
+#endif
+
+ /// equivalancy
+ bool operator==(const PrdTimer & t) const
+ {
+ return (xSec == t.xSec);
+ }
+
+
+ /**
+ Greater than
+ @return true if this > t2 and this - t2 < HALF_YEAR (no wrap)
+ OR this < t2 and t2 - xSec > HALF_YEAR (timer wrapped)
+ otherwise false
+ */
+ bool operator>(const PrdTimer & t2) const
+ {
+ return ( ((xSec > t2.xSec) && (xSec - t2.xSec < HALF_YEAR)) ||
+ ((xSec < t2.xSec) && (t2.xSec - xSec > HALF_YEAR)));
+ }
+
+
+ /**
+ Add seconds to the timer.
+ Internal timer value is wraped as needed
+ */
+ PrdTimer operator+(unsigned int seconds) const
+ {
+ seconds = seconds % YEAR;
+ seconds += xSec;
+ seconds = seconds % YEAR;
+ return seconds;
+ }
+
+ // diff time
+ unsigned int operator-(const PrdTimer & t) const { return (xSec - t.xSec); }
+
+ // get seconds since the beginning of the year
+ unsigned int getSec() const { return xSec; }
+
+ // get time struct
+ prdftm_t gettm() const { return ivTm; }
+
+ // set time struct
+ void settm(prdftm_t& i_tm)
+ {
+ ivTm = i_tm;
+ xSec = ( ivTm.sec +
+ (ivTm.min * 60) +
+ (ivTm.hour * 3600) +
+ (ivTm.yday * SEC_IN_DAY) );
+ }
+
+private: // functions
+private: // Data
+
+ uint32_t xSec; ///< Seconds since the beginning of the year (USA)
+ prdftm_t ivTm;
+
+#if !defined(__GNUC__)
+static uint32_t month_base[12]; // # of seconds since start of year at start of month
+#endif
+};
+
+#if !defined(__GNUC__)
+#if defined(iipResolution_C)
+uint32_t PrdTimer::month_base[12] =
+{
+ 0,
+ SEC_IN_DAY * 31,
+ SEC_IN_DAY * (31+28),
+ SEC_IN_DAY * (31+28+31),
+ SEC_IN_DAY * (31+28+31+30),
+ SEC_IN_DAY * (31+28+31+30+31),
+ SEC_IN_DAY * (31+28+31+30+31+30),
+ SEC_IN_DAY * (31+28+31+30+31+30+31),
+ SEC_IN_DAY * (31+28+31+30+31+30+31+31),
+ SEC_IN_DAY * (31+28+31+30+31+30+31+31+30),
+ SEC_IN_DAY * (31+28+31+30+31+30+31+31+30+31),
+ SEC_IN_DAY * (31+28+31+30+31+30+31+31+30+31+30)
+};
+#endif
+#endif
+
+
+#endif /* PRDFTIME_H */
diff --git a/src/usr/diag/prdf/common/util/xspprdFilterLink.h b/src/usr/diag/prdf/common/util/xspprdFilterLink.h
new file mode 100755
index 000000000..3fd0b91c0
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/xspprdFilterLink.h
@@ -0,0 +1,26 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/xspprdFilterLink.h $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2001,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#if !defined(PRDFFILTER_H)
+#include <prdfFilters.H>
+#endif
diff --git a/src/usr/diag/prdf/common/util/xspprdScanCommFilter.h b/src/usr/diag/prdf/common/util/xspprdScanCommFilter.h
new file mode 100755
index 000000000..a64820fe9
--- /dev/null
+++ b/src/usr/diag/prdf/common/util/xspprdScanCommFilter.h
@@ -0,0 +1,26 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/diag/prdf/common/util/xspprdScanCommFilter.h $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2001,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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#if !defined(PRDFFILTER_H)
+#include <prdfFilters.H>
+#endif
OpenPOWER on IntegriCloud