Skip to content

Commit

Permalink
PRD: clean various BitString functions
Browse files Browse the repository at this point in the history
Change-Id: Id10ac2c18792336103b3d132c263fab87904b925
RTC: 167819
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/35693
Reviewed-by: Benjamin J. Weisenbeck <bweisenb@us.ibm.com>
Reviewed-by: Caleb N. Palmer <cnpalmer@us.ibm.com>
Reviewed-by: Brian J. Stegmiller <bjs@us.ibm.com>
Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com>
Tested-by: Zane C. Shelley <zshelle@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36318
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
  • Loading branch information
zane131 committed Feb 13, 2017
1 parent 6553e4a commit 3192051
Show file tree
Hide file tree
Showing 14 changed files with 113 additions and 219 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class ErrorRegisterMask : public ErrorRegisterFilter
<br><b>Parameters: </b> bit position
<br><b>Returns: </b> None.
<br><b>Requirements:</b> None.
<br><b>Promises: </b> bitStringMask.IsSet(bitPosition) == true.
<br><b>Promises: </b> bitStringMask.isBitSet(bitPosition) == true.
<br><b>Exceptions: </b> None.
<br><b>Notes: </b> The bitstring read from hardware during Read()
Expand Down Expand Up @@ -215,7 +215,7 @@ class ErrorRegisterMask : public ErrorRegisterFilter
};

inline void ErrorRegisterMask::SetMaskBit(uint32_t bitPosition)
{ bitStringMask.Set(bitPosition); }
{ bitStringMask.setBit(bitPosition); }

inline void ErrorRegisterMask::SetMaskBits(const BIT_STRING_CLASS & bitString)
{ bitStringMask.setString(bitString); }
Expand Down
4 changes: 2 additions & 2 deletions src/usr/diag/prdf/common/framework/register/iipscr.C
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void SCAN_COMM_REGISTER_CLASS::SetBit
{

BIT_STRING_CLASS & bitString = AccessBitString();
bitString.Set(bit_position);
bitString.setBit(bit_position);
}

// Function Specification //////////////////////////////////////////
Expand All @@ -176,7 +176,7 @@ void SCAN_COMM_REGISTER_CLASS::ClearBit
/*!o No value returned */
{
BIT_STRING_CLASS & bitString = AccessBitString();
bitString.Clear(bit_position);
bitString.clearBit(bit_position);
}


Expand Down
10 changes: 5 additions & 5 deletions src/usr/diag/prdf/common/framework/register/iipscr.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2012,2015 */
/* Contributors Listed Below - COPYRIGHT 2012,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -308,7 +308,7 @@ class SCAN_COMM_REGISTER_CLASS
<br><b>Parameters: </b> Position of bit to set (= 1)
<br><b>Returns: </b> None.
<br><b>Requirements:</b> bit position < GetBitString()->Length()
<br><b>Promises: </b> GetBitString()->IsSet(bit_position) == true
<br><b>Promises: </b> GetBitString()->isBitSet(bit_position) == true
<br><b>Exceptions: </b> None.
<br><b> Notes: </b> Register value is not reflected in hardware until
Write() is called
Expand All @@ -322,7 +322,7 @@ class SCAN_COMM_REGISTER_CLASS
<br><b>Parameters: </b> Position of bit to clear (= 0)
<br><b>Returns: </b> None.
<br><b>Requirements:</b> bit position < GetBitString()->Length()
<br><b>Promises: </b> GetBitString()->IsSet(bit_position) == false
<br><b>Promises: </b> GetBitString()->isBitSet(bit_position) == false
<br><b>Exceptions: </b> None.
<br><b> Notes: </b> Register value is not reflected in hardware until
Write() is called
Expand All @@ -337,7 +337,7 @@ class SCAN_COMM_REGISTER_CLASS
* @return TRUE if the bit is set, FALSE otherwise.
*/
bool IsBitSet( uint32_t i_bitPos )
{ return GetBitString()->IsSet(i_bitPos); }
{ return GetBitString()->isBitSet(i_bitPos); }

/** @brief Flushes all bits to 0. */
void clearAllBits();
Expand Down Expand Up @@ -375,7 +375,7 @@ class SCAN_COMM_REGISTER_CLASS
</ul><br>
*/
bool BitStringIsZero()
{ return GetBitString()->IsZero(); }
{ return GetBitString()->isZero(); }

/**
*@brief Returns TYPE_NA as type of Target associated with register.Actual
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void CaptureData::AddDataElement( TargetHandle_t i_trgt, int i_scomId,
size_t sz_buf = 0;

// Add buffer only if the value is non-zero.
if ( !i_bs->IsZero() )
if ( !i_bs->isZero() )
{
// Get the size of i_bs and ensure byte alignment.
sz_buf = (i_bs->getBitLen() + 8-1) / 8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ class SummaryRegister : public SCAN_COMM_REGISTER_CLASS
PRDF::BitString tmp = *iv_child->GetBitString(i_type);

//if any bits are set in iv_child, then set the iv_amount bit
if (0 != tmp.GetSetCount())
if (0 != tmp.getSetCount())
{
iv_bs->Set(0);
iv_bs->setBit(0);
*iv_bs = *iv_bs >> iv_amount;
}
return iv_bs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ int32_t AndResetErrorRegister::Reset(const BitKey & bit_list,
uint32_t i;
for(i = 0; i < bl_length; ++i) // Turn off all bits used to isolate problem
{
bs.Clear(bit_list.getListValue(i));
bs.clearBit(bit_list.getListValue(i));
}
xAndResetScr.SetBitString(&bs); // copy bs to SCR bit string
rc = xAndResetScr.Write(); // Write hardware (result = Hareware value ANDed with bs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class AndOperator : public RegisterResetOperator
uint32_t i;
for(i = 0; i < bl_length; ++i) // Turn off all bits specified
{
bs.Clear(bl.getListValue(i));
bs.clearBit(bl.getListValue(i));
}
writeReg->SetBitString(&bs); // Copy bit-string to register.
rc = writeReg->Write(); // Write hardware
Expand Down
16 changes: 8 additions & 8 deletions src/usr/diag/prdf/common/plat/p9/prdfP9ProcDomain.C
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void ProcDomain::SortForXstop()
{
for (uint32_t k = 0; k < GetSize(); k++)
if ((*j) == LookUp(k)->GetChipHandle())
l_externalChips.Set(k);
l_externalChips.setBit(k);
};

// Check if is internal.
Expand Down Expand Up @@ -221,29 +221,29 @@ void ProcDomain::SortForXstop()
BIT_STRING_BUFFER_CLASS l_prev(GetSize());
l_prev.clearAll();

while ((!(l_current == l_prev)) && (!l_current.IsZero()))
while ((!(l_current == l_prev)) && (!l_current.isZero()))
{
l_prev = l_current;
l_current.clearAll();

for (uint32_t i = 0; i < GetSize(); i++)
{
if (l_prev.IsSet(i)) // skip if this chip isn't in the pool.
if (l_prev.isBitSet(i)) // skip if this chip isn't in the pool.
for (uint32_t j = 0; j < GetSize(); j++)
{
ptr.u = &l_externalDrivers[i]; // zs01
if ( BitString(GetSize(), ptr.c).IsSet(j) )
l_current.Set(j);
if ( BitString(GetSize(), ptr.c).isBitSet(j) )
l_current.setBit(j);
}
}
}

// Hopefully, we got just one chip left...
if (1 == l_prev.GetSetCount())
if (1 == l_prev.getSetCount())
{
// Now find it.
for (uint32_t i = 0; i < GetSize(); i++)
if ((l_prev.IsSet(i)) &&
if ((l_prev.isBitSet(i)) &&
(l_internalCS[i] || (0 == l_internalOnlyCount)))
{
MoveToFront(i);
Expand Down Expand Up @@ -421,7 +421,7 @@ int32_t ProcDomain::OrderTheseChips(ATTENTION_TYPE attentionType,
{
for (uint32_t k = 0; k < i_chips.size(); k++)
if ((*j) == LookUp(k)->GetChipHandle())
l_externalChips.Set(k);
l_externalChips.setBit(k);
};

// Check if is internal.
Expand Down
10 changes: 5 additions & 5 deletions src/usr/diag/prdf/common/plat/pegasus/prdfLaneRepair.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2013,2015 */
/* Contributors Listed Below - COPYRIGHT 2013,2017 */
/* [+] Google Inc. */
/* [+] International Business Machines Corp. */
/* */
Expand Down Expand Up @@ -111,9 +111,9 @@ int32_t handleLaneRepairEvent( ExtensibleChip * i_chip,
PRDF_INF( PRDF_FUNC "New failed lane on RX HUID 0x%08x: %d",
getHuid(rxBusTgt), *lane);
if (*lane < 64)
l_newLaneMap0to63.Set(*lane);
l_newLaneMap0to63.setBit(*lane);
else if (*lane < 127)
l_newLaneMap64to127.Set(*lane - 64);
l_newLaneMap64to127.setBit(*lane - 64);
else
{
PRDF_ERR( PRDF_FUNC "Invalid lane number %d: rxBusTgt=0x%08x",
Expand Down Expand Up @@ -153,9 +153,9 @@ int32_t handleLaneRepairEvent( ExtensibleChip * i_chip,
lane != rx_vpdLanes.end(); ++lane)
{
if (*lane < 64)
l_vpdLaneMap0to63.Set(*lane);
l_vpdLaneMap0to63.setBit(*lane);
else if (*lane < 127)
l_vpdLaneMap64to127.Set(*lane - 64);
l_vpdLaneMap64to127.setBit(*lane - 64);
else
{
PRDF_ERR( PRDF_FUNC "Invalid VPD lane number %d: "
Expand Down
2 changes: 1 addition & 1 deletion src/usr/diag/prdf/common/rule/prdfRuleMetaData.C
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ int32_t RuleMetaData::CaptureErrorData( CaptureData & io_cap,
{
const BIT_STRING_CLASS *l_bitStringPtr =
l_primReg->GetBitString();
if(l_bitStringPtr->IsZero())
if(l_bitStringPtr->isZero())
{
//skip capture data if corresponding primary FIR is
//zero.
Expand Down
14 changes: 7 additions & 7 deletions src/usr/diag/prdf/common/util/prdfBitKey.C
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ uint32_t BitKey::getListValue(uint32_t n) const
BitString bs(iv_Capacity,(CPU_WORD *)cDataPtr());
for(uint32_t i = 0; i < iv_Capacity; ++i)
{
if(bs.IsSet(i)) ++setCount;
if(bs.isBitSet(i)) ++setCount;
if(setCount == n)
{
bitPos = i;
Expand All @@ -289,7 +289,7 @@ uint32_t BitKey::getListValue(uint32_t n) const
uint32_t BitKey::size(void) const
{
const BitString bs(iv_Capacity,(CPU_WORD *)cDataPtr());
return bs.GetSetCount();
return bs.getSetCount();
}

//------------------------------------------------------------------------------
Expand All @@ -299,7 +299,7 @@ void BitKey::removeBit(uint32_t n)
if(n < size())
{
BitString bs(iv_Capacity,DataPtr());
bs.Clear(getListValue(n));
bs.clearBit(getListValue(n));
}
}

Expand All @@ -312,9 +312,9 @@ void BitKey::removeBit(void)
while(i != 0)
{
--i;
if(bs.IsSet(i))
if(bs.isBitSet(i))
{
bs.Clear(i);
bs.clearBit(i);
break;
}
}
Expand All @@ -338,7 +338,7 @@ void BitKey::setBit(uint32_t i_bitValue)
ReAllocate(i_bitValue+1);
}
BitString bs(iv_Capacity,DataPtr());
bs.Set(i_bitValue);
bs.setBit(i_bitValue);
}

//------------------------------------------------------------------------------
Expand All @@ -362,7 +362,7 @@ void BitKey::ReAllocate(uint32_t i_len)
BitString dbs(iv_Capacity,newBuffer);
dbs.clearAll();
BitString sbs(oldSize,oldPtr);
if ( !sbs.IsZero() ) dbs.setString(sbs);
if ( !sbs.isZero() ) dbs.setString(sbs);
iv_storage1 = 0;
if(!wasDirect) // from indirect
{
Expand Down

0 comments on commit 3192051

Please sign in to comment.