diff options
author | Zane Shelley <zshelle@us.ibm.com> | 2012-11-15 10:40:06 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-11-16 22:03:16 -0600 |
commit | d33218560b7b2bf2ebc4b5a33fed8aa77b8793e6 (patch) | |
tree | 7fff02186430b3d6c87b1238311e217b9cf6e37c /src/usr/diag/prdf/common/framework/register | |
parent | 9342e9d7df794e5bcb352799a989d5a9f40e4ca0 (diff) | |
download | talos-hostboot-d33218560b7b2bf2ebc4b5a33fed8aa77b8793e6.tar.gz talos-hostboot-d33218560b7b2bf2ebc4b5a33fed8aa77b8793e6.zip |
Merged common FSP and HB PRD code to prdf/common/
Change-Id: Iac94c3690598b7263de230934b911bb4ced34557
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2350
Tested-by: Jenkins Server
Reviewed-by: Bradley W. Bishop <bradleyb@us.ibm.com>
Reviewed-by: Zane Shelley <zshelle@us.ibm.com>
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2368
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/diag/prdf/common/framework/register')
31 files changed, 7305 insertions, 0 deletions
diff --git a/src/usr/diag/prdf/common/framework/register/iipCaptureData.h b/src/usr/diag/prdf/common/framework/register/iipCaptureData.h new file mode 100755 index 000000000..eaa25b163 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipCaptureData.h @@ -0,0 +1,367 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipCaptureData.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef iipCaptureData_h +#define iipCaptureData_h + +// Class Specification ************************************************* +// +// Class name: CaptureData +// Parent class: None. +// +// Summary: This class provides a queue-like buffer for recording Scan +// Comm Register data. +// +// When this class is constructed or the Clear() member +// function is called, the buffer is empty. The Add() +// function adds data to the front or back of this buffer. +// The data is ordered according to the sequence of Add() +// calls and the Place parameter (FRONT or BACK). A Scan +// Comm Register is passed to the Add() function and the +// register is read during the Add() function. The data is +// then stored internally. Whenever the Copy() member +// function is called, the current internal data is copied to +// the specified buffer with respect to the current ordering. +// Only the number of bytes specified are copied. Therefore, +// any data that MUST be copied should be added using the +// FRONT placement. +// +// Cardinality: N +// +// Performance/Implementation: +// Space Complexity: Linear based on the number of Add() calls +// Time Complexity: All member functions constant unless otherwise +// stated. +// +// Usage Examples: +// +// BIT8 data[BUFFER_SIZE]; +// +// void foo(TARGETING::TargetHandle_t chipId, ScanCommRegisterAccess & scr) +// { +// CaptureData captureData; +// +// captureData.Add(chipId, scr, CaptureData::FRONT); +// captureData.Add(chipId, scr, CaptureData::BACK); +// +// int bytesCopied = captureData.Copy(data, BUFFER_SIZE); +// } +// +// End Class Specification ********************************************* + +/*--------------------------------------------------------------------*/ +/* Reference the virtual function tables and inline function + defintions in another translation unit. */ +/*--------------------------------------------------------------------*/ + +#include <list> + +#ifndef IIPCONST_H +#include <iipconst.h> +#endif +#include <prdfPlatServices.H> +#include <functional> // @jl04 a Needed for the unary function in new predicate. + +// Forward Declarations +class SCAN_COMM_REGISTER_CLASS; +class ScanCommRegisterAccess; +class BIT_STRING_CLASS; + +// @jl04 a start +// @jl04 a Added this enumeration for error log compression, elimination of secondary regs. + enum RegType + { + PRIMARY = 1, + SECONDARY = 2 + }; +// @jl04 a Stop + +/** + Capture data class + @author Doug Gilbert + @version V5R2 +*/ +class CaptureData +{ +public: + + enum Place + { + FRONT, + BACK + }; + + enum + { + INITIAL_DATA_COUNT = 80, + ENTRY_FIXED_SIZE = 8, + MAX_ENTRY_SIZE = 128 + }; + + /** + Constructor + */ + CaptureData(void); + + /* + Copy constructor - default is ok + */ +// CaptureData(const CaptureData & c); + + /* + Assignment operator - default is ok + */ +// CaptureData & operator=(const CaptureData & c); + + /** + Destructor + */ +// dg05d ~CaptureData(void); // compiler default is ok + + /** + Clear out capture data + <ul> + <br><b>Paramters:None + <br><b>Returns:Nothing + <br><b>Requirments:None. + <br><b>Promises: All capture data cleared ( copy(...) == 0 ) + </ul><br> + */ + void Clear(void); + + // dg00 start + /** + Add scr & data to capture log + <ul> + <br><b>Paramter: chipHandle target handle of chip object + <br><b>Paramter: scan comm id (unique one btye code representing scan comm address) + <br><b>Paramter: Scan comm register object + <br><b>Paramter: Optional location in capure vector [FRONT | BACK] def = BACK + <br><b>Returns: Nothing + <br><b>Requires: Nothing + <br><b>Promises: scr.Read() + <br><b>Notes: This is the required Add() method for Regatta and beyond + </ul><br> + */ + void Add( TARGETING::TargetHandle_t i_pchipHandle, int scomId, + SCAN_COMM_REGISTER_CLASS & scr, Place place = BACK, + RegType type = PRIMARY); // @jl04 c. Changed this to add the type to the end of the parms. + // dg00 end + + /* REMOVE for FSP + Add scr & data to capture log + <ul> + <br><b>Paramter: chipHandle target handle of chip object + <br><b>Paramter: Scan comm register object + <br><b>Paramter: Optional location in capure vector [FRONT | BACK] def = BACK + <br><b>Returns: Nothing + <br><b>Requires: Nothing + <br><b>Promises: scr.Read() + <br><b>Notes: This is the required Add() method for pre-Regatta + </ul><br> + + void Add(TARGETING::TargetHandle_t chipId, SCAN_COMM_REGISTER_CLASS & scr, + Place place = BACK); +*/ + + /** + Add scr & data to capture log (defunct) + <ul> + <br><b>Paramter: chipid (or chip enum) + <br><b>Paramter: Scan comm register object + <br><b>Paramter: Optional location in capure vector [FRONT | BACK] def = BACK + <br><b>Returns: Nothing + <br><b>Requires: Nothing + <br><b>Promises: scr.Read() + <br><b>Notes: This method is no longer implemented + </ul><br> + */ + void Add(ScanCommRegisterAccess & scr, Place place = BACK); + + // dg02 start + /** + Add scr & data to capture log + <ul> + <br><b>Paramter: i_pchipHandle Handle of chip object + <br><b>Paramter: scan comm id (unique one btye code representing scan comm address) + <br><b>Paramter: BIT_STRING_CLASS + <br><b>Paramter: Optional location in capure vector [FRONT | BACK] def = BACK + <br><b>Returns: Nothing + <br><b>Requires: Nothing + <br><b>Promises: + <br><b>Notes: This is available for Regatta and beyond. Not implemented on Condor + </ul><br> + */ + void Add( TARGETING::TargetHandle_t i_pchipHandle, int scomId, + BIT_STRING_CLASS & bs, Place place = BACK); + + // dg02 end + // dg06a start + /** + Add scr & data to capture log + <ul> + <br><b>Paramter: i_pTargetHandle Handle of chip object + <br><b>Paramter: scan comm id (unique code representing scan comm address) + <br><b>Paramter: Scan comm register address + <br><b>Paramter: Scan comm register bit length length + <br><b>Paramter: Optional location in capure vector [FRONT | BACK] def = BACK + <br><b>Returns: Nothing + <br><b>Requires: Nothing + <br><b>Promises: + <br><b>Notes: This is available for Regatta and beyond. Not implemented on Condor + </ul><br> + */ + void Add( TARGETING::TargetHandle_t i_pTargetHandle , int iScomId, + uint64_t iScomAddress, uint32_t iScomBitLength , + Place iplace = BACK); + // dg06a end + +// start @jl04a + /** + Drop scr & data from capture log + <ul> + <br><b>Paramter: Type of capture vector [PRIMARY | SECONDARY] def = PRIMARY. SECONDARIES dropped on connected. + <br><b>Returns: Nothing + <br><b>Requires: Nothing + <br><b>Promises: + </ul><br> + */ +void Drop(RegType type); //@jl04a +// end @jl04a + + /** + Copy caputre data to buffer + <ul> + <br><b>Paramter: ptr to buffer to place capture data + <br><b>Paramter: maxsize of buffer area + <br><b>Returns: Returns the number of bytes copied + <br><b>Requirements: None + <br><b>Promises: bytes copied <= bufferSize + <br><b>Notes: Caputure data is placed in the buffer in the order it exists + in the vector until done or buffer is full + <ul><br> + */ + unsigned int Copy(uint8_t * buffer, unsigned int bufferSize) const; + + // dg08a --> + /** + Reconstruct data from flat data + <ul> + <br><b>Paramter: i_flatdata ptr to flat data + <br><b>Returns: reference to the new capture data + <br><b>Requirements: None + <br><b>Promises: CaptureData created form flatdata + <br><b>Note: i_flatdata -> (uin32_t)size + data created by Copy() + data is network ordered bytes. + <ul><br> + */ + CaptureData & operator=(const uint8_t *i_flatdata); + // <-- dg08a + +private: + + // Notes ************************************************************* + // + // Instead of maintaining an actual data buffer, an auxilliary data + // structure is used to maintain data in a specific order. The main + // reason for this is that since data can be entered in the front or + // back of the buffer, the data must be copied to maintain the order. + // It is more efficient to copy a number of pointers than a large + // data buffer. However, there is added complexity since the data + // structure contains a pointer to dynamic data that must be + // allocated/deallocated properly. + // + // A vector of data structures is maintained that is given an initial + // size. The vector can grow dynamically, but this can be expensive + // in terms of copying and memory fragmentation. To prevent this, the + // number of calls to Add() between calls to Clear() should not exceed + // the enum INITIAL_DATA_COUNT. + // + // End Notes ********************************************************* + + class Data + { + public: + // Ctor + Data(TARGETING::TargetHandle_t i_pchipHandle= NULL, // dg01 + uint16_t a = 0, + uint16_t dbl = 0, + uint8_t * dPtr = NULL) + : + chipHandle(i_pchipHandle), + address(a), + dataByteLength(dbl), + dataPtr(dPtr) + {} + + ~Data(void) // dg05a + { // dg05a + if(dataPtr != NULL) // dg05a + { // dg05a + delete [] dataPtr; // pw01 + } // dg05a + } // dg05a + // Data + TARGETING::TargetHandle_t chipHandle; + uint16_t address; + uint16_t dataByteLength; + uint8_t * dataPtr; + + RegType registerType; // @jl04a + + Data(const Data & d); + Data & operator=(const Data & d); + }; + +// We should probably use a link list instead of a vector + typedef std::list<Data> DataContainerType; + typedef DataContainerType::iterator DataIterator; + typedef DataContainerType::const_iterator ConstDataIterator; + + DataContainerType data; + + /** + Private function to facilitate the adding of caputre data to the internal vector + */ + void AddDataElement(Data &dataElement, SCAN_COMM_REGISTER_CLASS & scr, Place place, RegType type); + //$TEMP @jl04 Changed AddDataElement to include a Register type. + + // Predicate for deciding to delete an element of data from a Capture Data list. + class prdfCompareCaptureDataType : public std::unary_function<Data &, bool> + { + public: + prdfCompareCaptureDataType(RegType i_ctor_input) : __private_storage(i_ctor_input){}; + bool operator() (Data &i) + { + return (i.registerType == __private_storage); + }; + + + private: + //Private storage for value passed in. + RegType __private_storage; + //Constructor allows a value to be passed in to compare against. + }; +}; + +#endif diff --git a/src/usr/diag/prdf/common/framework/register/iipErrorRegister.h b/src/usr/diag/prdf/common/framework/register/iipErrorRegister.h new file mode 100755 index 000000000..82508fe19 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipErrorRegister.h @@ -0,0 +1,224 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipErrorRegister.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/** + @file iipErrorRegister.h + @brief ErrorRegister class declaration +*/ +#ifndef iipErrorRegister_h +#define iipErrorRegister_h + +// Class Description ************************************************* +// +// Name: ErrorRegister +// Base class: ErrorRegisterType +// Concrete class that can be used as a base class +// +// Description: Error register declairation +// Usage: +// +// foo(SCAN_COMM_REGISTER &scr, ResolutionMap &resMap, +// STEP_CODE_DATA_STRUCT &error_data) +// { +// ErrorRegister er(scr,resMap); +// . +// . +// SINT32 rc = er.Analyze(error_data); +// } +// +// Notes: +// +// +// End Class Description ********************************************* +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#if !defined(iipErrorRegisterType_h) +#include "iipErrorRegisterType.h" +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +class SCAN_COMM_REGISTER_CLASS; +class ResolutionMap; + +class ErrorRegister : public ErrorRegisterType +{ +public: + /** + Constructor + <ul> + <br><b>Parameter: </b> Scan comm register + <br><b>Parameter: </b> Resolution Map + <br><b>Parameter: </b> Opt: ScrId [0 to 0xfe] - used with ErrorSignature + <br><b>Notes: </b> If no ScrId is provided then the scan + Comm register address is used + </ul><br> + */ + ErrorRegister(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, uint16_t scrId = 0x0fff); + + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default is ok + // Objects do not not own ptr to scan comm register and table + // + // End Function Specification **************************************** + // ~ErrorRegister(); + + /** + Analyse the error register + <ul> + <br><b>Parameters: </b> ServiceData object (error.service_data) + <br><b>Returns: </b> return code + <br><b>Requirements:</b> NoErrorOnZeroRead() if don't want rc == DD02 when no bits on in scr + <br><b>Promises: </b> error.service_data points to completed serviceData + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> optional + </ul><br> + */ + virtual int32_t Analyze(STEP_CODE_DATA_STRUCT & error); + + /** + Make is so Analyze() does not consider a Scr bit string of all zeros an error + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Analyze() == SUCCESS when scr data has no bits on + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Normaly Anayze() returns DD02 if scr data is zero + </ul><br> + */ + void NoErrorOnZeroScrRead(void) { xNoErrorOnZeroScr = true; } + + +protected: + + /** + Read the scan comm register, apply any masks, and return the resulting bit string + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> a Bit String + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Bit string contains data from hardware with masked bits zeroed + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Any class that overides Read() but does not + override Analyze() should set src_rc + return code from mops scr access + </ul><br> + */ + virtual const BIT_STRING_CLASS & Read(ATTENTION_TYPE i_attn); + + /** + Filter the bit string (if a filter is provided) & convert it to a BitList + <ul> + <br><b>Parameters: </b> Bit String + <br><b>Returns: </b> Bit List + <br><b>Requirements:</b> Read() + <br><b>Promises: </b> Bit list representation of the (filtered) bit string + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> The default implementation does not have a filter + </ul><br> + */ + virtual BIT_LIST_CLASS Filter(const BIT_STRING_CLASS & bs); + + virtual bool FilterUndo(prdfBitKey & i_bit_list) { return false; } + /** + Find a resolution for the Bit List + <ul> + <br><b>Parameters: </b> reference to ServiceDataCollector to act on + <br><b>Parameter: </b> Bit List + <br><b>Requirements:</b> Filter() + <br><b>Promises: </b> The bit list may be modified if the search + algoithm modified it to find a match. (as in a fuzzy search) + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> If no match for the Bit List is found in the + Resolution Map then the ResolutionMap default is used + </ul><br> + */ + virtual int32_t Lookup(STEP_CODE_DATA_STRUCT & scd, BIT_LIST_CLASS & bl); // dg02c - pass bl by value + + /** + Reset the hardware (if needed) + <ul> + <br><b>Parameters: </b> Bit List, ServiceData (error.service_data) + <br><b>Returns: </b> return code + <br><b>Requirements:</b> LookUp() + <br><b>Promises: </b> Hardware may be modified, internal Mask may be modified + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Default implementation does nothing + </ul><br> + */ + virtual int32_t Reset(const BIT_LIST_CLASS & bit_list,STEP_CODE_DATA_STRUCT & error); + +private: // functions + + int32_t SetErrorSignature(STEP_CODE_DATA_STRUCT & error, BIT_LIST_CLASS & bl); // dg02a + /** + Copy forbidden + */ + ErrorRegister(const ErrorRegister & er); + /** + Assignment forbidden + */ + ErrorRegister & operator=(const ErrorRegister & er); + +protected: // Data + + SCAN_COMM_REGISTER_CLASS & scr; + int32_t scr_rc; + +private: // Data + + ResolutionMap & rMap; + bool xNoErrorOnZeroScr; + uint16_t xScrId; + +}; + + + +#endif /* iipErrorRegister_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- ----- ------------------------------- +// 04/05/96 DRG Initial Creation +// p4902214 v4r1m0 05/09/97 DRG Added service data parm to Reset +// v4r1 01/07/98 DRG Add NoErrorOnZeroScrRead() +// d49274.2 V4R5 09/23/98 DRG Add scrId option +// 423599 fsp 10/27/03 dgilbert make scrid a bit16 +// dg02 482244 fips225 11/05/04 dgilbert add SetErrorSignture() +// 558003 fips310 06/21/06 dgilbert add FilterUndo() +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/register/iipErrorRegisterFilter.h b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterFilter.h new file mode 100755 index 000000000..71b016926 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterFilter.h @@ -0,0 +1,189 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipErrorRegisterFilter.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2001,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef iipErrorRegisterFilter_h +#define iipErrorRegisterFilter_h + +/** + @file iipErrorRegisterFileter.h + @brief ErrorRegisterFilter class declaration +*/ + +// Class Description ************************************************* +// +// Name: ErrorRegisterFilter +// Base class: ErrorRegister +// +// Description: Error register with a filter +// Usage: (see iipErrorRegisterMask.h) +// +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#if !defined(iipErrorRegister_h) +#include <iipErrorRegister.h> +#endif +#include <prdfFilters.H> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +/** + Error register class with filtering capabilities + @author Doug Gilbert + */ +class ErrorRegisterFilter : public ErrorRegister +{ +public: + + /** + Constructor + <ul> + <br><b>Parameter: </b> Scan comm register to get bitString from hardware + <br><b>Parameter: </b> Resolution map to map bit pattern to a resolution + <br><b>Parameter: </b> scan comm register id for error signature + <br><b>Returns: </b> Nothing + <br><b>Requirements:</b> None + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None + <br><b>Notes: </b> + </ul><br> + */ + ErrorRegisterFilter(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, uint16_t scrId = 0x0fff); + + /** + Constructor + <ul> + <br><b>Parameter: </b> Scan comm register to get bitString from hardware + <br><b>Parameter: </b> Resolution map to map bit pattern to a resolution + <br><b>Parameter: </b> Filter to apply to bit string before mapping it + <br><b>Parameter: </b> scan comm register id + <br><b>Returns: </b> Nothing + <br><b>Requirements:</b> None + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None + <br><b>Notes: </b> + </ul><br> + */ + ErrorRegisterFilter(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, prdfFilter * f, uint16_t scrId = 0x0fff); + + /* + 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> Compiler default is OK + </ul><br> + */ + //~ErrorRegisterFilter(); + + /** + * @brief Get the stored filter associated with this resolution map. + * @returns Currently assigned filter. + */ + prdfFilter * getFilter() const { return filter; }; + + /** + * @brief Store a new filter with this resolution map. + * @param i - Filter to store. + */ + void setFilter(prdfFilter * i_filter) { filter = i_filter; }; + +protected: // functions + + /** + Filter the bit string (if a filter is provided) & convert it to a BitList + <ul> + <br><b>Parameters: </b> Bit String + <br><b>Returns: </b> Bit List + <br><b>Requirements:</b> Read() + <br><b>Promises: </b> Bit list representation of the (filtered) bit string + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> filter is called only if provided + - DEFINTION in iipErrorRegisterMask.C + </ul><br> + */ + virtual prdfBitKey Filter(const BIT_STRING_CLASS & bs); + + /** + * Certain filters need to be reversed in order for Reset() to work right + * @return bit_list modified ? [true|false] + * @see prdfFilters.H + */ + virtual bool FilterUndo(prdfBitKey & i_bit_list) + { + bool modified = false; + if(filter) modified = filter->Undo(i_bit_list); + return modified; + } + +private: // functions + + /** Copy forbidden - no definition exists */ + ErrorRegisterFilter(const ErrorRegisterFilter & er); + /** Assignment forbidden - no definition exists */ + ErrorRegisterFilter & operator=(const ErrorRegisterFilter & er); + +protected: // data + + prdfFilter * filter; + +private: // Data + +}; + +inline +ErrorRegisterFilter::ErrorRegisterFilter(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + uint16_t scrId) +: ErrorRegister(r,rm,scrId), filter(NULL) +{} + +inline +ErrorRegisterFilter::ErrorRegisterFilter(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + prdfFilter * f, + uint16_t scrId) +: ErrorRegister(r,rm,scrId), filter(f) +{} + + +#endif /* iipErrorRegisterFilter_h */ + +// Change Log ************************************************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------------------------------- +// P4907878 v5r2 04/27/01 dgilbert Initial Creation +// 423599 fsp 10/28/03 dgilbert make scrId a uint16_t +// 558003 fips310 06/21/06 dgilbert add get/setFilter() and FilterUndo +// +// End Change Log ********************************************************************************* diff --git a/src/usr/diag/prdf/common/framework/register/iipErrorRegisterMask.h b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterMask.h new file mode 100755 index 000000000..c5b9087b3 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterMask.h @@ -0,0 +1,232 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipErrorRegisterMask.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef iipErrorRegisterMask_h +#define iipErrorRegisterMask_h + +/** + @file iipErrorRegisterMask.h + @brief ErrorRegisterMask class declaration +*/ + +// Class Description ************************************************* +// +// Name: ErrorRegisterMask +// Base class: ErrorRegister +// Concrete class that can be used as a base class +// +// Description: Maskable & Filterable Error register declairation +//-------------- +// Usage: +// foo(SCAN_COMM_REGISTER &scr, ResolutionMap &resMap, +// STEP_CODE_DATA_STRUCT &error_data) +// { +// ErrorRegisterMask erm(scr,resMap); +// uint32_t mask_data[] = {0x00000000, 0xFFFFFFFF}; +// erm.SetMaskBits(BIT_STRING_ADDRESS_CLASS(0,64,mask_data)); +// ... +// int32_t rc = er.Analyze(error_data); +// ... +// erm.SetMaskBit(15); +// } +//-------------------- +// Filter example +// +// FILTER_PRIORITY_CLASS filter(BIT_LIST_STRING_1); // bit 1 takes priority +// ErrorRegisterMask erm(scr,resMap,&filter); // if it's on +// ... +// int32_t rc = erm.Analyze(error_data); +// +// Notes: +// +// +// End Class Description ********************************************* +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(iipErrorRegisterFilter_h) +#include <iipErrorRegisterFilter.h> +#endif + +#ifndef IIPBITS_H +#include <iipbits.h> +#endif +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +/** + Error register with bit masking capabilities + @version V4R5 +*/ +class ErrorRegisterMask : public ErrorRegisterFilter +{ +public: + + /** + Constructor + <ul> + <br><b>Parameter: </b> ScanCommRegister + <br><b>Parameter: </b> Resolution map + <br><b>Parameter: </b> Optional Filter + <br><b>Parameter: </b> Optional scrId + <br><b>Parameter: </b> Optional maskScan comm register + <br><b>Notes: </b> If no ScrId is provided then the scan + Comm register address is used + </ul><br> + */ + ErrorRegisterMask(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, FILTER_CLASS * f = NULL, uint16_t scrId = 0x0fff, SCAN_COMM_REGISTER_CLASS & maskScr = *((SCAN_COMM_REGISTER_CLASS *) NULL)); // dg00 + + /** + Constructor + <ul> + <br><b>Parameter: </b> ScanCommRegister + <br><b>Parameter: </b> Resolution map + <br><b>Parameter: </b> scrId - for the signature + <br><b>Parameter: </b> Optional maskScan comm register + </ul><br> + */ + ErrorRegisterMask(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, uint16_t scrId, SCAN_COMM_REGISTER_CLASS & maskScr = *((SCAN_COMM_REGISTER_CLASS *) NULL)); // dg00 + + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default is ok + // + // End Function Specification **************************************** + // ~ErrorRegisterMask(); + + /** + Set a mask bit + <ul> + <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>Exceptions: </b> None. + <br><b>Notes: </b> The bitstring read from hardware during Read() + will have this bitpos reset (zeroed) prior to using + it for any Analysis. + </ul><br> + */ + void SetMaskBit(uint32_t bitPosition); + + /** + Set mask bits + <ul> + <br><b>Parameters: </b> BitString + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> bitStringMask != bitString; + + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> The bitstring read from hardware during Read() + will have the bit positions reset (zeroed) as + specified in the bitStringMask (by 1's) prior + to using it for any Analysis. + </ul><br> + */ + void SetMaskBits(const BIT_STRING_CLASS & bitString); + +protected: + + /** + Read the scan comm register, apply the mask, and return the resulting bit string + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> a Bit String + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Bit string contains data from hardware with masked bits zeroed + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Any class that overides Read() but does not + override Analyze() should set src_rc + return code from mops scr access + </ul><br> + */ + virtual const BIT_STRING_CLASS & Read(); + + + /** + Reset the error register and set mask bit if sdc is at theshold + <ul> + <br><b>Parameters: </b> BitList + <br><b>Returns: </b> return code + <br><b>Requirements:</b> Filter() + <br><b>Promises: </b> if xMaskScr == NULL then + bitStringMask bit(s) set if error.service_data->IsAtThreshold() + ELSE bitStringMask remains unchanged + Hardware may be modified + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> + </ul><br> + */ + virtual int32_t Reset(const BIT_LIST_CLASS & bit_list,STEP_CODE_DATA_STRUCT & error); + +private: // functions + /** Copy forbidden - no definition (code) exists*/ + ErrorRegisterMask(const ErrorRegisterMask & er); + /** Assignment forbidden - no definition (code) exists */ + ErrorRegisterMask & operator=(const ErrorRegisterMask & er); + +protected: // Data + + BIT_STRING_BUFFER_CLASS bitString; + BIT_STRING_BUFFER_CLASS bitStringMask; + +private: // Data + + SCAN_COMM_REGISTER_CLASS & xMaskScr; // dg00 +// bool maskIt; + +}; + +inline void ErrorRegisterMask::SetMaskBit(uint32_t bitPosition) +{ bitStringMask.Set(bitPosition); } + +inline void ErrorRegisterMask::SetMaskBits(const BIT_STRING_CLASS & bitString) +{ bitStringMask.SetBits(bitString); } + +#endif /* iipErrorRegisterMask_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- ----- ------------------------------- +// 05/03/96 DRG Initial Creation +// d49127.1 v4r1m0 05/31/96 DRG Added Analyze() Reset() & maskIt +// p4902214 v4r1m0 05/09/97 DRG Added service data parm to Reset +// Removed maskIt +// D49274.2 v4r5 09/24/98 DRG Added scrId +// dg00 v5r2 04/05/00 DRG Added maskScr +// P4907878 v5r2 04/27/01 drg factor out filter into ErrorRegisterFilter +// class +// 423599 fsp 10/28/03 dgilbert make scrId a uint16_t +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/register/iipErrorRegisterSet.h b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterSet.h new file mode 100755 index 000000000..0d91dd719 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterSet.h @@ -0,0 +1,124 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipErrorRegisterSet.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1997,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef iipErrorRegisterSet_h +#define iipErrorRegisterSet_h + +// Class Description ************************************************* +// +// Name: ErrorRegisterSet +// Base class: ErrorRegisterMask +// +// Description: To be used when the bits on in the error register +// represent a set of errors reported and the error +// analysis is to a union of the Resolutions +// for each error bit. +// +// Usage: See iipErrorRegister.h +// +// Warning: +// If this class is used with recoverable errors then all bits on are +// masked when ANY threshold is detected, therefore the chip should +// mask the hardware accordingly. +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(iipErrorRegisterMask_h) +#include <iipErrorRegisterMask.h> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +class ErrorRegisterSet: public ErrorRegisterMask +{ +public: + ErrorRegisterSet(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + FILTER_CLASS * f = NULL); + // Function Specification ******************************************** + // + // Purpose: Constructor + // Parameters: None + // Returns: Nothing + // Requirements: None + // Promises: Object created + // Exceptions: None + // Concurrency: synchronous + // Notes: + // + // End Function Specification **************************************** + + //~ErrorRegisterSet(); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: + // + // End Function Specification **************************************** + + virtual int32_t Analyze(STEP_CODE_DATA_STRUCT & error); + // Function Specification ******************************************** + // + // Purpose: Analyze the error(s) reported by this error register + // Parameters: Reference to area to return Service Data + // Returns: Return code + // Requirements: None. + // Promises: At least one Resolution called (See notes) + // Service data error signature scrid and error code modified + // if register has no bits on then + // rc = PRD_SCAN_COMM_REGISTER_ZERO (iipconst.h) + // If rc != SUCCESS then no promises + // Exceptions: Simulator may throw TBD otherwise none. + // Concurrency: + // Notes: + // A Resolution called for Each bit that's on in the error + // register. + // If no resolutions exist for a bit then the + // ResolutionMap default Resolution is Called. + // + // End Function Specification **************************************** +private: // functions +private: // Data + +}; + +#endif /* iipErrorRegisterSet_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// p4901848 v4r1 02/20/97 DGILBERT Initial Creation +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/register/iipErrorRegisterType.h b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterType.h new file mode 100755 index 000000000..85c5a3309 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterType.h @@ -0,0 +1,180 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipErrorRegisterType.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef iipErrorRegisterType_h +#define iipErrorRegisterType_h + +// Class Description ************************************************* +// +// Name: iipErrorRegisterType ABC +// Base class: None +// +// Description: +// Usage: +// +// End Class Description ********************************************* +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- +#if !defined(IIPBTLST_H) +#include <prdfBitKey.H> +#endif + +#if !defined(iipResolution_h) +#include <iipResolution.h> +#endif + +#include <iipsdbug.h> +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +class BIT_STRING_CLASS; +struct STEP_CODE_DATA_STRUCT; + +class ErrorRegisterType +{ + public: +// ERROR_REGISTER_CLASS(); + // Function Specification ******************************************** + // + // Purpose: Constructor + // Parameters: None + // Returns: Nothing + // Requirements: None + // Promises: Object created + // Exceptions: None + // Concurrency: synchronous + // Notes: Compiler default = ok + // + // End Function Specification **************************************** + + virtual ~ErrorRegisterType() {} + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: + // + // End Function Specification **************************************** + + virtual int32_t Analyze(STEP_CODE_DATA_STRUCT & error) = 0; + // Function Specification ******************************************** + // + // Purpose: Analyze the error reported by this error register + // Parameters: Reference to area to return Service Data + // Returns: Return code + // Requirements: None. + // Promises: Provide service data for the error condition reported + // by the hardware error register this object represents + // Exceptions: Simulator may throw TBD otherwise None. + // Concurrency: + // Notes: + // + // End Function Specification **************************************** + +protected: + + virtual const BIT_STRING_CLASS & Read(ATTENTION_TYPE i_attn) = 0; + // Function Specification ******************************************** + // + // Purpose: Read data in from hardware for this error register + // Parameters: None + // Returns: Reference to a bit string containing the data read + // Requirements: None. + // Promises: Returns a reference to the bit string containing the + // value read . May return NULL if hardware access failed. + // Exceptions: None. (Future: May throw Ereg_Read_Failure) + // Concurrency: + // Notes: + // + // End Function Specification **************************************** + + virtual prdfBitKey Filter(const BIT_STRING_CLASS & bs) = 0; + // Function Specification ******************************************** + // + // Purpose: Filter out unwanted bits in the bit string. + // Parameters: References to the bit string read in. + // Returns: Reference to a bit list + // Requirements: None. + // Promises: Return a bit list containing the desired pattern to + // use to find an Resolution to execute. + // Exceptions: None. + // Concurrency: + // Notes: + // + // End Function Specification **************************************** + + virtual bool FilterUndo(prdfBitKey & i_bit_list) = 0; + + /** + Find a resolution for the Bit List + <ul> + <br><b>Parameters: </b> reference to ServiceDataCollector to act on + <br><b>Parameter: </b> Bit List + <br><b>Requirements:</b> Filter() + <br><b>Promises: </b> The bit list may be modified if the search + algoithm modified it to find a match. (as in a fuzzy search) + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> If no match for the Bit List is found in the + Resolution Map then the ResolutionMap default is used + </ul><br> + */ + virtual int32_t Lookup(STEP_CODE_DATA_STRUCT & sdc, prdfBitKey & bl) = 0; //dg02c + + virtual int32_t Reset(const prdfBitKey & bit_list,STEP_CODE_DATA_STRUCT & error) = 0; + // Function Specification ******************************************** + // + // Purpose: Reset the hardware & perform any other actions needed + // to prepare for the next Analysis + // Parameters: Reference to a bit list + // Returns: Return code + // Requirements: None. + // Promises: Hardware register may be modified + // May do nothing if nothing is needed. + // Exceptions: None. + // Concurrency: + // Notes: + // + // End Function Specification **************************************** + +}; + + +#endif /* iipErrorRegisterType_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- ----- ------------------------------- +// v4r1m0 04/03/96 DRG Initial Creation from iiperst.h +// Abstraction of error register class +// p4902214 v4r1m0 05/09/97 DRG Added service data parm to Reset +// dg02 482244 fips225 11/05/04 dgilbert change Lookup() to pass bl by value +// 558003 fips310 06/21/06 dgilbert add FilterUndo() +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.C b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.C new file mode 100755 index 000000000..66977cb13 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.C @@ -0,0 +1,68 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +// 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 new file mode 100755 index 000000000..dd08c14b9 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.h @@ -0,0 +1,189 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef iipMopRegisterAccess_h +#define iipMopRegisterAccess_h + +// Class Specification ************************************************* +// +// Class name: MopRegisterAccess +// Parent class: None. +// +// Summary: This class provides access to hardware register via +// a MOP routine. A single pure virtual function Access() +// is declared for this purpose. +// +// Cardinality: 0 +// +// Performance/Implementation: +// Space Complexity: Constant +// Time Complexity: All member functions constant unless otherwise +// stated. +// +// Usage Examples: +// +// +// void foo(MopRegisterAccess & mra) +// { +// BIT_STRING_BUFFER_CLASS bitString(80); // 80 bits +// +// mra.Access(bitString, READ); +// ... +// +// } +// +// +// End Class Specification ********************************************* + +// Includes +#if !defined(IIPCONST_H) +#include <iipconst.h> +#endif +#include <prdfPlatServices.H> + +// Forward References +class BIT_STRING_CLASS; + +class MopRegisterAccess +{ +public: + + enum Operation + { + READ = 0, + WRITE = 1 + }; + + // MopRegisterAccess(void); + // Function Specification ******************************************** + // + // Purpose: Initialization + // Parameters: None. + // Returns: No value returned. + // Requirements: None. + // Promises: All data members are initialized. + // Exceptions: None. + // Concurrency: N/A + // Notes: This constructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification ////////////////////////////////////// + + // MopRegisterAccess(const MopRegisterAccess & scr); + // Function Specification ******************************************** + // + // Purpose: Copy + // Parameters: scr: Reference to instance to copy + // Returns: No value returned. + // Requirements: None. + // Promises: All data members will be copied (Deep copy). + // Exceptions: None. + // Concurrency: N/A. + // Notes: This constructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + + virtual ~MopRegisterAccess(void); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: N/A + // + // End Function Specification **************************************** + + // MopRegisterAccess & operator=(const MopRegisterAccess & scr); + // Function Specification ******************************************** + // + // Purpose: Assigment + // Parameters: d: Reference to instance to assign from + // Returns: Reference to this instance + // Requirements: None. + // Promises: All data members are assigned to + // Exceptions: None. + // Concurrency: N/A. + // Notes: This assingment operator is not declared. The compiler + // generated default definition is sufficient. + // + // End Function Specification **************************************** + + virtual uint32_t Access(BIT_STRING_CLASS & bs, + uint64_t registerId, + Operation operation) const = 0; + // Function Specification ******************************************** + // + // Purpose: This function reads or writes the hardware according + // to the specified operation. + // Parameters: bs: Bit string to retrieve(for write) or store data + // (from read) + // registerId: SCR Address or scan offset + // operation: Indicates either read or write operation + // Returns: Hardware OPs return code + // Requirements: bs.Length() == long enough + // Promises: For read operation, bs is modified to reflect hardware + // register state + // Exceptions: None. + // Concurrency: Nonreentrant. + // Note: The first bs.Length() bits from the Hardware OPs read + // are set/reset in bs (from left to right) + // For a write, the first bs.Length() bits are written + // to the hardware register with right padded 0's if + // needed + // + // End Function Specification **************************************** + //Get Ids and count + virtual const TARGETING::TargetHandle_t * GetChipIds(int & count) const = 0; + // Function Specification ******************************************** + // + // Purpose: Access Chip Ids and # of chips to access + // Parameters: count: Var to return chip count of valid IDs + // Returns: ptr to Chip ids + // Requirements: None + // Promises: None + // Exceptions: None. + // Concurrency: Reentrant. + // + // End Function Specification **************************************** + + private: + + }; + +#include <iipMopRegisterAccess.inl> + +// Change Log ********************************************************** +// +// Flag PTR/DCR# Userid Date Description +// ---- -------- -------- -------- ----------- +// n/a n/a JST 09/08/95 Created. +// d DGILBERT 05/19/95 Modified Access() parms +// +// End Change Log ****************************************************** + + +#endif diff --git a/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.inl b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.inl new file mode 100755 index 000000000..1bb95f597 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.inl @@ -0,0 +1,63 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipMopRegisterAccess.inl $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +// 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 +//--------------------------------------------------------------------- + +inline +MopRegisterAccess::~MopRegisterAccess(void) + { + } + diff --git a/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccessScanComm.h b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccessScanComm.h new file mode 100755 index 000000000..1824ac174 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccessScanComm.h @@ -0,0 +1,164 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipMopRegisterAccessScanComm.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef iipMopRegisterAccessScanComm_h +#define iipMopRegisterAccessScanComm_h + +// Class Specification ************************************************* +// +// Class name: MopRegisterAccessScanComm +// Parent class: MopRegisterAccess. +// +// Summary: This class provides access to hardware register data via +// a MOP Scan Comm routine. +// +// Cardinality: 0 +// +// Performance/Implementation: +// Space Complexity: Constant +// Time Complexity: All member functions constant unless otherwise +// stated. +// +// Usage Examples: +// +// +// +// End Class Specification ********************************************* + +// Includes + +#pragma interface + +#ifndef iipMopRegisterAccess_h +#include <iipMopRegisterAccess.h> +#endif + +// Forward References +class MopRegisterAccessScanComm : public MopRegisterAccess +{ +public: + + // Function Specification ******************************************** + // + // Purpose: CTOR + // Parameters: None + // Returns: No value returned. + // Requirements: None. + // Promises: All data members are initialized. + // Exceptions: None. + // Concurrency: N/A + // Note: Multiple chip IDs are for chips that MOPs must + // access at the same time when performing a Scan + // Comm operation (ie STINGER & ARROW chips) + // + // End Function Specification ////////////////////////////////////// + + // MopRegisterAccessScanComm(const MopRegisterAccessScanComm & scr); + // Function Specification ******************************************** + // + // Purpose: Copy + // Parameters: scr: Reference to instance to copy + // Returns: No value returned. + // Requirements: None. + // Promises: All data members will be copied (Deep copy). + // Exceptions: None. + // Concurrency: N/A. + // Notes: This constructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + + // virtual ~MopRegisterAccessScanComm(void); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: N/A + // Notes: This destructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + + // MopRegisterAccessScanComm & operator=(const MopRegisterAccessScanComm & scr); + // Function Specification ******************************************** + // + // Purpose: Assigment + // Parameters: d: Reference to instance to assign from + // Returns: Reference to this instance + // Requirements: None. + // Promises: All data members are assigned to + // Exceptions: None. + // Concurrency: N/A. + // Notes: This assingment operator is not declared. The compiler + // generated default definition is sufficient. + // + // End Function Specification **************************************** + + virtual uint32_t Access(BIT_STRING_CLASS & bs, + uint32_t registerId, + Operation operation) const; + // Function Specification ******************************************** + // + // Purpose: This function reads or writes the hardware according + // to the specified operation. + // Parameters: bs: Bit string to retrieve(for write) or store data + // (from read) + // registerId: ScanComm register address + // operation: Indicates either read or write operation + // Returns: Hardware OPs return code + // Requirements: bs.Length() == long enough + // Promises: For read operation, bs is modified to reflect hardware + // register state + // Exceptions: None. + // Concurrency: Nonreentrant. + // Note: The first bs.Length() bits from the Hardware OPs read + // are set/reset in bs (from left to right) + // For a write, the first bs.Length() bits are written + // to the hardware register with right padded 0's if + // needed + // + // End Function Specification **************************************** + + +private: // DATA + +}; + +//#include <iipMopRegisterAccessScanComm.inl> // dg00 + +// Change Log ********************************************************** +// +// Flag PTR/DCR# Userid Date Description +// ---- -------- -------- -------- ----------- +// n/a n/a JST 09/08/95 Created. +// v4r3 DGILBERT 05/19/96 Modified Access() +// dg00 365764 dgilbert 04/19/02 remove inlines +// +// End Change Log ****************************************************** + + +#endif diff --git a/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccessScanComm.inl b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccessScanComm.inl new file mode 100755 index 000000000..7d1c59227 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipMopRegisterAccessScanComm.inl @@ -0,0 +1,64 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipMopRegisterAccessScanComm.inl $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +// Module Description ************************************************** +// +// Description: This module provides the inline implementation for the +// PRD MOP Register Access Scan Comm class. +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +inline +MopRegisterAccessScanComm::MopRegisterAccessScanComm(void) + { + } + + diff --git a/src/usr/diag/prdf/common/framework/register/iipResetErrorRegister.h b/src/usr/diag/prdf/common/framework/register/iipResetErrorRegister.h new file mode 100755 index 000000000..90e17d47d --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipResetErrorRegister.h @@ -0,0 +1,316 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipResetErrorRegister.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef iipResetErrorRegister_h +#define iipResetErrorRegister_h + +/** + @file iipResetErrorRegister.h + @brief ResetErrorRegister declaration +*/ + +// Class Description ************************************************* +// +// Name: ResetErrorRegister +// Base class: ErrorRegisterMask +// +// Description: Reset the error register after analysis by turning off +// the bits in the SCR that were used for the analysis +// Usage: Initialization +// ScanCommRegisterChip scr1(...), scr2(...); +// ResolutionMap rm(...); +// *** Reset SCR same as One used to read error reg *** +// ErrorRegister * er = new ResetErrorRegister(scr1,rm); +// +// *** Reset SCR different from one used to read error reg *** +// ErrorRegister * er1 = new ResetErrorRegister(scr1,rm,scr2); +// +// *** Using a Filter **** +// Filter * f = new PriorityFileter(...); +// ErrorRegister * er = new ResetErrorRegister(scr1,rm,f); +// ErrorRegister *er1 = new ResetErrorRegister(scr1,rm,scr2,f); +// +// Regular usage same as ErrorRegister +// +// RESET: +// if scr2 is not given then turn off bits in scr1 specified by bit_list +// and scr1.Write(); +// if scr2 then copy bitlist from scr1 to scr2 then set off bits +// in scr2 specified by bit_list then scr2.Write(); +// +// End Class Description ********************************************* +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#ifndef iipErrorRegisterMask_h +#include <iipErrorRegisterMask.h> +#endif + +#include <vector> +#include <prdfResetOperators.H> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +class ResetErrorRegister : public ErrorRegisterMask +{ +public: + /** + Constructor + <ul> + <br><b>Parameter: </b> Scan comm register associated with the error register + <br><b>Parameter: </b> ResolutionMap + <br><b>Parameter: </b> Optional filter + <br><b>Parameter: </b> Optional scrId - to use in the error signature + <br><b>Notes: </b> If no scrId is provided than the address of the scan comm register is used + </ul><br> + */ + ResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, FILTER_CLASS * f = NULL, uint16_t scrID = 0x0fff, SCAN_COMM_REGISTER_CLASS & maskScr = *((SCAN_COMM_REGISTER_CLASS *) NULL)); + + /** + Constructor + <ul> + <br><b>Parameter: </b> Scan comm register associated with the error register + <br><b>Parameter: </b> ResolutionMap + <br><b>Parameter: </b> scrId - used in the error signature + <br><b>Notes: </b> If no scrId is provided than the address of the scan comm register is used + </ul><br> + */ + ResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, uint16_t scrID, SCAN_COMM_REGISTER_CLASS & maskScr = *((SCAN_COMM_REGISTER_CLASS *) NULL)); + + /** + Constructor - Where scan comm register to read is different from the scan comm register to write to reset + <ul> + <br><b>Parameter: </b> Scan comm register associated with the error register + <br><b>Parameter: </b> ResolutionMap + <br><b>Parameter: </b> Scan comm register to write to reset the error + <br><b>Parameter: </b> Optional filter + <br><b>Parameter: </b> Optional scrId - to use in the error signature + <br><b>Notes: </b> If no scrId is provided than the address of the scan comm register is used + </ul><br> + */ + ResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, SCAN_COMM_REGISTER_CLASS & reset, FILTER_CLASS * f = NULL, uint16_t scrID = 0x0fff); + + /** + Constructor - Where scan comm register to read is different from the scan comm register to write to reset + <ul> + <br><b>Parameter: </b> Scan comm register associated with the error register + <br><b>Parameter: </b> ResolutionMap + <br><b>Parameter: </b> Scan comm register to write to reset the error + <br><b>Parameter: </b> scrId - to use in the error signature + <br><b>Notes: </b> If no scrId is provided than the address of the scan comm register is used + </ul><br> + */ + ResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, ResolutionMap & rm, SCAN_COMM_REGISTER_CLASS & reset, uint16_t scrID); + + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default is sufficient + // + // End Function Specification **************************************** + //~ResetErrorRegister(); + +protected: // functions + + /** + Reset the error register and set mask bit if sdc is at theshold + <ul> + <br><b>Parameters: </b> BitList + <br><b>Returns: </b> return code + <br><b>Requirements:</b> Filter() + <br><b>Promises: </b> bitStringMask bit(s) set if error.service_data->IsAtThreshold() + Hardware modified + <br><b>Exceptions: </b> None + <br><b>Notes: </b> Zeros written to hardware + </ul><br> + */ + virtual int32_t Reset(const BIT_LIST_CLASS & bit_list, STEP_CODE_DATA_STRUCT & error); + +private: // functions + + /** Copy prohibited */ + ResetErrorRegister(const ResetErrorRegister & er); + /** Assignment prohibited */ + ResetErrorRegister & operator=(const ResetErrorRegister & er); + +private: // Data + + SCAN_COMM_REGISTER_CLASS * resetScr; + +}; + + +inline +ResetErrorRegister::ResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + FILTER_CLASS * f, + uint16_t scrId, + SCAN_COMM_REGISTER_CLASS & maskScr) +: ErrorRegisterMask(r,rm,f,scrId,maskScr), resetScr(&r) +{} + +inline +ResetErrorRegister::ResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + SCAN_COMM_REGISTER_CLASS & reset, + FILTER_CLASS * f, + uint16_t scrId) +: ErrorRegisterMask(r,rm,f,scrId), resetScr(&reset) +{} + +inline +ResetErrorRegister::ResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + uint16_t scrId, + SCAN_COMM_REGISTER_CLASS & maskScr) +: ErrorRegisterMask(r,rm,scrId,maskScr), resetScr(&r) +{} + +inline +ResetErrorRegister::ResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + SCAN_COMM_REGISTER_CLASS & reset, + uint16_t scrId) +: ErrorRegisterMask(r,rm,scrId), resetScr(&reset) +{} + + +/** + * @class ResetAndMaskErrorRegister + * ErrorRegister to reset and mask errors. + * + * Similar to ResetErrorRegister, but adds mask capability and multiple + * reset/mask registers. + * + * Will do masking if isAtThreshold(). + * Always does resets. (TODO: Should this be done only on recov?) + */ +class ResetAndMaskErrorRegister : public ErrorRegisterMask +{ + public: + /** + * @struct ResetRegisterStruct + * Stores information required to do reset/mask. + */ + struct ResetRegisterStruct + { + RegisterResetOperator * op; + SCAN_COMM_REGISTER_CLASS * read; + SCAN_COMM_REGISTER_CLASS * write; + + bool operator<(const ResetRegisterStruct & rhs) const + { + if (this->op != rhs.op) + return (this->op < rhs.op); + else if (this->read != rhs.read) + return (this->read < rhs.read); + else + return (this->write < rhs.write); + }; + + bool operator==(const ResetRegisterStruct & rhs) const + { + return (this->op == rhs.op) && + (this->read == rhs.read) && + (this->write == rhs.write); + }; + }; + + typedef std::vector<ResetRegisterStruct> ResetRegisterVector; + + public: + /** + * Constructor + * @param r : Register for error isolation. + * @param rm : Resolution map for error. + * @param f : Register filter. + * @param scrId : ScanComm register ID. + */ + ResetAndMaskErrorRegister(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + FILTER_CLASS * f = NULL, + uint16_t scrId = 0x0fff) + : ErrorRegisterMask(r, rm, f, scrId), cv_resets(), cv_masks() {}; + + /** + * Constructor + * @param r : Register for error isolation. + * @param rm : Resolution map for error. + * @param scrId : ScanComm register ID. + */ + ResetAndMaskErrorRegister(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + uint16_t scrId = 0x0fff) + : ErrorRegisterMask(r, rm, scrId), cv_resets(), cv_masks() {}; + + /** + * Add additional reset register to list. + */ + void addReset(ResetRegisterStruct i_reset) + { cv_resets.push_back(i_reset); }; + + /** + * Add additional mask register to list. + */ + void addMask(ResetRegisterStruct i_mask) + { cv_masks.push_back(i_mask); }; + + protected: + /** + * Reset/Mask error after error isolation. + * + * @param bl : bit list of errors detected. + * @param sdc : current STEP_CODE. + */ + virtual int32_t Reset(const BIT_LIST_CLASS & bl, + STEP_CODE_DATA_STRUCT & sdc); + + private: + // prohibit copy, assignment. + ResetAndMaskErrorRegister(const ResetAndMaskErrorRegister &); + ResetAndMaskErrorRegister& operator=(const ResetAndMaskErrorRegister&); + + private: + + /** + * List of resets. + */ + ResetRegisterVector cv_resets; + /** + * List of masks. + */ + ResetRegisterVector cv_masks; +}; + + + +#endif /* iipResetErrorRegister_h */ diff --git a/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.C b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.C new file mode 100755 index 000000000..675bff0a2 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.C @@ -0,0 +1,215 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +// Module Description ************************************************** +// +// Description: This module provides the implementation for the PRD Scan +// Comm Register Access class. +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define iipScanCommRegisterAccess_C + +#include <CcSynch.h> +#include <iipconst.h> +#include <iipbits.h> +#include <iipMopRegisterAccess.h> +#include <iipScanCommRegisterAccess.h> +#include <prdfMain.H> +#undef iipScanCommRegisterAccess_C + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- +// +#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) +#if (GCC_VERSION >= 3004) +template<> +#endif +ScanCommRegisterAccess::SynchType::StepType + ScanCommRegisterAccess::SynchType::step = + ScanCommRegisterAccess::SynchType::STATIC_INITIAL_VALUE; + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +uint32_t ScanCommRegisterAccess::UnSync(void) +{ + uint32_t l_rc = SUCCESS; + synch.Advance(); // make everything out of synch + return(l_rc); +} + +uint32_t ScanCommRegisterAccess::Read(void) +{ + uint32_t rc = SUCCESS; + + if(!synch.IsCurrent()) + { +// BIT_STRING_BUFFER_CLASS bs(GetBitLength(), GetBufferByteSize()); + BIT_STRING_CLASS & bs = AccessBitString(); + + rc = Access(bs,GetAddress(), MopRegisterAccess::READ); + // dg01 start + if (rc != SUCCESS) + { + synch.Advance(); // make everything out of synch if failed + } + // dg01 end + +// if(rc == SUCCESS) +// { +// SetBitString(&bs); +// } + } + + return(rc); +} + +// ---------------------------------------------------------------------------- +// dg00 start +uint32_t ScanCommRegisterAccess::ForceRead(void) +{ + uint32_t rc = SUCCESS; + + BIT_STRING_CLASS & bs = AccessBitString(); + rc = Access(bs,GetAddress(), MopRegisterAccess::READ); + synch.IsCurrent(); + + return rc; +} +// dg00 end +//------------------------------------------------------------------------------- + +uint32_t ScanCommRegisterAccess::Write(void) +{ + uint32_t rc = (uint32_t) FAIL; + +// const BIT_STRING_CLASS * bit_string_ptr = GetBitString(); + + BIT_STRING_CLASS & bs = AccessBitString(); +// if(bit_string_ptr != NULL) +// { +// BIT_STRING_BUFFER_CLASS bs(GetBitLength(), GetBufferByteSize()); + +// bs.SetBits(*bit_string_ptr); + + rc = Access(bs, GetAddress(),MopRegisterAccess::WRITE); +// } + + return(rc); +} + +// unsigned int ScanCommRegisterAccess::GetBufferByteSize(void) const +// { +// return(BUFFER_BYTE_SIZE); +// } + +uint32_t ScanCommRegisterAccess::Access(BIT_STRING_CLASS & bs, uint64_t registerId, + MopRegisterAccess::Operation op) const +{ + using namespace PRDF; + + uint32_t rc = SCR_ACCESS_FAILED; + if(hops != NULL) + { + rc = hops->Access(bs, registerId, op); + } + return(rc); +} + +// #ifdef _USE_IOSTREAMS_ + +// ostream & operator<<(ostream & out, const ScanCommRegisterAccess & scr) +// { +// out << "Address: " << scr.GetAddress() << " Chip: "; // << hops; + + +// uint32_t count; +// const uint32_t * values = scr.GetChipSelectValues(count); + +// if(count) +// { +// for(uint32_t i = 0;i < count;i++) +// { +// out << values[i] << " "; +// } +// } +// else +// { +// out << "None "; +// } + +// const BIT_STRING_CLASS * bit_string_ptr = scr.GetBitString(); + +// if(bit_string_ptr == NULL) +// { +// out << " No Data"; +// } +// else +// { +// out << " Data: " << (*bit_string_ptr); +// } + +// return(out); +// } + +// #endif + +// Change Log ********************************************************** +// +// Flag PTR/DCR# Userid Date Description +// ---- -------- -------- -------- ----------- +// n/a n/a JST ??/??/95 Created. +// D24747.4 JFP 02/23/95 Added #include <CuLib.h> +// DGILBERT 05/23/97 Access()/Read()/Write() change +// dg01 aix343882 dgilbert 07/16/01 Make out of synch if Read fails +// +// End Change Log ****************************************************** + + + + + + + diff --git a/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.h b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.h new file mode 100755 index 000000000..965d34fe6 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.h @@ -0,0 +1,340 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1997,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef iipScanCommRegisterAccess_h +#define iipScanCommRegisterAccess_h + +// Class Specification ************************************************* +// +// Class name: ScanCommRegisterAccess +// Parent class: SCAN_COMM_REGISTER_CLASS +// +// Summary: This class provides access to the Scan Comm Register +// physical hardware. The member functions Read() and Write() +// both call the common function Access(). Access() is +// implemented to use a MopRegisterAccessScanComm instance to +// access the hardware. +// +// This class contains an instance of the CcSynch class. This +// data member is used to ensure that the Read() function will +// only call the Access() function once for any given synch +// value. An external thread must ensure that the synch value +// is advanced at appropriate times. AN eclosed class id is +// used to ensure that the class template CcSynch +// specialization is unique. See the specification of the +// CcSynch class for more details +// +// Cardinality: 0 +// +// Performance/Implementation: +// Space Complexity: Constant +// Time Complexity: All member functions constant unless otherwise +// stated. +// +// Usage Examples: +// +// void foo(ScanCommRegisterAccess & scr) +// { +// scr.Read(); +// scr.Write(); +// } +// +// +// End Class Specification ********************************************* + + +// Includes +#ifndef IIPSCR_H +#include <iipscr.h> +#endif + +#ifndef CcSynch_h +#include <CcSynch.h> +#endif + +#if !defined(IIPCONST_H) +#include <iipconst.h> +#endif + +#ifndef iipMopRegisterAccess_h +#include <iipMopRegisterAccess.h> +#endif + +// // Forward References +// #ifdef _USE_IOSTREAMS_ +// class ostream; +// #endif + +class ScanCommRegisterAccess : public SCAN_COMM_REGISTER_CLASS +{ +public: + + struct id {}; + typedef CcSynch<uint16_t, id> SynchType; + + /** + Constructor + <ul> + <br><b>Parameter: </b> ar: Scan Comm Register address. + <br><b>Parameter: </b> mopsAccess object + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Heap memory may be allocated + <br><b>Exceptions: </b> None. + </ul><br> + */ + ScanCommRegisterAccess(uint64_t ra, MopRegisterAccess &hopsAccessor); + + // Function Specification ******************************************** + // + // Purpose: Copy + // Parameters: scr: Reference to instance to copy + // Returns: No value returned. + // Requirements: None. + // Promises: All data members will be copied (Deep copy). + // Exceptions: None. + // Concurrency: N/A. + // Notes: This constructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + // ScanCommRegisterAccess(const ScanCommRegisterAccess & scr); + + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: N/A + // Notes: This destructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + // virtual ~ScanCommRegisterAccess(void); + + // Function Specification ******************************************** + // + // Purpose: Assigment + // Parameters: d: Reference to instance to assign from + // Returns: Reference to this instance + // Requirements: None. + // Promises: All data members are assigned to + // Exceptions: None. + // Concurrency: N/A. + // Notes: This assingment operator is not declared. The compiler + // generated default definition is sufficient. + // + // End Function Specification **************************************** + // ScanCommRegisterAccess & operator=(const ScanCommRegisterAccess & scr); + + // virtual const uint32_t * GetChipSelectValues( retired + // unsigned int & chipSelectCount) const = 0; retired + + // Function Specification ******************************************** + // + // Purpose: This function returns the size (in bytes) of the + // buffer needed for accesses. + // Parameters: None. + // Returns: Buffer size. + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant. + // + // End Function Specification **************************************** + // virtual unsigned int GetBufferByteSize(void) const; + + // dg00 start + /** + Read hardware register (pure virtual) + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> [SUCCESS | MOPs return code] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Internal bit string represents the value of the + hardware register (if rc == SUCCESS) + <br><b>Sideaffects: </b> Value guarrenteed to be read from hardware. + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual uint32_t ForceRead(void); + // dg00 end + + /** + Read hardware register + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> [SUCCESS | MOPs return code] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Internal bit string represents the value of the + hardware register (if rc == SUCCESS) + <br><b>Sideaffects: </b> The bit string value may or may not be retrieved + from hardware; a buffered copy may be used. + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual uint32_t Read(void); + + /** + Unsynchronize the register access to recollect reg contents. + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> [SUCCESS] + <br><b>Requirements:</b> None. + </ul><br> + */ + virtual uint32_t UnSync(void); + + /** + Write hardware register + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> [SUCCESS | MOPs return code] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Internal bit string value written to hardware + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> If internal bitstring was never read/set/modified then + zeros are written to corresponding hardware register. + </ul><br> + */ + virtual uint32_t Write(void); + + /** + Access a copy of the short id for signatures. + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> ID. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual uint16_t GetId(void) const { return cv_shortId; }; + + /** + Set the short id for signatures. + <ul> + <br><b>Parameters: </b> ID. + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> For virtual registers, this is not required to have + any effect. + </ul><br> + */ + virtual void SetId(uint16_t i_id) { cv_shortId = i_id; }; + + + /** + Access the chipid(s) of the chip + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> ptr to const array of chipIds + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None + <br><b>Exceptions: </b> None. + </ul><br> + */ + const TARGETING::TargetHandle_t * GetChipIds(int & chipCount) const + { return hops->GetChipIds(chipCount); } + + const MopRegisterAccess & GetHops(void)const { return *hops; } + +protected: + ScanCommRegisterAccess() : SCAN_COMM_REGISTER_CLASS(0xffffffff), hops(NULL) {} +private: // Functions + + /** + This function reads or writes the hardware according to the specified operation. + <ul> + <br><b>Parameter: </b> bufferPtr: Pointer to buffer for input + <br><b>Parameter: </b> (write operation) or output (read operation) + <br><b>Paramter: </b> op: Indicates either read or write operation + <br><b>Returns: </b> None. + <br><b>Requirements:</b> Buffer must be valid. + <br><b>Promises: </b> For read operation, buffer is modified. + <br><b>Exceptions: </b> None. + </ul><br> + */ + uint32_t Access(BIT_STRING_CLASS & bs, uint64_t registerId, + MopRegisterAccess::Operation op) const; + +// #ifdef _USE_IOSTREAMS_ + +// friend ostream & operator<<(ostream & out, +// const ScanCommRegisterAccess & scr); + +// #endif + +private: // Data + +// enum +// { +// BUFFER_BYTE_SIZE = 12 +// }; + SynchType synch; + + MopRegisterAccess * hops; + + uint16_t cv_shortId; +}; + +// #ifdef _USE_IOSTREAMS_ + +// // Function Specification ******************************************** +// // +// // Purpose: This function outputs the Scan Comm Register data +// // members to the specified output stream. +// // Parameters: out: Output Stream +// // scr: Reference to a Scan Comm Register instance +// // Returns: Parameter output stream +// // Requirements: None. +// // Promises: Output stream will be written to. +// // Exceptions: None. +// // Concurrency: Reentrant. +// // +// // End Function Specification **************************************** +// ostream & operator<<(ostream & out, +// const ScanCommRegisterAccess & scr); + +// #endif + + +#include <iipScanCommRegisterAccess.inl> + +// Change Log ********************************************************** +// +// Flag PTR/DCR# Userid Date Description +// ---- -------- -------- -------- ----------- +// n/a n/a JST 05/05/95 Created. +// D49127.7 DGILBERT 09/19/96 Ctor changed +// DGILBERT 05/23/97 Access change +// dg00 D49420.1 DGILBERT 08/21/00 Add ForceRead() +// f510901 iawillia 06/29/05 Add GetId/SetId +// +// End Change Log ****************************************************** + + +#endif diff --git a/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.inl b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.inl new file mode 100755 index 000000000..f78d46708 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.inl @@ -0,0 +1,68 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipScanCommRegisterAccess.inl $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +// Module Description ************************************************** +// +// Description: This module provides the inline implementation for the +// PRD Scan Comm Register Access class. +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +inline +ScanCommRegisterAccess::ScanCommRegisterAccess( + uint64_t ra, + MopRegisterAccess & hopsAccessor) +: +SCAN_COMM_REGISTER_CLASS(ra), +synch(), +hops(&hopsAccessor) +{ +} diff --git a/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterChip.C b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterChip.C new file mode 100755 index 000000000..72300c691 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterChip.C @@ -0,0 +1,117 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipScanCommRegisterChip.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +// Module Description ************************************************** +// +// Description: This module provides the implementation for the PRD Scan +// Comm Register Chip class. +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- + +#define iipScanCommRegisterChip_C + +#include <iipchip.h> +// #include <iipMopRegisterAccessScanCommSingle.h> +#include <iipScanCommRegisterChip.h> + +#undef iipScanCommRegisterChip_C + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +ScanCommRegisterChip::ScanCommRegisterChip(uint64_t ra, + unsigned int bl, + MopRegisterAccess & hopsAccess) + : + ScanCommRegisterAccess(ra,hopsAccess), + xBitString(bl) +{ + xBitString.Pattern(0); // Clear +} + +// -------------------------------------------------------------------- + + +// --------------------------------------------------------------------- + +void ScanCommRegisterChip::SetBitString(const BIT_STRING_CLASS *bs) +{ + xBitString.SetBits(*bs); +} + +// --------------------------------------------------------------------- + +// const uint32_t * ScanCommRegisterChip::GetChipSelectValues +// (unsigned int & chipSelectCount) const +// { +// const uint32_t * chipSelectValues = NULL; + +// if(chipPtr) +// { +// chipSelectCount = chipPtr->GetChipSelectCount(); +// chipSelectValues = chipPtr->GetChipSelectValues(); +// } +// else +// { +// chipSelectCount = 0; +// } + +// return(chipSelectValues); +// } + +// Change Log ********************************************************** +// +// Flag PTR/DCR# Userid Date Description +// ---- -------- -------- -------- ----------- +// n/a n/a JST 04/18/95 Created. +// D49127.7 DGILBERT 09/20/96 Added xBitString, Get/SetBitString() +// AccessBitString() +// DGILBERT 05/27/97 V4R3 changes +// +// End Change Log ****************************************************** + diff --git a/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterChip.h b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterChip.h new file mode 100755 index 000000000..035cb42d0 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipScanCommRegisterChip.h @@ -0,0 +1,226 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipScanCommRegisterChip.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef iipScanCommRegisterChip_h +#define iipScanCommRegisterChip_h + +// Class Specification ************************************************* +// +// Class name: ScanCommRegisterChip +// Parent class: ScanCommRegisterAccess +// +// Summary: This class provides access to a Scan Comm Register +// associated with a specific chip. +// +// A pointer to a CHIP_CLASS is maintained. The member +// function GetChipSelectValues() is implemented to use the +// CHIP_CLASS instance to return the values. +// +// Cardinality: N +// +// Performance/Implementation: +// Space Complexity: Constant +// Time Complexity: All member functions constant unless otherwise +// stated. +// +// Usage Examples: +// +// void foo(CHIP_CLASS * chipPtr, unsigned int registerAddress, +// unsigned int bitLength) +// { +// ScanCommRegisterChip scr(chipPtr, registerAddress, bitLength); +// scr.Read(); +// scr.Write(); +// } +// +// End Class Specification ********************************************* + +// Includes +#if !defined(iipScanCommRegisterAccess_h) +#include <iipScanCommRegisterAccess.h> +#endif + +#if !defined(IIPBITS_H) +#include <iipbits.h> +#endif + + +// Forward References +class CHIP_CLASS; +class MopsRegisterAccess; + +class ScanCommRegisterChip : public ScanCommRegisterAccess +{ +public: + + ScanCommRegisterChip(uint64_t ra, + unsigned int bl, + MopRegisterAccess &hopsAccess); + ScanCommRegisterChip() : ScanCommRegisterAccess(), xBitString((uint32_t)0) {} + // Function Specification ******************************************** + // + // Purpose: Initialization (preferred Ctor) + // Parameters: chid: Chip Id of chip on which the hardware register resides + // ra: Scan com register address or Register Id + // bl: Number of bits in register + // hopsAccess: object to access Hardware Ops + // Returns: No value returned. + // Requirements: None. + // Promises: All data members are initialized + // Exceptions: None. + // Concurrency: N/A + // + // End Function Specification ////////////////////////////////////// + + + //ScanCommRegisterChip(const ScanCommRegisterChip & scr); + // Function Specification ******************************************** + // + // Purpose: Copy + // Parameters: scr: Reference to instance to copy + // Returns: No value returned. + // Requirements: None. + // Promises: All data members will be copied (Deep copy). + // Exceptions: None. + // Concurrency: N/A. + // Notes: This constructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + + //virtual ~ScanCommRegisterChip(void); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: N/A + // Notes: This destructor is not declared. This compiler generated + // default definition is sufficient. + // + // End Function Specification **************************************** + + // ScanCommRegisterChip & operator=(const ScanCommRegisterChip & scr); + // Function Specification ******************************************** + // + // Purpose: Assigment + // Parameters: d: Reference to instance to assign from + // Returns: Reference to this instance + // Requirements: None. + // Promises: All data members are assigned to + // Exceptions: None. + // Concurrency: N/A. + // Notes: This assingment operator is not declared. The compiler + // generated default definition is sufficient. + // + // End Function Specification **************************************** + +// virtual const uint32_t * GetChipSelectValues(unsigned int & chipSelectCount) const; + // Function Specification ******************************************** + // + // Purpose: This function returns the chip select values. + // Parameters: chipSelectCount: Number of chip select values in + // returned array + // Returns: Pointer to an array of chip select values + // Requirements: None. + // Promises: Parameter chipSelectCount is modified. + // Exceptions: None. + // Concurrency: Reentrant. + // Notes: If the chipPtr is NULL, then the count will be zero and + // NULL is returned. + // + // End Function Specification **************************************** + + virtual const BIT_STRING_CLASS * GetBitString(ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { return &xBitString; } + // Function Specification ******************************************** + // + // Purpose: Access the bit string + // Parameters: None + // Returns: the bit string + // Requirements: none + // Promises: a bit string + // Exceptions: None. + // Notes: + // + // End Function Specification **************************************** + + virtual void SetBitString(const BIT_STRING_CLASS * bs); + // Function Specification ******************************************** + // + // Purpose: Modify the internal bit string + // Parameters: a Bit string + // Returns: Nothing + // Requirements: none + // Promises: Internal bit string == *bs for first len bits where + // len is the smaller of the two lengths + // Exceptions: None. + // Notes: + // + // End Function Specification **************************************** + +protected: // Functions + + virtual BIT_STRING_CLASS & AccessBitString(void) { return(xBitString); } + // Function Specification ******************************************** + // + // Purpose: Get non-cost referece to bit string + // Parameters: None. + // Returns: BIT_STRING_CLASS & + // Requirements: none. + // Promises: Direct access to the Bit string + // Exceptions: None + // Notes: + // + // End Function Specification **************************************** + + +private: // functions + + friend class CaptureData; + +private: // Data + +// CHIP_CLASS * chipPtr; + BIT_STRING_BUFFER_CLASS xBitString; +// MopRegisterAccessScanCommSingle xHopsAccess; + +}; + +// Change Log ********************************************************** +// +// Flag PTR/DCR# Userid Date Description +// ---- -------- -------- -------- ----------- +// n/a n/a JST 04/18/95 Created. +// D49127.7 DGILBERT 09/20/96 Added xBitString, Get/SetBitString() +// AccessBitString() +// DGILBERT 05/27/97 V4R3 changes +// dgilbert 10/02/02 fips changes +// +// End Change Log ****************************************************** + + +#endif diff --git a/src/usr/diag/prdf/common/framework/register/iipXorResetErrorRegister.h b/src/usr/diag/prdf/common/framework/register/iipXorResetErrorRegister.h new file mode 100755 index 000000000..ce41875aa --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipXorResetErrorRegister.h @@ -0,0 +1,143 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipXorResetErrorRegister.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1997,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef iipXorResetErrorRegister_h +#define iipXorResetErrorRegister_h + +/** + @file iipXorResetErrorRegister.h + @brief XorResetErrorRegister declaration +*/ + +// Class Description ************************************************* +// +// Name: XorResetErrorRegister +// Base class: ErrorRegisterMask +// +// Description: Reset error register after analyze. Hardware register +// is reset by XORing value written. +// +// Usage: See iipResetErrorRegister.h +// +// Implementation in iipResetErrorRegister.C +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#ifndef iipErrorRegisterMask_h +#include <iipErrorRegisterMask.h> +#endif + + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +class XorResetErrorRegister : public ErrorRegisterMask +{ +public: + XorResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + FILTER_CLASS * f = NULL); + + // Function Specification ******************************************** + // + // Purpose: Constructor + // Parameters: r: scan comm register associated with error register + // rm: Map of bitList to Resolutions + // reset: scan comm register to write reset to + // f: ptr to a bitList filter object + // Returns: Nothing + // Requirements: None + // Promises: Object created + // Exceptions: None + // Concurrency: synchronous + // Notes: + // + // End Function Specification **************************************** + + //~XorResetErrorRegister(); + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Compiler default is sufficient + // + // End Function Specification **************************************** + +protected: // functions + + virtual int32_t Reset(const BIT_LIST_CLASS & bit_list, STEP_CODE_DATA_STRUCT & error); + // Function Specification ******************************************** + // + // Purpose: Reset the hardware & perform any other actions needed + // to prepare for the next Analysis + // Parameters: Reference to a bit list + // Returns: Return code + // Requirements: None. + // Promises: Hardware Registers modified + // Bits in bit_list are turned off in SCR then SCR::Write() + // Mask bits set if theshold was reached (see parent class) + // Exceptions: None. + // Concurrency: + // Notes: bit_list.GetListLength() may be zero + // + // End Function Specification **************************************** + +private: // functions + + XorResetErrorRegister(const XorResetErrorRegister & er); // Copy not allowed + // Assignment not allowed + XorResetErrorRegister & operator=(const XorResetErrorRegister & er); + +private: // Data + +}; + + +inline +XorResetErrorRegister::XorResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + FILTER_CLASS * f) +: ErrorRegisterMask(r,rm,f) +{} + + +#endif /* iipXorResetErrorRegister_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- --------- ---- -------- ----- ------------------------------- +// D49127.12 v4r1 02/13/97 DRG Initial Creation +// p4902214 v4r1 05/09/97 DRG Added service data parm to Reset +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/register/iipscr.C b/src/usr/diag/prdf/common/framework/register/iipscr.C new file mode 100755 index 000000000..0462f2a51 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipscr.C @@ -0,0 +1,286 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipscr.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1997,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#define IIPSCR_C + +/* Module Description *************************************************/ +/* */ +/* Description: This module contains the implementation for the */ +/* Processor Runtime Diagnostics Scan Communication */ +/* Register class. */ +/* */ +/* Notes: Unless stated otherwise, assume that each function */ +/* specification has no side-effects, no dependencies, and */ +/* constant time complexity. */ +/* */ +/* End Module Description *********************************************/ + +/*--------------------------------------------------------------------*/ +/* Includes */ +/*--------------------------------------------------------------------*/ + +#include <iipbits.h> +#include <iipscr.h> +#include <iipconst.h> + +/*--------------------------------------------------------------------*/ +/* User Types */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Constants */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Macros */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Internal Function Prototypes */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Global Variables */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Static Variables */ +/*--------------------------------------------------------------------*/ + +// Function Specification ////////////////////////////////////////// +// +// Title: ~SCAN_COMM_REGISTER_CLASS (Virtual destructor) +// +// Purpose: This destructor deallocates the Bit String. +// +// Side-effects: Memory is deallocated. +// +// Dependencies: None. +// +// End Function Specification ////////////////////////////////////// + +SCAN_COMM_REGISTER_CLASS::~SCAN_COMM_REGISTER_CLASS +( + void + /*!i No parameters */ + ) +/*!o No value returned */ +{ +} + +// Function Specification /////////////////////////////////////////// +// +// Title: Read +// +// Purpose: This function reads the actual hardware register and +// sets the Bit String data member values. The specified +// Bit String is then used to mask the Bit String data +// member. If an error occur, then the error is reported +// and the Bit String values are undefined. +// +// Side-effects: Hardware register is read. +// Bit String data member is modified. +// Memory is reallocated. +// +// End Function Specification ////////////////////////////////////// + +uint32_t SCAN_COMM_REGISTER_CLASS::Read +( + BIT_STRING_CLASS & mask + /*!i Reference to Bit String mask */ + ) +/*!o Error return code */ +{ + uint32_t rc = Read(); + + if(rc == SUCCESS) + { + BIT_STRING_CLASS & bitString = AccessBitString(); + bitString.Mask(mask); + } + + return(rc); +} + + +uint32_t SCAN_COMM_REGISTER_CLASS::UnSync(void){return(SUCCESS);} + +// Function Specification ////////////////////////////////////////// +// +// Title: Set Bit +// +// Purpose: This function sets(1) the specified bit position in +// the Bit String. If the Bit String is NULL, then a +// new Bit String is allocated and cleared to all zero +// before setting the bit. +// +// Side-effects: Bit String is modified. +// Memory may be allocated. +// +// Dependencies: bit_position must be in the string +// +// End Function Specification ////////////////////////////////////// + +void SCAN_COMM_REGISTER_CLASS::SetBit +( + uint32_t bit_position + /*!i Bit position in string */ + ) +/*!o No value returned */ +{ + + BIT_STRING_CLASS & bitString = AccessBitString(); + bitString.Set(bit_position); +} + +// Function Specification ////////////////////////////////////////// +// +// Title: Clear Bit +// +// Purpose: This function clears(0) the specified bit position in +// the Bit String. If the Bit String is NULL, then a +// new Bit String is allocated and cleared to all zeros. +// +// Side-effects: Bit String is modified. +// Memory may be allocated. +// +// Dependencies: bit_position must be in the string +// +// End Function Specification ////////////////////////////////////// + +void SCAN_COMM_REGISTER_CLASS::ClearBit +( + uint32_t bit_position + /*!i Bit position in string */ + ) +/*!o No value returned */ +{ + BIT_STRING_CLASS & bitString = AccessBitString(); + bitString.Clear(bit_position); +} + +// Function Specification ////////////////////////////////////////// +// +// Title: SCAN_COMM_REGISTER_CLASS (Copy constructor) +// +// Purpose: This constuctor initializes the data members. This +// copy constructor uses a "deep" copy. +// +// Side-effects: This instance is initialized. +// +// Dependencies: None. +// +// Time Complexity: Constant + time complexity of SetBitString() +// +// End Function Specification ////////////////////////////////////// + +SCAN_COMM_REGISTER_CLASS::SCAN_COMM_REGISTER_CLASS +( + const SCAN_COMM_REGISTER_CLASS & scr + /*!i Scan Comm Register reference to copy */ + ) : +/*!o No value returned */ +address(scr.address) +{ +} + +// Function Specification /////////////////////////////////////////// +// +// Title: operator= (Assignment operator) +// +// Purpose: This assignment operator assigns the Bit String data +// member. +// +// Side-effects: Bit String data member is modified. +// Memory is reallocated. +// +// Dependencies: None. +// +// Time Complexity: Constant +// +// End Function Specification ////////////////////////////////////// + +SCAN_COMM_REGISTER_CLASS & SCAN_COMM_REGISTER_CLASS::operator= +( + const SCAN_COMM_REGISTER_CLASS & scr + /*!i Scan Comm Register instance to assign from */ + ) +/*!o Reference to this Scan Comm Register instance */ +{ + // Check for assignment to self + if(this != &scr) + { + address = scr.address; + } + + return(*this); +} + +// Function Specification /////////////////////////////////////////// +// +// Title: Clear Bit String +// +// Purpose: This function clears the Bit String. If the data +// member is NULL, then a new Bit String is allocated. +// Upon return, the state of the Bit String is all zero. +// +// Side-effects: Bit String data member is modified. +// Memory is allocated or reallocated. +// +// End Function Specification ////////////////////////////////////// + +void SCAN_COMM_REGISTER_CLASS::clearAllBits() +{ + BIT_STRING_CLASS & bitString = AccessBitString(); + bitString.Pattern( 0, bitString.GetLength(), 0x00000000, 32 ); +} + +void SCAN_COMM_REGISTER_CLASS::setAllBits() +{ + BIT_STRING_CLASS & bitString = AccessBitString(); + bitString.Pattern( 0, bitString.GetLength(), 0xffffffff, 32 ); +} + +// Function Specification ////////////////////////////////////////// +// +// Title: SCAN_COMM_REGISTER_CLASS (Constructor) +// +// Purpose: This constuctor initializes the data members. +// +// Side-effects: This instance is initialized. Memory may be allocated +// +// Dependencies: None. +// +// End Function Specification ////////////////////////////////////// + +SCAN_COMM_REGISTER_CLASS::SCAN_COMM_REGISTER_CLASS +( + uint64_t a + /*!i Physical address of register */ + ) : +/*!o No value returned */ +address(a) +{ +} + +#undef IIPSCR_C diff --git a/src/usr/diag/prdf/common/framework/register/iipscr.h b/src/usr/diag/prdf/common/framework/register/iipscr.h new file mode 100755 index 000000000..cd4fb4f83 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/iipscr.h @@ -0,0 +1,445 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/iipscr.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1997,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef IIPSCR_H +#define IIPSCR_H + +// Module Description ************************************************** +// +// Description: This module contains the declarations for the +// Processor Runtime Diagnostics Scan Communication +// Register class. +// +// Notes: Unless stated otherwise, assume that each function +// specification has no side-effects, no dependencies, and +// constant time complexity. +// +// End Module Description ********************************************** + + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- + +#if !defined(IIPBITS_H) +#include <iipbits.h> +#endif + +#include <iipsdbug.h> +#include <prdfMain.H> + + +/*--------------------------------------------------------------------*/ +/* Forward References */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* User Types */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Constants */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Macros */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Global Variables */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Function Prototypes */ +/*--------------------------------------------------------------------*/ + +// Class Specification ************************************************* +// +// Name: SCAN_COMM_REGISTER_CLASS +// +// Title: Scan Communication Register +// +// Purpose: SCAN_COMM_REGISTER_CLASS provides the representation +// and access to a physical register. +// +// Usage: This is an abstract base class. +// +// Side-effects: Memory is allocated. +// +// Dependencies: None. +// +// Notes: The Scan Communication Register is a model of an actual +// physical register. The bits in the register are represented by the +// bit_string data member which is modified dynamically as operations +// are preformed. It acts as a temporarily cached value of the +// register. When a read is performed, the bit values are updated in +// the bit string. When a write is performed, the current value of the +// bits are used as the value to write. The current value of this +// cached bit string can be accessed or modified by other objects via +// the public interface. The physical address and bit length of the +// hardware register are set during intialization and used on all +// acceses. +// +// The basic Read() and Write() functions are virtual. The +// actual implemenations are dependent on the actual hardware +// and the software Hardware Manual Ops Scan Control Routines. +// These function specifications describe a common behaviour +// that every derived class must follow. Additional, +// information may also be specified. +// +// A Read() function is also provided that has a Bit String +// mask parameter. This function calls the virtual Read() +// and then applies the mask so that the internal Bit String +// contains the hardware register contents with certain bits +// ignored (masked off). +// +// Cardinality: 0 +// +// Space Complexity: Linear +// K + Mn where K and M are constants and n is the +// number of bits in the register. +// +// End Class Specification ********************************************* + +/** + SCAN_COMM_REGISTER_CLASS + @author Doug Gilbert + @V5R2 + */ +class SCAN_COMM_REGISTER_CLASS +{ +public: + + /** + Destructor + */ + virtual ~SCAN_COMM_REGISTER_CLASS(void); + + // dg00 start + /** + Read hardware register (virtual) + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> [SUCCESS | MOPs return code] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Internal bit string represents the value of the + hardware register (if rc == SUCCESS) + <br><b>Sideaffects: </b> Value guarenteed to be read from hardware. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Default is to call Read(). If a child class cannot + guarentee hardware access everytime Read() is called + then the function ForceRead() should be overridden. + </ul><br> + */ + virtual uint32_t ForceRead(void) { return Read(); }; + // dg00 end + + /** + Read hardware register (pure virtual) + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> [SUCCESS | MOPs return code] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Internal bit string represents the value of the + hardware register (if rc == SUCCESS) + <br><b>Sideaffects: </b> The bit string value may or may not be retrieved + from hardware; a buffered copy may be used. + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual uint32_t Read(void) = 0; + + virtual uint32_t UnSync(void); + + /** + Read hardware register and apply a mask + <ul> + <br><b>Parameters: </b> Mask to apply + <br><b>Returns: </b> [SUCCESS | MOPs return code] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Internal bit string represents the value of the + hardware register with the bits turned off as + specified by the mask. + <br><b>Sideaffects: </b> The bit string value may or may not be retrieved + from hardware. a buffered copy may be used. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> if bits read from hardware = '00110100' + and mask = '01110000' + then internal bit sting = '00000100' + + if mask.Length() < GetBitString()->Length() + then mask is right extended with 0's + if mask.Length() > GetBitString()->Length() + then extra mask bits are ignored. + </ul><br> + */ + uint32_t Read(BIT_STRING_CLASS & mask); + + /** + Write hardware register (pure virtual) + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> [SUCCESS | MOPs return code] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Internal bit string value written to hardware + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> If internal bitstring was never read/set/modified then + zeros are written to corresponding hardware register. + </ul><br> + */ + virtual uint32_t Write(void) = 0; + + /** + Access a copy of the scan comm address + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> Scan Comm address + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + uint64_t GetAddress(void) const { return address; } + + /** + Access a copy of the short id for signatures. + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> ID. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + virtual uint16_t GetId(void) const = 0; + + /** + Set the short id for signatures. + <ul> + <br><b>Parameters: </b> ID. + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> For virtual registers, this is not required to have + any effect. + </ul><br> + */ + virtual void SetId(uint16_t) = 0; + + + /** + Access the bit length of the register + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> bit length of the register + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + uint32_t GetBitLength(void) const { return (GetBitString())->GetLength();} + + /** + Access the internal bit string (pure virtual) + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> ptr to the internal bit string (const) + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> If the internal bit string was never read/modified then + all bits are zero + </ul><br> + */ + virtual + const BIT_STRING_CLASS * GetBitString(ATTENTION_TYPE + i_type = PRDF::INVALID_ATTENTION_TYPE + ) const = 0; + + /** + Modify the internal bit string (pure virtual) + <ul> + <br><b>Parameters: </b> a bit string + <br><b>Returns: </b> Nothing + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Internal bit string == *bs for first len bits where + len is the smaller of the two lengths. + Memory may be (re)allocated + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> The hardware register value is not modified until + Write() is called + </ul><br> + */ + virtual void SetBitString(const BIT_STRING_CLASS * bs) = 0; + + /** + SetBit + <ul> + <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>Exceptions: </b> None. + <br><b> Notes: </b> Register value is not reflected in hardware until + Write() is called + </ul><br> + */ + void SetBit(uint32_t bit_position); + + /** + ClearBit (reset bit) + <ul> + <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>Exceptions: </b> None. + <br><b> Notes: </b> Register value is not reflected in hardware until + Write() is called + </ul><br> + */ + void ClearBit(uint32_t bit_position); + + /** + * @brief Will query if a bit is set. + * @param i_bitPos The bit position to query. + * @pre The bit position must be less than GetBitString()->Length() + * @return TRUE if the bit is set, FALSE otherwise. + */ + bool IsBitSet( uint32_t i_bitPos ) + { return GetBitString()->IsSet(i_bitPos); } + + /** @brief Flushes all bits to 0. */ + void clearAllBits(); + + /** @brief Flushes all bits to 1. */ + void setAllBits(); + + /** + Get a field within the bitstring (right justified) + <ul> + <br><b>Parameters: </b> start bit position, length of field + <br><b>Returns: </b> CPU_WORD containing requested bits (right justified) + <br><b>Requirements:</b> bit_position < GetBitLength(), + length <= sizeof(CPU_WORD) (32 bits for 603/403) + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + CPU_WORD GetBitFieldJustified(uint32_t bit_position,uint32_t length) const + { return GetBitString()->GetFieldJustify(bit_position,length); } + + /** + Set a field within the bitstring with a value (from right to left in bit string) + <ul> + <br><b>Parameters: </b> start bit position, length of field, value + <br><b>Returns: </b> Nothing + <br><b>Requirements:</b> bit_position < GetBitLength(), + length <= sizeof(CPU_WORD) (32 bits for 603/403), + length must be large enought to hold the value. + <br><b>Promises: </b> GetBitFieldJustified(bitPosition,length) == value + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SetBitFieldJustified(uint32_t bitPosition,uint32_t length,CPU_WORD value) + { AccessBitString().SetFieldJustify(bitPosition,length,value); } + + /** + Query if bit string is all zeros + <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> + */ + bool BitStringIsZero() + { return GetBitString()->IsZero(); } + +protected: + + /** + Constructor + <ul> + <br><b>Parameters: </b> Scan Comm Address + <br><b>Promises: </b> Heap memory may be allocated + </ul><br> + */ + SCAN_COMM_REGISTER_CLASS( uint64_t a); + + /** + Copy Constructor + <ul> + <br><b>Parameters: </b> SCAN_COMM_REGISTER_CLASS + <br><b>Promises: </b> Heap memory may be (re)allocated + </ul><br> + */ + SCAN_COMM_REGISTER_CLASS(const SCAN_COMM_REGISTER_CLASS & scr); + + /** + Assignment operator + <ul> + <br><b>Parameters: </b> SCAN_COMM_REGISTER_CLASS + <br><b>Promises: </b> Heap memory may be (re)allocated + (*this) == scr; + </ul><br> + */ + SCAN_COMM_REGISTER_CLASS & operator= ( const SCAN_COMM_REGISTER_CLASS & scr); + + /** + Get modifiable reference to internal bit string (don't even thing about making this public!!!) + <ul> + <br><b>Paramters: </b> None. + <br><b>Returns </b> Reference to the internal bit string + <br><b>Requirments </b> None. + <br><b>Promises </b> None. + </ul><br> + */ + virtual BIT_STRING_CLASS & AccessBitString(void) = 0; + +private: // Data + + // Enum Specification ////////////////////////////////////////////// + // + // Purpose: These enumerated constants specify implementation data. + // + // End Enum Specification ////////////////////////////////////////// + + enum + { + ODD_PARITY_SET_BIT_POSITION = 16 + }; + + // Data Specification ////////////////////////////////////////////// + // + // Purpose: These data members specify the physical properties of + // register. + // + // End Data Specification ////////////////////////////////////////// + + uint64_t address; + +}; + +#endif diff --git a/src/usr/diag/prdf/common/framework/register/prdfCaptureData.C b/src/usr/diag/prdf/common/framework/register/prdfCaptureData.C new file mode 100755 index 000000000..29b62f596 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfCaptureData.C @@ -0,0 +1,436 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfCaptureData.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2003,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/** + @file prdfCaptureData.C + @brief Squadrons implementation of capture data +*/ +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- + +#ifdef __HOSTBOOT_MODULE + +// For hostboot, these are no-ops +#define htonl(foo) (foo) +#define htons(foo) (foo) +#define ntohl(foo) (foo) +#define ntohs(foo) (foo) + +#else + +// for hton funcs. +#include <netinet/in.h> + +#endif + +#ifndef IIPBITS_H +#include <iipbits.h> +#endif + +// 3 dg06d +#include <prdfHomRegisterAccess.H> // dg06a +#include <iipScanCommRegisterChip.h> // dg06a + +#ifndef IIPCHIP_H +#include <iipchip.h> +#endif + +#ifndef IIPCAPTUREDATA_H +#include <iipCaptureData.h> +#endif + +#include <string.h> + +#include <algorithm> // @jl04 a Add this for the Drop function. + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +CaptureData::CaptureData(void):data() +{ +// data.reserve(INITIAL_DATA_COUNT); +} + +// dg05d CaptureData::~CaptureData(void) +// dg05d { +// dg05d if(!data.empty()) +// dg05d { +// dg05d Clear(); +// dg05d } +// dg05d } + +void CaptureData::Clear(void) +{ + + if(!data.empty()) + { +// dg05d for(DataContainerType::iterator i = data.begin();i != data.end();i++) +// dg05d { +// dg05d delete [] (*i).dataPtr; +// dg05d } + + data.erase(data.begin(), data.end()); + + } /* if not empty */ +} + + +// @jl04 c Changed this to add the type parm. +void CaptureData::Add( TARGETING::TargetHandle_t i_pchipHandle, int scomId, + SCAN_COMM_REGISTER_CLASS & scr, Place place, RegType type) +{ + uint16_t bufferLength = scr.GetBitLength() / 8; + + if((scr.GetBitLength() % 8) != 0) + bufferLength += 1; + + Data dataElement(i_pchipHandle, scomId, bufferLength, NULL); + + AddDataElement(dataElement, scr, place, type); +} + +// start dg02 +void CaptureData::Add( TARGETING::TargetHandle_t i_pchipHandle, int scomId, + BIT_STRING_CLASS & bs, Place place) +{ + uint16_t bufferLength = bs.GetLength() / 8; + + if((bs.GetLength() % 8) != 0) + bufferLength += 1; + + Data dataElement(i_pchipHandle, scomId, bufferLength, NULL); + + DataIterator dataIterator; + + if(place == FRONT) + { + data.insert(data.begin(), dataElement); + dataIterator = data.begin(); + } + else + { + data.push_back(dataElement); + dataIterator = data.end(); + dataIterator--; + } + if(!bs.IsZero()) + { + uint8_t *bufferPtr = new uint8_t[(*dataIterator).dataByteLength]; + BIT_STRING_ADDRESS_CLASS bitString(0, bs.GetLength(), (CPU_WORD *) bufferPtr); + + bitString.SetBits(bs); + (*dataIterator).dataPtr = bufferPtr; + } + else + { + (*dataIterator).dataByteLength = 0; + } + + +} + +// end dg02 + +// start dg06a +void CaptureData::Add( TARGETING::TargetHandle_t i_pchipHandle, + int iScomId, uint64_t iScomAddress, + uint32_t iScomBitLength, Place iplace ) +{ + PRDF::HomRegisterAccessScom hops(i_pchipHandle); + ScanCommRegisterChip scrc(iScomAddress, iScomBitLength, hops); + + Add(i_pchipHandle, iScomId, scrc, iplace); +} + +// end dg06a + +// start jl04a +void CaptureData::Drop(RegType i_type) +{ + // Function below requires a predicate function above to Drop + // a data element from the capture data if it is + // defined as secondary data instead of primary data in the rule files. + // This predicate has to exist within the CaptureData Class because the + // class "Data" is defined within CaptureData class. + data.erase( std::remove_if(data.begin(),data.end(), + prdfCompareCaptureDataType(i_type)), data.end() ); +} +// end jl04a + +// @jl04 c Changed the AddDataElement to include a type. +void CaptureData::AddDataElement( Data & dataElement, + SCAN_COMM_REGISTER_CLASS & scr, + Place place, RegType type ) +{ + DataIterator dataIterator; + + if(place == FRONT) + { + data.insert(data.begin(), dataElement); + dataIterator = data.begin(); + } + else + { + data.push_back(dataElement); + dataIterator = data.end(); + dataIterator--; + } + +//$TEMP @jl04 or @jl05. + (*dataIterator).registerType = type; +//$TEMP @jl04 or @jl05. + + if(scr.Read() == SUCCESS) + { + const BIT_STRING_CLASS *bitStringPtr = scr.GetBitString(); + + if(!bitStringPtr->IsZero()) + { + uint8_t *bufferPtr = new uint8_t[(*dataIterator).dataByteLength]; + BIT_STRING_ADDRESS_CLASS bitString(0, bitStringPtr->GetLength(), + (CPU_WORD *) bufferPtr); + + bitString.SetBits(*bitStringPtr); + (*dataIterator).dataPtr = bufferPtr; + } + else + { + (*dataIterator).dataByteLength = 0; + } + } + else + { + // Zero out data length if SCRs failed + (*dataIterator).dataByteLength = 0; + } + +} +// ------------------------------------------------------------------------------------------------ + +/* CaptureData Format: + * capture data -> ( <chip header> <registers> )* + * chip header -> ( <chip id:32> <# registers:32> ) + * registers -> ( <reg id:16> <reg byte len:16> <bytes>+ ) + */ +unsigned int CaptureData::Copy(uint8_t *i_buffer, unsigned int i_bufferSize) const +{ + using namespace TARGETING; + using namespace PRDF; + + TargetHandle_t l_pcurrentChipHandle =NULL ; + uint8_t * l_entryCountPos = NULL; + uint32_t l_regEntries = 0; + + uint32_t l_bytesWritten = 0; + for (ConstDataIterator i = data.begin(); i != data.end(); i++) + { + // Check for new chip. + if (i->chipHandle != l_pcurrentChipHandle) + { // Update previous header, write new header. + + if (NULL != l_entryCountPos) // Update previous entry count. + { + l_regEntries = htonl(l_regEntries); + memcpy(l_entryCountPos, &l_regEntries, sizeof(l_regEntries)); + l_regEntries = 0; + } + + // Update chip Handles.... + TargetHandle_t l_ptempHandle = l_pcurrentChipHandle = i->chipHandle; + HUID l_chipHuid =PlatServices::getHuid(l_ptempHandle); + const size_t l_huidSize = sizeof(l_chipHuid); + l_chipHuid = htonl(l_chipHuid); + + // Verify space. + if (i_bufferSize < l_bytesWritten + 2 * l_huidSize) + { + break; + } + // Write header. + memcpy(&i_buffer[l_bytesWritten], + &l_chipHuid, l_huidSize); + l_bytesWritten += l_huidSize; + l_entryCountPos = &i_buffer[l_bytesWritten]; + l_ptempHandle = NULL; + memcpy(l_entryCountPos, &l_chipHuid, l_huidSize); + l_bytesWritten += l_huidSize; + } + + // Go to next entry if 0 data length. + if (0 == i->dataByteLength) + continue; + + // Check room. + if ((l_bytesWritten + 2*sizeof(uint16_t) + i->dataByteLength) > + i_bufferSize) + continue; + + // Write register ID. + uint16_t l_regId = htons(i->address); + memcpy(&i_buffer[l_bytesWritten], &l_regId, sizeof(l_regId)); + l_bytesWritten += sizeof(l_regId); + + // Write register length. + uint16_t l_regLen = htons(i->dataByteLength); + memcpy(&i_buffer[l_bytesWritten], &l_regLen, sizeof(l_regLen)); + l_bytesWritten += sizeof(l_regLen); + + // Write register data. + uint32_t l_dataWritten = 0; + while ((l_dataWritten + 4) <= i->dataByteLength) + { + uint32_t l_temp32; + memcpy(&l_temp32, &i->dataPtr[l_dataWritten], sizeof(l_temp32)); + l_temp32 = htonl(l_temp32); + memcpy(&i_buffer[l_bytesWritten], &l_temp32, 4); + l_dataWritten += 4; l_bytesWritten += 4; + } + if (l_dataWritten != i->dataByteLength) + { + uint32_t l_temp32; + memcpy(&l_temp32, &i->dataPtr[l_dataWritten], sizeof(l_temp32)); + l_temp32 = htonl(l_temp32); + memcpy(&i_buffer[l_bytesWritten], + &l_temp32, i->dataByteLength - l_dataWritten); + l_bytesWritten += i->dataByteLength - l_dataWritten; + } + + // Update entry count. + l_regEntries++; + } + + // Update previous entry count. + if (NULL != l_entryCountPos) + { + l_regEntries = htonl(l_regEntries); + memcpy(l_entryCountPos, &l_regEntries, sizeof(l_regEntries)); + l_regEntries = 0; + } + + return l_bytesWritten; +} + +// dg08a --> +CaptureData & CaptureData::operator=(const uint8_t *i_flatdata) +{ + using namespace TARGETING; + using namespace PRDF; + + uint32_t l_tmp32 = 0; + uint16_t l_tmp16 = 0; + + HUID l_chipHuid =PRDF::INVALID_HUID ; + const size_t l_huidSize = sizeof(l_chipHuid); + + // Read size. + memcpy(&l_tmp32, i_flatdata, sizeof(uint32_t)); + uint32_t size = ntohl(l_tmp32); + i_flatdata += sizeof(uint32_t); + + Clear(); + + // Calculate end of buffer. + const uint8_t *eptr = i_flatdata + size; + + while(i_flatdata < eptr) + { + // Read chip Handle. + memcpy(&l_chipHuid , i_flatdata,l_huidSize ); + i_flatdata += l_huidSize ; + TargetHandle_t l_pchipHandle =NULL; + l_chipHuid = ntohl(l_chipHuid); + l_pchipHandle = PlatServices::getTarget(l_chipHuid ); + if(NULL ==l_pchipHandle) + { + continue; + } + + // Read # of entries. + memcpy(&l_tmp32, i_flatdata, sizeof(uint32_t)); + i_flatdata += sizeof(l_tmp32); + uint32_t entries = ntohl(l_tmp32); + + // Input each entry. + for(uint32_t i = 0; i < entries; ++i) + { + // Read register id. + memcpy(&l_tmp16, i_flatdata, sizeof(uint16_t)); + i_flatdata += sizeof(uint16_t); + int regid = ntohs(l_tmp16); + + // Read byte count. + memcpy(&l_tmp16, i_flatdata, sizeof(uint16_t)); + i_flatdata += sizeof(uint16_t); + uint32_t bytecount = ntohs(l_tmp16); + + // Read data for register. + prdfBitStringBuffer bs(bytecount * 8); + for(uint32_t bc = 0; bc < bytecount; ++bc) + { + bs.SetFieldJustify(bc*8,8,(CPU_WORD)(*(i_flatdata+bc))); //mp01a + } + i_flatdata += bytecount; + + // Add to capture data. + Add(l_pchipHandle, regid, bs); + } + } + + return *this; +} + +// <-- dg08a + +// copy ctor for Data class +CaptureData::Data::Data(const Data & d): +chipHandle(d.chipHandle), address(d.address), +dataByteLength(d.dataByteLength), dataPtr(NULL) +{ + if(d.dataPtr != NULL) + { + dataPtr = new uint8_t[dataByteLength]; + + memcpy(dataPtr, d.dataPtr, dataByteLength); + } +} + +CaptureData::Data & CaptureData::Data::operator=(const Data & d) +{ + chipHandle = d.chipHandle; + address = d.address; + dataByteLength = d.dataByteLength; + if(dataPtr != NULL) + { + delete[]dataPtr; + dataPtr = NULL; + } + if(d.dataPtr != NULL) + { + dataPtr = new uint8_t[dataByteLength]; + memcpy(dataPtr, d.dataPtr, dataByteLength); + } + + return *this; +} diff --git a/src/usr/diag/prdf/common/framework/register/prdfErrorRegister.C b/src/usr/diag/prdf/common/framework/register/prdfErrorRegister.C new file mode 100755 index 000000000..9d5488678 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfErrorRegister.C @@ -0,0 +1,227 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfErrorRegister.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/** + @file iipErrorRegister.C + @brief ErrorRegister class definition +*/ +// Module Description ************************************************** +// +// Description: Definition of ErrorRegister class +// +// End Module Description ********************************************** +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define iipErrorRegister_C + +#include <prdfMain.H> +#include <prdfAssert.h> +#include <iipstep.h> +#include <iipbits.h> +#include <iipResolution.h> +#include <iipscr.h> +#include <prdfErrorSignature.H> +#include <iipServiceDataCollector.h> +#include <prdfResolutionMap.H> +#include <iipErrorRegister.h> + +#include <iipconst.h> +#include <iipglobl.h> +#undef iipErrorRegister_C +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +int32_t ErrorRegister::SetErrorSignature(STEP_CODE_DATA_STRUCT & error,prdfBitKey & bl) +{ + using namespace PRDF; + + int32_t rc = SUCCESS; + ErrorSignature * esig = error.service_data->GetErrorSignature(); + uint32_t blen = bl.size(); + switch(blen) + { + case 0: + (error.service_data->GetErrorSignature())->setErrCode(PRD_SCAN_COMM_REGISTER_ZERO); + if(xNoErrorOnZeroScr != true) rc = PRD_SCAN_COMM_REGISTER_ZERO; + break; + + case 1: + esig->setErrCode(bl.getListValue(0)); + break; + + default: + for(uint32_t index = 0; index < blen; ++index) //dg01a + { //dg01a + esig->setErrCode(bl.getListValue(index)); //dg01a + } //dg01a + esig->setErrCode(PRD_MULTIPLE_ERRORS); + }; + return rc; +} + +/*---------------------------------------------------------------------*/ + +ErrorRegister::ErrorRegister +(SCAN_COMM_REGISTER_CLASS & r, prdfResolutionMap & rm, uint16_t scrId) +: ErrorRegisterType(), scr(r), scr_rc(SUCCESS), rMap(rm), xNoErrorOnZeroScr(false), xScrId(scrId) +{ + PRDF_ASSERT(&r != NULL); + PRDF_ASSERT(&rm != NULL); +} + +/*---------------------------------------------------------------------*/ + +int32_t ErrorRegister::Analyze(STEP_CODE_DATA_STRUCT & error) +{ + using namespace PRDF; + + int32_t rc = SUCCESS; + + uint32_t l_savedErrSig = 0; // @pw01 + + if(xScrId == 0x0fff) + { + (error.service_data->GetErrorSignature())->setRegId(scr.GetAddress()); + } + else + { + (error.service_data->GetErrorSignature())->setRegId(xScrId); + } + + // Get Data from hardware + const BIT_STRING_CLASS &bs = Read(error.service_data->GetCauseAttentionType()); // @pw02 + prdfBitKey bl; // null bit list has length 0 + + if (scr_rc == SUCCESS) + { + bl = Filter(bs); + rc = SetErrorSignature(error,bl); //dg02c - made function of this block of code + // @pw01 + // Save signature to determine if it changes during resolution execution. + l_savedErrSig = (error.service_data->GetErrorSignature())->getSigId(); + } + + uint32_t res_rc = Lookup(error, bl); // lookup and execute the resolutions + if(SUCCESS == rc) rc = res_rc; // previous rc has prioity over res_rc + + + // @pw01 + // If we had a DD02 and the signature changes, ignore DD02. + if ((rc == PRD_SCAN_COMM_REGISTER_ZERO) && + ((error.service_data->GetErrorSignature())->getSigId() + != l_savedErrSig) + ) + { + // Found a better answer during the DD02 analysis. + rc = res_rc; + } + + + if(scr_rc == SUCCESS) + { + FilterUndo(bl); // dg03a + // NOTE: This is an unusual work-a-round for NOT clearing + // particular FIR bits in a register because they are cleared + // in another part of the plugin code. jl01 + if(rc == PRD_NO_CLEAR_FIR_BITS) + { + rc = SUCCESS; //Return success to indicate that we understand the DDFF + } + else + { + int32_t reset_rc; + reset_rc = Reset(bl,error); + if(rc == SUCCESS)rc = reset_rc; + } + } + else // scr read failed + { + (error.service_data->GetErrorSignature())->setErrCode(PRD_SCANCOM_FAILURE); + rc = scr_rc; + } + + return(rc); +} + +/*---------------------------------------------------------------------*/ + +const BIT_STRING_CLASS & ErrorRegister::Read(ATTENTION_TYPE i_attn) +{ + scr_rc = scr.Read(); + return (*scr.GetBitString(i_attn)); +} + +/*---------------------------------------------------------------------*/ + +prdfBitKey ErrorRegister::Filter +(const BIT_STRING_CLASS & bs) +{ + prdfBitKey bit_list; + bit_list = bs; + return(bit_list); +} + +/*---------------------------------------------------------------------*/ + +int32_t ErrorRegister::Lookup(STEP_CODE_DATA_STRUCT & sdc, prdfBitKey & bl) // dg02c dg03c +{ + int32_t rc = SUCCESS; +// if (bl.GetListLength() == 0) return(rMap.GetDefault()); /dg00d + prdfResolutionList rList; + rMap.LookUp(rList,bl,sdc); // dg04c + // SetErrorSignature(sdc,bl); // LookUp may have changed bl dg02a dg04d + for(prdfResolutionList::iterator i = rList.begin(); i != rList.end(); ++i) + { + rc |= (*i)->Resolve(sdc); + } + return rc; +} + +/*---------------------------------------------------------------------*/ + +int32_t ErrorRegister::Reset(const prdfBitKey & bit_list, STEP_CODE_DATA_STRUCT & error) +{ + return(SUCCESS); +} diff --git a/src/usr/diag/prdf/common/framework/register/prdfErrorRegisterMask.C b/src/usr/diag/prdf/common/framework/register/prdfErrorRegisterMask.C new file mode 100755 index 000000000..680dfde66 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfErrorRegisterMask.C @@ -0,0 +1,178 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfErrorRegisterMask.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/** + @file prdfErrorRegisterMask.C + @brief ErrorRegisterMask class definition +*/ + +// Module Description ************************************************** +// +// Description: +// +// End Module Description ********************************************** +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define prdfErrorRegisterMask_C + +#include <iipscr.h> +#include <prdfFilters.H> +#include <iipErrorRegisterMask.h> +#include <iipServiceDataCollector.h> + +#undef prdfErrorRegisterMask_C +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- +ErrorRegisterMask::ErrorRegisterMask +( + SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + FILTER_CLASS * f, + uint16_t scrId, + SCAN_COMM_REGISTER_CLASS & maskScr // dg00 + ) +: +ErrorRegisterFilter(r,rm,f,scrId), +bitString(r.GetBitLength()), +bitStringMask(r.GetBitLength()), +xMaskScr(maskScr) +{ + bitStringMask.Pattern(0); +} + +ErrorRegisterMask::ErrorRegisterMask +( + SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + uint16_t scrId, + SCAN_COMM_REGISTER_CLASS & maskScr // dg00 +) +: +ErrorRegisterFilter(r,rm,scrId), +bitString(r.GetBitLength()), +bitStringMask(r.GetBitLength()), +xMaskScr(maskScr) +{ + bitStringMask.Pattern(0); // clear software mask +} + +// ********************************************************************** + +const BIT_STRING_CLASS & ErrorRegisterMask::Read() +{ + scr_rc = scr.Read(); + bitString = *scr.GetBitString(); + // apply software mask + bitString.Mask(bitStringMask); + // apply hardware mask - if scan comm register for it was specified + if(&xMaskScr != NULL) /*constant condition*/ // dg00 + { // dg00 + int32_t rc = xMaskScr.Read(); // dg00 + if(rc == SUCCESS) // dg00 + { // dg00 + bitString.Mask(*(xMaskScr.GetBitString())); // dg00 + } // dg00 + } // dg00 + + return(bitString); +} + +// *********************************************************************** + +int32_t ErrorRegisterMask::Reset(const BIT_LIST_CLASS & bit_list, + STEP_CODE_DATA_STRUCT & error) +{ + int32_t rc = SUCCESS; + if(error.service_data->IsAtThreshold()) + { + int32_t blLength = bit_list.size(); + int i = 0; + if(&xMaskScr == NULL) /* constant condition*/ // dg00 + { // dg00 + for(i = 0; i < blLength; ++i) + { + SetMaskBit(bit_list.getListValue(i)); + } + } // dg00 +// else // valid maskSCR // dg00 +// { // dg00 +// for(i = 0; i < blLength; ++i) // dg00 +// { // dg00 +// xMaskScr.SetBit(bit_list.GetListValue(i)); // dg00 +// } // dg00 +// rc = xMaskScr.Write(); // dg00 +// } // dg00 + } + return rc; +} + +// *************************************************************************** + +BIT_LIST_CLASS ErrorRegisterFilter::Filter +(const BIT_STRING_CLASS & bs) +{ + BIT_LIST_CLASS bit_list; + bit_list = bs; + if(filter) filter->Apply(bit_list); + return bit_list; +} + + + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ------ -------- -------- ------------------------------ +// v4r1mo 05/03/96 DGILBERT Initial Creation +// d49127.1 v4r1m0 05/31/96 DGILBERT Added Analyze() and Reset() +// p4902214 v4r1m0 05/09/97 DGILBERT Added service data to Reset() +// Removed Analyse() +// D49274.2 v4r5 09/24/98 DGILBERT Added scrId +// dg00 v5r2 04/05/00 DGILBERT Added maskScr +// P4907878 v5r2 04/27/01 DGILBERT factor out filter into +// ErrorRegisterFilter class +// 423599 fsp 10/28/03 dgilbert make scrId a uint16_t +// +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C b/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C new file mode 100755 index 000000000..aaca68beb --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C @@ -0,0 +1,457 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2002,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/** + @file prdfHomRegisterAccess.C + @brief definition of HomRegisterAccess +*/ +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define prdfHomRegisterAccess_C + +#ifdef __HOSTBOOT_MODULE + #include <ecmdDataBufferBase.H> + #include <fapi.H> + #include <errlmanager.H> + #include <devicefw/userif.H> + #include <targeting/common/targetservice.H> +#else + #include <ecmdDataBuffer.H> + #include <hwsvScanScom.H> + #include <chicservlib.H> + #include <hwsvExecutionService.H> +#endif + +#include <prdfHomRegisterAccess.H> +#include <prdf_service_codes.H> +#include <iipbits.h> +#include <iipglobl.h> +#include <prdfMain.H> +#include <prdfPlatServices.H> + +#undef prdfHomRegisterAccess_C + + +namespace PRDF +{ + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//------------------------------------------------------------------------------ +// Member Function Specifications +//------------------------------------------------------------------------------ + +ScomService& getScomService() +{ + return PRDF_GET_SINGLETON(theScomService); +} + +ScomService::ScomService() : + iv_ScomAccessor(NULL) +{ + PRDF_DTRAC("ScomService() initializing default iv_ScomAccessor"); + iv_ScomAccessor = new ScomAccessor(); +} + +ScomService::~ScomService() +{ + if(NULL != iv_ScomAccessor) + { + PRDF_DTRAC("~ScomService() deleting iv_ScomAccessor"); + delete iv_ScomAccessor; + iv_ScomAccessor = NULL; + } +} + +void ScomService::setScomAccessor(ScomAccessor & i_ScomAccessor) +{ + PRDF_DTRAC("ScomService::setScomAccessor() setting new scom accessor"); + + if(NULL != iv_ScomAccessor) + { + PRDF_TRAC("ScomService::setScomAccessor() deleting old iv_ScomAccessor"); + delete iv_ScomAccessor; + iv_ScomAccessor = NULL; + } + + iv_ScomAccessor = &i_ScomAccessor; +} + +uint32_t ScomService::Access(TARGETING::TargetHandle_t i_target, + BIT_STRING_CLASS & bs, + uint64_t registerId, + MopRegisterAccess::Operation operation) const +{ + PRDF_DENTER("ScomService::Access()"); + + uint32_t rc = iv_ScomAccessor->Access(i_target, + bs, + registerId, + operation); + + PRDF_DEXIT("ScomService::Access(): rc=%d", rc); + + return rc; +} + + +uint32_t ScomAccessor::Access(TARGETING::TargetHandle_t i_target, + BIT_STRING_CLASS & bs, + uint64_t registerId, + MopRegisterAccess::Operation operation) const +{ + PRDF_DENTER("ScomAccessor::Access()"); + + uint32_t rc = SUCCESS; + errlHndl_t errH = NULL; + uint32_t bsize = bs.GetLength(); + uint32_t l_ecmdRc = ECMD_DBUF_SUCCESS; + + if(i_target != NULL) + { + #ifdef __HOSTBOOT_MODULE + + ecmdDataBufferBase buffer(bsize); + uint64_t l_data = 0; + size_t l_size = sizeof(uint64_t); + + #else + + ecmdDataBuffer buffer(bsize); + + #endif + + switch (operation) + { + case MopRegisterAccess::WRITE: + for(unsigned int i = 0; i < bsize; ++i) + { + if(bs.IsSet(i)) buffer.setBit(i); + } + + // FIXME: If register is in a EX chiplet, need to also update + // PORE image ???? + + #ifdef __HOSTBOOT_MODULE + + l_data = buffer.getDoubleWord(0); + errH = deviceWrite( i_target, + &l_data, + l_size, + DEVICE_SCOM_ADDRESS(registerId)); + + #else + + errH = HWSV::hwsvPutScom(i_target, registerId, buffer); + + #endif + + break; + + case MopRegisterAccess::READ: + bs.Pattern(0x00000000); // clear all bits + + #ifdef __HOSTBOOT_MODULE + + errH = deviceRead( i_target, &l_data, l_size, + DEVICE_SCOM_ADDRESS(registerId) ); + l_ecmdRc = buffer.setDoubleWord(0, l_data); + + #else + + errH = HWSV::hwsvGetScom(i_target, registerId, buffer); + + #endif + + for(unsigned int i = 0; i < bsize; ++i) + { + if(buffer.isBitSet(i)) bs.Set(i); + } + + break; + + default: + PRDF_ERR("ScomAccessor::Access() unsuppported scom op: 0x%08X", operation); + break; + + } // end switch operation + + } + else // Invalid target + { + /*@ + * @errortype + * @subsys EPUB_FIRMWARE_SP + * @reasoncode PRDF_CODE_FAIL + * @moduleid PRDF_HOM_SCOM + * @userdata1 PRD Return code = SCR_ACCESS_FAILED + * @userdata2 The invalid ID causing the fail + * @devdesc Access SCOM failed due to NULL target handle + * @procedure EPUB_PRC_SP_CODE + */ + + // create an error log + PRDF_CREATE_ERRL(errH, + ERRL_SEV_PREDICTIVE, // error on diagnostic + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_MACH_CHECK, + SRCI_NO_ATTR, + PRDF_HOM_SCOM, // module id + FSP_DEFAULT_REFCODE, // refcode What do we use??? + PRDF_CODE_FAIL, // Reason code + SCR_ACCESS_FAILED, // user data word 1 + PlatServices::getHuid(i_target), // user data word 2 + 0x0000, // user data word 3 + 0x0000 // user data word 4 + ); + } + + if(errH) + { + rc = PRD_SCANCOM_FAILURE; + PRDF_ADD_SW_ERR(errH, rc, PRDF_HOM_SCOM, __LINE__); + PRDF_ADD_PROCEDURE_CALLOUT(errH, SRCI_PRIORITY_MED, EPUB_PRC_SP_CODE); + + bool l_isAbort = false; + PRDF_ABORTING(l_isAbort); + if (!l_isAbort) + { + PRDF_COMMIT_ERRL(errH, ERRL_ACTION_SA|ERRL_ACTION_REPORT); + } + else + { + delete errH; + errH = NULL; + } + } + if (l_ecmdRc != ECMD_DBUF_SUCCESS) + { + PRDF_ERR( "ScomAccessor::Access ecmdDataBuffer " + "operation failed with ecmd_rc = 0x%.8X", l_ecmdRc ); + /*@ + * @errortype + * @subsys EPUB_FIRMWARE_SP + * @reasoncode PRDF_ECMD_DATA_BUFFER_FAIL + * @moduleid PRDF_HOM_SCOM + * @userdata1 ecmdDataBuffer return code + * @userdata2 Chip HUID + * @userdata3 unused + * @userdata4 unused + * @devdesc Low-level data buffer support returned a failure. Probable firmware error. + * @procedure EPUB_PRC_SP_CODE + */ + errlHndl_t ecmd_rc_errl = NULL; + PRDF_CREATE_ERRL(ecmd_rc_errl, + ERRL_SEV_PREDICTIVE, // error on diagnosticERRL_ETYPE_NOT_APPLICABLE + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_MACH_CHECK, // B1xx src + SRCI_NO_ATTR, + PRDF_HOM_SCOM, // module id + FSP_DEFAULT_REFCODE, // refcode + PRDF_ECMD_DATA_BUFFER_FAIL, // Reason code - see prdf_service_codes.H + l_ecmdRc, // user data word 1 + PlatServices::getHuid(i_target), // user data word 2 + 0, // user data word 3 + 0 // user data word 4 + ); + + PRDF_ADD_PROCEDURE_CALLOUT(ecmd_rc_errl, SRCI_PRIORITY_MED, EPUB_PRC_SP_CODE); + PRDF_COMMIT_ERRL(ecmd_rc_errl, ERRL_ACTION_REPORT); + + rc = FAIL; + } + + PRDF_DEXIT("ScomAccessor::Access(): rc=%d", rc); + + return rc; +} + +//------------------------------------------------------------------------------ + +uint32_t HomRegisterAccessScom::Access( BIT_STRING_CLASS & bs, + uint64_t registerId, + Operation operation) const +{ + PRDF_DENTER("HomRegisterAccessScom::Access()"); + + uint32_t rc = getScomService().Access(iv_ptargetHandle, + bs, + registerId, + operation); + + PRDF_DEXIT("HomRegisterAccessScom::Access() rc=%d", rc); + + return rc; +} + +//------------------------------------------------------------------------------ + +HomRegisterAccessScan::HomRegisterAccessScan( + TARGETING::TargetHandle_t i_ptargetHandle, + ScanRingField * start, ScanRingField * end ) +: MopRegisterAccess(), iv_punitHandle(i_ptargetHandle) +{ + iv_aliasIds.reserve(end-start); + while(start != end) + { + iv_aliasIds.push_back(*start); + ++start; + } +} + +//------------------------------------------------------------------------------ + +uint32_t HomRegisterAccessScan::Access(BIT_STRING_CLASS & bs, + uint64_t registerId, + Operation operation) const +{ + + uint32_t rc = SUCCESS; + errlHndl_t errH = NULL; + HUID l_chipHUID = PlatServices::getHuid(iv_punitHandle); + if(operation == MopRegisterAccess::READ) + { + if(iv_punitHandle != NULL) + { + #ifdef __HOSTBOOT_MODULE + ecmdDataBufferBase buf(bs.GetLength()); + #else + ecmdDataBuffer buf(bs.GetLength()); + #endif + + uint32_t curbit = 0; + bs.Pattern(0x00000000); // clear desination bit string + for(AliasIdList::const_iterator i = iv_aliasIds.begin(); i != iv_aliasIds.end(); ++i) + { + for(uint32_t j = 0; j != i->length; ++j) + { + if(buf.isBitSet(j)) bs.Set(j+curbit); + } + curbit += i->length; + } + } + else + { + + /*@ + * @errortype + * @subsys EPUB_FIRMWARE_SP + * @reasoncode PRDF_CODE_FAIL + * @moduleid PRDF_HOM_SCAN + * @userdata1 PRD Return code = SCR_ACCESS_FAILED + * @userdata2 The invalid ID causing the fail + * @userdata3 Code location = 0x0001 + * @devdesc Access Scan failed due to an invalid function unit + * @procedure EPUB_PRC_SP_CODE + */ + // create an error log + PRDF_CREATE_ERRL(errH, + ERRL_SEV_PREDICTIVE, // error on diagnostic + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_MACH_CHECK, + SRCI_NO_ATTR, + PRDF_HOM_SCAN, // module id + FSP_DEFAULT_REFCODE, // refcode What do we use??? + PRDF_CODE_FAIL, // Reason code + SCR_ACCESS_FAILED, // user data word 1 + l_chipHUID, // user data word 2 + 0x0001, // user data word 3 + 0x0000 // user data word 4 + ); + } + } + // PRD does not ever expect to write scan rings - create an error log + else + { + PRDF_ERR( "HomRegisterAccessScan::Access " + "only scan read is supported. Invalid Scan Op: 0x%.8X", operation ); + + /*@ + * @errortype + * @subsys EPUB_FIRMWARE_SP + * @reasoncode PRDF_UNSUPPORTED_SCAN_WRITE + * @moduleid PRDF_HOM_SCAN + * @userdata1 PRD Return code = SCR_ACCESS_FAILED + * @userdata2 The ID for the scan + * @userdata3 Code location = 0x0002 + * @devdesc Access Scan failed. PRD does not ever expect to write scan rings. + * @procedure EPUB_PRC_SP_CODE + */ + // create an error log + PRDF_CREATE_ERRL(errH, + ERRL_SEV_PREDICTIVE, // error on diagnostic + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_MACH_CHECK, + SRCI_NO_ATTR, + PRDF_HOM_SCAN, // module id + FSP_DEFAULT_REFCODE, // refcode What do we use??? + PRDF_UNSUPPORTED_SCAN_WRITE, // Reason code + SCR_ACCESS_FAILED, // user data word 1 + l_chipHUID, // user data word 2 + 0x0002, // user data word 3 + 0x0000 // user data word 4 + ); + } + if(errH) + { + rc = PRD_SCANCOM_FAILURE; + PRDF_ADD_SW_ERR(errH, rc, PRDF_HOM_SCAN, __LINE__); + PRDF_ADD_PROCEDURE_CALLOUT(errH, SRCI_PRIORITY_MED, EPUB_PRC_SP_CODE); + + bool l_isAbort = false; + PRDF_ABORTING(l_isAbort); + if (!l_isAbort) + { + PRDF_COMMIT_ERRL(errH, ERRL_ACTION_SA|ERRL_ACTION_REPORT); + + } + else + { + delete errH; + errH = NULL; + } + } + + return rc; +} + +} // End namespace PRDF diff --git a/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.H b/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.H new file mode 100755 index 000000000..1427dcb4d --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.H @@ -0,0 +1,311 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2002,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef PRDFHOMREGISTERACCESS_H +#define PRDFHOMREGISTERACCESS_H +/** + @file prdfHomRegisterAccess.H + @brief Provide access to scan & scan com registers via the HOM +*/ + + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#include <iipMopRegisterAccess.h> +#include <vector> +#include <prdfPlatServices.H> +#include <iipglobl.h> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- + +namespace PRDF +{ + +class ScomAccessor +{ + public: + + /** + * @brief ctor + */ + inline ScomAccessor() {} + + /** + * @brief dtor + */ + inline virtual ~ScomAccessor() {} + + /** + Access the scan com register + @param i_target Target to access the register + @param BIT_STRING_CLASS - holds data read or to write + @param register address + @param [READ|WRITE] + @returns [SUCCESS|FAIL] + @pre bs.Length() must be size of register data to read/write + @post For read operation, bs is modified to reflect hardware register state + @note + */ + virtual uint32_t Access(TARGETING::TargetHandle_t i_target, + BIT_STRING_CLASS & bs, + uint64_t registerId, + MopRegisterAccess::Operation operation) const; + + private: + + /** + * @brief disable copy + */ + ScomAccessor(const ScomAccessor &); + + /** + * @brief disable assignment + */ + ScomAccessor & operator=(const ScomAccessor &); + +}; + +/** + * @brief Singleton to access the only ScomService + */ +class ScomService; +PRDF_DECLARE_SINGLETON(ScomService, theScomService); + +/** + * @brief Returns a reference to the ScomService singleton + * + * @return Reference to the ScomService + */ +ScomService& getScomService(); + +/** + * @brief ScomService class + */ +class ScomService +{ + public: + + /** + * @brief Construct ScomService + */ + ScomService(); + + /** + * @brief Destroys ScomService + */ + ~ScomService(); + + /** + * @brief set the scom accessor to be used + * + * @param[in] i_ScomAccessor new scom accessor + */ + void setScomAccessor(ScomAccessor & i_ScomAccessor); + + /** + Access the scan com register + @param i_target Target to access the register + @param BIT_STRING_CLASS - holds data read or to write + @param register address + @param [READ|WRITE] + @returns [SUCCESS|FAIL] + @pre bs.Length() must be size of register data to read/write + @post For read operation, bs is modified to reflect hardware register state + @note + */ + virtual uint32_t Access(TARGETING::TargetHandle_t i_target, + BIT_STRING_CLASS & bs, + uint64_t registerId, + MopRegisterAccess::Operation operation) const; + + private: + + // Disable copy constructor / assignment operator + ScomService(const ScomService& i_right); + ScomService& operator=(const ScomService& i_right); + + // Scom access to actual HW or Sim + ScomAccessor * iv_ScomAccessor; +}; + +/** + Access Scan comm via the HOM + @author Doug Gilbert + @par + @code + @endcode +*/ +class HomRegisterAccessScom : public MopRegisterAccess +{ +public: + /** + Constructor + @param + @returns + @pre + @post + @see + @note + */ + inline HomRegisterAccessScom(TARGETING::TargetHandle_t i_ptargetHandle ); + inline HomRegisterAccessScom(void); + + /* + Destructor + */ + // ~HomRegisterAccessScom(); + + /** + Access the scan com register + @param BIT_STRING_CLASS - holds data read or to write + @param register address + @param [READ|WRITE] + @returns [SUCCESS|FAIL] + @pre bs.Length() must be size of register data to read/write + @post For read operation, bs is modified to reflect hardware register state + @note + */ + virtual uint32_t Access(BIT_STRING_CLASS & bs, + uint64_t registerId, + Operation operation) const; + + /** + Get the handle used to pass to access (obsolite???) + @param returnes number of targethandles in TargetHandle list + @returns list of targethandles + @pre none + @post none + @note Can this be removed from the framework??? + */ + inline virtual const TARGETING::TargetHandle_t * GetChipIds(int & count) const { count = 0; return NULL;} + + bool operator==(const HomRegisterAccessScom & hrm) + { + return (hrm.iv_ptargetHandle == iv_ptargetHandle); + } + +private: // functions +private: // Data + + // maybe we should store the functionalUnitPtr instead + TARGETING::TargetHandle_t iv_ptargetHandle; + +}; + +struct ScanRingField +{ + uint64_t registerId; + uint32_t length; +}; +/** + Access Scan ring registers via the HOM + @author Doug Gilbert + @par + @code + @endcode +*/ +class HomRegisterAccessScan : public MopRegisterAccess +{ +public: + /** + Constructor + @param + @returns + @pre + @post + @see + @note + */ + HomRegisterAccessScan(TARGETING::TargetHandle_t i_ptargetHandle ,ScanRingField * start, ScanRingField * end); + inline HomRegisterAccessScan(void); + + /* + Destructor + */ + // ~HomRegisterAccessScan(); + + /** + Access the scan com register + @param BIT_STRING_CLASS - holds data read or to write + @param register address + @param [READ|WRITE] + @returns [SUCCESS|FAIL] + @pre bs.Length() must be size of register data to read/write + @post For read operation, bs is modified to reflect hardware register state + @note + */ + virtual uint32_t Access(BIT_STRING_CLASS & bs, + uint64_t registerId, + Operation operation) const; + + + /** + Get the Id(s) used to pass to access (obsolite???) + @param returnes number of targetHandle + @returns list of targetHandles + @pre none + @post none + @note Can this be removed from the framework??? + */ + inline virtual const TARGETING::TargetHandle_t * GetChipIds(int & count) const { count = 0; return NULL;} + + bool operator==(const HomRegisterAccessScan & hrm) + { + return (hrm.iv_punitHandle == iv_punitHandle); + } + +private: // functions +private: // Data + + typedef std::vector<ScanRingField> AliasIdList; + + // maybe we should store the functionalUnitPtr instead + TARGETING::TargetHandle_t iv_punitHandle; + + // list of fields to extract + AliasIdList iv_aliasIds; + +}; + + + + +inline HomRegisterAccessScom::HomRegisterAccessScom(TARGETING::TargetHandle_t i_ptargetHandle ) +: MopRegisterAccess(), iv_ptargetHandle(i_ptargetHandle ) +{} + +inline HomRegisterAccessScom::HomRegisterAccessScom() +: MopRegisterAccess(), iv_ptargetHandle(NULL) +{} + +inline HomRegisterAccessScan::HomRegisterAccessScan() +: MopRegisterAccess(),iv_punitHandle(NULL) +{} + +} // End namespace PRDF + +#endif /* PRDFHOMREGISTERACCESS_H */ diff --git a/src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H b/src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H new file mode 100755 index 000000000..266999f25 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H @@ -0,0 +1,584 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2004,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef __PRDFOPERATORREGISTER_H +#define __PRDFOPERATORREGISTER_H + +#include <algorithm> + +#include <iipscr.h> +#include <prdrCommon.H> + +class PrdfNotRegister : public SCAN_COMM_REGISTER_CLASS +{ + public: + PrdfNotRegister() : + SCAN_COMM_REGISTER_CLASS(0), iv_child(NULL), iv_iBS(0) + { + iv_bs = &iv_iBS; + } + + PrdfNotRegister(SCAN_COMM_REGISTER_CLASS & i_arg) : + SCAN_COMM_REGISTER_CLASS(0), iv_child(&i_arg), + iv_iBS(i_arg.GetBitString()->GetLength()) + { + iv_bs = &iv_iBS; + } + + PrdfNotRegister & operator=(const PrdfNotRegister & r) + { + iv_child = r.iv_child; + iv_iBS = r.iv_iBS; + //iv_bs = r.iv_bs; <-- don't do this! + return *this; + } + + virtual uint32_t Read() { return iv_child->Read(); } + virtual uint32_t Write() { return iv_child->Write(); } + + const BIT_STRING_CLASS * GetBitString( + ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { + (*iv_bs) = ~(*iv_child->GetBitString(i_type)); + return iv_bs; + } + + virtual uint16_t GetId() const { return iv_child->GetId(); } + virtual void SetId(uint16_t i_id) {} + + bool operator==(const PrdfNotRegister & r) const + { return r.iv_child == iv_child; } + + bool operator<(const PrdfNotRegister & r) const + { return iv_child < r.iv_child; } + + bool operator>=(const PrdfNotRegister & r) const + { return iv_child >= r.iv_child; } + + protected: + BIT_STRING_CLASS & AccessBitString(void) { return iv_iBS; } + void SetBitString(const BIT_STRING_CLASS *) {} + + private: + SCAN_COMM_REGISTER_CLASS * iv_child; + + prdfBitStringBuffer * iv_bs; + prdfBitStringBuffer iv_iBS; +}; + +class PrdfLeftShiftRegister : public SCAN_COMM_REGISTER_CLASS +{ + public: + PrdfLeftShiftRegister() : + SCAN_COMM_REGISTER_CLASS(0), iv_child(NULL), iv_amount(0), iv_iBS(0) + { + iv_bs = &iv_iBS; + } + + PrdfLeftShiftRegister(SCAN_COMM_REGISTER_CLASS & i_arg, uint16_t i_amount) : + SCAN_COMM_REGISTER_CLASS(0), iv_child(&i_arg), iv_amount(i_amount), + iv_iBS(i_arg.GetBitString()->GetLength()) + { + iv_bs = &iv_iBS; + } + + PrdfLeftShiftRegister & operator=(const PrdfLeftShiftRegister & r) + { + iv_child = r.iv_child; + iv_amount = r.iv_amount; + iv_iBS = r.iv_iBS; + //iv_bs = r.iv_bs; <-- don't do this! + return *this; + } + + virtual uint32_t Read() { return iv_child->Read(); } + virtual uint32_t Write() { return iv_child->Write(); } + + const BIT_STRING_CLASS * GetBitString( + ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { + (*iv_bs) = (*iv_child->GetBitString(i_type)) << iv_amount; + return iv_bs; + } + + virtual uint16_t GetId() const { return iv_child->GetId(); } + virtual void SetId(uint16_t i_id) {} + + bool operator==(const PrdfLeftShiftRegister & r) const + { return (r.iv_child == iv_child) && (r.iv_amount == iv_amount); } + + bool operator<(const PrdfLeftShiftRegister & r) const + { + if (iv_child == r.iv_child) + return iv_amount < r.iv_amount; + return iv_child < r.iv_child; + } + + bool operator>=(const PrdfLeftShiftRegister & r) const + { + if (iv_child == r.iv_child) + return iv_amount >= r.iv_amount; + return iv_child >= r.iv_child; + } + + protected: + BIT_STRING_CLASS & AccessBitString(void) { return iv_iBS; } + void SetBitString(const BIT_STRING_CLASS *) {} + + private: + SCAN_COMM_REGISTER_CLASS * iv_child; + uint16_t iv_amount; + + prdfBitStringBuffer * iv_bs; + prdfBitStringBuffer iv_iBS; +}; + +class PrdfRightShiftRegister : public SCAN_COMM_REGISTER_CLASS +{ + public: + PrdfRightShiftRegister() : + SCAN_COMM_REGISTER_CLASS(0), iv_child(NULL), iv_amount(0), iv_iBS(0) + { + iv_bs = &iv_iBS; + } + + PrdfRightShiftRegister(SCAN_COMM_REGISTER_CLASS & i_arg, + uint16_t i_amount) : + SCAN_COMM_REGISTER_CLASS(0), iv_child(&i_arg), iv_amount(i_amount), + iv_iBS(i_arg.GetBitString()->GetLength()) + { + iv_bs = &iv_iBS; + } + + PrdfRightShiftRegister & operator=(const PrdfRightShiftRegister & r) + { + iv_child = r.iv_child; + iv_amount = r.iv_amount; + iv_iBS = r.iv_iBS; + //iv_bs = r.iv_bs; <-- don't do this! + return *this; + } + + virtual uint32_t Read() { return iv_child->Read(); } + virtual uint32_t Write() { return iv_child->Write(); } + + const BIT_STRING_CLASS * GetBitString( + ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { + (*iv_bs) = (*iv_child->GetBitString(i_type)) >> iv_amount; + return iv_bs; + } + + virtual uint16_t GetId() const { return iv_child->GetId(); } + virtual void SetId(uint16_t i_id) {} + + bool operator==(const PrdfRightShiftRegister & r) const + { return (r.iv_child == iv_child) && (r.iv_amount == iv_amount); } + + bool operator<(const PrdfRightShiftRegister & r) const + { + if (iv_child == r.iv_child) + return iv_amount < r.iv_amount; + return iv_child < r.iv_child; + } + + bool operator>=(const PrdfRightShiftRegister & r) const + { + if (iv_child == r.iv_child) + return iv_amount >= r.iv_amount; + return iv_child >= r.iv_child; + } + + protected: + BIT_STRING_CLASS & AccessBitString(void) { return iv_iBS; } + void SetBitString(const BIT_STRING_CLASS *) {} + + private: + SCAN_COMM_REGISTER_CLASS * iv_child; + uint16_t iv_amount; + + prdfBitStringBuffer * iv_bs; + prdfBitStringBuffer iv_iBS; +}; + + +class PrdfAndRegister : public SCAN_COMM_REGISTER_CLASS +{ + public: + PrdfAndRegister() : + SCAN_COMM_REGISTER_CLASS(0), iv_left(NULL), iv_right(NULL), iv_iBS(0) + { + iv_bs = &iv_iBS; + } + + PrdfAndRegister(SCAN_COMM_REGISTER_CLASS & i_left, + SCAN_COMM_REGISTER_CLASS & i_right) : + SCAN_COMM_REGISTER_CLASS(0), iv_left(&i_left), iv_right(&i_right), + iv_iBS(std::min(i_left.GetBitString()->GetLength(), + i_right.GetBitString()->GetLength())) + { + iv_bs = &iv_iBS; + } + + PrdfAndRegister & operator=(const PrdfAndRegister & r) + { + iv_left = r.iv_left; + iv_right = r.iv_right; + iv_iBS = r.iv_iBS; + //iv_bs = r.iv_bs; <-- don't do this! + return *this; + } + + virtual uint32_t Read() + { + return iv_left->Read() | iv_right->Read(); + } + virtual uint32_t Write() + { + return iv_left->Write() | iv_right->Write(); + } + + const BIT_STRING_CLASS * GetBitString( + ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { + (*iv_bs) = *iv_left->GetBitString(i_type); + (*iv_bs) = (*iv_bs) & (*iv_right->GetBitString(i_type)); + return iv_bs; + } + + virtual uint16_t GetId() const + { + return Prdr::PrdrSignatureOp::combineSig(iv_left->GetId(), + iv_right->GetId()); + } + + virtual void SetId(uint16_t i_id) {} + + bool operator==(const PrdfAndRegister & r) const + { return (r.iv_left == iv_left) && (r.iv_right == iv_right); } + + bool operator<(const PrdfAndRegister & r) const + { + if (iv_left == r.iv_left) + return iv_right < r.iv_right; + return iv_left < r.iv_left; + } + + bool operator>=(const PrdfAndRegister & r) const + { + if (iv_left == r.iv_left) + return iv_right >= r.iv_right; + return iv_left >= r.iv_left; + } + + protected: + BIT_STRING_CLASS & AccessBitString(void) { return iv_iBS; } + void SetBitString(const BIT_STRING_CLASS *) {} + + private: + SCAN_COMM_REGISTER_CLASS * iv_left; + SCAN_COMM_REGISTER_CLASS * iv_right; + + prdfBitStringBuffer * iv_bs; + prdfBitStringBuffer iv_iBS; +}; + +class PrdfOrRegister : public SCAN_COMM_REGISTER_CLASS +{ + public: + PrdfOrRegister() : + SCAN_COMM_REGISTER_CLASS(0), iv_left(NULL), iv_right(NULL), iv_iBS(0) + { + iv_bs = &iv_iBS; + } + + PrdfOrRegister(SCAN_COMM_REGISTER_CLASS & i_left, + SCAN_COMM_REGISTER_CLASS & i_right) : + SCAN_COMM_REGISTER_CLASS(0), iv_left(&i_left), iv_right(&i_right), + iv_iBS(std::min(i_left.GetBitString()->GetLength(), + i_right.GetBitString()->GetLength())) + { + iv_bs = &iv_iBS; + } + + PrdfOrRegister & operator=(const PrdfOrRegister & r) + { + iv_left = r.iv_left; + iv_right = r.iv_right; + iv_iBS = r.iv_iBS; + //iv_bs = r.iv_bs; <-- don't do this! + return *this; + } + + virtual uint32_t Read() + { + return iv_left->Read() | iv_right->Read(); + } + virtual uint32_t Write() + { + return iv_left->Write() | iv_right->Write(); + } + + const BIT_STRING_CLASS * GetBitString( + ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { + (*iv_bs) = *iv_left->GetBitString(i_type); + (*iv_bs) = (*iv_bs) | (*iv_right->GetBitString(i_type)); + return iv_bs; + } + + virtual uint16_t GetId() const + { + return Prdr::PrdrSignatureOp::combineSig(iv_left->GetId(), + iv_right->GetId()); + } + + virtual void SetId(uint16_t i_id) {} + + bool operator==(const PrdfOrRegister & r) const + { return (r.iv_left == iv_left) && (r.iv_right == iv_right); } + + bool operator<(const PrdfOrRegister & r) const + { + if (iv_left == r.iv_left) + return iv_right < r.iv_right; + return iv_left < r.iv_left; + } + + bool operator>=(const PrdfOrRegister & r) const + { + if (iv_left == r.iv_left) + return iv_right >= r.iv_right; + return iv_left >= r.iv_left; + } + + protected: + BIT_STRING_CLASS & AccessBitString(void) { return iv_iBS; } + void SetBitString(const BIT_STRING_CLASS *) {} + + private: + SCAN_COMM_REGISTER_CLASS * iv_left; + SCAN_COMM_REGISTER_CLASS * iv_right; + + prdfBitStringBuffer * iv_bs; + prdfBitStringBuffer iv_iBS; +}; + +class PrdfNullRegister : public SCAN_COMM_REGISTER_CLASS +{ + public: + PrdfNullRegister(int size) : + SCAN_COMM_REGISTER_CLASS(0), iv_iBS(size) + {} + + PrdfNullRegister & operator=(const PrdfNullRegister & r) + { + iv_iBS = r.iv_iBS; + return *this; + } + + virtual uint32_t Read() { return 0; } + virtual uint32_t Write() { return 0; } + + const BIT_STRING_CLASS * GetBitString( + ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { + return &iv_iBS; + } + + protected: + BIT_STRING_CLASS & AccessBitString(void) { return iv_iBS; } + void SetBitString(const BIT_STRING_CLASS *) {} + + private: + prdfBitStringBuffer iv_iBS; + + virtual uint16_t GetId() const + { return Prdr::PrdrSignatureOp::DEFAULT_SIGNATURE; } + + virtual void SetId(uint16_t i_id) {} + +}; + +class PrdfAttnTypeRegister : public SCAN_COMM_REGISTER_CLASS +{ + public: + PrdfAttnTypeRegister() : + SCAN_COMM_REGISTER_CLASS(0), iv_check(&cv_null), iv_recov(&cv_null), + iv_special(&cv_null), iv_proccs(&cv_null), iv_iBS(0) + { + iv_bs = &iv_iBS; + } + + PrdfAttnTypeRegister( SCAN_COMM_REGISTER_CLASS & i_check, + SCAN_COMM_REGISTER_CLASS & i_recov, + SCAN_COMM_REGISTER_CLASS & i_special, + SCAN_COMM_REGISTER_CLASS & i_proccs ) : + SCAN_COMM_REGISTER_CLASS(0), + iv_check( NULL == &i_check ? &cv_null : &i_check), + iv_recov( NULL == &i_recov ? &cv_null : &i_recov), + iv_special(NULL == &i_special ? &cv_null : &i_special), + iv_proccs( NULL == &i_proccs ? &cv_null : &i_proccs), + iv_iBS(0) // will fully initialize this inside ctor. + { + uint32_t l_length = 1024; + l_length = std::min(l_length, iv_check->GetBitString()->GetLength()); + l_length = std::min(l_length, iv_recov->GetBitString()->GetLength()); + l_length = std::min(l_length, iv_special->GetBitString()->GetLength()); + l_length = std::min(l_length, iv_proccs->GetBitString()->GetLength()); + iv_iBS = prdfBitStringBuffer(l_length); + iv_bs = &iv_iBS; + } + + PrdfAttnTypeRegister & operator=(const PrdfAttnTypeRegister & r) + { + //iv_null = r.iv_null; <-- don't do this! + iv_check = (r.iv_check == &r.cv_null ? &cv_null : r.iv_check); + iv_recov = (r.iv_recov == &r.cv_null ? &cv_null : r.iv_recov); + iv_special = (r.iv_special == &r.cv_null ? &cv_null : r.iv_special); + iv_proccs = (r.iv_proccs == &r.cv_null ? &cv_null : r.iv_proccs); + iv_iBS = r.iv_iBS; + //iv_bs = r.iv_bs; <-- don't do this! + return *this; + } + + virtual uint32_t Read() + { + return iv_check->Read() | iv_recov->Read() | + iv_special->Read() | iv_proccs->Read(); + } + + virtual uint32_t Write() + { + return iv_check->Write() | iv_recov->Write() | + iv_special->Write() | iv_proccs->Write(); + } + + const BIT_STRING_CLASS * GetBitString( + ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { + using namespace PRDF; + switch (i_type) + { + case CHECK_STOP: + (*iv_bs) = BIT_STRING_BUFFER_CLASS( + *iv_check->GetBitString(i_type)); + break; + + case RECOVERABLE: + (*iv_bs) = BIT_STRING_BUFFER_CLASS( + *iv_recov->GetBitString(i_type)); + break; + + case SPECIAL: + (*iv_bs) = BIT_STRING_BUFFER_CLASS( + *iv_special->GetBitString(i_type)); + break; + + case PROC_CS: + (*iv_bs) = BIT_STRING_BUFFER_CLASS( + *iv_proccs->GetBitString(i_type)); + break; + } + + return iv_bs; + } + + virtual uint16_t GetId() const + { + using Prdr::PrdrSignatureOp; + uint16_t l_rc = PrdrSignatureOp::DEFAULT_SIGNATURE; + l_rc = PrdrSignatureOp::combineSig(l_rc, iv_check->GetId()); + l_rc = PrdrSignatureOp::combineSig(l_rc, iv_recov->GetId()); + l_rc = PrdrSignatureOp::combineSig(l_rc, iv_special->GetId()); + l_rc = PrdrSignatureOp::combineSig(l_rc, iv_proccs->GetId()); + return l_rc; + } + + virtual void SetId(uint16_t i_id) {} + + bool operator==(const PrdfAttnTypeRegister & r) const + { + return (r.iv_check == iv_check) && (r.iv_recov == iv_recov) && + (r.iv_special == iv_special) && (r.iv_proccs == iv_proccs); + } + + protected: + BIT_STRING_CLASS & AccessBitString(void) { return iv_iBS; } + void SetBitString(const BIT_STRING_CLASS *) {} + + private: + static PrdfNullRegister cv_null; + + SCAN_COMM_REGISTER_CLASS * iv_check; + SCAN_COMM_REGISTER_CLASS * iv_recov; + SCAN_COMM_REGISTER_CLASS * iv_special; + SCAN_COMM_REGISTER_CLASS * iv_proccs; + + prdfBitStringBuffer * iv_bs; + prdfBitStringBuffer iv_iBS; +}; + +class PrdfConstantRegister : public SCAN_COMM_REGISTER_CLASS +{ + public: + PrdfConstantRegister() : + SCAN_COMM_REGISTER_CLASS(0), iv_iBS(0) + {} + + PrdfConstantRegister(BIT_STRING_CLASS i_arg) : + SCAN_COMM_REGISTER_CLASS(0), iv_iBS(i_arg) + {} + + PrdfConstantRegister & operator=(const PrdfConstantRegister & r) + { + iv_iBS = r.iv_iBS; + return *this; + } + + virtual uint32_t Read() { return SUCCESS; } + virtual uint32_t Write() { return SUCCESS; } + + const BIT_STRING_CLASS * GetBitString( + ATTENTION_TYPE i_type = PRDF::INVALID_ATTENTION_TYPE) const + { + return &iv_iBS; + } + + virtual uint16_t GetId() const + { return Prdr::PrdrSignatureOp::DEFAULT_SIGNATURE; } + + virtual void SetId(uint16_t i_id) {} + + bool operator==(const PrdfConstantRegister & r) const + { return r.iv_iBS == iv_iBS; } + + protected: + BIT_STRING_CLASS & AccessBitString(void) { return iv_iBS; } + void SetBitString(const BIT_STRING_CLASS *) {} + + private: + prdfBitStringBuffer iv_iBS; +}; + +#endif diff --git a/src/usr/diag/prdf/common/framework/register/prdfResetErrorRegister.C b/src/usr/diag/prdf/common/framework/register/prdfResetErrorRegister.C new file mode 100755 index 000000000..0f0a6deec --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfResetErrorRegister.C @@ -0,0 +1,199 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfResetErrorRegister.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/** + @file iipResetErrorRegister.C + @brief ResetErrorRegister class definition +*/ + +// Module Description ************************************************** +// +// Description: +// +// End Module Description ********************************************** +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define iipResetErrorRegister_C + +#include <iipscr.h> +#include <iipResetErrorRegister.h> +#include <iipXorResetErrorRegister.h> +#include <xspprdAndResetErrorRegister.h> +#include <iipServiceDataCollector.h> + +#ifndef __HOSTBOOT_MODULE + #include <prdfSdcFileControl.H> // for SyncAnalysis +#endif + +#undef iipResetErrorRegister_C +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- +int32_t ResetErrorRegister::Reset(const prdfBitKey & bit_list, + STEP_CODE_DATA_STRUCT & error) +{ + #ifndef __HOSTBOOT_MODULE + ServiceDataCollector & sdc = *(error.service_data); + SyncAnalysis (sdc); //Add call to Sync SDC + #endif + + int32_t rc = ErrorRegisterMask::Reset(bit_list,error); // set mask bits & undo filters + uint32_t bl_length = bit_list.size(); + + if(bl_length != 0) // Check for bits to reset + { + if(&scr != resetScr) // reset different then ereg scr - move bits + { + resetScr->SetBitString(scr.GetBitString()); + } + uint32_t i; + for(i = 0; i < bl_length; ++i) // Turn off all bits specified + { + resetScr->ClearBit(bit_list.getListValue(i)); + } + rc = resetScr->Write(); // Write hardware + } + return rc; +} + +// Reset and Mask error registers. +int32_t +ResetAndMaskErrorRegister::Reset(const prdfBitKey & bit_list, + STEP_CODE_DATA_STRUCT & error) +{ + using namespace PRDF; + int32_t rc = SUCCESS; + // Don't do reset on CS. + if ((CHECK_STOP != error.service_data->GetAttentionType()) && //@pw01 + (UNIT_CS != error.service_data->GetAttentionType()) && + (UNIT_CS != error.service_data->GetCauseAttentionType())) + { + #ifndef __HOSTBOOT_MODULE + ServiceDataCollector & sdc = *(error.service_data); + SyncAnalysis (sdc); //Add call to Sync SDC + #endif + + rc = ErrorRegisterMask::Reset(bit_list,error); //undo filters + + // Mask registers as needed, if at threshold. + if (error.service_data->IsAtThreshold()) + { + for (ResetRegisterVector::iterator i = cv_masks.begin(); + i != cv_masks.end(); + ++i) + { + rc |= i->op->Reset(bit_list, error, i->read, i->write); + } + } + + // Reset registers as needed. + for (ResetRegisterVector::iterator i = cv_resets.begin(); + i != cv_resets.end(); + ++i) + { + rc |= i->op->Reset(bit_list, error, i->read, i->write); + } + } + + return rc; +} + +// ---------------------------------------------------------------------- + +int32_t XorResetErrorRegister::Reset(const prdfBitKey & bit_list, + STEP_CODE_DATA_STRUCT & error) +{ + #ifndef __HOSTBOOT_MODULE + ServiceDataCollector & sdc = *(error.service_data); + SyncAnalysis (sdc); + #endif + + int32_t rc = ErrorRegisterMask::Reset(bit_list,error); // set mask bits and undo filters + uint32_t bl_length = bit_list.size(); + + if(bl_length != 0) // Check for bits to reset + { + scr.clearAllBits(); + + // Turn on all bits to be reset + // We acted on all bits in bit_list so they should all be on + // in the hdw register + uint32_t i; + for(i = 0; i < bl_length; ++i) // Turn on bits to be reset + { + scr.SetBit(bit_list.getListValue(i)); + } + rc = scr.Write(); // Write hardware + } + return rc; +} + +// ----------------------------------------------------------------------- + +int32_t AndResetErrorRegister::Reset(const prdfBitKey & bit_list, + STEP_CODE_DATA_STRUCT & error) +{ + #ifndef __HOSTBOOT_MODULE + ServiceDataCollector & sdc = *(error.service_data); + SyncAnalysis (sdc); + #endif + + // set internal mask bits if threshold + int32_t rc = ErrorRegisterMask::Reset(bit_list,error); // set mask bits and undo filters + + uint32_t bl_length = bit_list.size(); + if(bl_length !=0) + { + BIT_STRING_BUFFER_CLASS bs(xAndResetScr.GetBitLength()); + bs.Pattern(0xffffffff,32); // set to all ones + uint32_t i; + for(i = 0; i < bl_length; ++i) // Turn off all bits used to isolate problem + { + bs.Clear(bit_list.getListValue(i)); + } + xAndResetScr.SetBitString(&bs); // copy bs to SCR bit string + rc = xAndResetScr.Write(); // Write hardware (result = Hareware value ANDed with bs) + } + return rc; +} diff --git a/src/usr/diag/prdf/common/framework/register/prdfResetOperators.H b/src/usr/diag/prdf/common/framework/register/prdfResetOperators.H new file mode 100755 index 000000000..cd6985831 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfResetOperators.H @@ -0,0 +1,330 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfResetOperators.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2005,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/** + * @file prdfResetOperators.H + * Operator classes for enacting different reset and mask policies on a + * register set. + * + * Defines RegisterResetOperator base class and a number of derived types. + */ + +#ifndef __PRDFRESETOPERATORS_H +#define __PRDFRESETOPERATORS_H + +#include <prdfBitKey.H> +#include <iipscr.h> +#include <iipconst.h> + +/** + * @class RegisterResetOperator + * Interface class for reset operators. (pure virtual) + * + * Provides a single interface, the reset "operator". These operators are used + * to enact specific reset or mask policies onto a register read/write pair. + */ +class RegisterResetOperator +{ + public: + virtual ~RegisterResetOperator() { } // zs01 + + /** + * Reset Operator + * + * @param bl : Bit list of registers to reset. + * @param sdc : The current STEP_CODE information. + * @param readReg : The ScanCOMM register to read bits from. + * @param writeReg : The ScanCOMM register to update with reset/mask. + */ + virtual + int32_t Reset(const BIT_LIST_CLASS & bl, + STEP_CODE_DATA_STRUCT & sdc, + SCAN_COMM_REGISTER_CLASS * readReg, + SCAN_COMM_REGISTER_CLASS * writeReg) const = 0; +}; + +/** + * @enum ResetOperatorBehaviors + * Useful enum for defining operator templates which behave only slightly + * different between masking and reseting. + * + * By using these enum types as parameters to the template (a bool) it makes + * the template instantiation more understandable. + */ +enum ResetOperatorBehaviors + { + RESETOPERATOR_MASK = true, + RESETOPERATOR_RESET = false + }; + +/** + * @fn getStaticResetOperator + * Returns a pointer to a static reset operator of requested type. + * + * Example usage: + * getStaticResetOperator<OrOperator<RESETOPERATOR_MASK> >() will return + * a pointer to an Or-type operator which does masking (sets bits). + */ +template <class T> +T * getStaticResetOperator() { static T l_op; return &l_op; }; + +/** + * @class OrOperator + * Implements the 'or' behavior of a reset/mask operator. + * + * Template parameter determines if reset or mask. + * + * Behavior: + * Reset - + * Read old bits. + * Remove "reset" bits. + * Write result. + * Mask - + * Write "mask" bits. + */ +template <bool> class OrOperator; +// Typedefs for easier instantiation. +typedef OrOperator<RESETOPERATOR_MASK> OrMaskOperator; +typedef OrOperator<RESETOPERATOR_RESET> OrResetOperator; + +// Class definition +template <bool Type> +class OrOperator : public RegisterResetOperator +{ + int32_t Reset(const BIT_LIST_CLASS & bl, + STEP_CODE_DATA_STRUCT & sdc, + SCAN_COMM_REGISTER_CLASS * readReg, + SCAN_COMM_REGISTER_CLASS * writeReg) const + { + int32_t rc = SUCCESS; + + uint32_t bl_length = bl.size(); + + if(bl_length != 0) // Check for bits to reset + { + writeReg->clearAllBits(); + + if (RESETOPERATOR_RESET == Type) + { + // Make sure this register was read. (TODO: is this needed?) + readReg->Read(); + + if(readReg != writeReg) // read different than write, move bits. + { + writeReg->SetBitString(readReg->GetBitString()); + } + } + uint32_t i; + for(i = 0; i < bl_length; ++i) // Turn off all bits specified + { + if (RESETOPERATOR_MASK == Type) + writeReg->SetBit(bl.getListValue(i)); + else + writeReg->ClearBit(bl.getListValue(i)); + } + rc = writeReg->Write(); // Write hardware + } + return rc; + } +}; + +/** + * @class AndOperator + * Implements the 'and' behavior of a reset/mask operator. + * + * Template parameter determines if reset or mask. + * + * Behavior: + * Reset - + * Write not of bits. + * Mask - + * Read mask register. + * Set bits. + * Write mask register. + */ +template <bool> class AndOperator; +// Typedefs for easier instantiation. +typedef AndOperator<RESETOPERATOR_MASK> AndMaskOperator; +typedef AndOperator<RESETOPERATOR_RESET> AndResetOperator; + +// Class definition +template <bool Type> +class AndOperator : public RegisterResetOperator +{ + int32_t Reset(const BIT_LIST_CLASS & bl, + STEP_CODE_DATA_STRUCT & sdc, + SCAN_COMM_REGISTER_CLASS * readReg, + SCAN_COMM_REGISTER_CLASS * writeReg) const + { + int32_t rc = SUCCESS; + uint32_t bl_length = bl.size(); + + if (RESETOPERATOR_RESET == Type) + { + if(bl_length != 0) // Check for bits to reset + { + BIT_STRING_BUFFER_CLASS bs(writeReg->GetBitLength()); + bs.Pattern(0xffffffff, 32); // set all to 1's. + + uint32_t i; + for(i = 0; i < bl_length; ++i) // Turn off all bits specified + { + bs.Clear(bl.getListValue(i)); + } + writeReg->SetBitString(&bs); // Copy bit-string to register. + rc = writeReg->Write(); // Write hardware + } + } + else // RESETOPERATOR_MASK + { + // Make sure this register was read. (TODO: is this needed?) + readReg->Read(); + + if(readReg != writeReg) // read different than write, move bits. + { + writeReg->SetBitString(readReg->GetBitString()); + } + for(uint32_t i = 0; i < bl_length; ++i) + { + writeReg->SetBit(bl.getListValue(i)); + } + + rc = writeReg->Write(); + } + return rc; + } +}; + + +/** + * @class XorOperator + * Implements the 'xor' behavior of a reset/mask operator. + * + * Template parameter determines if reset or mask. + * + * Behavior: + * Reset - Write bit. + * Mask - Clear bit. + */ +template <bool> class XorOperator; +// Typedefs for easier instantiation. +typedef XorOperator<RESETOPERATOR_MASK> XorMaskOperator; +typedef XorOperator<RESETOPERATOR_RESET> XorResetOperator; + +// Class definition +template <bool Type> +class XorOperator : public RegisterResetOperator +{ + int32_t Reset(const BIT_LIST_CLASS & bl, + STEP_CODE_DATA_STRUCT & sdc, + SCAN_COMM_REGISTER_CLASS * readReg, + SCAN_COMM_REGISTER_CLASS * writeReg) const + { + int32_t rc = SUCCESS; + uint32_t bl_length = bl.size(); + + if (RESETOPERATOR_RESET == Type) + { + writeReg->clearAllBits(); + + for (uint32_t i = 0; i < bl_length; ++i) + writeReg->SetBit(bl.getListValue(i)); + + rc = writeReg->Write(); + } + else // RESETOPERATOR_MASK + { + // Make sure this register was read. (TODO: is this needed?) + readReg->Read(); + + if(readReg != writeReg) // read different than write, move bits. + { + writeReg->SetBitString(readReg->GetBitString()); + } + for(uint32_t i = 0; i < bl_length; ++i) + { + writeReg->ClearBit(bl.getListValue(i)); + } + + rc = writeReg->Write(); + + } + return rc; + } +}; + +/** + * @class NotOperator + * Implements the 'not' behavior of a reset/mask operator. + * + * Template parameter determines if reset or mask. + * + * Behavior: + * Reset - Clears all bits. + * Mask - Sets all bits. + */ +template <bool> class NotOperator; +// Typedefs for easier instantiation. +typedef NotOperator<RESETOPERATOR_MASK> NotMaskOperator; +typedef NotOperator<RESETOPERATOR_RESET> NotResetOperator; + +// Class definition +template <bool Type> +class NotOperator : public RegisterResetOperator +{ + int32_t Reset(const BIT_LIST_CLASS & bl, + STEP_CODE_DATA_STRUCT & sdc, + SCAN_COMM_REGISTER_CLASS * readReg, + SCAN_COMM_REGISTER_CLASS * writeReg) const + { + int32_t rc = SUCCESS; + + if (RESETOPERATOR_RESET == Type) + { + writeReg->clearAllBits(); + rc = writeReg->Write(); // Write hardware + } + else // RESETOPERATOR_MASK + { + BIT_STRING_BUFFER_CLASS bs(writeReg->GetBitLength()); + bs.Pattern(0xffffffff, 32); // set all to 1's. + writeReg->SetBitString(&bs); // Copy bit-string to register. + rc = writeReg->Write(); // Write hardware + } + return rc; + } +}; + + +#endif + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// F510901 f300 07/15/05 iawillia Initial file creation. +// F523598 f300 10/04/05 iawillia Add AndOperator. Fix Or. +// F537132 f300 02/20/06 iawillia Add RMW mask register. +// F545881 f300 04/19/06 dgilbert Add #include <iipscr.h> +// zs01 D620028 f330 07/25/07 zshelle Support for mcp5 compiler +// End Change Log ***************************************************** diff --git a/src/usr/diag/prdf/common/framework/register/prdfScanFacility.C b/src/usr/diag/prdf/common/framework/register/prdfScanFacility.C new file mode 100755 index 000000000..5228f9a87 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfScanFacility.C @@ -0,0 +1,179 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfScanFacility.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2002,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/** + @file prdfScanFacility.C + @brief PRD ScanFaclity class definition +*/ +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define prdfScanFacility_C + +#include <iipscr.h> +#include <prdfScanFacility.H> +#include <prdfFlyWeight.C> +#include <prdfFlyWeightS.C> + +#undef prdfScanFacility_C + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- +// special comparater - if address same and pointing to same access module then are equal +bool operator==(const ScanCommRegisterChip & scrc1, const ScanCommRegisterChip & scrc2) +{ + return((scrc1.GetAddress() == scrc2.GetAddress()) && (&(scrc1.GetHops()) == &(scrc2.GetHops()))); +} + +bool operator>=(const ScanCommRegisterChip & scrc1, const ScanCommRegisterChip & scrc2) +{ + if (scrc1.GetAddress() == scrc2.GetAddress()) + return (&scrc1.GetHops()) >= (&scrc2.GetHops()); + return scrc1.GetAddress() >= scrc2.GetAddress(); +}; + +bool operator<(const ScanCommRegisterChip & scrc1, const ScanCommRegisterChip & scrc2) +{ + if (scrc1.GetAddress() == scrc2.GetAddress()) + return (&scrc1.GetHops()) < (&scrc2.GetHops()); + return scrc1.GetAddress() < scrc2.GetAddress(); +} + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- +PrdfNullRegister PrdfAttnTypeRegister::cv_null(1024); //@01 + + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +class ScanCommAccess; +class ScanCommRegisters; + +ScanFacility & ScanFacility::Access(void) +{ + static ScanFacility sf; + return sf; +} +//------------------------------------------------------------------------------------------------- +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetScanCommRegister(TARGETING::TargetHandle_t i_ptargetHandle, + uint64_t address, + uint32_t bitLength) +{ + using namespace PRDF; + HomRegisterAccessScom hraKey(i_ptargetHandle); + HomRegisterAccessScom & hra = iv_scomAccessFw.get(hraKey); + ScanCommRegisterChip scrKey(address,bitLength,hra); + return iv_scomRegFw.get(scrKey); +} +//------------------------------------------------------------------------------------------------- +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetScanRingRegister(TARGETING::TargetHandle_t i_ptargetHandle, + PRDF::ScanRingField * start, + PRDF::ScanRingField * end) +{ + using namespace PRDF; + uint32_t bitLength = 0; + for(ScanRingField * srf = start; srf != end; ++srf) + { + bitLength += srf->length; + } + HomRegisterAccessScan hra(i_ptargetHandle,start,end); + iv_scanAccessList.push_back(hra); + ScanCommRegisterChip scrKey(start->registerId,bitLength,hra); + return iv_scomRegFw.get(scrKey); +} + +//------------------------------------------------------------------------------------------------- + +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetNotRegister(SCAN_COMM_REGISTER_CLASS & i_arg) +{ + PrdfNotRegister r(i_arg); + return iv_notRegFw.get(r); +} + +//------------------------------------------------------------------------------------------------- + +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetLeftShiftRegister(SCAN_COMM_REGISTER_CLASS & i_arg, uint16_t i_amount) +{ + PrdfLeftShiftRegister r(i_arg, i_amount); + return iv_leftRegFw.get(r); +} + +//------------------------------------------------------------------------------------------------- + +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetRightShiftRegister(SCAN_COMM_REGISTER_CLASS & i_arg, uint16_t i_amount) +{ + PrdfRightShiftRegister r(i_arg, i_amount); + return iv_rightRegFw.get(r); +} + + +//------------------------------------------------------------------------------------------------- + +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetAndRegister(SCAN_COMM_REGISTER_CLASS & i_left, + SCAN_COMM_REGISTER_CLASS & i_right) +{ + PrdfAndRegister r(i_left,i_right); + return iv_andRegFw.get(r); +} + +//------------------------------------------------------------------------------------------------- + +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetOrRegister(SCAN_COMM_REGISTER_CLASS & i_left, + SCAN_COMM_REGISTER_CLASS & i_right) +{ + PrdfOrRegister r(i_left,i_right); + return iv_orRegFw.get(r); +} + +//------------------------------------------------------------------------------------------------- + +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetAttnTypeRegister(SCAN_COMM_REGISTER_CLASS & i_check, + SCAN_COMM_REGISTER_CLASS & i_recov, + SCAN_COMM_REGISTER_CLASS & i_special, + SCAN_COMM_REGISTER_CLASS & i_proccs) +{ + PrdfAttnTypeRegister r(i_check,i_recov,i_special,i_proccs); + return iv_attnRegFw.get(r); +} + +//------------------------------------------------------------------------------------------------- + +SCAN_COMM_REGISTER_CLASS & ScanFacility::GetConstantRegister(BIT_STRING_CLASS i_val) +{ + PrdfConstantRegister r(i_val); + return iv_constRegFw.get(r); +} + +//------------------------------------------------------------------------------------------------- diff --git a/src/usr/diag/prdf/common/framework/register/prdfScanFacility.H b/src/usr/diag/prdf/common/framework/register/prdfScanFacility.H new file mode 100755 index 000000000..58e711b08 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/prdfScanFacility.H @@ -0,0 +1,203 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/prdfScanFacility.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2002,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef PRDFSCANFACILITY_H +#define PRDFSCANFACILITY_H +/** + @file prdfScanFacility.H + @brief Description +*/ + + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#include <prdfFlyWeight.H> +#include <prdfFlyWeightS.H> +#include <vector> +#include <prdfHomRegisterAccess.H> +#include <iipScanCommRegisterChip.h> +#include <prdfOperatorRegister.H> +#include <prdfPlatServices.H> + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +class SCAN_COMM_REGISTER_CLASS; + +/** + PRD Scan Facility + @author Doug Gilbert + @par The Scan facility is used by PRD to access Scan and Scan Comm functions. + It attempts to reduce duplicate objects and their aggragates as must as possible. + @code + ScanFacility & sf = ScanFacility::Access(); + SCAN_COMM_REGISTER_CLASS & scr = sf.GetScanCommRegister(chipId,Address,bitLen); + scr.Read() ... see iipscr.h + ScanRingField srf[] = + {{hregAliasId1 , fieldBitLength1}, + {hregAliasId2 , fieldBitLength2}}; + SCAN_COMM_REGISTER_CLASS & sr = s.GetScanRingRegister(aTARGETING::TargetHandle_t,srf,srf+2); + scr.Read() .... SCAN_COMM_REGISTER_CLASS + // Note you can't write a scan ring register from PRD + // you can only read scan ring registers from PRD if the global attention type is CHECK_STOP + @endcode +*/ +class ScanFacility +{ +public: + /** + The Scan Facility is a singleton - this function provides access to it. + */ + static ScanFacility & Access(void); + + /** + Get a scan comm register for this functional unit + @param Target Handle see target.H + @param scan comm address + @param number of bits in the register + @pre Address of register must correspond to the functional unit indicated + @post If the scr does not yet exist it will be created otherwise a reference + to one already in existance (same address and functional unit) is returned. + */ + SCAN_COMM_REGISTER_CLASS & GetScanCommRegister(TARGETING::TargetHandle_t i_ptargetHandle, + uint64_t address, + uint32_t bitLength); + + /** + Get a scan ring register + @param i_ptargetHandle handle to target in targeting + @param pointer to list an array of ScanRingField see prdfHomRegisterAccess.H + @param pointer to last entry+1 of ScanFingField array + @pre AliasId's for the scan ring registers MUST exist in the function unit associated with the Id given + @post Access object and scr created for this register. the bit length of the scr returned will be the sum + of all the field lengths provided. + @note an SCR based on a scan ring register can not be written, and should only be read if the global + attention type is CHECK_STOP. + */ + SCAN_COMM_REGISTER_CLASS & GetScanRingRegister(TARGETING::TargetHandle_t i_ptargetHandle, + PRDF::ScanRingField * start, + PRDF::ScanRingField * end); + + /** + * Get a register that bitwise inverts the bitstring of a register when read or written to + * @param SCAN_COMM_REGISTER_CLASS source + * @post Only one instance of the register with this SCR paramter will exist + */ + SCAN_COMM_REGISTER_CLASS & GetNotRegister(SCAN_COMM_REGISTER_CLASS & i_arg); + + /** + * Get a register that bitwise left shift the bitstring of a register when read or written to + * @param SCAN_COMM_REGISTER_CLASS source + * @post Only one instance of the register with this SCR paramter and amount will exist + */ + SCAN_COMM_REGISTER_CLASS & GetLeftShiftRegister(SCAN_COMM_REGISTER_CLASS & i_arg, uint16_t i_amount); + + /** + * Get a register that bitwise right shift the bitstring of a register when read or written to + * @param SCAN_COMM_REGISTER_CLASS source + * @post Only one instance of the register with this SCR paramter and amount will exist + */ + SCAN_COMM_REGISTER_CLASS & GetRightShiftRegister(SCAN_COMM_REGISTER_CLASS & i_arg, uint16_t i_amount); + + + + /** + * Get a register that bit-wise ANDs the bitstring of two register when read or written to + * @param The 2 SCR 's to AND + * @posrt Only one instance of the register with these SCRs will exist + */ + SCAN_COMM_REGISTER_CLASS & GetAndRegister(SCAN_COMM_REGISTER_CLASS & i_left, + SCAN_COMM_REGISTER_CLASS & i_right); + + /** + * Get a register that bitwise ORs the bitstrings of two register when read or written + * @param the 2 SCR's to OR + * @post Only one instance of the register with these SCR's will exist + */ + SCAN_COMM_REGISTER_CLASS & GetOrRegister(SCAN_COMM_REGISTER_CLASS & i_left, + SCAN_COMM_REGISTER_CLASS & i_right); + + /** + * Get a AttnTypeRegister + * @params 3 scr Registers + * @post only one instance of the register with these SCR's will exist + */ + SCAN_COMM_REGISTER_CLASS & GetAttnTypeRegister(SCAN_COMM_REGISTER_CLASS & i_check, + SCAN_COMM_REGISTER_CLASS & i_recov, + SCAN_COMM_REGISTER_CLASS & i_special, + SCAN_COMM_REGISTER_CLASS & i_proccs); + + /** + * Get a PrdfConstantRegister + * @param BIT_STRING_CLASS - the bit string constant to use. + * @post only one instance of the register with this BIT_STRING value will + * exist. + */ + SCAN_COMM_REGISTER_CLASS & GetConstantRegister(BIT_STRING_CLASS i_val); + + /** + Destructor + */ +// ~ScanFacility(); +private: // functions + /** + Constructor + @param + @returns + @pre + @post + @see + @note + */ + ScanFacility() {} + + +private: // Data + typedef FlyWeight<PRDF::HomRegisterAccessScom,10> ScanCommAccess; + typedef std::vector<PRDF::HomRegisterAccessScan> ScanRingAccess; + typedef FlyWeightS<ScanCommRegisterChip,50> ScanCommRegisters; + typedef FlyWeight<PrdfAttnTypeRegister,50> AttnTypeRegisters; + typedef FlyWeightS<PrdfOrRegister,10> OrRegisters; + typedef FlyWeightS<PrdfAndRegister,50> AndRegisters; + typedef FlyWeightS<PrdfNotRegister,50> NotRegisters; + typedef FlyWeightS<PrdfLeftShiftRegister,10> LeftShiftRegisters; + typedef FlyWeightS<PrdfRightShiftRegister, 10> RightShiftRegisters; + typedef FlyWeight<PrdfConstantRegister, 10> ConstantRegisters; + + ScanCommAccess iv_scomAccessFw; + ScanRingAccess iv_scanAccessList; + ScanCommRegisters iv_scomRegFw; + NotRegisters iv_notRegFw; + LeftShiftRegisters iv_leftRegFw; + RightShiftRegisters iv_rightRegFw; + AndRegisters iv_andRegFw; + OrRegisters iv_orRegFw; + AttnTypeRegisters iv_attnRegFw; + ConstantRegisters iv_constRegFw; + +}; + + +#endif /* PRDFSCANFACILITY_H */ diff --git a/src/usr/diag/prdf/common/framework/register/xspprdAndResetErrorRegister.h b/src/usr/diag/prdf/common/framework/register/xspprdAndResetErrorRegister.h new file mode 100755 index 000000000..fea03d7d2 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/register/xspprdAndResetErrorRegister.h @@ -0,0 +1,181 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/register/xspprdAndResetErrorRegister.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2001,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef xspprdAndResetErrorRegister_h +#define xspprdAndResetErrorRegister_h + +/** + @file iipAndResetErrorRegister.h + @brief AndResetErrorRegister declaration +*/ + +// Class Description ************************************************* +// +// Name: AndResetErrorRegister +// Base class: ErrorRegisterMask +// +// Description: Resets the bit(s) in an error register that were used to +// Analyze an error. Intended to be used with hardware +// registers that support SCOM AND-Write to reset bits. +// This has an advantage in that register is only writen +// to reset the bits as opposted to a read-modify-write. +// +// Usage: See iipResetErrorRegister.h +// +// End Class Description ********************************************* + +//-------------------------------------------------------------------- +// Includes +//-------------------------------------------------------------------- + +#ifndef iipErrorRegisterMask_h +#include <iipErrorRegisterMask.h> +#endif + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +/** + Reset Error register using And-Write + @author Doug Gilbert +*/ +class AndResetErrorRegister: public ErrorRegisterMask +{ + public: +/** + Constructor + <ul> + <br><b>Parameter: </b> Scan comm register to read from + <br><b>Parameter: </b> Resolution map (see iipResolutionMap.h) + <br><b>Paramteer: </b> Scan comm register to write to (for reset) + <br><b>Parameter: </b> Ptr to filter class (optional) + <br><b>Parameter: </b> Scan comm register id(optional) + <br><b>Parameter: </b> Scan comm Register of hardware mask (optional) + <br><b>Returns: </b> Nothing + <br><b>Requirements:</b> (software) - None + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None + <br><b>Notes: </b> Scan comm register to write to should be AND-write + in hardware or strange things will happen + </ul><br> +*/ + AndResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r,ResolutionMap & rm, SCAN_COMM_REGISTER_CLASS & resetScr, FILTER_CLASS * f = NULL, uint16_t scrId = 0x0fff, SCAN_COMM_REGISTER_CLASS & maskScr = *((SCAN_COMM_REGISTER_CLASS *) NULL)); + +/** + Constructor + <ul> + <br><b>Parameter: </b> Scan comm register to read from + <br><b>Parameter: </b> Resolution map (see iipResolutionMap.h) + <br><b>Parameter: </b> Scan comm register to Write to Reset the error + <br><b>Parameter: </b> Scan Comm Register id + <br><b>Parameter: </b> Scan comm Register of hardware mask (optional) + <br><b>Returns: </b> Nothing + <br><b>Requirements:</b> (software) - None. + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None + <br><b>Notes: </b> Scancomm register to write to should be AND-write in hardware + or results will not be as expected + </ul><br> +*/ + AndResetErrorRegister(SCAN_COMM_REGISTER_CLASS & r,ResolutionMap & rm, SCAN_COMM_REGISTER_CLASS & resetScr, uint16_t scrId, SCAN_COMM_REGISTER_CLASS & r1 = *((SCAN_COMM_REGISTER_CLASS *) NULL)); + + +/** + 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> Compiler default is sufficient + </ul><br> +*/ +// ~xspprdAndResetErrorRegister(); + +protected: // functions + + /** + Reset the error register in hardware + <ul> + <br><b>Parameter: </b> The bit listed used to Resolve the error + <br><b>Parameter: </b> The serviceData collector + <br><b>Returns: </b> Return code [SUCCESS | mops return code] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Bits listed in the bitList are turned off in the + corresponding hardware register + hardware register. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Hardware register Modified. The a logical anding is done in hardware + </ul><br> + */ + virtual int32_t Reset(const BIT_LIST_CLASS & bit_list, STEP_CODE_DATA_STRUCT & error); + + private: // functions + /* + copy constructor - prohibits coping - no definition should exist + */ + AndResetErrorRegister(const AndResetErrorRegister & ares); + + /* + Assignment operator - prohipits assignment - do definition should exist + */ + AndResetErrorRegister & operator=(const AndResetErrorRegister & er); + + private: // Data + + SCAN_COMM_REGISTER_CLASS & xAndResetScr; + +}; + +inline AndResetErrorRegister::AndResetErrorRegister +( SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + SCAN_COMM_REGISTER_CLASS & resetScr, + FILTER_CLASS * f, + uint16_t scrId, + SCAN_COMM_REGISTER_CLASS & maskScr + ) +: ErrorRegisterMask(r,rm,f,scrId,maskScr), xAndResetScr(resetScr) +{} + +inline AndResetErrorRegister::AndResetErrorRegister +( SCAN_COMM_REGISTER_CLASS & r, + ResolutionMap & rm, + SCAN_COMM_REGISTER_CLASS & resetScr, + uint16_t scrId, + SCAN_COMM_REGISTER_CLASS & r1 +) +: ErrorRegisterMask(r,rm,scrId,r1), xAndResetScr(resetScr) +{} + +#endif /* xspprdAndResetErrorRegister_h */ + +// Change Log ********************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- -------- ---- -------- -------- ------------------------------- +// v5r2 12/21/00 dgilbert Initial Creation +// 423599 fsp 10/27/03 dgilbert make scrid a bit16 +// +// End Change Log ***************************************************** |