diff options
| author | Prem Shanker Jha <premjha2@in.ibm.com> | 2013-09-20 07:40:14 -0500 |
|---|---|---|
| committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-12-01 18:51:43 -0600 |
| commit | 554aa3dbb530d6da0de7c83bf23346ae5f6032eb (patch) | |
| tree | 572c61c8da5932bd593804ddef39e78ccc2076f2 /src/usr/diag/prdf/common/util | |
| parent | 90b6464a0364c1bb86ad490c3807dcbbaab3b26b (diff) | |
| download | talos-hostboot-554aa3dbb530d6da0de7c83bf23346ae5f6032eb.tar.gz talos-hostboot-554aa3dbb530d6da0de7c83bf23346ae5f6032eb.zip | |
PRDF: Added support for secondary filter in rule code.
- Secondary filter basically mask the certain bits.
As a result it is possible to divide FIR analysis
in two phase. This filter is intended to filter out
secondary bits during first phase of analysis.
Change-Id: Ib42b269d2e9fd5588b58950949c379bdc8518bfc
RTC: 85130
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/6288
Tested-by: Jenkins Server
Reviewed-by: Christopher T. Phan <cphan@us.ibm.com>
Reviewed-by: Bilicon Patil <bilpatil@in.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Reviewed-by: Zane Shelley <zshelle@us.ibm.com>
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/14572
Diffstat (limited to 'src/usr/diag/prdf/common/util')
| -rwxr-xr-x | src/usr/diag/prdf/common/util/prdfBitKey.C | 69 | ||||
| -rwxr-xr-x | src/usr/diag/prdf/common/util/prdfBitKey.H | 12 | ||||
| -rwxr-xr-x | src/usr/diag/prdf/common/util/prdfFilters.C | 180 | ||||
| -rwxr-xr-x | src/usr/diag/prdf/common/util/prdfFilters.H | 627 |
4 files changed, 428 insertions, 460 deletions
diff --git a/src/usr/diag/prdf/common/util/prdfBitKey.C b/src/usr/diag/prdf/common/util/prdfBitKey.C index c0e5bb61e..82970a233 100755 --- a/src/usr/diag/prdf/common/util/prdfBitKey.C +++ b/src/usr/diag/prdf/common/util/prdfBitKey.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2004,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -35,17 +37,18 @@ namespace PRDF { -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // Local -//------------------------------------------------------------------------------------------------- -inline uint32_t getWordSize(uint32_t bitCount) // # of bit32's needed for this bit_count +//------------------------------------------------------------------------------ +// # of bit32's needed for this bit_count +inline uint32_t getWordSize(uint32_t bitCount) { return (bitCount/32) + ((bitCount%32)? 1:0); } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // member function definitions -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ BitKey::BitKey(void) : iv_Capacity(0), iv_storage1(0) @@ -53,7 +56,7 @@ BitKey::BitKey(void) iv_rep.storage2 = 0; } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ BitKey::BitKey(uint32_t i_bitPos) : iv_Capacity(0), iv_storage1(0) @@ -62,7 +65,7 @@ BitKey::BitKey(uint32_t i_bitPos) setBit(i_bitPos); } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ BitKey::BitKey(const uint8_t * i_array,uint8_t i_size) : iv_Capacity(0), iv_storage1(0) @@ -76,7 +79,21 @@ BitKey::BitKey(const uint8_t * i_array,uint8_t i_size) } } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ + +BitKey::BitKey( const std::vector <uint8_t> & i_bitList ) + : iv_Capacity(0), iv_storage1(0) +{ + iv_rep.storage2 = 0; + std::vector< uint8_t >::const_iterator itList = i_bitList.begin(); + while( itList != i_bitList.end() ) + { + setBit( *itList ); + itList++; + } +} + +//------------------------------------------------------------------------------ BitKey::BitKey(const char * i_ble) : iv_Capacity(0), iv_storage1(0) @@ -89,14 +106,14 @@ BitKey::BitKey(const char * i_ble) } } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ BitKey::~BitKey(void) { if(!IsDirect()) delete [] iv_rep.buffer; } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ BitKey::BitKey (const BitKey & bit_list) : iv_Capacity(bit_list.iv_Capacity), iv_storage1(bit_list.iv_storage1) @@ -113,7 +130,7 @@ BitKey::BitKey (const BitKey & bit_list) } } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ BitKey & BitKey::operator=(const BitKey & bit_list) { @@ -143,7 +160,7 @@ BitKey & BitKey::operator=(const BitKey & bit_list) return(*this); } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ BitKey & BitKey::operator=(const BitString & bit_string) { @@ -158,7 +175,7 @@ BitKey & BitKey::operator=(const BitString & bit_string) return(*this); } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ BitKey & BitKey::operator=(const char * string_ptr) { @@ -177,7 +194,7 @@ BitKey & BitKey::operator=(const char * string_ptr) return(*this); } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ bool BitKey::operator==(const BitKey & that) const { @@ -212,7 +229,7 @@ bool BitKey::operator==(const BitKey & that) const } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // Candidate funciton for bs class bool BitKey::isSubset(const BitKey & that) const @@ -223,9 +240,11 @@ bool BitKey::isSubset(const BitKey & that) const 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== + // size can be non-zero with no bits on - so if that has no bits than use + // operator== BitKey zero; - if(that == zero) result = operator==(that); // only true if both are empty - eg not bits on" + // only true if both are empty - eg not bits on" + if(that == zero) result = operator==(that); // 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) @@ -243,7 +262,7 @@ bool BitKey::isSubset(const BitKey & that) const return result; } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // get bit position of nth bit that is set uint32_t BitKey::getListValue(uint32_t n) const @@ -265,7 +284,7 @@ uint32_t BitKey::getListValue(uint32_t n) const return bitPos; } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ uint32_t BitKey::size(void) const { @@ -273,7 +292,7 @@ uint32_t BitKey::size(void) const return bs.GetSetCount(); } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ void BitKey::removeBit(uint32_t n) { @@ -284,7 +303,7 @@ void BitKey::removeBit(uint32_t n) } } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ void BitKey::removeBit(void) { @@ -301,7 +320,7 @@ void BitKey::removeBit(void) } } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ void BitKey::removeBits(const BitKey & i_bk) { @@ -310,7 +329,7 @@ void BitKey::removeBits(const BitKey & i_bk) mybs.Mask(yobs); } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ void BitKey::setBit(uint32_t i_bitValue) { @@ -322,7 +341,7 @@ void BitKey::setBit(uint32_t i_bitValue) bs.Set(i_bitValue); } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ void BitKey::ReAllocate(uint32_t i_len) { diff --git a/src/usr/diag/prdf/common/util/prdfBitKey.H b/src/usr/diag/prdf/common/util/prdfBitKey.H index 1bfaa96a4..964b14660 100755 --- a/src/usr/diag/prdf/common/util/prdfBitKey.H +++ b/src/usr/diag/prdf/common/util/prdfBitKey.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2004,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -29,6 +31,7 @@ #define PRDFBITLKEY_H #include <prdf_types.h> +#include <vector> namespace PRDF { @@ -127,8 +130,13 @@ class BitKey */ BitKey(const char * i_ble); + /** + * @brief constructor from vector of bits + * @param i_bitList list of FIR bit position + */ + BitKey( const std::vector <uint8_t> & i_bitList ); //! Copy Constructor - BitKey (const BitKey & bit_list); + BitKey ( const BitKey & bit_list ); //! Destructor ~BitKey(void); diff --git a/src/usr/diag/prdf/common/util/prdfFilters.C b/src/usr/diag/prdf/common/util/prdfFilters.C index 8d25656eb..141688bf3 100755 --- a/src/usr/diag/prdf/common/util/prdfFilters.C +++ b/src/usr/diag/prdf/common/util/prdfFilters.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 1996,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -35,9 +37,9 @@ #include <prdfBitKey.H> #include <prdfFilters.H> //#include <xspprdScanCommFilter.h> -#include <iipscr.h> //#include <xspprdFilterLink.h> - +#include <iipstep.h> +#include <iipServiceDataCollector.h> #undef iipFilters_C namespace PRDF @@ -69,49 +71,50 @@ namespace PRDF FilterClass::~FilterClass(void) {} -//------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------- -bool FilterPriority::Apply(BitKey & ioBitList) +bool FilterPriority::Apply( BitKey & ioBitList, STEP_CODE_DATA_STRUCT & io_sdc ) { - bool modified = false; - if(ioBitList.isSubset(ivBitKey)) - { - ioBitList = ivBitKey; - modified = true; - } - return modified; + bool modified = false; + if( ioBitList.isSubset(ivBitKey) ) + { + ioBitList = ivBitKey; + modified = true; + } + return modified; } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ -bool SingleBitFilter::Apply(BitKey & bit_list) +bool SingleBitFilter::Apply( BitKey & bit_list, STEP_CODE_DATA_STRUCT & io_sdc ) { - bool rc = false; - uint32_t list_length = bit_list.size(); - if(list_length > 1) - { - rc = true; - while(--list_length) + bool rc = false; + uint32_t list_length = bit_list.size(); + if( list_length > 1 ) { - bit_list.removeBit(); + rc = true; + while( --list_length ) + { + bit_list.removeBit(); + } } - } - return(rc); + return( rc ); } -//------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------- -bool PrioritySingleBitFilter::Apply(BitKey & bit_list) +bool PrioritySingleBitFilter::Apply( BitKey & bit_list, + STEP_CODE_DATA_STRUCT & io_sdc ) { bool l_modified = false; // Do priority bit. - for (size_t i = 0; i < iv_bitList.size(); i++) + for ( size_t i = 0; i < iv_bitList.size(); i++ ) { BitKey l_key = iv_bitList[i]; - if (bit_list.isSubset(l_key)) + if ( bit_list.isSubset(l_key) ) { l_modified = true; bit_list = l_key; @@ -119,9 +122,9 @@ bool PrioritySingleBitFilter::Apply(BitKey & bit_list) } } // Do single bit filter portion. - if (!l_modified) + if ( !l_modified ) { - while (1 < bit_list.size()) + while ( 1 < bit_list.size() ) { l_modified = true; bit_list.removeBit(); @@ -130,93 +133,72 @@ bool PrioritySingleBitFilter::Apply(BitKey & bit_list) return l_modified; } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ -bool FilterTranspose::Apply(BitKey & iBitList) +bool FilterTranspose::Apply( BitKey & iBitList, STEP_CODE_DATA_STRUCT & io_sdc ) { - bool result = false; - if(iBitList == ivBitKey) - { - BitKey bk(ivSingleBitPos); - iBitList = bk; - result = true; - } - return result; + bool result = false; + if(iBitList == ivBitKey) + { + BitKey bk(ivSingleBitPos); + iBitList = bk; + result = true; + } + return result; } bool FilterTranspose::Undo(BitKey & iBitList) { - bool result = false; - BitKey testbl(ivSingleBitPos); - if(iBitList.isSubset(testbl)) - { - iBitList = ivBitKey; - result = true; - } - - return result; + bool result = false; + BitKey testbl(ivSingleBitPos); + if(iBitList.isSubset(testbl)) + { + iBitList = ivBitKey; + result = true; + } + + return result; } -//------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------- -bool FilterLink::Apply(BitKey & bit_list) +bool FilterLink::Apply( BitKey & bit_list, STEP_CODE_DATA_STRUCT & io_sdc ) { - bool rc = xFilter1.Apply(bit_list); - rc = rc || xFilter2.Apply(bit_list); - return rc; + bool rc = xFilter1.Apply( bit_list, io_sdc ); + rc = rc || xFilter2.Apply( bit_list,io_sdc ); + return rc; } -bool FilterLink::Undo(BitKey & bit_list) +bool FilterLink::Undo( BitKey & bit_list ) { - bool rc = xFilter1.Undo(bit_list); - rc = rc || xFilter2.Undo(bit_list); - return rc; + bool rc = xFilter1.Undo(bit_list); + rc = rc || xFilter2.Undo(bit_list); + return rc; } -//------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------ -bool ScanCommFilter::Apply(BitKey & bitList) +bool SecondaryBitsFilter::Apply( BitKey & io_bitList, + STEP_CODE_DATA_STRUCT & io_sdc ) { - // Read HW register - scr.Read(); - - // local copy of bit string from scan comm register - BIT_STRING_BUFFER_CLASS bsb(*scr.GetBitString()); - BitKey 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); + bool l_modified = false; + do + { + // if it is not a primary pass then we need not apply this filter. + // so continuing with usual flow. + if( !( io_sdc.service_data )->isPrimaryPass( ) ) break; + //if there is no secondary bit position to flip or if no bit is set in + //bit key then let us skip this apply. + if( ( 0 == iv_secBitList.size() ) || ( 0 == io_bitList.size()) ) break; + + BitKey l_key ( iv_secBitList ); + io_bitList.removeBits( l_key ); + l_modified = true; + + }while(0); + + return l_modified; } + } //End namespace PRDF -// 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 Filters.C;rewrote PrioritySingleBitFilter -// changed to use BitKey -// 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 index 932f53d51..bdad805d8 100755 --- a/src/usr/diag/prdf/common/util/prdfFilters.H +++ b/src/usr/diag/prdf/common/util/prdfFilters.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2004,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -36,7 +38,6 @@ #if !defined(PRDFBITLKEY_H) #include <prdfBitKey.H> #endif - #include <vector> namespace PRDF @@ -46,157 +47,159 @@ namespace PRDF /*--------------------------------------------------------------------*/ class BitKey; +struct STEP_CODE_DATA_STRUCT; /*--------------------------------------------------------------------*/ /* User Types */ /*--------------------------------------------------------------------*/ /** - FilterClass Specifies and interface for removing unwanted bits from a BitKey. - Abstract base class - @see BitKey -*/ + * @brief Defines FilterClass + * Describes interface for removing unwanted bits from a BitKey. + * It is a abstract base class. + * see BitKey + */ class FilterClass { -public: - - - /** - Destructor. This implementation does nothing - */ - virtual ~FilterClass(void); - - - /** - Apply filter to the BitKey. - @post bit_list may be modified - @return true if bit_list was modified, otherwise false - */ - virtual bool Apply(BitKey & 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(BitKey & io_bit_list) { return false; } - -protected: - - /** - Default Constructor - @note The default compiler generated copy constructor and assignment operator - are adaquate. - */ - FilterClass(void) {} + public: + + /** + * @brief Destructor. This implementation does nothing + */ + virtual ~FilterClass(void); + + /** + * @brief Applies filter on given bitkey + * @param i_bitList bitkey on which filter acts. + * @param io_sdc reference to STEP_CODE_DATA struct. + * @return true if bit key is modified false otherwise. + */ + virtual bool Apply( BitKey & io_bit_list, + STEP_CODE_DATA_STRUCT & io_sdc ) = 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(BitKey & io_bit_list) { return false; } + + protected: + + /** + * @brief Default Constructor + * @note The default compiler generated copy constructor and assignment + * operator are adaquate. + */ + FilterClass(void) {} }; -//! FilterPriority -/*! - FilterPriority 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 FilterPriority : public FilterClass -{ -public: - - /*! - Constructor - \param i_bld ptr bit list string encoding - */ - FilterPriority(const char * i_ble) - : ivBitKey(i_ble) - {} - - - /*! - Constructor - \param iBitList BitKey - */ - FilterPriority(const BitKey & iBitList) - : ivBitKey(iBitList) - {} +/** @brief description of FilterPriority filter. - /*! - Apply the filter to a bit list - \param ioBitList to apply filter to - \returns true if iBitList modified otherwise false - */ - virtual bool Apply(BitKey & ioBitList); + * FilterPriority 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. -protected: + * Examples: + * Priority BitKey: ("1") + * Original BitKey: ("1", "5", "31") + * Filtered BitKey: ("1") + * Priority BitKey: ("1") + * Original BitKey: ("5", "31") + * Filtered BitKey: ("5", "31") - BitKey ivBitKey; + * 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") + */ +class FilterPriority : public FilterClass +{ + public: + + /** + * @brief Constructor + * @param i_ble ptr bit list string encoding + */ + FilterPriority(const char * i_ble) + : ivBitKey(i_ble) + {} + + + /*! + Constructor + \param iBitList BitKey + */ + FilterPriority(const BitKey & iBitList) + : ivBitKey(iBitList) + {} + + /** + * @brief Applies priority filter on given bitkey. + * @param i_bitList bitkey on which filter acts. + * @param io_sdc reference to STEP_CODE_DATA struct. + * @return true if bit key is modified false otherwise. + */ + virtual bool Apply( BitKey & ioBitList, STEP_CODE_DATA_STRUCT & io_sdc ); + + protected: + + BitKey ivBitKey; }; //! PrioritySingleBitFilter /*! - PrioritySingleBitFilter removes all but one bit from a BitKey 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 BitKey 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. +PrioritySingleBitFilter removes all but one bit from a BitKey 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 BitKey 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 FilterClass { -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) + public: + + /** + * @brief Constructor + * @param pbls 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) { @@ -208,243 +211,199 @@ public: } }; - PrioritySingleBitFilter(const std::vector<uint8_t> & 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(BitKey & bit_list); + /** + * @brief Apply filter to bitkey. + * 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. + * @param i_bitList bitkey on which seondary filter need to act. + * @param io_sdc reference to STEP_CODE_DATA struct. + * @return true if bit key is modified false otherwise. + */ + virtual bool Apply( BitKey & ioBitList, STEP_CODE_DATA_STRUCT & io_sdc ); -private: // functions -private: // Data + private: // functions + private: // Data - std::vector<uint8_t> iv_bitList; + std::vector<uint8_t> iv_bitList; }; -//! FilterTranspose -/*! - FilterTranspose transposes an exactly matching key to a single bit. If there is not an - exact match, the key is not modified. -*/ +/** + * @brief FilterTranspose + + * FilterTranspose transposes an exactly matching key to a single bit. If there + * is not an exact match, the key is not modified. + */ class FilterTranspose : public FilterPriority { -public: - - /** - Constructor - \param i_bitKey bit list key - \param iBitPos bit to set if i_bitKey matches target. - */ - FilterTranspose(const BitKey &i_bitKey,uint32_t iBitPos) - : FilterPriority(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(BitKey & 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(BitKey & iBitList); - -private: // functions -private: // Data - - uint32_t ivSingleBitPos; + public: + + /** + Constructor + \param i_bitKey bit list key + \param iBitPos bit to set if i_bitKey matches target. + */ + FilterTranspose(const BitKey &i_bitKey,uint32_t iBitPos) + : FilterPriority(i_bitKey),ivSingleBitPos(iBitPos) + {} + + /** + * @brief Applies transpose filter on given bitlist + * If the provide BitList exactly matches the internal BitList than + * the provid bitlist is modified such that all bits are cleared and + * ivSingleBitPos is set. + * @param i_bitList bitkey on which filter acts. + * @param io_sdc reference to STEP_CODE_DATA struct. + * @return true if bit key is modified false otherwise. + */ + virtual bool Apply( BitKey & ioBitList, STEP_CODE_DATA_STRUCT & io_sdc ); + + /** + * 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(BitKey & 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 +/** + * @brief Description of interface for SingleBitFilter. + * + * reduces a BitKey to single bit e.g. + * .... + * ErrorRegisterMask ereg(scr,resMap,&sbFilter); + * rc = ereg.Analyze(serviceData); ( See iipErrorRegisterMask.h ) + * ereg will apply filter before analyzing the error */ + class SingleBitFilter: public FilterClass { -public: - /*! - Constructor - */ - SingleBitFilter(): FilterClass() {} - - /*! - Remove all but one bit from bit_list - \param ioBitList Target bit list - \returns true if ioBitList was modified otherwise false - */ - virtual bool Apply(BitKey & ioBitList); - -private: // functions -private: // Data + public: + + /** + @param Constructor + */ + SingleBitFilter(): FilterClass() {} + + /** + * @brief joins two different filter such that one acts after other. + * @param i_bitList bitkey on which SingleBitFilter filter acts. + * @param io_sdc reference to STEP_CODE_DATA struct. + * @return true if bit key is modified false otherwise. + */ + virtual bool Apply( BitKey & ioBitList, STEP_CODE_DATA_STRUCT & io_sdc ); + + private: // functions + private: // Data }; //! FilterLink /*! - FilterLink links two FILTER_CLASS types together allowing two filters - to act on a single BitKey object. - @code +FilterLink links two FILTER_CLASS types together allowing two filters +to act on a single BitKey object. +@code - Filter * foo(Filter & f1, Filter & f2) - { - Filter * joint = new FilterLink(f1,f2); - return joint; - } - @endcode - */ + Filter * foo(Filter & f1, Filter & f2) + { + Filter * joint = new FilterLink(f1,f2); + return joint; + } +@endcode +*/ class FilterLink: public FilterClass { -public: - /** - Constructor - <ul> - <br><b>Parameters: </b> Two FilterClasss 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(FilterClass & f1, FilterClass & 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 ( BitKey & bit_list ); - - /** - * Undo the filter Apply() - * @post bit_list may be modified - * @Return true if bit_list was modified, otherwise false - */ - virtual bool Undo(BitKey & iBitList); - -private: // functions -private: // Data - - // may be extended to use a vector if needed - FilterClass & xFilter1; - FilterClass & xFilter2; + public: + + /** + * @brief Constructor + * @param i_f1 first filter. usually existing one. + * @param i_f2 second filter. usually the new one. + */ + FilterLink(FilterClass & f1, FilterClass & f2); + + /** + * @brief joins two different filter such that one can act after other. + * @param i_bitList bitkey on which seondary filter need to act. + * @param io_sdc reference to STEP_CODE_DATA struct. + * @return true if bit key is modified false otherwise. + */ + virtual bool Apply( BitKey & ioBitList, STEP_CODE_DATA_STRUCT & io_sdc ); + + /** + * Undo the filter Apply() + * @post bit_list may be modified + * @Return true if bit_list was modified, otherwise false + */ + virtual bool Undo(BitKey & iBitList); + + private: // functions + private: // Data + + // may be extended to use a vector if needed + FilterClass & xFilter1; + FilterClass & xFilter2; }; +inline FilterLink::FilterLink(FilterClass & f1, FilterClass & f2) +: xFilter1(f1), xFilter2(f2) {} -class SCAN_COMM_REGISTER_CLASS; - -//! ScanCommFilter -/*! - ScanCommFilter reads a HW scom register to determin which bits to - removes bits from a BitKey object - @par Base class Filter - @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 FilterClass +class SecondaryBitsFilter: public FilterClass { -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) - : - FilterClass(), - 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(BitKey & bit_list); - -private: // functions -private: // Data - SCAN_COMM_REGISTER_CLASS & scr; - InvertValue xInvert; -}; + public: + + /** + * @brief constructor + * @param i_bitList list of bits identified as secondary in a FIR. + * @note This filter maintains a list of bits which it + * considers it as secondary. PRDF analysis is broken in to two + * steps. The first pass is known as primary pass and second pass + * is known as secondary pass. In first pass, secondary filter + * gets activiated but in secondary pass it remains inactive. + * In primary pass, filter ignores all the secondary bits for + * analysis. If primary bits are on, due to action of + * secondary filter, primary pass ends up with return code 0xdd02. + * Inorder to make sure there are really no bits on, secondary + * pass is launched. In this pass, secondary filter doesn't + * operate so analysis continues as usual. Intention of this + * pass is to identify and analyze secondary error bits which were + * ignored during primary pass due to action of this filter. + */ + SecondaryBitsFilter( const std::vector<uint8_t> & i_bitList ) + { + iv_secBitList = i_bitList; + } -inline FilterLink::FilterLink(FilterClass & f1, FilterClass & f2) -: xFilter1(f1), xFilter2(f2) {} + /** + * @brief clears all the bits identified as secondary in the given BitKey. + * @param i_bitList bitkey on which seondary filter need to act. + * @param io_sdc reference to STEP_CODE_DATA struct. + * @return true if bit key is modified false otherwise. + */ + virtual bool Apply( BitKey & ioBitList, STEP_CODE_DATA_STRUCT & io_sdc ); + + private: // data + + std::vector<uint8_t> iv_secBitList; // list of bit pos marked as secondary + +}; } //End namespace PRDF |

