diff options
author | Zane Shelley <zshelle@us.ibm.com> | 2014-12-03 17:10:39 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-01-16 15:59:50 -0600 |
commit | 97cf5a436ee27a3e66f66fa781953db8e8cbe943 (patch) | |
tree | 9a6a01e321641023fe6eadfdf7099f2ad31d6165 /src/usr/diag | |
parent | 740885df9ac6bcb67792912086ed853751b43a9b (diff) | |
download | talos-hostboot-97cf5a436ee27a3e66f66fa781953db8e8cbe943.tar.gz talos-hostboot-97cf5a436ee27a3e66f66fa781953db8e8cbe943.zip |
PRD: removed dead code
Change-Id: Ia9fe6f046f2a6d35b09382fa03845c2119c9786c
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/14701
Tested-by: Jenkins Server
Reviewed-by: Christopher T. Phan <cphan@us.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Reviewed-by: Prem Shanker Jha <premjha2@in.ibm.com>
Reviewed-by: Bilicon Patil <bilpatil@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/15205
Diffstat (limited to 'src/usr/diag')
-rwxr-xr-x | src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.C | 199 | ||||
-rwxr-xr-x | src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.h | 149 | ||||
-rwxr-xr-x | src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.C | 68 | ||||
-rwxr-xr-x | src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.h | 9 | ||||
-rwxr-xr-x | src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.inl | 65 | ||||
-rwxr-xr-x | src/usr/diag/prdf/common/plat/prdfL3Table.C | 77 | ||||
-rwxr-xr-x | src/usr/diag/prdf/common/plat/prdfL3Table.H | 110 | ||||
-rwxr-xr-x | src/usr/diag/prdf/common/plat/prdfRepairHealth.C | 74 | ||||
-rwxr-xr-x | src/usr/diag/prdf/common/plat/prdfRepairHealth.H | 216 | ||||
-rwxr-xr-x | src/usr/diag/prdf/common/util/UtilMapX.H | 195 | ||||
-rwxr-xr-x | src/usr/diag/prdf/common/util/UtilTree.C | 343 | ||||
-rwxr-xr-x | src/usr/diag/prdf/common/util/UtilTree.H | 179 | ||||
-rwxr-xr-x | src/usr/diag/prdf/common/util/UtilTreeX.H | 168 |
13 files changed, 5 insertions, 1847 deletions
diff --git a/src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.C b/src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.C deleted file mode 100755 index 7560ecb43..000000000 --- a/src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.C +++ /dev/null @@ -1,199 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2000,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -// Module Description ************************************************** -// -// Description: -// -// End Module Description ********************************************** - -//---------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------- -#define xspprdAccessPllChip_C - -#include <xspprdAccessPllChip.h> - -#if !defined(IIPSCR_H) -#include <iipscr.h> -#endif - -#if !defined(PRDFSCANFACILITY_H) -#include <prdfScanFacility.H> -#endif - -#include <iipServiceDataCollector.h> - -#undef xspprdAccessPllChip_C -//---------------------------------------------------------------------- -// User Types -//---------------------------------------------------------------------- - -namespace PRDF -{ - -//---------------------------------------------------------------------- -// Constants -//---------------------------------------------------------------------- -const uint32_t PLL_LOCK = 0x00800003; // Pll status address -const uint32_t PLL_MASK = 0x0080000C; // Pll Mask/Block reg address -const uint32_t PLL_ID = 0xeed; -// Pll status bit definitions -const uint32_t PLL0 = 8; -const uint32_t PLL1 = 9; -const uint32_t PLL2 = 10; -const uint32_t PLL3 = 11; -const uint32_t PLLBLK0 = 8; -const uint32_t PLLBLK1 = 9; -const uint32_t PLLBLK2 = 10; -const uint32_t PLLBLK3 = 11; - -//---------------------------------------------------------------------- -// Macros -//---------------------------------------------------------------------- - -//---------------------------------------------------------------------- -// Internal Function Prototypes -//---------------------------------------------------------------------- - -//---------------------------------------------------------------------- -// Global Variables -//---------------------------------------------------------------------- - -//--------------------------------------------------------------------- -// Member Function Specifications -//--------------------------------------------------------------------- - -// -------------------------------------------------------------------- - -bool AccessPllChip::QueryPll(void) -{ - bool hasPll = false; - SCAN_COMM_REGISTER_CLASS & pll_lock_reg = - ScanFacility::Access().GetScanCommRegister(GetChipHandle(),PLL_LOCK,64); - SCAN_COMM_REGISTER_CLASS & pll_mask_reg = - ScanFacility::Access().GetScanCommRegister(GetChipHandle(),PLL_MASK,64); - - - // Read pll_lock register - int32_t rc = pll_lock_reg.Read(); - pll_mask_reg.Read(); - - if (rc == SUCCESS) { - const BIT_STRING_CLASS * lock = pll_lock_reg.GetBitString(); - const BIT_STRING_CLASS * mask = pll_mask_reg.GetBitString(); - - if ( (lock != NULL) && (mask != NULL) ) { - CPU_WORD senseBits = lock->GetField(PLL0, 4); - CPU_WORD blockBits = mask->GetField(PLLBLK0, 4); - if (senseBits & (~blockBits)) hasPll = true; - } - } - - return hasPll; -} - -// -------------------------------------------------------------------- - -int32_t AccessPllChip::ClearPll(void) -{ - int32_t rc = SUCCESS; - SCAN_COMM_REGISTER_CLASS & pll_lock_reg = - ScanFacility::Access().GetScanCommRegister(GetChipHandle(),PLL_LOCK,64); -// SCAN_COMM_REGISTER_CLASS & pll_mask_reg = -// ScanFacility::Access().GetScanCommRegister(GetId(),PLL_MASK,64); - - pll_lock_reg.Read(); - - // Need to also clear out status bits - pll_lock_reg.ClearBit(PLL0); - pll_lock_reg.ClearBit(PLL1); - pll_lock_reg.ClearBit(PLL2); - pll_lock_reg.ClearBit(PLL3); - - rc = pll_lock_reg.Write(); - - return rc; -} - -// -------------------------------------------------------------------- - -int32_t AccessPllChip::MaskPll(STEP_CODE_DATA_STRUCT & serviceData) -{ - int32_t rc = SUCCESS; -// SCAN_COMM_REGISTER_CLASS & pll_lock_reg = -// ScanFacility::Access().GetScanCommRegister(GetId(),PLL_LOCK,64); - SCAN_COMM_REGISTER_CLASS & pll_mask_reg = - ScanFacility::Access().GetScanCommRegister(GetChipHandle(),PLL_MASK,64); - - - //Read pll status reg mask to get current state - pll_mask_reg.Read(); - - // Set mask bits for pll - pll_mask_reg.SetBit(PLLBLK0); - pll_mask_reg.SetBit(PLLBLK1); - pll_mask_reg.SetBit(PLLBLK2); - pll_mask_reg.SetBit(PLLBLK3); - - // Write back to hardware - rc = pll_mask_reg.Write(); - - return rc; -} - -// -------------------------------------------------------------------- - -int32_t AccessPllChip::UnMaskPll(void) -{ - int32_t rc = SUCCESS; -// SCAN_COMM_REGISTER_CLASS & pll_lock_reg = -// ScanFacility::Access().GetScanCommRegister(GetId(),PLL_LOCK,64); - SCAN_COMM_REGISTER_CLASS & pll_mask_reg = - ScanFacility::Access().GetScanCommRegister(GetChipHandle(),PLL_MASK,64); - - //Read pll status reg mask to get current state - pll_mask_reg.Read(); - - // Set mask bits for pll - pll_mask_reg.ClearBit(PLLBLK0); - pll_mask_reg.ClearBit(PLLBLK1); - pll_mask_reg.ClearBit(PLLBLK2); - pll_mask_reg.ClearBit(PLLBLK3); - - // Write back to hardware - rc = pll_mask_reg.Write(); - - return rc; -} -// -------------------------------------------------------------------- - -void AccessPllChip::CapturePll(STEP_CODE_DATA_STRUCT & serviceData) -{ - SCAN_COMM_REGISTER_CLASS & pll_lock_reg = - ScanFacility::Access().GetScanCommRegister(GetChipHandle(),PLL_LOCK,64); - (serviceData.service_data->GetCaptureData()).Add(GetChipHandle(), PLL_ID ,pll_lock_reg); -} - -} // end namespace PRDF - diff --git a/src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.h b/src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.h deleted file mode 100755 index 328383814..000000000 --- a/src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.h +++ /dev/null @@ -1,149 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/config/xspprdAccessPllChip.h $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2000,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -#ifndef xspprdAccessPllChip_h -#define xspprdAccessPllChip_h - -// Class Description ************************************************* -// -// Name: xspprdAccessPllChip -// Base class: PllChip -// -// Description: Provide PLL support for chips that have Access jtag interface -// Usage: -// -// End Class Description ********************************************* - -//-------------------------------------------------------------------- -// Includes -//-------------------------------------------------------------------- - -#include <iipchip.h> - -namespace PRDF -{ - -//-------------------------------------------------------------------- -// Forward References -//-------------------------------------------------------------------- - -/** - * Provide PLL support for chips that have Access jtag interface - * - * @author Doug Gilbert - */ -class AccessPllChip : public CHIP_CLASS -{ - public: - - /** - * @brief Constructor - * @param i_target A chip target. - */ - explicit AccessPllChip( TARGETING::TargetHandle_t i_target ); - - /** - Query hardware to see if there is a PLL error reported by this chip - <ul> - <br><b>Parameters: </b> None. - <br><b>Returns: </b> [true | false] - <br><b>Requirements:</b> None. - <br><b>Promises: </b> None. - <br><b>Exceptions: </b> None. - </ul><br> - */ - virtual bool QueryPll(); - - /** - Clear the pll check bit(s) in the hardware - <ul> - <br><b>Parameters: </b> None. - <br><b>Returns: </b> return code - <br><b>Requirements:</b> None. - <br><b>Promises: </b> None. - <br><b>Exceptions: </b> None. - </ul><br> - */ - virtual int32_t ClearPll(); - - /** - Disable the reporting of PLL errors in the hardware - <ul> - <br><b>Parameters: </b> serviceData - <br><b>Returns: </b> return code - <br><b>Requirements:</b> none. - <br><b>Promises: </b> serviceData may be modified - <br><b>Exceptions: </b> None. - </ul><br> - */ - virtual int32_t MaskPll(STEP_CODE_DATA_STRUCT & serviceData); - - /** - Enable the reporting of PLL errors in the hardware - <ul> - <br><b>Parameters: </b> None. - <br><b>Returns: </b> return code - <br><b>Requirements:</b> none. - <br><b>Promises: </b> none. - <br><b>Exceptions: </b> None. - </ul><br> - */ - virtual int32_t UnMaskPll(); - - /** - * Add the PLL status register to the service Capturedata - * @param Service Data collector - * @pre none - * @post service data collectors' capture data has the content of the PLL - * status reg - */ - void CapturePll(STEP_CODE_DATA_STRUCT & serviceData); - - private: // functions - - /** - Copy constructor - Forbidden - <ul> - <br><b>Notes: </b> No definitions should exist - </ul><br> - */ - AccessPllChip(const AccessPllChip &); - /** - Assignment operator - Forbidden - <ul> - <br><b>Notes: </b> No definitions should exist - </ul><br> - */ - AccessPllChip & operator=(const AccessPllChip &); - - private: // Data - -}; - -inline AccessPllChip::AccessPllChip( TARGETING::TargetHandle_t i_target ) : - CHIP_CLASS(i_target) -{} - -} // end namespace PRDF - -#endif /* xspprdAccessPllChip_h */ diff --git a/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.C b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.C deleted file mode 100755 index ea82b4314..000000000 --- a/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.C +++ /dev/null @@ -1,68 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 1996,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -// Module Description ************************************************** -// -// Description: This module provides the implementation for the PRD MOP -// Register Access class. -// -// End Module Description ********************************************** - -/*--------------------------------------------------------------------*/ -/* Emit the virtual function tables and inline function defintions in - this translation unit. */ -/*--------------------------------------------------------------------*/ -//---------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------- -#define iipMopRegisterAccess_C - -#include <iipMopRegisterAccess.h> - -#undef iipMopRegisterAccess_C - -//---------------------------------------------------------------------- -// User Types -//---------------------------------------------------------------------- - -//---------------------------------------------------------------------- -// Constants -//---------------------------------------------------------------------- - -//---------------------------------------------------------------------- -// Macros -//---------------------------------------------------------------------- - -//---------------------------------------------------------------------- -// Internal Function Prototypes -//---------------------------------------------------------------------- - -//---------------------------------------------------------------------- -// Global Variables -//---------------------------------------------------------------------- - -//--------------------------------------------------------------------- -// Member Function Specifications -//--------------------------------------------------------------------- - - diff --git a/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.h b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.h index 829573096..b8b799f8b 100755 --- a/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.h +++ b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.h @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 1996,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2015 */ +/* [+] 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. */ @@ -106,7 +108,8 @@ public: // // End Function Specification **************************************** - virtual ~MopRegisterAccess(void); + virtual ~MopRegisterAccess() {} + // Function Specification ******************************************** // // Purpose: Destruction @@ -178,6 +181,4 @@ public: } // end namespace PRDF -#include <iipMopRegisterAccess.inl> - #endif diff --git a/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.inl b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.inl deleted file mode 100755 index 6c9e4bf93..000000000 --- a/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.inl +++ /dev/null @@ -1,65 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.inl $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 1996,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -// Module Description ************************************************** -// -// Description: This module provides the inline implementation for the -// PRD MOP Register Access class. -// -// End Module Description ********************************************** - -//---------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------- - -//---------------------------------------------------------------------- -// User Types -//---------------------------------------------------------------------- - -//---------------------------------------------------------------------- -// Constants -//---------------------------------------------------------------------- - -//---------------------------------------------------------------------- -// Macros -//---------------------------------------------------------------------- - -//---------------------------------------------------------------------- -// Internal Function Prototypes -//---------------------------------------------------------------------- - -//---------------------------------------------------------------------- -// Global Variables -//---------------------------------------------------------------------- - -//--------------------------------------------------------------------- -// Member Function Specifications -//--------------------------------------------------------------------- - -namespace PRDF -{ - -inline -MopRegisterAccess::~MopRegisterAccess() {} - -} // end namespace PRDF diff --git a/src/usr/diag/prdf/common/plat/prdfL3Table.C b/src/usr/diag/prdf/common/plat/prdfL3Table.C deleted file mode 100755 index fdd5aa34d..000000000 --- a/src/usr/diag/prdf/common/plat/prdfL3Table.C +++ /dev/null @@ -1,77 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/plat/prdfL3Table.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2004,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -/** - @file prdfL3Table.C - @brief description -*/ -//------------------------------------------------------------------------------------------------- -// Includes -//------------------------------------------------------------------------------------------------- -#define prdfL3Table_C - -#include <prdfL3Table.H> - -#undef prdfL3Table_C -//------------------------------------------------------------------------------------------------- -// User Types, Constants, macros, prototypes, globals -//------------------------------------------------------------------------------------------------- - -//------------------------------------------------------------------------------------------------- -// Member Function Specifications -//------------------------------------------------------------------------------------------------- - -namespace PRDF -{ - -//------------------------------------------------------------------------------------------------- - -int32_t L3TableAdd(TARGETING::TargetHandle_t i_pl3targetHandle, uint32_t address) -{ - int32_t rc = 0; - return rc; -} - -//------------------------------------------------------------------------------------------------- - -void L3TableGet(TARGETING::TargetHandle_t i_pl3targetHandle, uint32_t table[LineDeleteTableSize]) -{ -} - -//------------------------------------------------------------------------------------------------- - -int32_t prdfL3TableCount(TARGETING::TargetHandle_t i_pl3targetHandle) -{ - int32_t rc = 0; - return rc; -} - -//------------------------------------------------------------------------------------------------- - -errlHndl_t prdfL3LineDelete(TARGETING::TargetHandle_t i_pl3targetHandle, uint32_t address) -{ - return NULL; -} - -} // end namespace PRDF - diff --git a/src/usr/diag/prdf/common/plat/prdfL3Table.H b/src/usr/diag/prdf/common/plat/prdfL3Table.H deleted file mode 100755 index 13385c6a4..000000000 --- a/src/usr/diag/prdf/common/plat/prdfL3Table.H +++ /dev/null @@ -1,110 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/plat/prdfL3Table.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2004,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -#ifndef PRDFL3TABLE_H -#define PRDFL3TABLE_H -/** - @file prdfL3Table.H - @brief Description -*/ - - -//-------------------------------------------------------------------- -// Includes -//-------------------------------------------------------------------- - -#include <stdint.h> -#include <prdfTargetFwdRef.H> -#include <errlentry.H> - -namespace PRDF -{ - -//-------------------------------------------------------------------- -// Forward References -//-------------------------------------------------------------------- - -enum l3TableEnum -{ - LineDeleteTableSize = 10, ///< Size of line delete table - TableSizeBytes = LineDeleteTableSize*4, // wl01 - allFox = 0xffffffff, ///< uint of -1 - l3AddressMask = 0x007ffff0 -}; - - /** - Add a cache line address to the cache line delete table - <ul> - <br><b>Parameters: </b> L3 target Handle, cacheline address in format from ReadDataErLg2 register - <br><b>Returns: </b> 0 = address already in table, 1-LineDeleteTableSize = position added to table, LineDeleteTableSize + 1 = table overflow - <br><b>Requirements:</b> preconditions - <br><b>Promises: </b> postconditions - <br><b>Exceptions: </b> None. - <br><b>Notes: </b> - </ul><br> -*/ -extern int32_t L3TableAdd(TARGETING::TargetHandle_t i_pl3targetHandle, uint32_t address); - - /** - Copies the line delete table to memory address passed in - <ul> - <br><b>Parameters: </b> L3 target Handle, address of int32[10] - <br><b>Returns: </b> returns void - <br><b>Requirements:</b> preconditions - <br><b>Promises: </b> postconditions - <br><b>Exceptions: </b> None. - <br><b>Notes: </b> - </ul><br> -*/ -extern void L3TableGet(TARGETING::TargetHandle_t i_pl3targetHandle, uint32_t table[LineDeleteTableSize]); - - /** - Get the count of line deletes in the table - <ul> - <br><b>Parameters: </b> L3 target Handle - <br><b>Returns: </b> returns the number of line deletes in the table - <br><b>Requirements:</b> preconditions - <br><b>Promises: </b> postconditions - <br><b>Exceptions: </b> None. - <br><b>Notes: </b> - </ul><br> -*/ -extern int32_t prdfL3TableCount(TARGETING::TargetHandle_t i_pl3targetHandle); - - /** - Makes the call to DA to do the line delete - <ul> - <br><b>Parameters: </b> L3 target Handle, cacheline address in format from ReadDataErLg2 register - <br><b>Returns: </b> returns return code from D/a - <br><b>Requirements:</b> preconditions - <br><b>Promises: </b> postconditions - <br><b>Exceptions: </b> None. - <br><b>Notes: </b> - </ul><br> -*/ -extern errlHndl_t prdfL3LineDelete(TARGETING::TargetHandle_t i_pl3targetHandle, uint32_t address); - -} // end namespace PRDF - -#endif /* PRDFL3TABLE_H */ - diff --git a/src/usr/diag/prdf/common/plat/prdfRepairHealth.C b/src/usr/diag/prdf/common/plat/prdfRepairHealth.C deleted file mode 100755 index 079d1ade4..000000000 --- a/src/usr/diag/prdf/common/plat/prdfRepairHealth.C +++ /dev/null @@ -1,74 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/plat/prdfRepairHealth.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2009,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -#include <prdfRepairHealth.H> -#include <svpdextstructs.H> -#include <svpdextinterface.H> -#include <limits.h> - -//#include <prdfP7McRepairHealth.H> - -tracDesc_t g_asmTracDesc; -#ifdef __HOSTBOOT_MODULE -TRAC_INIT( &g_asmTracDesc, PRDF_COMP_NAME, KILOBYTE ); -#else -TRAC_INIT( &g_asmTracDesc, PRDF_COMP_NAME, 4096 ); -#endif - -/* prdfGetRepairHealthStatus - * Get repair objects for FRU. - */ -errlHndl_t prdfGetRepairHealthStatus(uint32_t i_rid, - std::vector<PrdfRepairHealthStatus> & o_repairs) -{ - o_repairs.clear(); - - errlHndl_t l_errl = NULL; -/* - svpd_FruEnum l_fruType; - - do - { - - // Determine RID's FRU type. - l_errl = SVPD_get_frutype(i_rid, &l_fruType); - if (NULL != l_errl) break; - - switch(l_fruType) - { - case FRU_MS: - prdfP7McGetDimmRepairHealthStatus( i_rid, o_repairs ); - break; - - case FRU_PF: - prdfP7McGetInterfaceRepairHealthStatus( i_rid, o_repairs); - break; - - default: - break; - } - } while (false); -*/ - return l_errl; -} - diff --git a/src/usr/diag/prdf/common/plat/prdfRepairHealth.H b/src/usr/diag/prdf/common/plat/prdfRepairHealth.H deleted file mode 100755 index 91014d2b9..000000000 --- a/src/usr/diag/prdf/common/plat/prdfRepairHealth.H +++ /dev/null @@ -1,216 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/plat/prdfRepairHealth.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2009,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -/** @file prdfRepairHealth.H - * @brief Defines interfaces to get applied repairs and health for a FRU, such - * as a DIMM. - */ -#ifndef __PRDF_PRDFREPAIRHEALTH_H -#define __PRDF_PRDFREPAIRHEALTH_H - -#include <vector> -#include <algorithm> - -#include <errlentry.H> - -// NOTE: Cannot use utilities prdfTrace.H because this code is pulled into -// libprdf_asm.so which is a very limited environment. -extern tracDesc_t g_asmTracDesc; - -// Forward declaration. -class PrdfRepairHealthStatus; - -/** @fn prdfGetRepairHealthStatus - * @brief Get the repair / health information for a RID. - * - * @param i_rid - The RID to get health information on. - * @param o_repairs - Vector containing RepairHealthStatus objects found for - * the RID. - * - * @return NULL or error log. - * - * The vector returned can contain information about many repairs, each in - * their own object. These repairs may even be of the same type but will have - * a unique identifier. For instance, a DIMM RID might return a set of "Chip - * Marks" for each "Rank" in the DIMM, a set of "Symbol Marks" for each "Rank" - * in the DIMM, and a single "DRAM Steer" for the entire DIMM. - * - * RID types presently supported: - * - DIMMs. - */ -errlHndl_t prdfGetRepairHealthStatus(uint32_t i_rid, - std::vector<PrdfRepairHealthStatus> & o_repairs); - -/** @class PrdfRepairHealthStatus - * @brief Holds information about a particular repair. - * - * A particular repair contains: - * - An identifier of the type of repair this is. - * - A set of identifying information about the repair. - * - A maximum and currently applied repair count. - * - * The identifying information about a repair can be of various amounts - * depending on the type of repair. For instance, a DIMM "Chip Mark" may only - * list the DIMM "Rank" while a "Bus eRepair" might have "Bus Direction" and - * two or more associated FRU identifiers. - * - * @note The identifiers for Interface eRepair are not finalized. Support for - * this is not until 7.2. - */ -class PrdfRepairHealthStatus -{ - public: - /** Types of repairs possible. */ - enum RepairTypes - { - /** UNKNOWN / Default Repair */ - PRDF_REPAIR_UNKNOWN, - /** DIMM Chip Mark */ - PRDF_REPAIR_CHIP_MARK, - /** DIMM Symbol Mark */ - PRDF_REPAIR_SYMBOL_MARK, - /** DIMM Spare DRAM Steer - not supported on all DIMMs */ - PRDF_REPAIR_SPARE_DRAM_STEER, - /** Inter-chip Bus Repair (eRepair) */ - PRDF_REPAIR_INTERFACE_REPAIR, - }; - - /** Types of associated identifying information */ - enum RepairIdentifiers - { - /** DIMM Rank ID */ - PRDF_REPAIR_ID_RANK, - /** Inter-chip Bus Repair - Bus Direction */ - PRDF_REPAIR_ID_BUS_DIRECTION, - /** Inter-chip Bus Repair - Upstream Chip */ - PRDF_REPAIR_ID_BUS_UPSTREAM_CHIP, - //** Inter-chip Bus Repair - Memory Controller Sequence*/ - PRDF_REPAIR_ID_BUS_MC_SEQUENCE, - //** Inter-chip Bus Repair - Memory Controller Channel*/ - PRDF_REPAIR_ID_BUS_MC_CHANNEL, - //** Inter-chip Bus Repair - Bus Repair Bit*/ - PRDF_REPAIR_ID_BUS_REPAIR_BIT, - //** Inter-chip Bus Repair - Clock Repaired*/ - PRDF_REPAIR_ID_BUS_CLOCK_REPAIRED, - }; - - /** Structure to hold associated identifying information */ - struct RepairId - { - RepairIdentifiers idType; - uint32_t id; - }; - - public: - /** Default constructor */ - PrdfRepairHealthStatus() : iv_repairType(PRDF_REPAIR_UNKNOWN), - iv_repairIdsCount(0), - iv_repairIds(NULL), - iv_repairsAllowed(0), - iv_repairsPresent(0) {}; - /** Copy constructor */ - PrdfRepairHealthStatus(const PrdfRepairHealthStatus & copy) - : iv_repairType(copy.iv_repairType), - iv_repairIdsCount(copy.iv_repairIdsCount), - iv_repairsAllowed(copy.iv_repairsAllowed), - iv_repairsPresent(copy.iv_repairsPresent) - { - // Copy the identfying info array into new object. - if (NULL == copy.iv_repairIds) - iv_repairIds = NULL; - else - { - iv_repairIds = new RepairId[iv_repairIdsCount]; - - std::copy(copy.iv_repairIds, - ©.iv_repairIds[iv_repairIdsCount], - iv_repairIds); - } - } - /** Destructor */ - ~PrdfRepairHealthStatus() - { - // Clean up the identifying info array. - if (NULL != iv_repairIds) - { - delete [] iv_repairIds; - iv_repairIds = NULL; - } - } - - // ---- External interfaces ---- // - /** Return the type of repair. */ - RepairTypes getRepairType() const { return iv_repairType; } - /** Return the number of associated identifying infos. */ - size_t getRepairIdsCount() const { return iv_repairIdsCount; } - /** @fn getRepairIds - * - * @brief Return pointer to associated identifying info array. - * @note This pointer should NOT be deleted by the caller. It is - * owned by this object. */ - const RepairId * getRepairIds() const { return iv_repairIds; } - /** Return maximum number of repairs allowed of this type / id */ - size_t getRepairsAllowed() const { return iv_repairsAllowed; } - /** Return current number of repairs of this type / id */ - size_t getRepairsPresent() const { return iv_repairsPresent; } - - protected: - /* ---- Interfaces for assigning contents. ---- - * These are defined protected so that only inheriting classes can - * used these. Design is that a repair type will define a "builder" - * class that has a constructor with the parameters to complete this - * object and fill in the extra identifying information. - */ - /** Assign repair type */ - void setRepairType(RepairTypes i_repairType) - { iv_repairType = i_repairType; } - /** @fn setRepairIds - * - * @brief Assign identifying info - * @param i_repairIds - This must be allocated using the new[] and - * ownership of the memory transfers to this object. - */ - void setRepairIds(size_t i_repairIdsCount, RepairId * i_repairIds) - { iv_repairIdsCount = i_repairIdsCount; - iv_repairIds = i_repairIds; } - /** Assign max / current repair counts */ - void setRepairCounts(size_t i_allowed, size_t i_present) - { iv_repairsAllowed = i_allowed; - iv_repairsPresent = i_present; }; - - private: - /** Repair type */ - RepairTypes iv_repairType; - - /** Extra identifying info count */ - size_t iv_repairIdsCount; - /** Extra identifying info array */ - RepairId * iv_repairIds; - - /** Maximum repair count. */ - size_t iv_repairsAllowed; - /** Current repair count. */ - size_t iv_repairsPresent; -}; - -#endif diff --git a/src/usr/diag/prdf/common/util/UtilMapX.H b/src/usr/diag/prdf/common/util/UtilMapX.H deleted file mode 100755 index 5e6acb08e..000000000 --- a/src/usr/diag/prdf/common/util/UtilMapX.H +++ /dev/null @@ -1,195 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/util/UtilMapX.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2004,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -#ifndef __UTIL_UTILMAPX_H -#define __UTIL_UTILMAPX_H - -#include "UtilTree.H" -#include <algorithm> - -namespace PRDF -{ - -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; -}; - -} // end namespace PRDF - -#endif - diff --git a/src/usr/diag/prdf/common/util/UtilTree.C b/src/usr/diag/prdf/common/util/UtilTree.C deleted file mode 100755 index 86d714d01..000000000 --- a/src/usr/diag/prdf/common/util/UtilTree.C +++ /dev/null @@ -1,343 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/util/UtilTree.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2004,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -#include "UtilTree.H" - -namespace PRDF -{ - -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); -}; - -} // end namespace PRDF - diff --git a/src/usr/diag/prdf/common/util/UtilTree.H b/src/usr/diag/prdf/common/util/UtilTree.H deleted file mode 100755 index 01aa66c94..000000000 --- a/src/usr/diag/prdf/common/util/UtilTree.H +++ /dev/null @@ -1,179 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/util/UtilTree.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2004,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -#ifndef __UTIL_UTILTREE_H -#define __UTIL_UTILTREE_H - -#include <stdint.h> -#include <stddef.h> - -#include <functional> - -#include <iostream> - -namespace PRDF -{ - -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; -}; - -} // end namespace PRDF - -#endif - diff --git a/src/usr/diag/prdf/common/util/UtilTreeX.H b/src/usr/diag/prdf/common/util/UtilTreeX.H deleted file mode 100755 index 5e7129d0e..000000000 --- a/src/usr/diag/prdf/common/util/UtilTreeX.H +++ /dev/null @@ -1,168 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/diag/prdf/common/util/UtilTreeX.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2004,2014 */ -/* */ -/* Licensed under the Apache License, Version 2.0 (the "License"); */ -/* you may not use this file except in compliance with the License. */ -/* You may obtain a copy of the License at */ -/* */ -/* http://www.apache.org/licenses/LICENSE-2.0 */ -/* */ -/* Unless required by applicable law or agreed to in writing, software */ -/* distributed under the License is distributed on an "AS IS" BASIS, */ -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ -/* implied. See the License for the specific language governing */ -/* permissions and limitations under the License. */ -/* */ -/* IBM_PROLOG_END_TAG */ - -#ifndef __UTIL_UTILTREEX_H -#define __UTIL_UTILTREEX_H - -#include "UtilTree.H" - -namespace PRDF -{ - -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); -}; - -} // end namespace PRDF - -#endif - |